зеркало из https://github.com/mozilla/fxa.git
Merge pull request #16882 from mozilla/update-testConfig-file
chore(functional-tests): update the playwright config file to use defineConfig method
This commit is contained in:
Коммит
1569f134b5
|
@ -37,7 +37,13 @@ test('mocha tests', async ({ target, page }, info) => {
|
|||
|
||||
## Creating new tests
|
||||
|
||||
`yarn record` is a convenient script to start with when creating a new test. It starts playwright in debug mode and runs the `tests/stub.spec.ts` test which creates a new account and prints the credentials to the terminal. From there you can use the Playwright inspector to record your test and copy the command output to your test file.
|
||||
`codegen` is a convenient way to start with when creating a new test. Using the codegen command runs the test generator followed by the URL of the website you want to generate tests for. It opens up two windows, a browser window where you interact with the website you wish to test and the Playwright Inspector window where you can record your tests and then copy them into your editor. More info on `codegen` and other options to start with a new test can be found [here](https://playwright.dev/docs/codegen#generate-tests-with-the-playwright-inspector)
|
||||
|
||||
Example:
|
||||
|
||||
```ts
|
||||
npx playwright codegen localhost:3030
|
||||
```
|
||||
|
||||
## Fixtures
|
||||
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
"private": true,
|
||||
"scripts": {
|
||||
"clean": "rimraf dist",
|
||||
"record": "NODE_OPTIONS='--dns-result-order=ipv4first' playwright test --project=stub --debug",
|
||||
"test": "NODE_OPTIONS='--dns-result-order=ipv4first' playwright test --project=local",
|
||||
"test-local": "NODE_OPTIONS='--dns-result-order=ipv4first' playwright test --project=local",
|
||||
"test-stage": "NODE_OPTIONS='--dns-result-order=ipv4first' playwright test --project=stage",
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
import { PlaywrightTestConfig, Project } from '@playwright/test';
|
||||
import * as path from 'path';
|
||||
import { TargetNames } from './lib/targets';
|
||||
import { TestOptions, WorkerOptions } from './lib/fixtures/standard';
|
||||
import { getFirefoxUserPrefs } from './lib/targets/firefoxUserPrefs';
|
||||
import type { Project } from '@playwright/test';
|
||||
import { PlaywrightTestConfig, defineConfig } from '@playwright/test';
|
||||
import * as path from 'path';
|
||||
import { TestOptions, WorkerOptions } from './lib/fixtures/standard';
|
||||
import { TargetNames } from './lib/targets';
|
||||
|
||||
const CI = !!process.env.CI;
|
||||
|
||||
|
@ -22,7 +23,7 @@ if (CI) {
|
|||
maxFailures = retries * workers * 2;
|
||||
}
|
||||
|
||||
const config: PlaywrightTestConfig<TestOptions, WorkerOptions> = {
|
||||
export default defineConfig<PlaywrightTestConfig<TestOptions, WorkerOptions>>({
|
||||
outputDir: path.resolve(__dirname, '../../artifacts/functional'),
|
||||
forbidOnly: CI,
|
||||
retries,
|
||||
|
@ -35,7 +36,6 @@ const config: PlaywrightTestConfig<TestOptions, WorkerOptions> = {
|
|||
(name) =>
|
||||
({
|
||||
name,
|
||||
testIgnore: 'stub.spec.ts',
|
||||
use: {
|
||||
browserName: 'firefox',
|
||||
targetName: name,
|
||||
|
@ -49,19 +49,6 @@ const config: PlaywrightTestConfig<TestOptions, WorkerOptions> = {
|
|||
},
|
||||
} as Project)
|
||||
),
|
||||
{
|
||||
name: 'stub',
|
||||
testMatch: 'stub.spec.ts',
|
||||
use: {
|
||||
browserName: 'firefox',
|
||||
targetName: 'local',
|
||||
launchOptions: {
|
||||
args: DEBUG ? ['-start-debugger-server'] : undefined,
|
||||
firefoxUserPrefs: getFirefoxUserPrefs('local', DEBUG),
|
||||
headless: !DEBUG,
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
reporter: CI
|
||||
? [
|
||||
|
@ -79,6 +66,4 @@ const config: PlaywrightTestConfig<TestOptions, WorkerOptions> = {
|
|||
: 'list',
|
||||
workers,
|
||||
maxFailures,
|
||||
};
|
||||
|
||||
export default config;
|
||||
});
|
||||
|
|
|
@ -1,7 +0,0 @@
|
|||
import { test } from '../lib/fixtures/standard';
|
||||
|
||||
test('stub', async ({ page, testAccountTracker }) => {
|
||||
const credentials = await testAccountTracker.signUp();
|
||||
console.log(credentials);
|
||||
await page.pause();
|
||||
});
|
Загрузка…
Ссылка в новой задаче