@augment-vir/test 31.57.3 → 31.57.5
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.
|
@@ -3,12 +3,18 @@ import { type Download, type Page } from '@playwright/test';
|
|
|
3
3
|
import { type RequireExactlyOne } from 'type-fest';
|
|
4
4
|
import { type UniversalTestContext } from '../augments/universal-testing-suite/universal-test-context.js';
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
7
|
-
* chooses on or the other).
|
|
6
|
+
* Output from {@link handleNewPageOrDownload}.
|
|
8
7
|
*
|
|
9
8
|
* @category Internal
|
|
10
9
|
*/
|
|
11
|
-
export
|
|
10
|
+
export type HandleNewPageOrDownloadResult = RequireExactlyOne<{
|
|
12
11
|
newPage: Page;
|
|
13
12
|
download: Download;
|
|
14
|
-
}
|
|
13
|
+
}>;
|
|
14
|
+
/**
|
|
15
|
+
* Run the trigger and catch a new page _or_ a new download (sometimes Playwright inconsistently
|
|
16
|
+
* chooses on or the other).
|
|
17
|
+
*
|
|
18
|
+
* @category Internal
|
|
19
|
+
*/
|
|
20
|
+
export declare function handleNewPageOrDownload(testContext: Readonly<UniversalTestContext>, trigger: () => MaybePromise<void>): Promise<HandleNewPageOrDownloadResult>;
|
|
@@ -10,16 +10,14 @@ export async function handleNewPageOrDownload(testContext, trigger) {
|
|
|
10
10
|
const openOrDownload = Promise.race([
|
|
11
11
|
testContext.page
|
|
12
12
|
.context()
|
|
13
|
-
.waitForEvent('page'
|
|
14
|
-
return (await newPage.opener()) === testContext.page;
|
|
15
|
-
})
|
|
13
|
+
.waitForEvent('page')
|
|
16
14
|
.then((result) => {
|
|
17
|
-
return {
|
|
15
|
+
return { newPage: result };
|
|
18
16
|
}),
|
|
19
17
|
testContext.page.waitForEvent('download').then((result) => {
|
|
20
18
|
return { download: result };
|
|
21
19
|
}),
|
|
22
20
|
]);
|
|
23
21
|
await trigger();
|
|
24
|
-
return
|
|
22
|
+
return await openOrDownload;
|
|
25
23
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@augment-vir/test",
|
|
3
|
-
"version": "31.57.
|
|
3
|
+
"version": "31.57.5",
|
|
4
4
|
"description": "A universal testing suite that works with Mocha style test runners _and_ Node.js's built-in test runner.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"test",
|
|
@@ -44,8 +44,8 @@
|
|
|
44
44
|
"test:web": "virmator test --no-deps web 'src/test-web/**/*.test.ts' 'src/augments/universal-testing-suite/**/*.test.ts'"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@augment-vir/assert": "^31.57.
|
|
48
|
-
"@augment-vir/common": "^31.57.
|
|
47
|
+
"@augment-vir/assert": "^31.57.5",
|
|
48
|
+
"@augment-vir/common": "^31.57.5",
|
|
49
49
|
"@date-vir/duration": "^8.1.0",
|
|
50
50
|
"@virmator/test": "^14.3.5",
|
|
51
51
|
"type-fest": "^5.3.1"
|