Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
TypeScript automationchromechromiume2e-testingelectronend-to-end-testingfirefoxjavascriptplaywrighttesttest-automationtestingtesting-toolswebwebkit
feat(ct): vue2 throw when updating a native html element (#22407)
Sander060979ef860c
diff --git a/packages/playwright-ct-vue2/registerSource.mjs b/packages/playwright-ct-vue2/registerSource.mjsindex b313e702da..fd8a2d063d 100644--- a/packages/playwright-ct-vue2/registerSource.mjs+++ b/packages/playwright-ct-vue2/registerSource.mjs@@ -190,6 +190,9 @@ window.playwrightUpdate = async (element, options) => {throw new Error('Component was not mounted');const component = wrapper.componentInstance;+ if (!component)+ throw new Error('Updating a native HTML element is not supported');+const { nodeData, slots } = __pwCreateComponent(options);for (const [name, value] of Object.entries(nodeData.on || {})) {diff --git a/tests/components/ct-vue2-cli/tests/update/update.spec.tsx b/tests/components/ct-vue2-cli/tests/update/update.spec.tsxindex bb93b99118..f9f7cf9c61 100644--- a/tests/components/ct-vue2-cli/tests/update/update.spec.tsx+++ b/tests/components/ct-vue2-cli/tests/update/update.spec.tsx@@ -43,3 +43,11 @@ test('update slots without remounting', async ({ mount }) => {await expect(component.getByTestId('remount-count')).toContainText('1');});++test('throw error when updating a native html element', async ({ mount }) => {+ const component = await mount(<div id="1337"></div>);++ await expect(async () => {+ await component.update(<div id="9001"></div>);+ }).rejects.toThrowError('Updating a native HTML element is not supported');+});