@atomic-testing/vue-3 0.89.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/dist/index.cjs +1 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -6
- package/dist/index.d.mts +5 -6
- package/dist/index.mjs +1 -8
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
- package/src/VueInteractor.ts +0 -10
- package/src/types.ts +5 -4
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
|
}
|
|
@@ -96,10 +96,6 @@ var VueInteractor = class VueInteractor extends _atomic_testing_dom_core.DOMInte
|
|
|
96
96
|
await super.drag(locator, delta);
|
|
97
97
|
await this.flush();
|
|
98
98
|
}
|
|
99
|
-
async wait(ms) {
|
|
100
|
-
await super.wait(ms);
|
|
101
|
-
await this.flush();
|
|
102
|
-
}
|
|
103
99
|
async waitUntilComponentState(locator, option = _atomic_testing_core.defaultWaitForOption) {
|
|
104
100
|
await super.waitUntilComponentState(locator, option);
|
|
105
101
|
await this.flush();
|
|
@@ -109,9 +105,6 @@ var VueInteractor = class VueInteractor extends _atomic_testing_dom_core.DOMInte
|
|
|
109
105
|
await this.flush();
|
|
110
106
|
return result;
|
|
111
107
|
}
|
|
112
|
-
clone() {
|
|
113
|
-
return new VueInteractor(this.rootEl);
|
|
114
|
-
}
|
|
115
108
|
};
|
|
116
109
|
//#endregion
|
|
117
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 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 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/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,MAAM,KAAK,MAAM;CACnB;CAEA,MAAe,UAAU,SAAsB,QAAkD;EAC/F,MAAM,MAAM,UAAU,SAAS,MAAM;EACrC,MAAM,KAAK,MAAM;CACnB;CAEA,MAAe,UAAU,SAAsB,QAAkD;EAC/F,MAAM,MAAM,UAAU,SAAS,MAAM;EACrC,MAAM,KAAK,MAAM;CACnB;CAEA,MAAe,QAAQ,SAAsB,QAAgD;EAC3F,MAAM,MAAM,QAAQ,SAAS,MAAM;EACnC,MAAM,KAAK,MA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,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,WAAA,GAAA,qBAAA,OAAA,CAD4B,mBAAmB,EAAE,UAAU,CACtC,CAAC,CAAC;CACzB,SAAS,QAAQ;EAEf,OAAA,GAAA,IAAA,UAAA,CAAgB,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,IAAIC,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(rootElementAtt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QAAQ;EACR,OAAO,YAAY,SAAS;EAC5B,OAAO,QAAQ,QAAQ;CACzB;CAEA,OAAO,IAAIC,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"}
|
package/dist/index.d.cts
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;
|
|
@@ -45,10 +46,8 @@ declare class VueInteractor extends DOMInteractor {
|
|
|
45
46
|
scrollBy(locator: PartLocator, delta: Point): Promise<void>;
|
|
46
47
|
dragTo(source: PartLocator, target: PartLocator): Promise<void>;
|
|
47
48
|
drag(locator: PartLocator, delta: Point): Promise<void>;
|
|
48
|
-
wait(ms: number): Promise<void>;
|
|
49
49
|
waitUntilComponentState(locator: PartLocator, option?: Partial<Readonly<WaitForOption>>): Promise<void>;
|
|
50
50
|
waitUntil<T>(option: WaitUntilOption<T>): Promise<T>;
|
|
51
|
-
clone(): Interactor;
|
|
52
51
|
}
|
|
53
52
|
//#endregion
|
|
54
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;
|
|
@@ -45,10 +46,8 @@ declare class VueInteractor extends DOMInteractor {
|
|
|
45
46
|
scrollBy(locator: PartLocator, delta: Point): Promise<void>;
|
|
46
47
|
dragTo(source: PartLocator, target: PartLocator): Promise<void>;
|
|
47
48
|
drag(locator: PartLocator, delta: Point): Promise<void>;
|
|
48
|
-
wait(ms: number): Promise<void>;
|
|
49
49
|
waitUntilComponentState(locator: PartLocator, option?: Partial<Readonly<WaitForOption>>): Promise<void>;
|
|
50
50
|
waitUntil<T>(option: WaitUntilOption<T>): Promise<T>;
|
|
51
|
-
clone(): Interactor;
|
|
52
51
|
}
|
|
53
52
|
//#endregion
|
|
54
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
|
}
|
|
@@ -95,10 +95,6 @@ var VueInteractor = class VueInteractor extends DOMInteractor {
|
|
|
95
95
|
await super.drag(locator, delta);
|
|
96
96
|
await this.flush();
|
|
97
97
|
}
|
|
98
|
-
async wait(ms) {
|
|
99
|
-
await super.wait(ms);
|
|
100
|
-
await this.flush();
|
|
101
|
-
}
|
|
102
98
|
async waitUntilComponentState(locator, option = defaultWaitForOption) {
|
|
103
99
|
await super.waitUntilComponentState(locator, option);
|
|
104
100
|
await this.flush();
|
|
@@ -108,9 +104,6 @@ var VueInteractor = class VueInteractor extends DOMInteractor {
|
|
|
108
104
|
await this.flush();
|
|
109
105
|
return result;
|
|
110
106
|
}
|
|
111
|
-
clone() {
|
|
112
|
-
return new VueInteractor(this.rootEl);
|
|
113
|
-
}
|
|
114
107
|
};
|
|
115
108
|
//#endregion
|
|
116
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 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 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,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,MAAM,KAAK,MAAM;CACnB;CAEA,MAAe,UAAU,SAAsB,QAAkD;EAC/F,MAAM,MAAM,UAAU,SAAS,MAAM;EACrC,MAAM,KAAK,MAAM;CACnB;CAEA,MAAe,UAAU,SAAsB,QAAkD;EAC/F,MAAM,MAAM,UAAU,SAAS,MAAM;EACrC,MAAM,KAAK,MAAM;CACnB;CAEA,MAAe,QAAQ,SAAsB,QAAgD;EAC3F,MAAM,MAAM,QAAQ,SAAS,MAAM;EACnC,MAAM,KAAK,MAAM;CACnB;CAEA,MAAe,UAAU,SAAsB,QAA8C;EAC3F,MAAM,MAAM,UAAU,SAAS,MAAM;EACrC,MAAM,KAAK,MAAM;CACnB;CAEA,MAAe,SAAS,SAAsB,QAAiD;EAC7F,MAAM,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AoB,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 byAttribute(rootElementAttributeName, rootId),\n new VueInteractor(),\n {\n parts: partDefinitions,\n },\n cleanup\n );\n}\n"],"mappings":";;;;;AAsBA,IAAa,gBAAb,cAAmC,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,cAAc,SAAsB,OAA8B;EAC/E,MAAM,MAAM,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AO,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"
|
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,
|
|
@@ -136,11 +135,6 @@ export class VueInteractor extends DOMInteractor {
|
|
|
136
135
|
await this.flush();
|
|
137
136
|
}
|
|
138
137
|
|
|
139
|
-
override async wait(ms: number): Promise<void> {
|
|
140
|
-
await super.wait(ms);
|
|
141
|
-
await this.flush();
|
|
142
|
-
}
|
|
143
|
-
|
|
144
138
|
override async waitUntilComponentState(
|
|
145
139
|
locator: PartLocator,
|
|
146
140
|
option: Partial<Readonly<WaitForOption>> = defaultWaitForOption
|
|
@@ -154,8 +148,4 @@ export class VueInteractor extends DOMInteractor {
|
|
|
154
148
|
await this.flush();
|
|
155
149
|
return result;
|
|
156
150
|
}
|
|
157
|
-
|
|
158
|
-
override clone(): Interactor {
|
|
159
|
-
return new VueInteractor(this.rootEl);
|
|
160
|
-
}
|
|
161
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 {
|