@augment-vir/test 31.54.0 → 31.54.2

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 NavOptions } from '../test-playwright/nav.js';
3
+ export { 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: {
@@ -1,5 +1,4 @@
1
1
  import { isInsidePlaywrightTest, RuntimeEnvError } from '@augment-vir/core';
2
- export { playwrightTeatNameUrlParam } from '../test-playwright/nav.js';
3
2
  async function importPlaywrightTestApi() {
4
3
  if (!isInsidePlaywrightTest()) {
5
4
  return new RuntimeEnvError("The 'testPlaywright' api cannot be used outside of a Playwright test context.");
@@ -1,5 +1,4 @@
1
1
  import { RuntimeEnvError } from '@augment-vir/core';
2
- import { elementCases } from '../test-web/element-cases.js';
3
2
  declare function importWebTestApi(this: void): Promise<RuntimeEnvError | {
4
3
  /**
5
4
  * Cleans up all rendered test HTML by removing the actual wrapper nodes. Common use case is
@@ -46,7 +45,7 @@ declare function importWebTestApi(this: void): Promise<RuntimeEnvError | {
46
45
  */
47
46
  typeText: typeof import("../test-web/type-into-element").typeString;
48
47
  /** Create multiple test cases for element testing. */
49
- elementCases: typeof elementCases;
48
+ elementCases: typeof import("../test-web/element-cases.js").elementCases;
50
49
  }>;
51
50
  /**
52
51
  * A suite of web test helpers. This is only accessible within a browser runtime. If accessed
@@ -1,5 +1,4 @@
1
1
  import { isRuntimeEnv, RuntimeEnv, RuntimeEnvError } from '@augment-vir/core';
2
- import { elementCases } from '../test-web/element-cases.js';
3
2
  async function importWebTestApi() {
4
3
  if (!isRuntimeEnv(RuntimeEnv.Web)) {
5
4
  return new RuntimeEnvError("The 'testWeb' api cannot be used outside of a browser context.");
@@ -9,6 +8,7 @@ async function importWebTestApi() {
9
8
  const { deleteAllTextInInput, typeString, typeStringIntoElement } = await import('../test-web/type-into-element');
10
9
  const { fixtureCleanup, fixture } = await import('@open-wc/testing-helpers');
11
10
  const { renderElement } = await import('../test-web/render-element');
11
+ const { elementCases } = await import('../test-web/element-cases.js');
12
12
  return {
13
13
  /**
14
14
  * Cleans up all rendered test HTML by removing the actual wrapper nodes. Common use case is
@@ -1,6 +1,6 @@
1
- import { sendMouse } from '@web/test-runner-commands';
2
1
  import { getCenterOfElement } from './symlinked/element-position.js';
3
2
  async function sendMouseToMiddleOfElement(element, operationType) {
3
+ const { sendMouse } = await import('@web/test-runner-commands');
4
4
  const center = getCenterOfElement(element);
5
5
  await sendMouse({
6
6
  position: [
@@ -1,5 +1,4 @@
1
- import { assert, waitUntil } from '@augment-vir/assert';
2
- import { ensureArray } from '@augment-vir/common';
1
+ import { assert, check, waitUntil } from '@augment-vir/assert';
3
2
  import { itCasesWithContext, } from '../augments/universal-testing-suite/it-cases-with-context.js';
4
3
  import { renderElement } from './render-element.js';
5
4
  import { extractElementText } from './symlinked/element-text.js';
@@ -35,8 +34,10 @@ async function testRenderElement(testContext, elementDefinition, testCase) {
35
34
  await testCase.act?.(instance);
36
35
  await waitUntil.isTrue(() => {
37
36
  const text = extractElementText(instance);
38
- if (testCase.expect?.text) {
39
- assert.hasValues(text, ensureArray(testCase.expect.text));
37
+ if (check.isArray(testCase.expect?.text)) {
38
+ assert.hasValues(text, testCase.expect.text);
39
+ }
40
+ else if (check.isString(testCase.expect?.text)) {
40
41
  assert.hasValue(text, testCase.expect.text);
41
42
  }
42
43
  if (testCase.expect?.events) {
@@ -1,6 +1,6 @@
1
- import { fixture } from '@open-wc/testing-helpers';
2
1
  import { html } from 'element-vir';
3
2
  export async function renderElement(elementDefinition, ...args) {
3
+ const { fixture } = await import('@open-wc/testing-helpers');
4
4
  const instance = await fixture(html `
5
5
  <${elementDefinition.assign(args[0] || {})}></${elementDefinition}>
6
6
  `);
@@ -1,6 +1,6 @@
1
- import { sendKeys } from '@web/test-runner-commands';
2
1
  import { focusElement } from './element-test-focus.js';
3
2
  export async function typeString(text) {
3
+ const { sendKeys } = await import('@web/test-runner-commands');
4
4
  return await sendKeys({
5
5
  type: text,
6
6
  });
@@ -10,6 +10,7 @@ export async function typeStringIntoElement(text, element) {
10
10
  await typeString(text);
11
11
  }
12
12
  export async function deleteAllTextInInput(inputElement) {
13
+ const { sendKeys } = await import('@web/test-runner-commands');
13
14
  const lastValue = inputElement.value;
14
15
  if (lastValue) {
15
16
  await focusElement(inputElement);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@augment-vir/test",
3
- "version": "31.54.0",
3
+ "version": "31.54.2",
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.54.0",
48
- "@augment-vir/common": "^31.54.0",
47
+ "@augment-vir/assert": "^31.54.2",
48
+ "@augment-vir/common": "^31.54.2",
49
49
  "@open-wc/testing-helpers": "^3.0.1",
50
50
  "@virmator/test": "^14.3.0",
51
51
  "type-fest": "^5.2.0"