-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: add `@debug` decorator * chore: generate changeset * docs: update typo in readme * docs: fix typos in readme
- Loading branch information
1 parent
b170fdc
commit a50e25b
Showing
5 changed files
with
94 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
--- | ||
'playwright-decorators': minor | ||
--- | ||
|
||
Add `@debug` decorator | ||
|
||
Runs a `@test`(s) or `@suite`(s) in debug mode. | ||
`@test`(s) or `@suite`(s) lacking the `@debug` decorator will be excluded. | ||
Learn more about debug mode: https://playwright.dev/docs/debug | ||
|
||
```ts | ||
import { suite, test, debug, TestArgs } from 'playwright-decorators'; | ||
|
||
// Debug selected test suite(s) | ||
@debug() // <-- Decorate suite with @debug() | ||
@suite() | ||
class DebugTestSuite { | ||
} | ||
|
||
// Or debug selected test(s) | ||
@suite() | ||
class TestSuite { | ||
@debug() // <-- Decorate test with @debug() | ||
@test() | ||
async test({ page }: TestArgs) { | ||
// ... | ||
} | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { createSuiteAndTestDecorator } from './custom' | ||
|
||
/** | ||
* Runs a @test or @suite in debug mode. | ||
* @test(s) or @suite(s) lacking the @debug decorator will be excluded. | ||
* Learn more about debug mode: https://playwright.dev/docs/debug | ||
*/ | ||
export const debug = () => | ||
createSuiteAndTestDecorator( | ||
'debug', | ||
({ suite }) => { | ||
process.env.PWDEBUG = '1' | ||
suite.only = true | ||
}, | ||
({ test }) => { | ||
process.env.PWDEBUG = '1' | ||
test.only = true | ||
} | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters