@augment-vir/test 31.67.0 → 31.68.0
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.
|
@@ -9,7 +9,8 @@ export type MenuOptionOptions = Parameters<Page['getByRole']>[1] & Partial<{
|
|
|
9
9
|
nth: number;
|
|
10
10
|
}>;
|
|
11
11
|
/**
|
|
12
|
-
* Find the matching (or first) "option" element.
|
|
12
|
+
* Find the matching (or first) "option" or "menuitem" element. Tries both roles and returns
|
|
13
|
+
* whichever one is found.
|
|
13
14
|
*
|
|
14
15
|
* @category Internal
|
|
15
16
|
*/
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import { assertTestContext, TestEnv, } from '../augments/universal-testing-suite/universal-test-context.js';
|
|
2
2
|
/**
|
|
3
|
-
* Find the matching (or first) "option" element.
|
|
3
|
+
* Find the matching (or first) "option" or "menuitem" element. Tries both roles and returns
|
|
4
|
+
* whichever one is found.
|
|
4
5
|
*
|
|
5
6
|
* @category Internal
|
|
6
7
|
*/
|
|
7
8
|
export function getMenuOption(testContext, options) {
|
|
8
9
|
assertTestContext(testContext, TestEnv.Playwright);
|
|
9
|
-
const baseLocator = testContext.page
|
|
10
|
+
const baseLocator = testContext.page
|
|
11
|
+
.getByRole('option', options)
|
|
12
|
+
.or(testContext.page.getByRole('menuitem', options));
|
|
10
13
|
if (options && 'nth' in options) {
|
|
11
14
|
return baseLocator.nth(options.nth);
|
|
12
15
|
}
|
|
@@ -12,10 +12,14 @@ export async function handleNewPageOrDownload(testContext, trigger) {
|
|
|
12
12
|
.context()
|
|
13
13
|
.waitForEvent('page')
|
|
14
14
|
.then((result) => {
|
|
15
|
-
return {
|
|
15
|
+
return {
|
|
16
|
+
newPage: result,
|
|
17
|
+
};
|
|
16
18
|
}),
|
|
17
19
|
testContext.page.waitForEvent('download').then((result) => {
|
|
18
|
-
return {
|
|
20
|
+
return {
|
|
21
|
+
download: result,
|
|
22
|
+
};
|
|
19
23
|
}),
|
|
20
24
|
]);
|
|
21
25
|
await trigger();
|
|
@@ -57,7 +57,10 @@ async function saveScreenshotBuffer(testContext, screenshotBuffer, screenshotBas
|
|
|
57
57
|
*/
|
|
58
58
|
export function getScreenshotPath(testContext, screenshotBaseName) {
|
|
59
59
|
assertTestContext(testContext, TestEnv.Playwright);
|
|
60
|
-
const screenshotFileName = addSuffix({
|
|
60
|
+
const screenshotFileName = addSuffix({
|
|
61
|
+
value: screenshotBaseName,
|
|
62
|
+
suffix: '.png',
|
|
63
|
+
});
|
|
61
64
|
return testContext.testInfo.snapshotPath(screenshotFileName);
|
|
62
65
|
}
|
|
63
66
|
/**
|
|
@@ -85,7 +88,10 @@ export async function expectPlaywrightScreenshot(testContext, options) {
|
|
|
85
88
|
await saveScreenshotBuffer(testContext, currentScreenshotBuffer, options.screenshotBaseName);
|
|
86
89
|
}
|
|
87
90
|
async function writeExpectationScreenshot(contents, fileName) {
|
|
88
|
-
const filePath = assertWrapTestContext(testContext, TestEnv.Playwright).testInfo.outputPath(addSuffix({
|
|
91
|
+
const filePath = assertWrapTestContext(testContext, TestEnv.Playwright).testInfo.outputPath(addSuffix({
|
|
92
|
+
value: fileName,
|
|
93
|
+
suffix: '.png',
|
|
94
|
+
}));
|
|
89
95
|
await writeFileAndDir(filePath, contents);
|
|
90
96
|
}
|
|
91
97
|
if (existsSync(screenshotFilePath)) {
|
|
@@ -23,7 +23,7 @@ export async function deleteAllTextInInput(inputElement) {
|
|
|
23
23
|
if (inputElement.value === lastValue) {
|
|
24
24
|
throw new Error(`Input value was not changed at all`);
|
|
25
25
|
}
|
|
26
|
-
if (inputElement.value.length >= lastValue.length) {
|
|
26
|
+
else if (inputElement.value.length >= lastValue.length) {
|
|
27
27
|
throw new Error(`Input value length was not decreased.`);
|
|
28
28
|
}
|
|
29
29
|
await deleteAllTextInInput(inputElement);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@augment-vir/test",
|
|
3
|
-
"version": "31.
|
|
3
|
+
"version": "31.68.0",
|
|
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,22 +44,22 @@
|
|
|
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.
|
|
48
|
-
"@augment-vir/common": "^31.
|
|
49
|
-
"@date-vir/duration": "^8.
|
|
50
|
-
"@virmator/test": "^14.
|
|
47
|
+
"@augment-vir/assert": "^31.68.0",
|
|
48
|
+
"@augment-vir/common": "^31.68.0",
|
|
49
|
+
"@date-vir/duration": "^8.2.0",
|
|
50
|
+
"@virmator/test": "^14.8.2",
|
|
51
51
|
"type-fest": "^5.4.4"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
54
|
"@open-wc/testing-helpers": "^3.0.1",
|
|
55
55
|
"@playwright/test": "^1.58.2",
|
|
56
|
-
"@types/node": "^25.3.
|
|
56
|
+
"@types/node": "^25.3.5",
|
|
57
57
|
"@web/dev-server-esbuild": "^1.0.5",
|
|
58
58
|
"@web/test-runner": "^0.20.2",
|
|
59
59
|
"@web/test-runner-commands": "^0.9.0",
|
|
60
60
|
"@web/test-runner-playwright": "^0.11.1",
|
|
61
61
|
"@web/test-runner-visual-regression": "^0.10.0",
|
|
62
|
-
"element-vir": "^26.14.
|
|
62
|
+
"element-vir": "^26.14.6",
|
|
63
63
|
"istanbul-smart-text-reporter": "^1.1.5",
|
|
64
64
|
"pixelmatch": "^7.1.0",
|
|
65
65
|
"pngjs": "^7.0.0",
|