@augment-vir/test 31.50.3 → 31.51.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.
package/README.md CHANGED
@@ -1,10 +1,15 @@
1
1
  # @augment-vir/test
2
2
 
3
- A universal testing suite that works with Mocha style test runners _and_ Node.js's built-in test runner with the following main exports:
3
+ A universal testing suite that works with Mocha style test runners, Node.js's built-in test runner, and Playwright tests with the following main exports:
4
4
 
5
5
  - [`describe`](https://electrovir.github.io/augment-vir/functions/describe.html): the normal describe test suite function, automatically imported based on the current environment.
6
6
  - [`it`](https://electrovir.github.io/augment-vir/functions/it.html): the normal it test function, automatically imported based on the current environment.
7
7
  - [`itCases`](https://electrovir.github.io/augment-vir/functions/itCases.html): a succinct way to test lots of inputs and outputs to a single function.
8
- - [`testWeb`](https://electrovir.github.io/augment-vir/variables/testWeb.html): a API of web-testing utilities, only available in browser environments.
8
+ - [`testWeb`](https://electrovir.github.io/augment-vir/variables/testWeb.html): a API of web testing utilities, only available in browser environments.
9
+ - [`testPlaywright`](https://electrovir.github.io/augment-vir/variables/testPlaywright.html): a API of Playwright testing utilities, only available in Playwright test environments.
9
10
 
10
11
  See the docs under `Test`, or `Package: @augment-vir/test` here: https://electrovir.github.io/augment-vir
12
+
13
+ ## Caveats
14
+
15
+ Playwright does not always set the `PLAYWRIGHT_TEST` env var, especially if you have a playwright config file that imports from TypeScript. If your playwright tests aren't working with this package, try setting `PLAYWRIGHT_TEST="1"` as an env var before calling Playwright (`PLAYWRIGHT_TEST="1" playwright test`).
@@ -14,16 +14,16 @@ declare function importPlaywrightTestApi(this: void): Promise<RuntimeEnvError |
14
14
  */
15
15
  expectAllVisible: typeof import("../test-playwright/all-visible.js").expectAllVisible;
16
16
  /** Clicks a label to select its input and then types the given text. */
17
- enterTextByLabel: typeof import("../test-playwright/enter-text").enterTextByLabel;
17
+ enterTextByLabel: typeof import("../test-playwright/enter-text.js").enterTextByLabel;
18
18
  /** Find the matching (or first) element with the "option" role. */
19
19
  getMenuOption: typeof import("../test-playwright/get-option.js").getMenuOption;
20
20
  /** Checks if a locator contains the given class. */
21
- checkHasClass: typeof import("../test-playwright/has-class").checkHasClass;
21
+ checkHasClass: typeof import("../test-playwright/has-class.js").checkHasClass;
22
22
  /**
23
23
  * Run the trigger and catch a new page _or_ a new download (sometimes Playwright
24
24
  * inconsistently chooses on or the other).
25
25
  */
26
- handleNewPageOrDownload: typeof import("../test-playwright/new-page-or-download").handleNewPageOrDownload;
26
+ handleNewPageOrDownload: typeof import("../test-playwright/new-page-or-download.js").handleNewPageOrDownload;
27
27
  /** Read from a page's local storage (using `page.evaluate`). */
28
28
  readLocalStorage: typeof import("../test-playwright/local-storage.js").readLocalStorage;
29
29
  /** Screenshot methods. */
@@ -4,12 +4,12 @@ async function importPlaywrightTestApi() {
4
4
  if (!isInsidePlaywrightTest()) {
5
5
  return new RuntimeEnvError("The 'testPlaywright' api cannot be used outside of a Playwright test context.");
6
6
  }
7
- const { checkHasClass } = await import('../test-playwright/has-class');
8
- const { enterTextByLabel } = await import('../test-playwright/enter-text');
7
+ const { checkHasClass } = await import('../test-playwright/has-class.js');
8
+ const { enterTextByLabel } = await import('../test-playwright/enter-text.js');
9
9
  const { expectAllVisible } = await import('../test-playwright/all-visible.js');
10
- const { getMenuOption } = await import('../test-playwright/get-option');
10
+ const { getMenuOption } = await import('../test-playwright/get-option.js');
11
11
  const { getScreenshotPath, takeScreenshot, expectScreenshot } = await import('../test-playwright/screenshot.js');
12
- const { handleNewPageOrDownload } = await import('../test-playwright/new-page-or-download');
12
+ const { handleNewPageOrDownload } = await import('../test-playwright/new-page-or-download.js');
13
13
  const { navigateTo, extractNavUrl } = await import('../test-playwright/nav.js');
14
14
  const { readLocalStorage } = await import('../test-playwright/local-storage.js');
15
15
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@augment-vir/test",
3
- "version": "31.50.3",
3
+ "version": "31.51.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,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.3",
48
- "@augment-vir/common": "^31.50.3",
47
+ "@augment-vir/assert": "^31.51.0",
48
+ "@augment-vir/common": "^31.51.0",
49
49
  "@open-wc/testing-helpers": "^3.0.1",
50
50
  "@virmator/test": "^14.2.2",
51
51
  "type-fest": "^5.2.0"