-
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 support for creating custom test and suite decorator (#38)
* feat: add `createSuiteAndTestDecorator` util * chore: rewrite decorators to use `create*Decorator` utils * chore: move errors to custom file * docs: document `createTestAndSuiteDecorator` * fix: export `TestInfo` type * chore: add changeset * chore: format code * docs: reformat * ci: fix step name
- Loading branch information
1 parent
bd10be1
commit dbea0b6
Showing
24 changed files
with
283 additions
and
239 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,18 @@ | ||
--- | ||
'playwright-decorators': patch | ||
--- | ||
|
||
Fix export of `TestInfo` type | ||
|
||
```ts | ||
import { suite, test, TestArgs, TestInfo } from '@playwright/test' | ||
|
||
@suite() | ||
class TestSuite { | ||
@test() | ||
myTest({ page }: TestArgs, testInfo: TestInfo) { | ||
// ... | ||
} | ||
} | ||
|
||
``` |
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,31 @@ | ||
--- | ||
'playwright-decorators': minor | ||
--- | ||
|
||
Added support for creating custom test and suite decorator | ||
|
||
```ts | ||
import { createSuiteAndTestDecorator } from 'playwright-decorators' | ||
import playwright from '@playwright/test' | ||
|
||
const mySuiteAndTestDecorator = createSuiteAndTestDecorator( | ||
'mySuiteAndTestDecorator', | ||
({suite}) => { | ||
suite.initialized(() => { | ||
/** run custom code when suite is initialized **/ | ||
}) | ||
}, | ||
({test}) => { | ||
test.beforeTest(() => { | ||
/** run custom code before test execution **/ | ||
}) | ||
test.afterTest(() => { | ||
/** run custom code after test execution **/ | ||
}) | ||
|
||
playwright.beforeEach(() => { | ||
/** run custom code before each test execution **/ | ||
}) | ||
} | ||
); | ||
``` |
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
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
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
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.