Skip to content

Commit e3db859

Browse files
committed
Update vite-bundle.spec.ts
1 parent 07e65e3 commit e3db859

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

test/bundler/vite-bundle-test/vite-bundle.spec.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,10 @@ describe('vite-bundle', () => {
6767
const page = await browser.newPage();
6868

6969
try {
70-
await page.goto(`http://localhost:${PORT}/`, { waitUntil: 'networkidle0' });
70+
await page.goto(`http://localhost:${PORT}/index.html`, { waitUntil: 'networkidle0' });
71+
72+
// Ensure the custom element is defined
73+
await page.waitForFunction(() => !!customElements.get('my-component'), { timeout: 20000 });
7174

7275
// Wait for the element to be present
7376
await page.waitForSelector('my-component', { timeout: 20000 });
@@ -76,7 +79,12 @@ describe('vite-bundle', () => {
7679
await page.waitForFunction(
7780
() => {
7881
const el = document.querySelector('my-component');
79-
return !!el && !!(el as any).shadowRoot && !!(el as any).shadowRoot.textContent && (el as any).shadowRoot.textContent.trim().length > 0;
82+
return (
83+
!!el &&
84+
!!(el as any).shadowRoot &&
85+
!!(el as any).shadowRoot.textContent &&
86+
(el as any).shadowRoot.textContent.trim().length > 0
87+
);
8088
},
8189
{ timeout: 20000 },
8290
);

0 commit comments

Comments
 (0)