Skip to content

Commit

Permalink
chore(e2e): add environment config
Browse files Browse the repository at this point in the history
  • Loading branch information
scarqin committed Mar 10, 2023
1 parent 53b6b07 commit 09c40d7
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 11 deletions.
23 changes: 20 additions & 3 deletions test/e2e/playwright.config.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,27 @@
import { defineConfig } from '@playwright/test';
import { defineConfig, devices } from '@playwright/test';
export default defineConfig({
workers: process.env.CI ? 2 : 10,
use: {
baseURL: 'http://localhost:4200',
// baseURL: 'https://postcat.com',
headless: true,
viewport: { width: 1280, height: 720 },
ignoreHTTPSErrors: true,
video: 'on-first-retry'
}
video: 'on-first-retry',
screenshot: 'only-on-failure'
},
projects: [
{
name: 'chromium',
use: { ...devices['Desktop Chrome'] }
},
{
name: 'firefox',
use: { ...devices['Desktop Firefox'] }
},
{
name: 'webkit',
use: { ...devices['Desktop Safari'] }
}
]
});
2 changes: 1 addition & 1 deletion test/e2e/src/api-edit.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { test, expect } from '@playwright/test';
test.describe('Add API', () => {
test.beforeEach(async ({ page }) => {
await page.goto('http://localhost:4200/');
await page.goto('/');
});

test('Add Form-data API', async ({ page }) => {
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/src/api-group.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { test, expect } from '@playwright/test';
test.describe('Group Operate', () => {
test.beforeEach(async ({ page }) => {
await page.goto('http://localhost:4200/');
await page.goto('/');
//Add group
await page.getByRole('banner').getByRole('button').hover();
await page.locator('a').filter({ hasText: 'New Group' }).click();
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/src/api-unit-test.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const waitForResponse = async page => {
};
test.describe('Test API', () => {
test.beforeEach(async ({ page }) => {
await page.goto('http://localhost:4200/');
await page.goto('/');
});
/**
* Basic Test
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/src/env.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { test, expect } from '@playwright/test';

test('test', async ({ page }) => {
await page.goto('http://localhost:4200/');
await page.goto('/');

//Add env
await page.locator('a').filter({ hasText: 'Environment' }).click();
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/src/export_api.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { test, expect } from '@playwright/test';
test('Export API', async ({ page }) => {
await page.goto('http://localhost:4200/');
await page.goto('/');
await page.locator('a:has-text("Setting")').click();
await page.getByRole('button', { name: 'Export' }).click();
await page.getByRole('button', { name: 'Confirm' }).click();
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/src/extension.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { test, expect } from '@playwright/test';
// const installExtension = async () => {};
// test.describe('Extension Operate', () => {
// test.beforeEach(async ({ page }) => {
// await page.goto('http://localhost:4200/');
// await page.goto('/');
// });

// test('Basic Operate', async ({ page }) => {
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/src/user.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { test, expect } from '@playwright/test';

import { ifTipsExist } from './commom.util';
test('User Opeate', async ({ page }) => {
await page.goto('http://localhost:4200/');
await page.goto('/');

//Login
await page.getByRole('button', { name: 'Sign in/Up' }).click();
Expand All @@ -14,7 +14,7 @@ test('User Opeate', async ({ page }) => {
await page.getByRole('button', { name: 'switch to the cloud workspace' }).click();

//Change Pasword
await page.locator('button[ng-reflect-title="Open Settings"]').click();
await page.locator('eo-iconpark-icon[name="setting"]').click();
await page.getByText('New password', { exact: true }).click();
await page.getByText('New password', { exact: true }).fill('123456');
await page.getByText('New password', { exact: true }).press('Tab');
Expand Down

0 comments on commit 09c40d7

Please sign in to comment.