@augment-vir/test 31.50.1 → 31.50.3
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.
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { RuntimeEnvError } from '@augment-vir/core';
|
|
2
2
|
export { type MenuOptionOptions } from '../test-playwright/get-option.js';
|
|
3
|
-
export { playwrightTeatNameUrlParam, type
|
|
3
|
+
export { playwrightTeatNameUrlParam, type NavOptions } from '../test-playwright/nav.js';
|
|
4
4
|
export { type LocatorScreenshotOptions, type SaveScreenshotOptions, type TakeScreenshotOptions, } from '../test-playwright/screenshot.js';
|
|
5
5
|
declare function importPlaywrightTestApi(this: void): Promise<RuntimeEnvError | {
|
|
6
6
|
navigation: {
|
|
@@ -51,7 +51,7 @@ export function extractTestNameAsDir(testContext) {
|
|
|
51
51
|
* @package [`@augment-vir/test`](https://www.npmjs.com/package/@augment-vir/test)
|
|
52
52
|
*/
|
|
53
53
|
export function cleanTestNameAsDir(testName) {
|
|
54
|
-
return assertWrap.isTruthy(sanitizeFilePath(camelCaseToKebabCase(testName).replaceAll(/[<>:"/\-\\|?*_\s]+/g, '_')));
|
|
54
|
+
return assertWrap.isTruthy(sanitizeFilePath(camelCaseToKebabCase(testName).replaceAll(/[<>:"/\-\\|?*_\s.]+/g, '_')));
|
|
55
55
|
}
|
|
56
56
|
function flattenMochaParentTitles(node) {
|
|
57
57
|
if (node.root) {
|
|
@@ -1,21 +1,24 @@
|
|
|
1
1
|
import { type GenericTreePaths } from 'spa-router-vir';
|
|
2
|
+
import { type UrlOverrides } from 'url-vir';
|
|
2
3
|
import { type UniversalTestContext } from '../augments/universal-testing-suite/universal-test-context.js';
|
|
3
4
|
/**
|
|
4
|
-
* Converts {@link
|
|
5
|
+
* Converts {@link NavOptions} into an actionable URL string.
|
|
5
6
|
*
|
|
6
7
|
* @category Internal
|
|
7
8
|
*/
|
|
8
|
-
export declare function extractNavUrl(
|
|
9
|
+
export declare function extractNavUrl(testContext: Readonly<UniversalTestContext>, options: Readonly<NavOptions>): string;
|
|
9
10
|
/**
|
|
10
11
|
* Used for the `path` argument of `testPlaywright.nav`.
|
|
11
12
|
*
|
|
12
13
|
* @category Internal
|
|
13
14
|
*/
|
|
14
|
-
export type
|
|
15
|
-
/**
|
|
16
|
-
|
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
export type NavOptions = Omit<UrlOverrides, 'paths'> & {
|
|
16
|
+
/** If not provided, the page's current URL will be used. */
|
|
17
|
+
baseFrontendUrl?: string | undefined;
|
|
18
|
+
paths?: string[]
|
|
19
|
+
/** Prefer using tree paths with `frontendPathTree` */
|
|
20
|
+
| GenericTreePaths;
|
|
21
|
+
};
|
|
19
22
|
/**
|
|
20
23
|
* The test name appended to the frontend when `testPlaywright.nav` is used.
|
|
21
24
|
*
|
|
@@ -27,8 +30,4 @@ export declare const playwrightTeatNameUrlParam = "test-name";
|
|
|
27
30
|
*
|
|
28
31
|
* @category Internal
|
|
29
32
|
*/
|
|
30
|
-
export declare function navigateTo(testContext: Readonly<UniversalTestContext>,
|
|
31
|
-
path: NavPath;
|
|
32
|
-
/** If not provided, the page's current URL will be used. */
|
|
33
|
-
baseFrontendUrl?: string | undefined;
|
|
34
|
-
}): Promise<void>;
|
|
33
|
+
export declare function navigateTo(testContext: Readonly<UniversalTestContext>, options: Readonly<NavOptions>): Promise<void>;
|
|
@@ -1,21 +1,26 @@
|
|
|
1
1
|
import { check } from '@augment-vir/assert';
|
|
2
|
+
import { omitObjectKeys } from '@augment-vir/common';
|
|
2
3
|
import { buildUrl } from 'url-vir';
|
|
3
|
-
import { assertTestContext, extractTestNameAsDir, TestEnv, } from '../augments/universal-testing-suite/universal-test-context.js';
|
|
4
|
+
import { assertTestContext, assertWrapTestContext, extractTestNameAsDir, TestEnv, } from '../augments/universal-testing-suite/universal-test-context.js';
|
|
4
5
|
/**
|
|
5
|
-
* Converts {@link
|
|
6
|
+
* Converts {@link NavOptions} into an actionable URL string.
|
|
6
7
|
*
|
|
7
8
|
* @category Internal
|
|
8
9
|
*/
|
|
9
|
-
export function extractNavUrl(
|
|
10
|
-
return
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
10
|
+
export function extractNavUrl(testContext, options) {
|
|
11
|
+
return buildUrl(options.baseFrontendUrl ||
|
|
12
|
+
assertWrapTestContext(testContext, TestEnv.Playwright).page.url(), {
|
|
13
|
+
...omitObjectKeys(options, ['paths']),
|
|
14
|
+
...(options.paths
|
|
15
|
+
? check.isArray(options.paths)
|
|
16
|
+
? {
|
|
17
|
+
paths: options.paths,
|
|
18
|
+
}
|
|
19
|
+
: {
|
|
20
|
+
paths: options.paths.fullPaths,
|
|
21
|
+
}
|
|
22
|
+
: {}),
|
|
23
|
+
}).href;
|
|
19
24
|
}
|
|
20
25
|
/**
|
|
21
26
|
* The test name appended to the frontend when `testPlaywright.nav` is used.
|
|
@@ -28,11 +33,11 @@ export const playwrightTeatNameUrlParam = 'test-name';
|
|
|
28
33
|
*
|
|
29
34
|
* @category Internal
|
|
30
35
|
*/
|
|
31
|
-
export async function navigateTo(testContext,
|
|
36
|
+
export async function navigateTo(testContext, options) {
|
|
32
37
|
assertTestContext(testContext, TestEnv.Playwright);
|
|
33
38
|
const page = testContext.page;
|
|
34
39
|
const testName = extractTestNameAsDir(testContext);
|
|
35
|
-
const finalPath = buildUrl(extractNavUrl(
|
|
40
|
+
const finalPath = buildUrl(extractNavUrl(testContext, options), {
|
|
36
41
|
search: {
|
|
37
42
|
[playwrightTeatNameUrlParam]: [testName],
|
|
38
43
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@augment-vir/test",
|
|
3
|
-
"version": "31.50.
|
|
3
|
+
"version": "31.50.3",
|
|
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.50.
|
|
48
|
-
"@augment-vir/common": "^31.50.
|
|
47
|
+
"@augment-vir/assert": "^31.50.3",
|
|
48
|
+
"@augment-vir/common": "^31.50.3",
|
|
49
49
|
"@open-wc/testing-helpers": "^3.0.1",
|
|
50
50
|
"@virmator/test": "^14.2.2",
|
|
51
51
|
"type-fest": "^5.2.0"
|