@atomic-testing/vue-3 0.88.0 → 0.90.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 +7 -0
- package/dist/index.cjs +5 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -6
- package/dist/index.d.mts +6 -6
- package/dist/index.mjs +5 -8
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -4
- package/src/VueInteractor.ts +5 -10
- package/src/types.ts +5 -4
package/README.md
CHANGED
|
@@ -164,3 +164,10 @@ const engine = createTestEngine<Component>(MyVueComponent, sceneParts);
|
|
|
164
164
|
3. **High-Level APIs**: Focus on user interactions, not DOM implementation details
|
|
165
165
|
4. **Framework Agnostic Drivers**: Reuse component drivers across different frameworks and test environments
|
|
166
166
|
5. **Future-Proof**: As your app grows or changes frameworks, your test patterns remain consistent
|
|
167
|
+
|
|
168
|
+
## Public API & stability
|
|
169
|
+
|
|
170
|
+
The stable surface of this package is its `.` barrel exports, frozen under
|
|
171
|
+
SemVer and machine-checked by the committed [API Extractor](https://api-extractor.com/)
|
|
172
|
+
report at [`etc/vue-3.api.md`](etc/vue-3.api.md). Exports tagged `@internal` are
|
|
173
|
+
not part of that guarantee. See the [1.0 API freeze & evolution policy](../../agent-docs/adr/006-1.0-api-freeze-and-evolution.md).
|
package/dist/index.cjs
CHANGED
|
@@ -4,7 +4,7 @@ let _testing_library_vue = require("@testing-library/vue");
|
|
|
4
4
|
let vue = require("vue");
|
|
5
5
|
let _atomic_testing_dom_core = require("@atomic-testing/dom-core");
|
|
6
6
|
//#region src/VueInteractor.ts
|
|
7
|
-
var VueInteractor = class
|
|
7
|
+
var VueInteractor = class extends _atomic_testing_dom_core.DOMInteractor {
|
|
8
8
|
async flush() {
|
|
9
9
|
await (0, vue.nextTick)();
|
|
10
10
|
}
|
|
@@ -12,6 +12,10 @@ var VueInteractor = class VueInteractor extends _atomic_testing_dom_core.DOMInte
|
|
|
12
12
|
await super.enterText(locator, text, option);
|
|
13
13
|
await this.flush();
|
|
14
14
|
}
|
|
15
|
+
async setRangeValue(locator, value) {
|
|
16
|
+
await super.setRangeValue(locator, value);
|
|
17
|
+
await this.flush();
|
|
18
|
+
}
|
|
15
19
|
async click(locator, option) {
|
|
16
20
|
await super.click(locator, option);
|
|
17
21
|
await this.flush();
|
|
@@ -92,10 +96,6 @@ var VueInteractor = class VueInteractor extends _atomic_testing_dom_core.DOMInte
|
|
|
92
96
|
await super.drag(locator, delta);
|
|
93
97
|
await this.flush();
|
|
94
98
|
}
|
|
95
|
-
async wait(ms) {
|
|
96
|
-
await super.wait(ms);
|
|
97
|
-
await this.flush();
|
|
98
|
-
}
|
|
99
99
|
async waitUntilComponentState(locator, option = _atomic_testing_core.defaultWaitForOption) {
|
|
100
100
|
await super.waitUntilComponentState(locator, option);
|
|
101
101
|
await this.flush();
|
|
@@ -105,9 +105,6 @@ var VueInteractor = class VueInteractor extends _atomic_testing_dom_core.DOMInte
|
|
|
105
105
|
await this.flush();
|
|
106
106
|
return result;
|
|
107
107
|
}
|
|
108
|
-
clone() {
|
|
109
|
-
return new VueInteractor(this.rootEl);
|
|
110
|
-
}
|
|
111
108
|
};
|
|
112
109
|
//#endregion
|
|
113
110
|
//#region src/createTestEngine.ts
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["DOMInteractor","defaultWaitForOption","TestEngine"],"sources":["../src/VueInteractor.ts","../src/createTestEngine.ts"],"sourcesContent":["import {\n BlurOption,\n ClickOption,\n defaultWaitForOption,\n EnterTextOption,\n FocusOption,\n HoverOption,\n Interactor,\n MouseDownOption,\n MouseEnterOption,\n MouseLeaveOption,\n MouseMoveOption,\n MouseOutOption,\n MouseUpOption,\n PartLocator,\n Point,\n PressKeyOption,\n WaitForOption,\n WaitUntilOption,\n} from '@atomic-testing/core';\nimport { DOMInteractor } from '@atomic-testing/dom-core';\nimport { nextTick } from 'vue';\n\nexport class VueInteractor extends DOMInteractor {\n private async flush() {\n await nextTick();\n }\n\n override async enterText(locator: PartLocator, text: string, option?: Partial<EnterTextOption>): Promise<void> {\n await super.enterText(locator, text, option);\n await this.flush();\n }\n\n override async click(locator: PartLocator, option?: Partial<ClickOption>): Promise<void> {\n await super.click(locator, option);\n await this.flush();\n }\n\n override async hover(locator: PartLocator, option?: Partial<HoverOption>): Promise<void> {\n await super.hover(locator, option);\n await this.flush();\n }\n\n override async mouseMove(locator: PartLocator, option?: Partial<MouseMoveOption>): Promise<void> {\n await super.mouseMove(locator, option);\n await this.flush();\n }\n\n override async mouseDown(locator: PartLocator, option?: Partial<MouseDownOption>): Promise<void> {\n await super.mouseDown(locator, option);\n await this.flush();\n }\n\n override async mouseUp(locator: PartLocator, option?: Partial<MouseUpOption>): Promise<void> {\n await super.mouseUp(locator, option);\n await this.flush();\n }\n\n override async mouseOver(locator: PartLocator, option?: Partial<HoverOption>): Promise<void> {\n await super.mouseOver(locator, option);\n await this.flush();\n }\n\n override async mouseOut(locator: PartLocator, option?: Partial<MouseOutOption>): Promise<void> {\n await super.mouseOut(locator, option);\n await this.flush();\n }\n\n override async mouseEnter(locator: PartLocator, option?: Partial<MouseEnterOption>): Promise<void> {\n await super.mouseEnter(locator, option);\n await this.flush();\n }\n\n override async mouseLeave(locator: PartLocator, option?: Partial<MouseLeaveOption>): Promise<void> {\n await super.mouseLeave(locator, option);\n await this.flush();\n }\n\n override async focus(locator: PartLocator, option?: Partial<FocusOption>): Promise<void> {\n await super.focus(locator, option);\n await this.flush();\n }\n\n override async blur(locator: PartLocator, option?: Partial<BlurOption>): Promise<void> {\n await super.blur(locator, option);\n await this.flush();\n }\n\n override async pressKey(locator: PartLocator, key: string, option?: Partial<PressKeyOption>): Promise<void> {\n await super.pressKey(locator, key, option);\n await this.flush();\n }\n\n override async contextMenu(locator: PartLocator): Promise<void> {\n await super.contextMenu(locator);\n await this.flush();\n }\n\n override async activate(locator: PartLocator): Promise<void> {\n await super.activate(locator);\n await this.flush();\n }\n\n override async selectOptionValue(locator: PartLocator, values: string[]): Promise<void> {\n await super.selectOptionValue(locator, values);\n await this.flush();\n }\n\n override async setInputFiles(locator: PartLocator, files: string | string[]): Promise<void> {\n await super.setInputFiles(locator, files);\n await this.flush();\n }\n\n override async scrollIntoView(locator: PartLocator): Promise<void> {\n await super.scrollIntoView(locator);\n await this.flush();\n }\n\n override async scrollBy(locator: PartLocator, delta: Point): Promise<void> {\n await super.scrollBy(locator, delta);\n await this.flush();\n }\n\n override async dragTo(source: PartLocator, target: PartLocator): Promise<void> {\n await super.dragTo(source, target);\n await this.flush();\n }\n\n override async drag(locator: PartLocator, delta: Point): Promise<void> {\n await super.drag(locator, delta);\n await this.flush();\n }\n\n override async wait(ms: number): Promise<void> {\n await super.wait(ms);\n await this.flush();\n }\n\n override async waitUntilComponentState(\n locator: PartLocator,\n option: Partial<Readonly<WaitForOption>> = defaultWaitForOption\n ): Promise<void> {\n await super.waitUntilComponentState(locator, option);\n await this.flush();\n }\n\n override async waitUntil<T>(option: WaitUntilOption<T>): Promise<T> {\n const result = await super.waitUntil(option);\n await this.flush();\n return result;\n }\n\n override clone(): Interactor {\n return new VueInteractor(this.rootEl);\n }\n}\n","import { byAttribute, ScenePart, TestEngine } from '@atomic-testing/core';\nimport { render } from '@testing-library/vue';\nimport { App, Component, createApp, defineComponent } from 'vue';\n\nimport { IVueTestEngineOption, VueSFCLikeComponent } from './types';\nimport { VueInteractor } from './VueInteractor';\n\nlet _rootId = 0;\nfunction getNextRootElementId() {\n return `${_rootId++}`;\n}\n\nconst rootElementAttributeName = 'data-atomic-testing-vue';\n\nfunction isSFCLikeObject(component: any): component is VueSFCLikeComponent {\n return (\n component && typeof component === 'object' && 'template' in component && typeof component.template === 'string'\n );\n}\n\nfunction createComponentFromSFCLike(sfcObj: VueSFCLikeComponent): Component {\n const componentOptions: any = {\n name: sfcObj.name || 'SFCComponent',\n template: sfcObj.template,\n };\n\n if (sfcObj.props) {\n componentOptions.props = sfcObj.props;\n }\n\n if (sfcObj.setup) {\n componentOptions.setup = sfcObj.setup;\n }\n\n if (sfcObj.data) {\n componentOptions.data = sfcObj.data;\n }\n\n if (sfcObj.methods) {\n componentOptions.methods = sfcObj.methods;\n }\n\n if (sfcObj.computed) {\n componentOptions.computed = sfcObj.computed;\n }\n\n return defineComponent(componentOptions);\n}\n\nexport function createTestEngine<T extends ScenePart>(\n component: Component | VueSFCLikeComponent,\n partDefinitions: T,\n option?: Readonly<Partial<IVueTestEngineOption>>\n): TestEngine<T> {\n const rootEl = option?.rootElement ?? document.body;\n const container = rootEl.appendChild(document.createElement('div'));\n const rootId = getNextRootElementId();\n container.setAttribute(rootElementAttributeName, rootId);\n\n let unmount: () => void;\n let app: App;\n\n // Create component from SFC-like object if needed\n const compiledComponent = isSFCLikeObject(component)\n ? createComponentFromSFCLike(component)\n : (component as Component);\n\n try {\n const renderResult = render(compiledComponent, { container });\n unmount = renderResult.unmount;\n } catch (_error) {\n // Fallback to manual Vue app creation if render fails\n app = createApp(compiledComponent);\n app.mount(container);\n unmount = () => {\n if (app) {\n app.unmount();\n }\n };\n }\n\n const cleanup = () => {\n unmount();\n rootEl.removeChild(container);\n return Promise.resolve();\n };\n\n return new TestEngine(\n byAttribute(rootElementAttributeName, rootId),\n new VueInteractor(),\n {\n parts: partDefinitions,\n },\n cleanup\n );\n}\n\nexport function createRenderedTestEngine<T extends ScenePart>(\n rootElement: HTMLElement,\n partDefinitions: T,\n _option?: Readonly<Partial<IVueTestEngineOption>>\n): TestEngine<T> {\n const rootId = getNextRootElementId();\n rootElement.setAttribute(rootElementAttributeName, rootId);\n\n const cleanup = () => {\n rootElement.removeAttribute(rootElementAttributeName);\n return Promise.resolve();\n };\n\n return new TestEngine(\n byAttribute(rootElementAttributeName, rootId),\n new VueInteractor(),\n {\n parts: partDefinitions,\n },\n cleanup\n );\n}\n"],"mappings":";;;;;;AAuBA,IAAa,gBAAb,MAAa,sBAAsBA,yBAAAA,cAAc;CAC/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,qBAAAA,YAAAA,GAAAA,qBAAAA,YAAAA,CACG,0BAA0B,MAAM,GAC5C,IAAI,cAAc,GAClB,EACE,OAAO,gBACT,GACA,OACF;AACF;AAEA,SAAgB,yBACd,aACA,iBACA,SACe;CACf,MAAM,SAAS,qBAAqB;CACpC,YAAY,aAAa,0BAA0B,MAAM;CAEzD,MAAM,gBAAgB;EACpB,YAAY,gBAAgB,wBAAwB;EACpD,OAAO,QAAQ,QAAQ;CACzB;CAEA,OAAO,IAAIA,qBAAAA,YAAAA,GAAAA,qBAAAA,YAAAA,CACG,0BAA0B,MAAM,GAC5C,IAAI,cAAc,GAClB,EACE,OAAO,gBACT,GACA,OACF;AACF"}
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["DOMInteractor","defaultWaitForOption","TestEngine"],"sources":["../src/VueInteractor.ts","../src/createTestEngine.ts"],"sourcesContent":["import {\n BlurOption,\n ClickOption,\n defaultWaitForOption,\n EnterTextOption,\n FocusOption,\n HoverOption,\n MouseDownOption,\n MouseEnterOption,\n MouseLeaveOption,\n MouseMoveOption,\n MouseOutOption,\n MouseUpOption,\n PartLocator,\n Point,\n PressKeyOption,\n WaitForOption,\n WaitUntilOption,\n} from '@atomic-testing/core';\nimport { DOMInteractor } from '@atomic-testing/dom-core';\nimport { nextTick } from 'vue';\n\nexport class VueInteractor extends DOMInteractor {\n private async flush() {\n await nextTick();\n }\n\n override async enterText(locator: PartLocator, text: string, option?: Partial<EnterTextOption>): Promise<void> {\n await super.enterText(locator, text, option);\n await this.flush();\n }\n\n override async setRangeValue(locator: PartLocator, value: number): Promise<void> {\n await super.setRangeValue(locator, value);\n await this.flush();\n }\n\n override async click(locator: PartLocator, option?: Partial<ClickOption>): Promise<void> {\n await super.click(locator, option);\n await this.flush();\n }\n\n override async hover(locator: PartLocator, option?: Partial<HoverOption>): Promise<void> {\n await super.hover(locator, option);\n await this.flush();\n }\n\n override async mouseMove(locator: PartLocator, option?: Partial<MouseMoveOption>): Promise<void> {\n await super.mouseMove(locator, option);\n await this.flush();\n }\n\n override async mouseDown(locator: PartLocator, option?: Partial<MouseDownOption>): Promise<void> {\n await super.mouseDown(locator, option);\n await this.flush();\n }\n\n override async mouseUp(locator: PartLocator, option?: Partial<MouseUpOption>): Promise<void> {\n await super.mouseUp(locator, option);\n await this.flush();\n }\n\n override async mouseOver(locator: PartLocator, option?: Partial<HoverOption>): Promise<void> {\n await super.mouseOver(locator, option);\n await this.flush();\n }\n\n override async mouseOut(locator: PartLocator, option?: Partial<MouseOutOption>): Promise<void> {\n await super.mouseOut(locator, option);\n await this.flush();\n }\n\n override async mouseEnter(locator: PartLocator, option?: Partial<MouseEnterOption>): Promise<void> {\n await super.mouseEnter(locator, option);\n await this.flush();\n }\n\n override async mouseLeave(locator: PartLocator, option?: Partial<MouseLeaveOption>): Promise<void> {\n await super.mouseLeave(locator, option);\n await this.flush();\n }\n\n override async focus(locator: PartLocator, option?: Partial<FocusOption>): Promise<void> {\n await super.focus(locator, option);\n await this.flush();\n }\n\n override async blur(locator: PartLocator, option?: Partial<BlurOption>): Promise<void> {\n await super.blur(locator, option);\n await this.flush();\n }\n\n override async pressKey(locator: PartLocator, key: string, option?: Partial<PressKeyOption>): Promise<void> {\n await super.pressKey(locator, key, option);\n await this.flush();\n }\n\n override async contextMenu(locator: PartLocator): Promise<void> {\n await super.contextMenu(locator);\n await this.flush();\n }\n\n override async activate(locator: PartLocator): Promise<void> {\n await super.activate(locator);\n await this.flush();\n }\n\n override async selectOptionValue(locator: PartLocator, values: string[]): Promise<void> {\n await super.selectOptionValue(locator, values);\n await this.flush();\n }\n\n override async setInputFiles(locator: PartLocator, files: string | string[]): Promise<void> {\n await super.setInputFiles(locator, files);\n await this.flush();\n }\n\n override async scrollIntoView(locator: PartLocator): Promise<void> {\n await super.scrollIntoView(locator);\n await this.flush();\n }\n\n override async scrollBy(locator: PartLocator, delta: Point): Promise<void> {\n await super.scrollBy(locator, delta);\n await this.flush();\n }\n\n override async dragTo(source: PartLocator, target: PartLocator): Promise<void> {\n await super.dragTo(source, target);\n await this.flush();\n }\n\n override async drag(locator: PartLocator, delta: Point): Promise<void> {\n await super.drag(locator, delta);\n await this.flush();\n }\n\n override async waitUntilComponentState(\n locator: PartLocator,\n option: Partial<Readonly<WaitForOption>> = defaultWaitForOption\n ): Promise<void> {\n await super.waitUntilComponentState(locator, option);\n await this.flush();\n }\n\n override async waitUntil<T>(option: WaitUntilOption<T>): Promise<T> {\n const result = await super.waitUntil(option);\n await this.flush();\n return result;\n }\n}\n","import { byAttribute, ScenePart, TestEngine } from '@atomic-testing/core';\nimport { render } from '@testing-library/vue';\nimport { App, Component, createApp, defineComponent } from 'vue';\n\nimport { IVueTestEngineOption, VueSFCLikeComponent } from './types';\nimport { VueInteractor } from './VueInteractor';\n\nlet _rootId = 0;\nfunction getNextRootElementId() {\n return `${_rootId++}`;\n}\n\nconst rootElementAttributeName = 'data-atomic-testing-vue';\n\nfunction isSFCLikeObject(component: any): component is VueSFCLikeComponent {\n return (\n component && typeof component === 'object' && 'template' in component && typeof component.template === 'string'\n );\n}\n\nfunction createComponentFromSFCLike(sfcObj: VueSFCLikeComponent): Component {\n const componentOptions: any = {\n name: sfcObj.name || 'SFCComponent',\n template: sfcObj.template,\n };\n\n if (sfcObj.props) {\n componentOptions.props = sfcObj.props;\n }\n\n if (sfcObj.setup) {\n componentOptions.setup = sfcObj.setup;\n }\n\n if (sfcObj.data) {\n componentOptions.data = sfcObj.data;\n }\n\n if (sfcObj.methods) {\n componentOptions.methods = sfcObj.methods;\n }\n\n if (sfcObj.computed) {\n componentOptions.computed = sfcObj.computed;\n }\n\n return defineComponent(componentOptions);\n}\n\nexport function createTestEngine<T extends ScenePart>(\n component: Component | VueSFCLikeComponent,\n partDefinitions: T,\n option?: Readonly<Partial<IVueTestEngineOption>>\n): TestEngine<T> {\n const rootEl = option?.rootElement ?? document.body;\n const container = rootEl.appendChild(document.createElement('div'));\n const rootId = getNextRootElementId();\n container.setAttribute(rootElementAttributeName, rootId);\n\n let unmount: () => void;\n let app: App;\n\n // Create component from SFC-like object if needed\n const compiledComponent = isSFCLikeObject(component)\n ? createComponentFromSFCLike(component)\n : (component as Component);\n\n try {\n const renderResult = render(compiledComponent, { container });\n unmount = renderResult.unmount;\n } catch (_error) {\n // Fallback to manual Vue app creation if render fails\n app = createApp(compiledComponent);\n app.mount(container);\n unmount = () => {\n if (app) {\n app.unmount();\n }\n };\n }\n\n const cleanup = () => {\n unmount();\n rootEl.removeChild(container);\n return Promise.resolve();\n };\n\n return new TestEngine(\n byAttribute(rootElementAttributeName, rootId),\n new VueInteractor(),\n {\n parts: partDefinitions,\n },\n cleanup\n );\n}\n\nexport function createRenderedTestEngine<T extends ScenePart>(\n rootElement: HTMLElement,\n partDefinitions: T,\n _option?: Readonly<Partial<IVueTestEngineOption>>\n): TestEngine<T> {\n const rootId = getNextRootElementId();\n rootElement.setAttribute(rootElementAttributeName, rootId);\n\n const cleanup = () => {\n rootElement.removeAttribute(rootElementAttributeName);\n return Promise.resolve();\n };\n\n return new TestEngine(\n byAttribute(rootElementAttributeName, rootId),\n new VueInteractor(),\n {\n parts: partDefinitions,\n },\n cleanup\n );\n}\n"],"mappings":";;;;;;AAsBA,IAAa,gBAAb,cAAmCA,yBAAAA,cAAc;CAC/C,MAAc,QAAQ;EACpB,OAAA,GAAA,IAAA,SAAA,CAAe;CACjB;CAEA,MAAe,UAAU,SAAsB,MAAc,QAAkD;EAC7G,MAAM,MAAM,UAAU,SAAS,MAAM,MAAM;EAC3C,MAAM,KAAK,MAAM;CACnB;CAEA,MAAe,cAAc,SAAsB,OAA8B;EAC/E,MAAM,MAAM,cAAc,SAAS,KAAK;EACxC,MAAM,KAAK,MAAM;CACnB;CAEA,MAAe,MAAM,SAAsB,QAA8C;EACvF,MAAM,MAAM,MAAM,SAAS,MAAM;EACjC,MAAM,KAAK,MAAM;CACnB;CAEA,MAAe,MAAM,SAAsB,QAA8C;EACvF,MAAM,MAAM,MAAM,SAAS,MAAM;EACjC,MA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BlurOption, ClickOption, EnterTextOption, FocusOption, HoverOption,
|
|
1
|
+
import { BlurOption, ClickOption, EnterTextOption, FocusOption, HoverOption, ITestEngineOption, MouseDownOption, MouseEnterOption, MouseLeaveOption, MouseMoveOption, MouseOutOption, MouseUpOption, PartLocator, Point, PressKeyOption, ScenePart, TestEngine, WaitForOption, WaitUntilOption } from "@atomic-testing/core";
|
|
2
2
|
import { Component } from "vue";
|
|
3
3
|
import { DOMInteractor } from "@atomic-testing/dom-core";
|
|
4
4
|
|
|
5
5
|
//#region src/types.d.ts
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
/**
|
|
7
|
+
* @deprecated Use {@link ITestEngineOption} from `@atomic-testing/core`.
|
|
8
|
+
*/
|
|
9
|
+
type IVueTestEngineOption = ITestEngineOption;
|
|
9
10
|
interface VueSFCLikeComponent {
|
|
10
11
|
template: string;
|
|
11
12
|
setup?: () => any;
|
|
@@ -24,6 +25,7 @@ declare function createRenderedTestEngine<T extends ScenePart>(rootElement: HTML
|
|
|
24
25
|
declare class VueInteractor extends DOMInteractor {
|
|
25
26
|
private flush;
|
|
26
27
|
enterText(locator: PartLocator, text: string, option?: Partial<EnterTextOption>): Promise<void>;
|
|
28
|
+
setRangeValue(locator: PartLocator, value: number): Promise<void>;
|
|
27
29
|
click(locator: PartLocator, option?: Partial<ClickOption>): Promise<void>;
|
|
28
30
|
hover(locator: PartLocator, option?: Partial<HoverOption>): Promise<void>;
|
|
29
31
|
mouseMove(locator: PartLocator, option?: Partial<MouseMoveOption>): Promise<void>;
|
|
@@ -44,10 +46,8 @@ declare class VueInteractor extends DOMInteractor {
|
|
|
44
46
|
scrollBy(locator: PartLocator, delta: Point): Promise<void>;
|
|
45
47
|
dragTo(source: PartLocator, target: PartLocator): Promise<void>;
|
|
46
48
|
drag(locator: PartLocator, delta: Point): Promise<void>;
|
|
47
|
-
wait(ms: number): Promise<void>;
|
|
48
49
|
waitUntilComponentState(locator: PartLocator, option?: Partial<Readonly<WaitForOption>>): Promise<void>;
|
|
49
50
|
waitUntil<T>(option: WaitUntilOption<T>): Promise<T>;
|
|
50
|
-
clone(): Interactor;
|
|
51
51
|
}
|
|
52
52
|
//#endregion
|
|
53
53
|
export { type IVueTestEngineOption, VueInteractor, type VueSFCLikeComponent, createRenderedTestEngine, createTestEngine };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { BlurOption, ClickOption, EnterTextOption, FocusOption, HoverOption,
|
|
1
|
+
import { BlurOption, ClickOption, EnterTextOption, FocusOption, HoverOption, ITestEngineOption, MouseDownOption, MouseEnterOption, MouseLeaveOption, MouseMoveOption, MouseOutOption, MouseUpOption, PartLocator, Point, PressKeyOption, ScenePart, TestEngine, WaitForOption, WaitUntilOption } from "@atomic-testing/core";
|
|
2
2
|
import { Component } from "vue";
|
|
3
3
|
import { DOMInteractor } from "@atomic-testing/dom-core";
|
|
4
4
|
|
|
5
5
|
//#region src/types.d.ts
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
/**
|
|
7
|
+
* @deprecated Use {@link ITestEngineOption} from `@atomic-testing/core`.
|
|
8
|
+
*/
|
|
9
|
+
type IVueTestEngineOption = ITestEngineOption;
|
|
9
10
|
interface VueSFCLikeComponent {
|
|
10
11
|
template: string;
|
|
11
12
|
setup?: () => any;
|
|
@@ -24,6 +25,7 @@ declare function createRenderedTestEngine<T extends ScenePart>(rootElement: HTML
|
|
|
24
25
|
declare class VueInteractor extends DOMInteractor {
|
|
25
26
|
private flush;
|
|
26
27
|
enterText(locator: PartLocator, text: string, option?: Partial<EnterTextOption>): Promise<void>;
|
|
28
|
+
setRangeValue(locator: PartLocator, value: number): Promise<void>;
|
|
27
29
|
click(locator: PartLocator, option?: Partial<ClickOption>): Promise<void>;
|
|
28
30
|
hover(locator: PartLocator, option?: Partial<HoverOption>): Promise<void>;
|
|
29
31
|
mouseMove(locator: PartLocator, option?: Partial<MouseMoveOption>): Promise<void>;
|
|
@@ -44,10 +46,8 @@ declare class VueInteractor extends DOMInteractor {
|
|
|
44
46
|
scrollBy(locator: PartLocator, delta: Point): Promise<void>;
|
|
45
47
|
dragTo(source: PartLocator, target: PartLocator): Promise<void>;
|
|
46
48
|
drag(locator: PartLocator, delta: Point): Promise<void>;
|
|
47
|
-
wait(ms: number): Promise<void>;
|
|
48
49
|
waitUntilComponentState(locator: PartLocator, option?: Partial<Readonly<WaitForOption>>): Promise<void>;
|
|
49
50
|
waitUntil<T>(option: WaitUntilOption<T>): Promise<T>;
|
|
50
|
-
clone(): Interactor;
|
|
51
51
|
}
|
|
52
52
|
//#endregion
|
|
53
53
|
export { type IVueTestEngineOption, VueInteractor, type VueSFCLikeComponent, createRenderedTestEngine, createTestEngine };
|
package/dist/index.mjs
CHANGED
|
@@ -3,7 +3,7 @@ import { render } from "@testing-library/vue";
|
|
|
3
3
|
import { createApp, defineComponent, nextTick } from "vue";
|
|
4
4
|
import { DOMInteractor } from "@atomic-testing/dom-core";
|
|
5
5
|
//#region src/VueInteractor.ts
|
|
6
|
-
var VueInteractor = class
|
|
6
|
+
var VueInteractor = class extends DOMInteractor {
|
|
7
7
|
async flush() {
|
|
8
8
|
await nextTick();
|
|
9
9
|
}
|
|
@@ -11,6 +11,10 @@ var VueInteractor = class VueInteractor extends DOMInteractor {
|
|
|
11
11
|
await super.enterText(locator, text, option);
|
|
12
12
|
await this.flush();
|
|
13
13
|
}
|
|
14
|
+
async setRangeValue(locator, value) {
|
|
15
|
+
await super.setRangeValue(locator, value);
|
|
16
|
+
await this.flush();
|
|
17
|
+
}
|
|
14
18
|
async click(locator, option) {
|
|
15
19
|
await super.click(locator, option);
|
|
16
20
|
await this.flush();
|
|
@@ -91,10 +95,6 @@ var VueInteractor = class VueInteractor extends DOMInteractor {
|
|
|
91
95
|
await super.drag(locator, delta);
|
|
92
96
|
await this.flush();
|
|
93
97
|
}
|
|
94
|
-
async wait(ms) {
|
|
95
|
-
await super.wait(ms);
|
|
96
|
-
await this.flush();
|
|
97
|
-
}
|
|
98
98
|
async waitUntilComponentState(locator, option = defaultWaitForOption) {
|
|
99
99
|
await super.waitUntilComponentState(locator, option);
|
|
100
100
|
await this.flush();
|
|
@@ -104,9 +104,6 @@ var VueInteractor = class VueInteractor extends DOMInteractor {
|
|
|
104
104
|
await this.flush();
|
|
105
105
|
return result;
|
|
106
106
|
}
|
|
107
|
-
clone() {
|
|
108
|
-
return new VueInteractor(this.rootEl);
|
|
109
|
-
}
|
|
110
107
|
};
|
|
111
108
|
//#endregion
|
|
112
109
|
//#region src/createTestEngine.ts
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../src/VueInteractor.ts","../src/createTestEngine.ts"],"sourcesContent":["import {\n BlurOption,\n ClickOption,\n defaultWaitForOption,\n EnterTextOption,\n FocusOption,\n HoverOption,\n Interactor,\n MouseDownOption,\n MouseEnterOption,\n MouseLeaveOption,\n MouseMoveOption,\n MouseOutOption,\n MouseUpOption,\n PartLocator,\n Point,\n PressKeyOption,\n WaitForOption,\n WaitUntilOption,\n} from '@atomic-testing/core';\nimport { DOMInteractor } from '@atomic-testing/dom-core';\nimport { nextTick } from 'vue';\n\nexport class VueInteractor extends DOMInteractor {\n private async flush() {\n await nextTick();\n }\n\n override async enterText(locator: PartLocator, text: string, option?: Partial<EnterTextOption>): Promise<void> {\n await super.enterText(locator, text, option);\n await this.flush();\n }\n\n override async click(locator: PartLocator, option?: Partial<ClickOption>): Promise<void> {\n await super.click(locator, option);\n await this.flush();\n }\n\n override async hover(locator: PartLocator, option?: Partial<HoverOption>): Promise<void> {\n await super.hover(locator, option);\n await this.flush();\n }\n\n override async mouseMove(locator: PartLocator, option?: Partial<MouseMoveOption>): Promise<void> {\n await super.mouseMove(locator, option);\n await this.flush();\n }\n\n override async mouseDown(locator: PartLocator, option?: Partial<MouseDownOption>): Promise<void> {\n await super.mouseDown(locator, option);\n await this.flush();\n }\n\n override async mouseUp(locator: PartLocator, option?: Partial<MouseUpOption>): Promise<void> {\n await super.mouseUp(locator, option);\n await this.flush();\n }\n\n override async mouseOver(locator: PartLocator, option?: Partial<HoverOption>): Promise<void> {\n await super.mouseOver(locator, option);\n await this.flush();\n }\n\n override async mouseOut(locator: PartLocator, option?: Partial<MouseOutOption>): Promise<void> {\n await super.mouseOut(locator, option);\n await this.flush();\n }\n\n override async mouseEnter(locator: PartLocator, option?: Partial<MouseEnterOption>): Promise<void> {\n await super.mouseEnter(locator, option);\n await this.flush();\n }\n\n override async mouseLeave(locator: PartLocator, option?: Partial<MouseLeaveOption>): Promise<void> {\n await super.mouseLeave(locator, option);\n await this.flush();\n }\n\n override async focus(locator: PartLocator, option?: Partial<FocusOption>): Promise<void> {\n await super.focus(locator, option);\n await this.flush();\n }\n\n override async blur(locator: PartLocator, option?: Partial<BlurOption>): Promise<void> {\n await super.blur(locator, option);\n await this.flush();\n }\n\n override async pressKey(locator: PartLocator, key: string, option?: Partial<PressKeyOption>): Promise<void> {\n await super.pressKey(locator, key, option);\n await this.flush();\n }\n\n override async contextMenu(locator: PartLocator): Promise<void> {\n await super.contextMenu(locator);\n await this.flush();\n }\n\n override async activate(locator: PartLocator): Promise<void> {\n await super.activate(locator);\n await this.flush();\n }\n\n override async selectOptionValue(locator: PartLocator, values: string[]): Promise<void> {\n await super.selectOptionValue(locator, values);\n await this.flush();\n }\n\n override async setInputFiles(locator: PartLocator, files: string | string[]): Promise<void> {\n await super.setInputFiles(locator, files);\n await this.flush();\n }\n\n override async scrollIntoView(locator: PartLocator): Promise<void> {\n await super.scrollIntoView(locator);\n await this.flush();\n }\n\n override async scrollBy(locator: PartLocator, delta: Point): Promise<void> {\n await super.scrollBy(locator, delta);\n await this.flush();\n }\n\n override async dragTo(source: PartLocator, target: PartLocator): Promise<void> {\n await super.dragTo(source, target);\n await this.flush();\n }\n\n override async drag(locator: PartLocator, delta: Point): Promise<void> {\n await super.drag(locator, delta);\n await this.flush();\n }\n\n override async wait(ms: number): Promise<void> {\n await super.wait(ms);\n await this.flush();\n }\n\n override async waitUntilComponentState(\n locator: PartLocator,\n option: Partial<Readonly<WaitForOption>> = defaultWaitForOption\n ): Promise<void> {\n await super.waitUntilComponentState(locator, option);\n await this.flush();\n }\n\n override async waitUntil<T>(option: WaitUntilOption<T>): Promise<T> {\n const result = await super.waitUntil(option);\n await this.flush();\n return result;\n }\n\n override clone(): Interactor {\n return new VueInteractor(this.rootEl);\n }\n}\n","import { byAttribute, ScenePart, TestEngine } from '@atomic-testing/core';\nimport { render } from '@testing-library/vue';\nimport { App, Component, createApp, defineComponent } from 'vue';\n\nimport { IVueTestEngineOption, VueSFCLikeComponent } from './types';\nimport { VueInteractor } from './VueInteractor';\n\nlet _rootId = 0;\nfunction getNextRootElementId() {\n return `${_rootId++}`;\n}\n\nconst rootElementAttributeName = 'data-atomic-testing-vue';\n\nfunction isSFCLikeObject(component: any): component is VueSFCLikeComponent {\n return (\n component && typeof component === 'object' && 'template' in component && typeof component.template === 'string'\n );\n}\n\nfunction createComponentFromSFCLike(sfcObj: VueSFCLikeComponent): Component {\n const componentOptions: any = {\n name: sfcObj.name || 'SFCComponent',\n template: sfcObj.template,\n };\n\n if (sfcObj.props) {\n componentOptions.props = sfcObj.props;\n }\n\n if (sfcObj.setup) {\n componentOptions.setup = sfcObj.setup;\n }\n\n if (sfcObj.data) {\n componentOptions.data = sfcObj.data;\n }\n\n if (sfcObj.methods) {\n componentOptions.methods = sfcObj.methods;\n }\n\n if (sfcObj.computed) {\n componentOptions.computed = sfcObj.computed;\n }\n\n return defineComponent(componentOptions);\n}\n\nexport function createTestEngine<T extends ScenePart>(\n component: Component | VueSFCLikeComponent,\n partDefinitions: T,\n option?: Readonly<Partial<IVueTestEngineOption>>\n): TestEngine<T> {\n const rootEl = option?.rootElement ?? document.body;\n const container = rootEl.appendChild(document.createElement('div'));\n const rootId = getNextRootElementId();\n container.setAttribute(rootElementAttributeName, rootId);\n\n let unmount: () => void;\n let app: App;\n\n // Create component from SFC-like object if needed\n const compiledComponent = isSFCLikeObject(component)\n ? createComponentFromSFCLike(component)\n : (component as Component);\n\n try {\n const renderResult = render(compiledComponent, { container });\n unmount = renderResult.unmount;\n } catch (_error) {\n // Fallback to manual Vue app creation if render fails\n app = createApp(compiledComponent);\n app.mount(container);\n unmount = () => {\n if (app) {\n app.unmount();\n }\n };\n }\n\n const cleanup = () => {\n unmount();\n rootEl.removeChild(container);\n return Promise.resolve();\n };\n\n return new TestEngine(\n byAttribute(rootElementAttributeName, rootId),\n new VueInteractor(),\n {\n parts: partDefinitions,\n },\n cleanup\n );\n}\n\nexport function createRenderedTestEngine<T extends ScenePart>(\n rootElement: HTMLElement,\n partDefinitions: T,\n _option?: Readonly<Partial<IVueTestEngineOption>>\n): TestEngine<T> {\n const rootId = getNextRootElementId();\n rootElement.setAttribute(rootElementAttributeName, rootId);\n\n const cleanup = () => {\n rootElement.removeAttribute(rootElementAttributeName);\n return Promise.resolve();\n };\n\n return new TestEngine(\n byAttribute(rootElementAttributeName, rootId),\n new VueInteractor(),\n {\n parts: partDefinitions,\n },\n cleanup\n );\n}\n"],"mappings":";;;;;AAuBA,IAAa,gBAAb,MAAa,sBAAsB,cAAc;CAC/C,MAAc,QAAQ;EACpB,MAAM,SAAS;CACjB;CAEA,MAAe,UAAU,SAAsB,MAAc,QAAkD;EAC7G,MAAM,MAAM,UAAU,SAAS,MAAM,MAAM;EAC3C,MAAM,KAAK,MAAM;CACnB;CAEA,MAAe,MAAM,SAAsB,QAA8C;EACvF,MAAM,MAAM,MAAM,SAAS,MAAM;EACjC,MAAM,KAAK,MAAM;CACnB;CAEA,MAAe,MAAM,SAAsB,QAA8C;EACvF,MAAM,MAAM,MAAM,SAAS,MAAM;EACjC,MAAM,KAAK,MAAM;CACnB;CAEA,MAAe,UAAU,SAAsB,QAAkD;EAC/F,MAAM,MAAM,UAAU,SAAS,MAAM;EACrC,MAAM,KAAK,MAAM;CACnB;CAEA,MAAe,UAAU,S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iBAAiB,UAAU,OAAO;CAGpC,IAAI,OAAO,UACT,iBAAiB,WAAW,OAAO;CAGrC,OAAO,gBAAgB,gBAAgB;AACzC;AAEA,SAAgB,iBACd,WACA,iBACA,QACe;CACf,MAAM,SAAS,QAAQ,eAAe,SAAS;CAC/C,MAAM,YAAY,OAAO,YAAY,SAAS,cAAc,KAAK,CAAC;CAClE,MAAM,SAAS,qBAAqB;CACpC,UAAU,aAAa,0BAA0B,MAAM;CAEvD,IAAI;CACJ,IAAI;CAGJ,MAAM,oBAAoB,gBAAgB,SAAS,IAC/C,2BAA2B,SAAS,IACnC;CAEL,IAAI;EAEF,UADqB,OAAO,mBAAmB,EAAE,UAAU,CACtC,CAAC,CAAC;CACzB,SAAS,QAAQ;EAEf,MAAM,UAAU,iBAAiB;EACjC,IAAI,MAAM,SAAS;EACnB,gBAAgB;GACd,IAAI,KACF,IAAI,QAAQ;EAEhB;CACF;CAEA,MAAM,gBAAgB;EACpB,QAAQ;EACR,OAAO,YAAY,SAAS;EAC5B,OAAO,QAAQ,QAAQ;CACzB;CAEA,OAAO,IAAI,WACT,YAAY,0BAA0B,MAAM,GAC5C,IAAI,cAAc,GAClB,EACE,OAAO,gBACT,GACA,OACF;AACF;AAEA,SAAgB,yBACd,aACA,iBACA,SACe;CACf,MAAM,SAAS,qBAAqB;CACpC,YAAY,aAAa,0BAA0B,MAAM;CAEzD,MAAM,gBAAgB;EACpB,YAAY,gBAAgB,wBAAwB;EACpD,OAAO,QAAQ,QAAQ;CACzB;CAEA,OAAO,IAAI,WACT,YAAY,0BAA0B,MAAM,GAC5C,IAAI,cAAc,GAClB,EACE,OAAO,gBACT,GACA,OACF;AACF"}
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../src/VueInteractor.ts","../src/createTestEngine.ts"],"sourcesContent":["import {\n BlurOption,\n ClickOption,\n defaultWaitForOption,\n EnterTextOption,\n FocusOption,\n HoverOption,\n MouseDownOption,\n MouseEnterOption,\n MouseLeaveOption,\n MouseMoveOption,\n MouseOutOption,\n MouseUpOption,\n PartLocator,\n Point,\n PressKeyOption,\n WaitForOption,\n WaitUntilOption,\n} from '@atomic-testing/core';\nimport { DOMInteractor } from '@atomic-testing/dom-core';\nimport { nextTick } from 'vue';\n\nexport class VueInteractor extends DOMInteractor {\n private async flush() {\n await nextTick();\n }\n\n override async enterText(locator: PartLocator, text: string, option?: Partial<EnterTextOption>): Promise<void> {\n await super.enterText(locator, text, option);\n await this.flush();\n }\n\n override async setRangeValue(locator: PartLocator, value: number): Promise<void> {\n await super.setRangeValue(locator, value);\n await this.flush();\n }\n\n override async click(locator: PartLocator, option?: Partial<ClickOption>): Promise<void> {\n await super.click(locator, option);\n await this.flush();\n }\n\n override async hover(locator: PartLocator, option?: Partial<HoverOption>): Promise<void> {\n await super.hover(locator, option);\n await this.flush();\n }\n\n override async mouseMove(locator: PartLocator, option?: Partial<MouseMoveOption>): Promise<void> {\n await super.mouseMove(locator, option);\n await this.flush();\n }\n\n override async mouseDown(locator: PartLocator, option?: Partial<MouseDownOption>): Promise<void> {\n await super.mouseDown(locator, option);\n await this.flush();\n }\n\n override async mouseUp(locator: PartLocator, option?: Partial<MouseUpOption>): Promise<void> {\n await super.mouseUp(locator, option);\n await this.flush();\n }\n\n override async mouseOver(locator: PartLocator, option?: Partial<HoverOption>): Promise<void> {\n await super.mouseOver(locator, option);\n await this.flush();\n }\n\n override async mouseOut(locator: PartLocator, option?: Partial<MouseOutOption>): Promise<void> {\n await super.mouseOut(locator, option);\n await this.flush();\n }\n\n override async mouseEnter(locator: PartLocator, option?: Partial<MouseEnterOption>): Promise<void> {\n await super.mouseEnter(locator, option);\n await this.flush();\n }\n\n override async mouseLeave(locator: PartLocator, option?: Partial<MouseLeaveOption>): Promise<void> {\n await super.mouseLeave(locator, option);\n await this.flush();\n }\n\n override async focus(locator: PartLocator, option?: Partial<FocusOption>): Promise<void> {\n await super.focus(locator, option);\n await this.flush();\n }\n\n override async blur(locator: PartLocator, option?: Partial<BlurOption>): Promise<void> {\n await super.blur(locator, option);\n await this.flush();\n }\n\n override async pressKey(locator: PartLocator, key: string, option?: Partial<PressKeyOption>): Promise<void> {\n await super.pressKey(locator, key, option);\n await this.flush();\n }\n\n override async contextMenu(locator: PartLocator): Promise<void> {\n await super.contextMenu(locator);\n await this.flush();\n }\n\n override async activate(locator: PartLocator): Promise<void> {\n await super.activate(locator);\n await this.flush();\n }\n\n override async selectOptionValue(locator: PartLocator, values: string[]): Promise<void> {\n await super.selectOptionValue(locator, values);\n await this.flush();\n }\n\n override async setInputFiles(locator: PartLocator, files: string | string[]): Promise<void> {\n await super.setInputFiles(locator, files);\n await this.flush();\n }\n\n override async scrollIntoView(locator: PartLocator): Promise<void> {\n await super.scrollIntoView(locator);\n await this.flush();\n }\n\n override async scrollBy(locator: PartLocator, delta: Point): Promise<void> {\n await super.scrollBy(locator, delta);\n await this.flush();\n }\n\n override async dragTo(source: PartLocator, target: PartLocator): Promise<void> {\n await super.dragTo(source, target);\n await this.flush();\n }\n\n override async drag(locator: PartLocator, delta: Point): Promise<void> {\n await super.drag(locator, delta);\n await this.flush();\n }\n\n override async waitUntilComponentState(\n locator: PartLocator,\n option: Partial<Readonly<WaitForOption>> = defaultWaitForOption\n ): Promise<void> {\n await super.waitUntilComponentState(locator, option);\n await this.flush();\n }\n\n override async waitUntil<T>(option: WaitUntilOption<T>): Promise<T> {\n const result = await super.waitUntil(option);\n await this.flush();\n return result;\n }\n}\n","import { byAttribute, ScenePart, TestEngine } from '@atomic-testing/core';\nimport { render } from '@testing-library/vue';\nimport { App, Component, createApp, defineComponent } from 'vue';\n\nimport { IVueTestEngineOption, VueSFCLikeComponent } from './types';\nimport { VueInteractor } from './VueInteractor';\n\nlet _rootId = 0;\nfunction getNextRootElementId() {\n return `${_rootId++}`;\n}\n\nconst rootElementAttributeName = 'data-atomic-testing-vue';\n\nfunction isSFCLikeObject(component: any): component is VueSFCLikeComponent {\n return (\n component && typeof component === 'object' && 'template' in component && typeof component.template === 'string'\n );\n}\n\nfunction createComponentFromSFCLike(sfcObj: VueSFCLikeComponent): Component {\n const componentOptions: any = {\n name: sfcObj.name || 'SFCComponent',\n template: sfcObj.template,\n };\n\n if (sfcObj.props) {\n componentOptions.props = sfcObj.props;\n }\n\n if (sfcObj.setup) {\n componentOptions.setup = sfcObj.setup;\n }\n\n if (sfcObj.data) {\n componentOptions.data = sfcObj.data;\n }\n\n if (sfcObj.methods) {\n componentOptions.methods = sfcObj.methods;\n }\n\n if (sfcObj.computed) {\n componentOptions.computed = sfcObj.computed;\n }\n\n return defineComponent(componentOptions);\n}\n\nexport function createTestEngine<T extends ScenePart>(\n component: Component | VueSFCLikeComponent,\n partDefinitions: T,\n option?: Readonly<Partial<IVueTestEngineOption>>\n): TestEngine<T> {\n const rootEl = option?.rootElement ?? document.body;\n const container = rootEl.appendChild(document.createElement('div'));\n const rootId = getNextRootElementId();\n container.setAttribute(rootElementAttributeName, rootId);\n\n let unmount: () => void;\n let app: App;\n\n // Create component from SFC-like object if needed\n const compiledComponent = isSFCLikeObject(component)\n ? createComponentFromSFCLike(component)\n : (component as Component);\n\n try {\n const renderResult = render(compiledComponent, { container });\n unmount = renderResult.unmount;\n } catch (_error) {\n // Fallback to manual Vue app creation if render fails\n app = createApp(compiledComponent);\n app.mount(container);\n unmount = () => {\n if (app) {\n app.unmount();\n }\n };\n }\n\n const cleanup = () => {\n unmount();\n rootEl.removeChild(container);\n return Promise.resolve();\n };\n\n return new TestEngine(\n byAttribute(rootElementAttributeName, rootId),\n new VueInteractor(),\n {\n parts: partDefinitions,\n },\n cleanup\n );\n}\n\nexport function createRenderedTestEngine<T extends ScenePart>(\n rootElement: HTMLElement,\n partDefinitions: T,\n _option?: Readonly<Partial<IVueTestEngineOption>>\n): TestEngine<T> {\n const rootId = getNextRootElementId();\n rootElement.setAttribute(rootElementAttributeName, rootId);\n\n const cleanup = () => {\n rootElement.removeAttribute(rootElementAttributeName);\n return Promise.resolve();\n };\n\n return new TestEngine(\n byAttrib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YAAY,0BAA0B,MAAM,GAC5C,IAAI,cAAc,GAClB,EACE,OAAO,gBACT,GACA,OACF;AACF;AAEA,SAAgB,yBACd,aACA,iBACA,SACe;CACf,MAAM,SAAS,qBAAqB;CACpC,YAAY,aAAa,0BAA0B,MAAM;CAEzD,MAAM,gBAAgB;EACpB,YAAY,gBAAgB,wBAAwB;EACpD,OAAO,QAAQ,QAAQ;CACzB;CAEA,OAAO,IAAI,WACT,YAAY,0BAA0B,MAAM,GAC5C,IAAI,cAAc,GAClB,EACE,OAAO,gBACT,GACA,OACF;AACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atomic-testing/vue-3",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.90.0",
|
|
4
4
|
"description": "The @atomic-testing/vue-3 package is a Vue 3 test adapter that extends Atomic Testing's component driver pattern to Vue applications. It enables testing Vue components using the same high-level semantic APIs used across React, Playwright, and DOM environments.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"integration",
|
|
@@ -33,8 +33,8 @@
|
|
|
33
33
|
"@testing-library/dom": "^10.4.1",
|
|
34
34
|
"@testing-library/vue": "^8.1.0",
|
|
35
35
|
"@vue/compiler-sfc": "^3.5.0",
|
|
36
|
-
"@atomic-testing/core": "0.
|
|
37
|
-
"@atomic-testing/dom-core": "0.
|
|
36
|
+
"@atomic-testing/core": "0.90.0",
|
|
37
|
+
"@atomic-testing/dom-core": "0.90.0"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"vue": "^3.5.0"
|
|
@@ -48,6 +48,7 @@
|
|
|
48
48
|
},
|
|
49
49
|
"scripts": {
|
|
50
50
|
"build": "tsdown",
|
|
51
|
-
"check:type": "tsgo --noEmit"
|
|
51
|
+
"check:type": "tsgo --noEmit",
|
|
52
|
+
"check:api": "api-extractor run"
|
|
52
53
|
}
|
|
53
54
|
}
|
package/src/VueInteractor.ts
CHANGED
|
@@ -5,7 +5,6 @@ import {
|
|
|
5
5
|
EnterTextOption,
|
|
6
6
|
FocusOption,
|
|
7
7
|
HoverOption,
|
|
8
|
-
Interactor,
|
|
9
8
|
MouseDownOption,
|
|
10
9
|
MouseEnterOption,
|
|
11
10
|
MouseLeaveOption,
|
|
@@ -31,6 +30,11 @@ export class VueInteractor extends DOMInteractor {
|
|
|
31
30
|
await this.flush();
|
|
32
31
|
}
|
|
33
32
|
|
|
33
|
+
override async setRangeValue(locator: PartLocator, value: number): Promise<void> {
|
|
34
|
+
await super.setRangeValue(locator, value);
|
|
35
|
+
await this.flush();
|
|
36
|
+
}
|
|
37
|
+
|
|
34
38
|
override async click(locator: PartLocator, option?: Partial<ClickOption>): Promise<void> {
|
|
35
39
|
await super.click(locator, option);
|
|
36
40
|
await this.flush();
|
|
@@ -131,11 +135,6 @@ export class VueInteractor extends DOMInteractor {
|
|
|
131
135
|
await this.flush();
|
|
132
136
|
}
|
|
133
137
|
|
|
134
|
-
override async wait(ms: number): Promise<void> {
|
|
135
|
-
await super.wait(ms);
|
|
136
|
-
await this.flush();
|
|
137
|
-
}
|
|
138
|
-
|
|
139
138
|
override async waitUntilComponentState(
|
|
140
139
|
locator: PartLocator,
|
|
141
140
|
option: Partial<Readonly<WaitForOption>> = defaultWaitForOption
|
|
@@ -149,8 +148,4 @@ export class VueInteractor extends DOMInteractor {
|
|
|
149
148
|
await this.flush();
|
|
150
149
|
return result;
|
|
151
150
|
}
|
|
152
|
-
|
|
153
|
-
override clone(): Interactor {
|
|
154
|
-
return new VueInteractor(this.rootEl);
|
|
155
|
-
}
|
|
156
151
|
}
|
package/src/types.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ITestEngineOption } from '@atomic-testing/core';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
/**
|
|
4
|
+
* @deprecated Use {@link ITestEngineOption} from `@atomic-testing/core`.
|
|
5
|
+
*/
|
|
6
|
+
export type IVueTestEngineOption = ITestEngineOption;
|
|
6
7
|
|
|
7
8
|
// Simple SFC-like object interface for template-based components
|
|
8
9
|
export interface VueSFCLikeComponent {
|