patchwright 1.64.1 → 1.65.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +116 -145
- package/helpers.mjs +387 -0
- package/lib/cli/testActions.js +0 -1
- package/lib/common/index.js +142 -65
- package/lib/common/index.js.txt +7 -7
- package/lib/matchers/expect.js +56 -30
- package/lib/matchers/expect.js.LICENSE +3 -3
- package/lib/matchers/expect.js.txt +4 -4
- package/lib/mcp/test/testContext.js +2 -8
- package/lib/runner/index.js +500 -401
- package/lib/runner/index.js.txt +24 -23
- package/lib/transform/babelBundle.js +81 -57
- package/lib/transform/babelBundle.js.txt +2 -2
- package/lib/transform/esmLoader.js +361 -163
- package/lib/transform/esmLoader.js.LICENSE +3 -3
- package/lib/transform/esmLoader.js.txt +9 -8
- package/lib/worker/workerProcessEntry.js +6 -14
- package/lib/worker/workerProcessEntry.js.txt +2 -2
- package/package.json +6 -5
- package/types/test.d.ts +365 -41
- package/types/testReporter.d.ts +22 -2
package/types/test.d.ts
CHANGED
|
@@ -20,13 +20,15 @@ export * from 'patchwright-core';
|
|
|
20
20
|
|
|
21
21
|
export type BlobReporterOptions = { outputDir?: string, fileName?: string };
|
|
22
22
|
export type DotReporterOptions = { omitTags?: boolean };
|
|
23
|
+
export type FailuresReporterOptions = { omitTags?: boolean };
|
|
23
24
|
export type LineReporterOptions = { omitTags?: boolean };
|
|
24
25
|
export type ListReporterOptions = { printSteps?: boolean, printFailuresInline?: boolean, omitTags?: boolean };
|
|
25
26
|
export type GitHubReporterOptions = { omitTags?: boolean };
|
|
26
|
-
export type JUnitReporterOptions = { outputFile?: string, stripANSIControlSequences?: boolean, includeProjectInTestName?: boolean, includeRetries?: boolean, omitTags?: boolean };
|
|
27
|
-
export type JsonReporterOptions = { outputFile?: string };
|
|
27
|
+
export type JUnitReporterOptions = { outputFile?: string, stripANSIControlSequences?: boolean, includeProjectInTestName?: boolean, includeRetries?: boolean, omitTags?: boolean, onlyFailures?: boolean };
|
|
28
|
+
export type JsonReporterOptions = { outputFile?: string, onlyFailures?: boolean };
|
|
28
29
|
export type PerfettoReporterOptions = { outputFile?: string };
|
|
29
30
|
export type HtmlReporterOptions = {
|
|
31
|
+
onlyFailures?: boolean;
|
|
30
32
|
outputFolder?: string;
|
|
31
33
|
open?: 'always' | 'never' | 'on-failure';
|
|
32
34
|
host?: string;
|
|
@@ -42,6 +44,7 @@ export type HtmlReporterOptions = {
|
|
|
42
44
|
export type ReporterDescription = Readonly<
|
|
43
45
|
['blob'] | ['blob', BlobReporterOptions] |
|
|
44
46
|
['dot'] | ['dot', DotReporterOptions] |
|
|
47
|
+
['failures'] | ['failures', FailuresReporterOptions] |
|
|
45
48
|
['line'] | ['line', LineReporterOptions] |
|
|
46
49
|
['list'] | ['list', ListReporterOptions] |
|
|
47
50
|
['github'] | ['github', GitHubReporterOptions] |
|
|
@@ -961,7 +964,7 @@ interface TestConfig<TestArgs = {}, WorkerArgs = {}> {
|
|
|
961
964
|
* ```
|
|
962
965
|
*
|
|
963
966
|
*/
|
|
964
|
-
reporter?: LiteralUnion<'list'|'dot'|'line'|'github'|'json'|'junit'|'null'|'html'|'blob'|'perfetto', string> | ReporterDescription[];
|
|
967
|
+
reporter?: LiteralUnion<'list'|'dot'|'failures'|'line'|'github'|'json'|'junit'|'null'|'html'|'blob'|'perfetto', string> | ReporterDescription[];
|
|
965
968
|
/**
|
|
966
969
|
* Global options for all tests, for example
|
|
967
970
|
* [testOptions.browserName](https://playwright.dev/docs/api/class-testoptions#test-options-browser-name). Learn more
|
|
@@ -1080,7 +1083,7 @@ interface TestConfig<TestArgs = {}, WorkerArgs = {}> {
|
|
|
1080
1083
|
* ```js
|
|
1081
1084
|
* import { test, expect } from '@playwright/test';
|
|
1082
1085
|
*
|
|
1083
|
-
* test.use({
|
|
1086
|
+
* test.use({ baseURL: `http://localhost:${process.env.MY_SERVER_PORT ?? 3000}` });
|
|
1084
1087
|
*
|
|
1085
1088
|
* test('homepage', async ({ page }) => {
|
|
1086
1089
|
* await page.goto('/');
|
|
@@ -2894,6 +2897,8 @@ export interface TestType<TestArgs extends {}, WorkerArgs extends {}> {
|
|
|
2894
2897
|
* });
|
|
2895
2898
|
* ```
|
|
2896
2899
|
*
|
|
2900
|
+
* The built-in `-exclusive-` lock runs the test only when no other tests are running.
|
|
2901
|
+
*
|
|
2897
2902
|
* Learn more about [test locks](https://playwright.dev/docs/test-parallel#test-locks).
|
|
2898
2903
|
* @param title Test title.
|
|
2899
2904
|
* @param details Additional test details.
|
|
@@ -2991,6 +2996,8 @@ export interface TestType<TestArgs extends {}, WorkerArgs extends {}> {
|
|
|
2991
2996
|
* });
|
|
2992
2997
|
* ```
|
|
2993
2998
|
*
|
|
2999
|
+
* The built-in `-exclusive-` lock runs the test only when no other tests are running.
|
|
3000
|
+
*
|
|
2994
3001
|
* Learn more about [test locks](https://playwright.dev/docs/test-parallel#test-locks).
|
|
2995
3002
|
* @param title Test title.
|
|
2996
3003
|
* @param details Additional test details.
|
|
@@ -4476,6 +4483,7 @@ export interface TestType<TestArgs extends {}, WorkerArgs extends {}> {
|
|
|
4476
4483
|
* - `test.skip(condition, description)`
|
|
4477
4484
|
* - `test.skip(callback, description)`
|
|
4478
4485
|
* - `test.skip()`
|
|
4486
|
+
* - `test.skip(description)`
|
|
4479
4487
|
*
|
|
4480
4488
|
* **Usage**
|
|
4481
4489
|
*
|
|
@@ -4519,14 +4527,14 @@ export interface TestType<TestArgs extends {}, WorkerArgs extends {}> {
|
|
|
4519
4527
|
* });
|
|
4520
4528
|
* ```
|
|
4521
4529
|
*
|
|
4522
|
-
* You can also call `test.skip()` without
|
|
4523
|
-
* recommend using `test.skip(title, body)` instead.
|
|
4530
|
+
* You can also call `test.skip()` without a condition inside the test body to always skip the test, optionally with a
|
|
4531
|
+
* `description`. However, we recommend using `test.skip(title, body)` instead.
|
|
4524
4532
|
*
|
|
4525
4533
|
* ```js
|
|
4526
4534
|
* import { test, expect } from '@playwright/test';
|
|
4527
4535
|
*
|
|
4528
4536
|
* test('less readable', async ({ page }) => {
|
|
4529
|
-
* test.skip();
|
|
4537
|
+
* test.skip('Not implemented yet');
|
|
4530
4538
|
* // ...
|
|
4531
4539
|
* });
|
|
4532
4540
|
* ```
|
|
@@ -4557,6 +4565,7 @@ export interface TestType<TestArgs extends {}, WorkerArgs extends {}> {
|
|
|
4557
4565
|
* - `test.skip(condition, description)`
|
|
4558
4566
|
* - `test.skip(callback, description)`
|
|
4559
4567
|
* - `test.skip()`
|
|
4568
|
+
* - `test.skip(description)`
|
|
4560
4569
|
*
|
|
4561
4570
|
* **Usage**
|
|
4562
4571
|
*
|
|
@@ -4600,14 +4609,14 @@ export interface TestType<TestArgs extends {}, WorkerArgs extends {}> {
|
|
|
4600
4609
|
* });
|
|
4601
4610
|
* ```
|
|
4602
4611
|
*
|
|
4603
|
-
* You can also call `test.skip()` without
|
|
4604
|
-
* recommend using `test.skip(title, body)` instead.
|
|
4612
|
+
* You can also call `test.skip()` without a condition inside the test body to always skip the test, optionally with a
|
|
4613
|
+
* `description`. However, we recommend using `test.skip(title, body)` instead.
|
|
4605
4614
|
*
|
|
4606
4615
|
* ```js
|
|
4607
4616
|
* import { test, expect } from '@playwright/test';
|
|
4608
4617
|
*
|
|
4609
4618
|
* test('less readable', async ({ page }) => {
|
|
4610
|
-
* test.skip();
|
|
4619
|
+
* test.skip('Not implemented yet');
|
|
4611
4620
|
* // ...
|
|
4612
4621
|
* });
|
|
4613
4622
|
* ```
|
|
@@ -4638,6 +4647,7 @@ export interface TestType<TestArgs extends {}, WorkerArgs extends {}> {
|
|
|
4638
4647
|
* - `test.skip(condition, description)`
|
|
4639
4648
|
* - `test.skip(callback, description)`
|
|
4640
4649
|
* - `test.skip()`
|
|
4650
|
+
* - `test.skip(description)`
|
|
4641
4651
|
*
|
|
4642
4652
|
* **Usage**
|
|
4643
4653
|
*
|
|
@@ -4681,14 +4691,14 @@ export interface TestType<TestArgs extends {}, WorkerArgs extends {}> {
|
|
|
4681
4691
|
* });
|
|
4682
4692
|
* ```
|
|
4683
4693
|
*
|
|
4684
|
-
* You can also call `test.skip()` without
|
|
4685
|
-
* recommend using `test.skip(title, body)` instead.
|
|
4694
|
+
* You can also call `test.skip()` without a condition inside the test body to always skip the test, optionally with a
|
|
4695
|
+
* `description`. However, we recommend using `test.skip(title, body)` instead.
|
|
4686
4696
|
*
|
|
4687
4697
|
* ```js
|
|
4688
4698
|
* import { test, expect } from '@playwright/test';
|
|
4689
4699
|
*
|
|
4690
4700
|
* test('less readable', async ({ page }) => {
|
|
4691
|
-
* test.skip();
|
|
4701
|
+
* test.skip('Not implemented yet');
|
|
4692
4702
|
* // ...
|
|
4693
4703
|
* });
|
|
4694
4704
|
* ```
|
|
@@ -4719,6 +4729,7 @@ export interface TestType<TestArgs extends {}, WorkerArgs extends {}> {
|
|
|
4719
4729
|
* - `test.skip(condition, description)`
|
|
4720
4730
|
* - `test.skip(callback, description)`
|
|
4721
4731
|
* - `test.skip()`
|
|
4732
|
+
* - `test.skip(description)`
|
|
4722
4733
|
*
|
|
4723
4734
|
* **Usage**
|
|
4724
4735
|
*
|
|
@@ -4762,14 +4773,96 @@ export interface TestType<TestArgs extends {}, WorkerArgs extends {}> {
|
|
|
4762
4773
|
* });
|
|
4763
4774
|
* ```
|
|
4764
4775
|
*
|
|
4765
|
-
* You can also call `test.skip()` without
|
|
4766
|
-
* recommend using `test.skip(title, body)` instead.
|
|
4776
|
+
* You can also call `test.skip()` without a condition inside the test body to always skip the test, optionally with a
|
|
4777
|
+
* `description`. However, we recommend using `test.skip(title, body)` instead.
|
|
4767
4778
|
*
|
|
4768
4779
|
* ```js
|
|
4769
4780
|
* import { test, expect } from '@playwright/test';
|
|
4770
4781
|
*
|
|
4771
4782
|
* test('less readable', async ({ page }) => {
|
|
4772
|
-
* test.skip();
|
|
4783
|
+
* test.skip('Not implemented yet');
|
|
4784
|
+
* // ...
|
|
4785
|
+
* });
|
|
4786
|
+
* ```
|
|
4787
|
+
*
|
|
4788
|
+
* @param title Test title.
|
|
4789
|
+
* @param details See [test.(call)(title[, details, body])](https://playwright.dev/docs/api/class-test#test-call) for test details
|
|
4790
|
+
* description.
|
|
4791
|
+
* @param body Test body that takes one or two arguments: an object with fixtures and optional
|
|
4792
|
+
* [TestInfo](https://playwright.dev/docs/api/class-testinfo).
|
|
4793
|
+
* @param condition Test is marked as "skipped" when the condition is `true`.
|
|
4794
|
+
* @param callback A function that returns whether to mark as "skipped", based on test fixtures. Test or tests are marked as "skipped"
|
|
4795
|
+
* when the return value is `true`.
|
|
4796
|
+
* @param description Optional description that will be reflected in a test report.
|
|
4797
|
+
*/
|
|
4798
|
+
skip(description: string): void;
|
|
4799
|
+
/**
|
|
4800
|
+
* Skip a test. Playwright will not run the test past the `test.skip()` call.
|
|
4801
|
+
*
|
|
4802
|
+
* Skipped tests are not supposed to be ever run. If you intend to fix the test, use
|
|
4803
|
+
* [test.fixme([title, details, body, condition, callback, description])](https://playwright.dev/docs/api/class-test#test-fixme)
|
|
4804
|
+
* instead.
|
|
4805
|
+
*
|
|
4806
|
+
* To declare a skipped test:
|
|
4807
|
+
* - `test.skip(title, body)`
|
|
4808
|
+
* - `test.skip(title, details, body)`
|
|
4809
|
+
*
|
|
4810
|
+
* To skip a test at runtime:
|
|
4811
|
+
* - `test.skip(condition, description)`
|
|
4812
|
+
* - `test.skip(callback, description)`
|
|
4813
|
+
* - `test.skip()`
|
|
4814
|
+
* - `test.skip(description)`
|
|
4815
|
+
*
|
|
4816
|
+
* **Usage**
|
|
4817
|
+
*
|
|
4818
|
+
* You can declare a skipped test, and Playwright will not run it.
|
|
4819
|
+
*
|
|
4820
|
+
* ```js
|
|
4821
|
+
* import { test, expect } from '@playwright/test';
|
|
4822
|
+
*
|
|
4823
|
+
* test.skip('never run', async ({ page }) => {
|
|
4824
|
+
* // ...
|
|
4825
|
+
* });
|
|
4826
|
+
* ```
|
|
4827
|
+
*
|
|
4828
|
+
* If your test should be skipped in some configurations, but not all, you can skip the test inside the test body
|
|
4829
|
+
* based on some condition. We recommend passing a `description` argument in this case. Playwright will run the test,
|
|
4830
|
+
* but abort it immediately after the `test.skip` call.
|
|
4831
|
+
*
|
|
4832
|
+
* ```js
|
|
4833
|
+
* import { test, expect } from '@playwright/test';
|
|
4834
|
+
*
|
|
4835
|
+
* test('Safari-only test', async ({ page, browserName }) => {
|
|
4836
|
+
* test.skip(browserName !== 'webkit', 'This feature is Safari-only');
|
|
4837
|
+
* // ...
|
|
4838
|
+
* });
|
|
4839
|
+
* ```
|
|
4840
|
+
*
|
|
4841
|
+
* You can skip all tests in a file or
|
|
4842
|
+
* [test.describe([title, details, callback])](https://playwright.dev/docs/api/class-test#test-describe) group based
|
|
4843
|
+
* on some condition with a single `test.skip(callback, description)` call.
|
|
4844
|
+
*
|
|
4845
|
+
* ```js
|
|
4846
|
+
* import { test, expect } from '@playwright/test';
|
|
4847
|
+
*
|
|
4848
|
+
* test.skip(({ browserName }) => browserName !== 'webkit', 'Safari-only');
|
|
4849
|
+
*
|
|
4850
|
+
* test('Safari-only test 1', async ({ page }) => {
|
|
4851
|
+
* // ...
|
|
4852
|
+
* });
|
|
4853
|
+
* test('Safari-only test 2', async ({ page }) => {
|
|
4854
|
+
* // ...
|
|
4855
|
+
* });
|
|
4856
|
+
* ```
|
|
4857
|
+
*
|
|
4858
|
+
* You can also call `test.skip()` without a condition inside the test body to always skip the test, optionally with a
|
|
4859
|
+
* `description`. However, we recommend using `test.skip(title, body)` instead.
|
|
4860
|
+
*
|
|
4861
|
+
* ```js
|
|
4862
|
+
* import { test, expect } from '@playwright/test';
|
|
4863
|
+
*
|
|
4864
|
+
* test('less readable', async ({ page }) => {
|
|
4865
|
+
* test.skip('Not implemented yet');
|
|
4773
4866
|
* // ...
|
|
4774
4867
|
* });
|
|
4775
4868
|
* ```
|
|
@@ -4800,6 +4893,7 @@ export interface TestType<TestArgs extends {}, WorkerArgs extends {}> {
|
|
|
4800
4893
|
* - `test.skip(condition, description)`
|
|
4801
4894
|
* - `test.skip(callback, description)`
|
|
4802
4895
|
* - `test.skip()`
|
|
4896
|
+
* - `test.skip(description)`
|
|
4803
4897
|
*
|
|
4804
4898
|
* **Usage**
|
|
4805
4899
|
*
|
|
@@ -4843,14 +4937,14 @@ export interface TestType<TestArgs extends {}, WorkerArgs extends {}> {
|
|
|
4843
4937
|
* });
|
|
4844
4938
|
* ```
|
|
4845
4939
|
*
|
|
4846
|
-
* You can also call `test.skip()` without
|
|
4847
|
-
* recommend using `test.skip(title, body)` instead.
|
|
4940
|
+
* You can also call `test.skip()` without a condition inside the test body to always skip the test, optionally with a
|
|
4941
|
+
* `description`. However, we recommend using `test.skip(title, body)` instead.
|
|
4848
4942
|
*
|
|
4849
4943
|
* ```js
|
|
4850
4944
|
* import { test, expect } from '@playwright/test';
|
|
4851
4945
|
*
|
|
4852
4946
|
* test('less readable', async ({ page }) => {
|
|
4853
|
-
* test.skip();
|
|
4947
|
+
* test.skip('Not implemented yet');
|
|
4854
4948
|
* // ...
|
|
4855
4949
|
* });
|
|
4856
4950
|
* ```
|
|
@@ -4879,6 +4973,7 @@ export interface TestType<TestArgs extends {}, WorkerArgs extends {}> {
|
|
|
4879
4973
|
* - `test.fixme(condition, description)`
|
|
4880
4974
|
* - `test.fixme(callback, description)`
|
|
4881
4975
|
* - `test.fixme()`
|
|
4976
|
+
* - `test.fixme(description)`
|
|
4882
4977
|
*
|
|
4883
4978
|
* **Usage**
|
|
4884
4979
|
*
|
|
@@ -4922,8 +5017,8 @@ export interface TestType<TestArgs extends {}, WorkerArgs extends {}> {
|
|
|
4922
5017
|
* });
|
|
4923
5018
|
* ```
|
|
4924
5019
|
*
|
|
4925
|
-
* You can also call `test.fixme()` without
|
|
4926
|
-
* recommend using `test.fixme(title, body)` instead.
|
|
5020
|
+
* You can also call `test.fixme()` without a condition inside the test body to always mark the test as "fixme",
|
|
5021
|
+
* optionally with a `description`. We recommend using `test.fixme(title, body)` instead.
|
|
4927
5022
|
*
|
|
4928
5023
|
* ```js
|
|
4929
5024
|
* import { test, expect } from '@playwright/test';
|
|
@@ -4957,6 +5052,7 @@ export interface TestType<TestArgs extends {}, WorkerArgs extends {}> {
|
|
|
4957
5052
|
* - `test.fixme(condition, description)`
|
|
4958
5053
|
* - `test.fixme(callback, description)`
|
|
4959
5054
|
* - `test.fixme()`
|
|
5055
|
+
* - `test.fixme(description)`
|
|
4960
5056
|
*
|
|
4961
5057
|
* **Usage**
|
|
4962
5058
|
*
|
|
@@ -5000,8 +5096,8 @@ export interface TestType<TestArgs extends {}, WorkerArgs extends {}> {
|
|
|
5000
5096
|
* });
|
|
5001
5097
|
* ```
|
|
5002
5098
|
*
|
|
5003
|
-
* You can also call `test.fixme()` without
|
|
5004
|
-
* recommend using `test.fixme(title, body)` instead.
|
|
5099
|
+
* You can also call `test.fixme()` without a condition inside the test body to always mark the test as "fixme",
|
|
5100
|
+
* optionally with a `description`. We recommend using `test.fixme(title, body)` instead.
|
|
5005
5101
|
*
|
|
5006
5102
|
* ```js
|
|
5007
5103
|
* import { test, expect } from '@playwright/test';
|
|
@@ -5035,6 +5131,7 @@ export interface TestType<TestArgs extends {}, WorkerArgs extends {}> {
|
|
|
5035
5131
|
* - `test.fixme(condition, description)`
|
|
5036
5132
|
* - `test.fixme(callback, description)`
|
|
5037
5133
|
* - `test.fixme()`
|
|
5134
|
+
* - `test.fixme(description)`
|
|
5038
5135
|
*
|
|
5039
5136
|
* **Usage**
|
|
5040
5137
|
*
|
|
@@ -5078,8 +5175,8 @@ export interface TestType<TestArgs extends {}, WorkerArgs extends {}> {
|
|
|
5078
5175
|
* });
|
|
5079
5176
|
* ```
|
|
5080
5177
|
*
|
|
5081
|
-
* You can also call `test.fixme()` without
|
|
5082
|
-
* recommend using `test.fixme(title, body)` instead.
|
|
5178
|
+
* You can also call `test.fixme()` without a condition inside the test body to always mark the test as "fixme",
|
|
5179
|
+
* optionally with a `description`. We recommend using `test.fixme(title, body)` instead.
|
|
5083
5180
|
*
|
|
5084
5181
|
* ```js
|
|
5085
5182
|
* import { test, expect } from '@playwright/test';
|
|
@@ -5113,6 +5210,7 @@ export interface TestType<TestArgs extends {}, WorkerArgs extends {}> {
|
|
|
5113
5210
|
* - `test.fixme(condition, description)`
|
|
5114
5211
|
* - `test.fixme(callback, description)`
|
|
5115
5212
|
* - `test.fixme()`
|
|
5213
|
+
* - `test.fixme(description)`
|
|
5116
5214
|
*
|
|
5117
5215
|
* **Usage**
|
|
5118
5216
|
*
|
|
@@ -5156,8 +5254,87 @@ export interface TestType<TestArgs extends {}, WorkerArgs extends {}> {
|
|
|
5156
5254
|
* });
|
|
5157
5255
|
* ```
|
|
5158
5256
|
*
|
|
5159
|
-
* You can also call `test.fixme()` without
|
|
5160
|
-
* recommend using `test.fixme(title, body)` instead.
|
|
5257
|
+
* You can also call `test.fixme()` without a condition inside the test body to always mark the test as "fixme",
|
|
5258
|
+
* optionally with a `description`. We recommend using `test.fixme(title, body)` instead.
|
|
5259
|
+
*
|
|
5260
|
+
* ```js
|
|
5261
|
+
* import { test, expect } from '@playwright/test';
|
|
5262
|
+
*
|
|
5263
|
+
* test('less readable', async ({ page }) => {
|
|
5264
|
+
* test.fixme();
|
|
5265
|
+
* // ...
|
|
5266
|
+
* });
|
|
5267
|
+
* ```
|
|
5268
|
+
*
|
|
5269
|
+
* @param title Test title.
|
|
5270
|
+
* @param details See [test.(call)(title[, details, body])](https://playwright.dev/docs/api/class-test#test-call) for test details
|
|
5271
|
+
* description.
|
|
5272
|
+
* @param body Test body that takes one or two arguments: an object with fixtures and optional
|
|
5273
|
+
* [TestInfo](https://playwright.dev/docs/api/class-testinfo).
|
|
5274
|
+
* @param condition Test is marked as "fixme" when the condition is `true`.
|
|
5275
|
+
* @param callback A function that returns whether to mark as "fixme", based on test fixtures. Test or tests are marked as "fixme"
|
|
5276
|
+
* when the return value is `true`.
|
|
5277
|
+
* @param description Optional description that will be reflected in a test report.
|
|
5278
|
+
*/
|
|
5279
|
+
fixme(description: string): void;
|
|
5280
|
+
/**
|
|
5281
|
+
* Mark a test as "fixme", with the intention to fix it. Playwright will not run the test past the `test.fixme()`
|
|
5282
|
+
* call.
|
|
5283
|
+
*
|
|
5284
|
+
* To declare a "fixme" test:
|
|
5285
|
+
* - `test.fixme(title, body)`
|
|
5286
|
+
* - `test.fixme(title, details, body)`
|
|
5287
|
+
*
|
|
5288
|
+
* To annotate test as "fixme" at runtime:
|
|
5289
|
+
* - `test.fixme(condition, description)`
|
|
5290
|
+
* - `test.fixme(callback, description)`
|
|
5291
|
+
* - `test.fixme()`
|
|
5292
|
+
* - `test.fixme(description)`
|
|
5293
|
+
*
|
|
5294
|
+
* **Usage**
|
|
5295
|
+
*
|
|
5296
|
+
* You can declare a test as to be fixed, and Playwright will not run it.
|
|
5297
|
+
*
|
|
5298
|
+
* ```js
|
|
5299
|
+
* import { test, expect } from '@playwright/test';
|
|
5300
|
+
*
|
|
5301
|
+
* test.fixme('to be fixed', async ({ page }) => {
|
|
5302
|
+
* // ...
|
|
5303
|
+
* });
|
|
5304
|
+
* ```
|
|
5305
|
+
*
|
|
5306
|
+
* If your test should be fixed in some configurations, but not all, you can mark the test as "fixme" inside the test
|
|
5307
|
+
* body based on some condition. We recommend passing a `description` argument in this case. Playwright will run the
|
|
5308
|
+
* test, but abort it immediately after the `test.fixme` call.
|
|
5309
|
+
*
|
|
5310
|
+
* ```js
|
|
5311
|
+
* import { test, expect } from '@playwright/test';
|
|
5312
|
+
*
|
|
5313
|
+
* test('to be fixed in Safari', async ({ page, browserName }) => {
|
|
5314
|
+
* test.fixme(browserName === 'webkit', 'This feature breaks in Safari for some reason');
|
|
5315
|
+
* // ...
|
|
5316
|
+
* });
|
|
5317
|
+
* ```
|
|
5318
|
+
*
|
|
5319
|
+
* You can mark all tests in a file or
|
|
5320
|
+
* [test.describe([title, details, callback])](https://playwright.dev/docs/api/class-test#test-describe) group as
|
|
5321
|
+
* "fixme" based on some condition with a single `test.fixme(callback, description)` call.
|
|
5322
|
+
*
|
|
5323
|
+
* ```js
|
|
5324
|
+
* import { test, expect } from '@playwright/test';
|
|
5325
|
+
*
|
|
5326
|
+
* test.fixme(({ browserName }) => browserName === 'webkit', 'Should figure out the issue');
|
|
5327
|
+
*
|
|
5328
|
+
* test('to be fixed in Safari 1', async ({ page }) => {
|
|
5329
|
+
* // ...
|
|
5330
|
+
* });
|
|
5331
|
+
* test('to be fixed in Safari 2', async ({ page }) => {
|
|
5332
|
+
* // ...
|
|
5333
|
+
* });
|
|
5334
|
+
* ```
|
|
5335
|
+
*
|
|
5336
|
+
* You can also call `test.fixme()` without a condition inside the test body to always mark the test as "fixme",
|
|
5337
|
+
* optionally with a `description`. We recommend using `test.fixme(title, body)` instead.
|
|
5161
5338
|
*
|
|
5162
5339
|
* ```js
|
|
5163
5340
|
* import { test, expect } from '@playwright/test';
|
|
@@ -5191,6 +5368,7 @@ export interface TestType<TestArgs extends {}, WorkerArgs extends {}> {
|
|
|
5191
5368
|
* - `test.fixme(condition, description)`
|
|
5192
5369
|
* - `test.fixme(callback, description)`
|
|
5193
5370
|
* - `test.fixme()`
|
|
5371
|
+
* - `test.fixme(description)`
|
|
5194
5372
|
*
|
|
5195
5373
|
* **Usage**
|
|
5196
5374
|
*
|
|
@@ -5234,8 +5412,8 @@ export interface TestType<TestArgs extends {}, WorkerArgs extends {}> {
|
|
|
5234
5412
|
* });
|
|
5235
5413
|
* ```
|
|
5236
5414
|
*
|
|
5237
|
-
* You can also call `test.fixme()` without
|
|
5238
|
-
* recommend using `test.fixme(title, body)` instead.
|
|
5415
|
+
* You can also call `test.fixme()` without a condition inside the test body to always mark the test as "fixme",
|
|
5416
|
+
* optionally with a `description`. We recommend using `test.fixme(title, body)` instead.
|
|
5239
5417
|
*
|
|
5240
5418
|
* ```js
|
|
5241
5419
|
* import { test, expect } from '@playwright/test';
|
|
@@ -5270,6 +5448,7 @@ export interface TestType<TestArgs extends {}, WorkerArgs extends {}> {
|
|
|
5270
5448
|
* - `test.fail(condition, description)`
|
|
5271
5449
|
* - `test.fail(callback, description)`
|
|
5272
5450
|
* - `test.fail()`
|
|
5451
|
+
* - `test.fail(description)`
|
|
5273
5452
|
*
|
|
5274
5453
|
* **Usage**
|
|
5275
5454
|
*
|
|
@@ -5312,8 +5491,8 @@ export interface TestType<TestArgs extends {}, WorkerArgs extends {}> {
|
|
|
5312
5491
|
* });
|
|
5313
5492
|
* ```
|
|
5314
5493
|
*
|
|
5315
|
-
* You can also call `test.fail()` without
|
|
5316
|
-
* recommend declaring a failing test with `test.fail(title, body)` instead.
|
|
5494
|
+
* You can also call `test.fail()` without a condition inside the test body to always mark the test as failed,
|
|
5495
|
+
* optionally with a `description`. We recommend declaring a failing test with `test.fail(title, body)` instead.
|
|
5317
5496
|
*
|
|
5318
5497
|
* ```js
|
|
5319
5498
|
* import { test, expect } from '@playwright/test';
|
|
@@ -5347,6 +5526,7 @@ export interface TestType<TestArgs extends {}, WorkerArgs extends {}> {
|
|
|
5347
5526
|
* - `test.fail(condition, description)`
|
|
5348
5527
|
* - `test.fail(callback, description)`
|
|
5349
5528
|
* - `test.fail()`
|
|
5529
|
+
* - `test.fail(description)`
|
|
5350
5530
|
*
|
|
5351
5531
|
* **Usage**
|
|
5352
5532
|
*
|
|
@@ -5389,8 +5569,8 @@ export interface TestType<TestArgs extends {}, WorkerArgs extends {}> {
|
|
|
5389
5569
|
* });
|
|
5390
5570
|
* ```
|
|
5391
5571
|
*
|
|
5392
|
-
* You can also call `test.fail()` without
|
|
5393
|
-
* recommend declaring a failing test with `test.fail(title, body)` instead.
|
|
5572
|
+
* You can also call `test.fail()` without a condition inside the test body to always mark the test as failed,
|
|
5573
|
+
* optionally with a `description`. We recommend declaring a failing test with `test.fail(title, body)` instead.
|
|
5394
5574
|
*
|
|
5395
5575
|
* ```js
|
|
5396
5576
|
* import { test, expect } from '@playwright/test';
|
|
@@ -5424,6 +5604,7 @@ export interface TestType<TestArgs extends {}, WorkerArgs extends {}> {
|
|
|
5424
5604
|
* - `test.fail(condition, description)`
|
|
5425
5605
|
* - `test.fail(callback, description)`
|
|
5426
5606
|
* - `test.fail()`
|
|
5607
|
+
* - `test.fail(description)`
|
|
5427
5608
|
*
|
|
5428
5609
|
* **Usage**
|
|
5429
5610
|
*
|
|
@@ -5466,8 +5647,8 @@ export interface TestType<TestArgs extends {}, WorkerArgs extends {}> {
|
|
|
5466
5647
|
* });
|
|
5467
5648
|
* ```
|
|
5468
5649
|
*
|
|
5469
|
-
* You can also call `test.fail()` without
|
|
5470
|
-
* recommend declaring a failing test with `test.fail(title, body)` instead.
|
|
5650
|
+
* You can also call `test.fail()` without a condition inside the test body to always mark the test as failed,
|
|
5651
|
+
* optionally with a `description`. We recommend declaring a failing test with `test.fail(title, body)` instead.
|
|
5471
5652
|
*
|
|
5472
5653
|
* ```js
|
|
5473
5654
|
* import { test, expect } from '@playwright/test';
|
|
@@ -5501,6 +5682,7 @@ export interface TestType<TestArgs extends {}, WorkerArgs extends {}> {
|
|
|
5501
5682
|
* - `test.fail(condition, description)`
|
|
5502
5683
|
* - `test.fail(callback, description)`
|
|
5503
5684
|
* - `test.fail()`
|
|
5685
|
+
* - `test.fail(description)`
|
|
5504
5686
|
*
|
|
5505
5687
|
* **Usage**
|
|
5506
5688
|
*
|
|
@@ -5543,8 +5725,8 @@ export interface TestType<TestArgs extends {}, WorkerArgs extends {}> {
|
|
|
5543
5725
|
* });
|
|
5544
5726
|
* ```
|
|
5545
5727
|
*
|
|
5546
|
-
* You can also call `test.fail()` without
|
|
5547
|
-
* recommend declaring a failing test with `test.fail(title, body)` instead.
|
|
5728
|
+
* You can also call `test.fail()` without a condition inside the test body to always mark the test as failed,
|
|
5729
|
+
* optionally with a `description`. We recommend declaring a failing test with `test.fail(title, body)` instead.
|
|
5548
5730
|
*
|
|
5549
5731
|
* ```js
|
|
5550
5732
|
* import { test, expect } from '@playwright/test';
|
|
@@ -5578,6 +5760,7 @@ export interface TestType<TestArgs extends {}, WorkerArgs extends {}> {
|
|
|
5578
5760
|
* - `test.fail(condition, description)`
|
|
5579
5761
|
* - `test.fail(callback, description)`
|
|
5580
5762
|
* - `test.fail()`
|
|
5763
|
+
* - `test.fail(description)`
|
|
5581
5764
|
*
|
|
5582
5765
|
* **Usage**
|
|
5583
5766
|
*
|
|
@@ -5620,8 +5803,8 @@ export interface TestType<TestArgs extends {}, WorkerArgs extends {}> {
|
|
|
5620
5803
|
* });
|
|
5621
5804
|
* ```
|
|
5622
5805
|
*
|
|
5623
|
-
* You can also call `test.fail()` without
|
|
5624
|
-
* recommend declaring a failing test with `test.fail(title, body)` instead.
|
|
5806
|
+
* You can also call `test.fail()` without a condition inside the test body to always mark the test as failed,
|
|
5807
|
+
* optionally with a `description`. We recommend declaring a failing test with `test.fail(title, body)` instead.
|
|
5625
5808
|
*
|
|
5626
5809
|
* ```js
|
|
5627
5810
|
* import { test, expect } from '@playwright/test';
|
|
@@ -5655,6 +5838,7 @@ export interface TestType<TestArgs extends {}, WorkerArgs extends {}> {
|
|
|
5655
5838
|
* - `test.fail(condition, description)`
|
|
5656
5839
|
* - `test.fail(callback, description)`
|
|
5657
5840
|
* - `test.fail()`
|
|
5841
|
+
* - `test.fail(description)`
|
|
5658
5842
|
*
|
|
5659
5843
|
* **Usage**
|
|
5660
5844
|
*
|
|
@@ -5697,8 +5881,8 @@ export interface TestType<TestArgs extends {}, WorkerArgs extends {}> {
|
|
|
5697
5881
|
* });
|
|
5698
5882
|
* ```
|
|
5699
5883
|
*
|
|
5700
|
-
* You can also call `test.fail()` without
|
|
5701
|
-
* recommend declaring a failing test with `test.fail(title, body)` instead.
|
|
5884
|
+
* You can also call `test.fail()` without a condition inside the test body to always mark the test as failed,
|
|
5885
|
+
* optionally with a `description`. We recommend declaring a failing test with `test.fail(title, body)` instead.
|
|
5702
5886
|
*
|
|
5703
5887
|
* ```js
|
|
5704
5888
|
* import { test, expect } from '@playwright/test';
|
|
@@ -5720,6 +5904,84 @@ export interface TestType<TestArgs extends {}, WorkerArgs extends {}> {
|
|
|
5720
5904
|
* @param description Optional description that will be reflected in a test report.
|
|
5721
5905
|
*/
|
|
5722
5906
|
(): void;
|
|
5907
|
+
/**
|
|
5908
|
+
* Marks a test as "should fail". Playwright runs this test and ensures that it is actually failing. This is useful
|
|
5909
|
+
* for documentation purposes to acknowledge that some functionality is broken until it is fixed.
|
|
5910
|
+
*
|
|
5911
|
+
* To declare a "failing" test:
|
|
5912
|
+
* - `test.fail(title, body)`
|
|
5913
|
+
* - `test.fail(title, details, body)`
|
|
5914
|
+
*
|
|
5915
|
+
* To annotate test as "failing" at runtime:
|
|
5916
|
+
* - `test.fail(condition, description)`
|
|
5917
|
+
* - `test.fail(callback, description)`
|
|
5918
|
+
* - `test.fail()`
|
|
5919
|
+
* - `test.fail(description)`
|
|
5920
|
+
*
|
|
5921
|
+
* **Usage**
|
|
5922
|
+
*
|
|
5923
|
+
* You can declare a test as failing, so that Playwright ensures it actually fails.
|
|
5924
|
+
*
|
|
5925
|
+
* ```js
|
|
5926
|
+
* import { test, expect } from '@playwright/test';
|
|
5927
|
+
*
|
|
5928
|
+
* test.fail('not yet ready', async ({ page }) => {
|
|
5929
|
+
* // ...
|
|
5930
|
+
* });
|
|
5931
|
+
* ```
|
|
5932
|
+
*
|
|
5933
|
+
* If your test fails in some configurations, but not all, you can mark the test as failing inside the test body based
|
|
5934
|
+
* on some condition. We recommend passing a `description` argument in this case.
|
|
5935
|
+
*
|
|
5936
|
+
* ```js
|
|
5937
|
+
* import { test, expect } from '@playwright/test';
|
|
5938
|
+
*
|
|
5939
|
+
* test('fail in WebKit', async ({ page, browserName }) => {
|
|
5940
|
+
* test.fail(browserName === 'webkit', 'This feature is not implemented for Mac yet');
|
|
5941
|
+
* // ...
|
|
5942
|
+
* });
|
|
5943
|
+
* ```
|
|
5944
|
+
*
|
|
5945
|
+
* You can mark all tests in a file or
|
|
5946
|
+
* [test.describe([title, details, callback])](https://playwright.dev/docs/api/class-test#test-describe) group as
|
|
5947
|
+
* "should fail" based on some condition with a single `test.fail(callback, description)` call.
|
|
5948
|
+
*
|
|
5949
|
+
* ```js
|
|
5950
|
+
* import { test, expect } from '@playwright/test';
|
|
5951
|
+
*
|
|
5952
|
+
* test.fail(({ browserName }) => browserName === 'webkit', 'not implemented yet');
|
|
5953
|
+
*
|
|
5954
|
+
* test('fail in WebKit 1', async ({ page }) => {
|
|
5955
|
+
* // ...
|
|
5956
|
+
* });
|
|
5957
|
+
* test('fail in WebKit 2', async ({ page }) => {
|
|
5958
|
+
* // ...
|
|
5959
|
+
* });
|
|
5960
|
+
* ```
|
|
5961
|
+
*
|
|
5962
|
+
* You can also call `test.fail()` without a condition inside the test body to always mark the test as failed,
|
|
5963
|
+
* optionally with a `description`. We recommend declaring a failing test with `test.fail(title, body)` instead.
|
|
5964
|
+
*
|
|
5965
|
+
* ```js
|
|
5966
|
+
* import { test, expect } from '@playwright/test';
|
|
5967
|
+
*
|
|
5968
|
+
* test('less readable', async ({ page }) => {
|
|
5969
|
+
* test.fail();
|
|
5970
|
+
* // ...
|
|
5971
|
+
* });
|
|
5972
|
+
* ```
|
|
5973
|
+
*
|
|
5974
|
+
* @param title Test title.
|
|
5975
|
+
* @param details See [test.(call)(title[, details, body])](https://playwright.dev/docs/api/class-test#test-call) for test details
|
|
5976
|
+
* description.
|
|
5977
|
+
* @param body Test body that takes one or two arguments: an object with fixtures and optional
|
|
5978
|
+
* [TestInfo](https://playwright.dev/docs/api/class-testinfo).
|
|
5979
|
+
* @param condition Test is marked as "should fail" when the condition is `true`.
|
|
5980
|
+
* @param callback A function that returns whether to mark as "should fail", based on test fixtures. Test or tests are marked as
|
|
5981
|
+
* "should fail" when the return value is `true`.
|
|
5982
|
+
* @param description Optional description that will be reflected in a test report.
|
|
5983
|
+
*/
|
|
5984
|
+
(description: string): void;
|
|
5723
5985
|
|
|
5724
5986
|
/**
|
|
5725
5987
|
* You can use `test.fail.only` to focus on a specific test that is expected to fail. This is particularly useful when
|
|
@@ -5813,6 +6075,7 @@ export interface TestType<TestArgs extends {}, WorkerArgs extends {}> {
|
|
|
5813
6075
|
* cannot be used in a `beforeAll` or `afterAll` hook. Use
|
|
5814
6076
|
* [test.setTimeout(timeout)](https://playwright.dev/docs/api/class-test#test-set-timeout) instead.
|
|
5815
6077
|
* - `test.slow()`
|
|
6078
|
+
* - `test.slow(description)`
|
|
5816
6079
|
* - `test.slow(condition, description)`
|
|
5817
6080
|
* - `test.slow(callback, description)`
|
|
5818
6081
|
*
|
|
@@ -5871,6 +6134,66 @@ export interface TestType<TestArgs extends {}, WorkerArgs extends {}> {
|
|
|
5871
6134
|
* cannot be used in a `beforeAll` or `afterAll` hook. Use
|
|
5872
6135
|
* [test.setTimeout(timeout)](https://playwright.dev/docs/api/class-test#test-set-timeout) instead.
|
|
5873
6136
|
* - `test.slow()`
|
|
6137
|
+
* - `test.slow(description)`
|
|
6138
|
+
* - `test.slow(condition, description)`
|
|
6139
|
+
* - `test.slow(callback, description)`
|
|
6140
|
+
*
|
|
6141
|
+
* **Usage**
|
|
6142
|
+
*
|
|
6143
|
+
* You can mark a test as slow by calling `test.slow()` inside the test body.
|
|
6144
|
+
*
|
|
6145
|
+
* ```js
|
|
6146
|
+
* import { test, expect } from '@playwright/test';
|
|
6147
|
+
*
|
|
6148
|
+
* test('slow test', async ({ page }) => {
|
|
6149
|
+
* test.slow();
|
|
6150
|
+
* // ...
|
|
6151
|
+
* });
|
|
6152
|
+
* ```
|
|
6153
|
+
*
|
|
6154
|
+
* If your test is slow in some configurations, but not all, you can mark it as slow based on a condition. We
|
|
6155
|
+
* recommend passing a `description` argument in this case.
|
|
6156
|
+
*
|
|
6157
|
+
* ```js
|
|
6158
|
+
* import { test, expect } from '@playwright/test';
|
|
6159
|
+
*
|
|
6160
|
+
* test('slow in Safari', async ({ page, browserName }) => {
|
|
6161
|
+
* test.slow(browserName === 'webkit', 'This feature is slow in Safari');
|
|
6162
|
+
* // ...
|
|
6163
|
+
* });
|
|
6164
|
+
* ```
|
|
6165
|
+
*
|
|
6166
|
+
* You can mark all tests in a file or
|
|
6167
|
+
* [test.describe([title, details, callback])](https://playwright.dev/docs/api/class-test#test-describe) group as
|
|
6168
|
+
* "slow" based on some condition by passing a callback.
|
|
6169
|
+
*
|
|
6170
|
+
* ```js
|
|
6171
|
+
* import { test, expect } from '@playwright/test';
|
|
6172
|
+
*
|
|
6173
|
+
* test.slow(({ browserName }) => browserName === 'webkit', 'all tests are slow in Safari');
|
|
6174
|
+
*
|
|
6175
|
+
* test('slow in Safari 1', async ({ page }) => {
|
|
6176
|
+
* // ...
|
|
6177
|
+
* });
|
|
6178
|
+
* test('fail in Safari 2', async ({ page }) => {
|
|
6179
|
+
* // ...
|
|
6180
|
+
* });
|
|
6181
|
+
* ```
|
|
6182
|
+
*
|
|
6183
|
+
* @param condition Test is marked as "slow" when the condition is `true`.
|
|
6184
|
+
* @param callback A function that returns whether to mark as "slow", based on test fixtures. Test or tests are marked as "slow" when
|
|
6185
|
+
* the return value is `true`.
|
|
6186
|
+
* @param description Optional description that will be reflected in a test report.
|
|
6187
|
+
*/
|
|
6188
|
+
slow(description: string): void;
|
|
6189
|
+
/**
|
|
6190
|
+
* Marks a test as "slow". Slow test will be given triple the default timeout.
|
|
6191
|
+
*
|
|
6192
|
+
* Note that [test.slow([condition, callback, description])](https://playwright.dev/docs/api/class-test#test-slow)
|
|
6193
|
+
* cannot be used in a `beforeAll` or `afterAll` hook. Use
|
|
6194
|
+
* [test.setTimeout(timeout)](https://playwright.dev/docs/api/class-test#test-set-timeout) instead.
|
|
6195
|
+
* - `test.slow()`
|
|
6196
|
+
* - `test.slow(description)`
|
|
5874
6197
|
* - `test.slow(condition, description)`
|
|
5875
6198
|
* - `test.slow(callback, description)`
|
|
5876
6199
|
*
|
|
@@ -5929,6 +6252,7 @@ export interface TestType<TestArgs extends {}, WorkerArgs extends {}> {
|
|
|
5929
6252
|
* cannot be used in a `beforeAll` or `afterAll` hook. Use
|
|
5930
6253
|
* [test.setTimeout(timeout)](https://playwright.dev/docs/api/class-test#test-set-timeout) instead.
|
|
5931
6254
|
* - `test.slow()`
|
|
6255
|
+
* - `test.slow(description)`
|
|
5932
6256
|
* - `test.slow(condition, description)`
|
|
5933
6257
|
* - `test.slow(callback, description)`
|
|
5934
6258
|
*
|