Skip to content

Commit

Permalink
Adds to gitignore a playwright.config.override.ts entry (#49329)
Browse files Browse the repository at this point in the history
* adds to gitignore  playwright.config.override.ts

* adds docs about the override file usage
  • Loading branch information
draganescu committed Apr 7, 2023
1 parent 32f217b commit e9b4e69
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ coverage
.phpunit.result.cache
.reassure


# Directories/files that may appear in your environment
*.log
yarn.lock
Expand Down Expand Up @@ -37,6 +38,7 @@ test/native/junit.xml

# Local overrides
.wp-env.override.json
playwright.config.override.ts
phpcs.xml
phpunit.xml
phpunit-watcher.yml
Expand Down
42 changes: 42 additions & 0 deletions docs/contributors/code/e2e/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,3 +114,45 @@ test.describe( 'Grouping tests (@webkit, -chromium)', () => {
} );
} );
```

## Local configuration of Playwright

Sometimes the deafults that Gutenberg offers for Playwright configuration need to be changed. While most configuration can be overriden by passing arguments to the test runner command line, we may want to make permanent confguration changes, such as setting the test to always run with `headless` mode set to `false` and you own custom slow motion value.

To do this one can create a file named `playwright.config.override.ts` file in the `/test/e2e/` folder. In this new file we need to import the exiting configuration, then use the new values on top to override the defaults.

For example:

```ts
/**
* External dependencies
*/
import { defineConfig } from '@playwright/test';
/**
* Internal dependencies
*/
import base from './playwright.config.ts';

const config = defineConfig( {
...base,
use: {
...base.use,
headless: true,
launchOptions: {
//slowMo: 500,
},
trace: 'off',
screenshot: 'off',
video: 'off',
},
} );

export default config;

```

After making this file you can now run your tests passing the new configuration file with the `--config` argument:

```bash
npm run test:e2e:playwright -- --config=test/e2e/playwright.override.config.ts
```

1 comment on commit e9b4e69

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flaky tests detected in e9b4e69.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/4638016563
📝 Reported issues:

Please sign in to comment.