forked from microsoft/playwright
-
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(expect): add toPass option to playwright config file
- Loading branch information
jonghoon.park
committed
Nov 18, 2023
1 parent
3f55587
commit 041785f
Showing
5 changed files
with
62 additions
and
1 deletion.
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -220,3 +220,25 @@ test('should show intermediate result for toPass that spills over test time', as | |
expect(result.output).toContain('Expected: 2'); | ||
expect(result.output).toContain('Received: 3'); | ||
}); | ||
|
||
test('should respect timeout in config file', async ({ runInlineTest }) => { | ||
This comment has been minimized.
Sorry, something went wrong.
injae-kim
|
||
const result = await runInlineTest({ | ||
'playwright.config.js': `module.exports = { expect: { toPass: { timeout: 100 } } }`, | ||
'a.spec.ts': ` | ||
import { test, expect } from '@playwright/test'; | ||
test('should fail', async () => { | ||
await test.expect(() => { | ||
expect(1).toBe(2); | ||
}).toPass(); | ||
}); | ||
` | ||
}); | ||
expect(result.exitCode).toBe(1); | ||
expect(result.output).toContain('Timeout 100ms exceeded while waiting on the predicate'); | ||
expect(result.output).toContain('Received: 1'); | ||
expect(result.output).toContain(` | ||
4 | await test.expect(() => { | ||
`.trim()); | ||
}); | ||
|
||
|
(PR naming)
feat(expect): add toPass option to playwright config file
vs
feat(expect): Make toPass's option configurable by TestConfig