mirror of
https://github.com/microsoft/playwright.git
synced 2025-06-26 21:40:17 +00:00
docs: improve locators examples and flow (#18548)
This commit is contained in:
parent
26044c11c0
commit
ad5fe28416
1404
docs/src/locators.md
1404
docs/src/locators.md
File diff suppressed because it is too large
Load Diff
@ -512,6 +512,7 @@ In addition to configuring [Browser] or [BrowserContext], videos or screenshots,
|
|||||||
- `globalTeardown`: Path to the global teardown file. This file will be required and run after all the tests. It must export a single function.
|
- `globalTeardown`: Path to the global teardown file. This file will be required and run after all the tests. It must export a single function.
|
||||||
- `retries`: The maximum number of retry attempts per test.
|
- `retries`: The maximum number of retry attempts per test.
|
||||||
- `testDir`: Directory with the test files.
|
- `testDir`: Directory with the test files.
|
||||||
|
- `testIdAttribute`: Set a custom data attribute for your [`method: Page.getByTestId`] locators.
|
||||||
- `testIgnore`: Glob patterns or regular expressions that should be ignored when looking for the test files. For example, `'**/test-assets'`.
|
- `testIgnore`: Glob patterns or regular expressions that should be ignored when looking for the test files. For example, `'**/test-assets'`.
|
||||||
- `testMatch`: Glob patterns or regular expressions that match test files. For example, `'**/todo-tests/*.spec.ts'`. By default, Playwright Test runs `.*(test|spec)\.(js|ts|mjs)` files.
|
- `testMatch`: Glob patterns or regular expressions that match test files. For example, `'**/todo-tests/*.spec.ts'`. By default, Playwright Test runs `.*(test|spec)\.(js|ts|mjs)` files.
|
||||||
- `timeout`: Time in milliseconds given to each test. Learn more about [various timeouts](./test-timeouts.md).
|
- `timeout`: Time in milliseconds given to each test. Learn more about [various timeouts](./test-timeouts.md).
|
||||||
@ -529,6 +530,9 @@ const config = {
|
|||||||
// Look for test files in the "tests" directory, relative to this configuration file
|
// Look for test files in the "tests" directory, relative to this configuration file
|
||||||
testDir: 'tests',
|
testDir: 'tests',
|
||||||
|
|
||||||
|
// change the default data-testid to a custom attribute
|
||||||
|
testIdAttribute: 'data-pw'
|
||||||
|
|
||||||
// Each test is given 30 seconds
|
// Each test is given 30 seconds
|
||||||
timeout: 30000,
|
timeout: 30000,
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user