MCPcopy
hub / github.com/QwikDev/qwik / expectHtmlOnARootPage

Function expectHtmlOnARootPage

e2e/qwik-cli-e2e/tests/serve.spec.ts:116–134  ·  view source on GitHub ↗
(host: string)

Source from the content-addressed store, hash-verified

114}
115
116async function expectHtmlOnARootPage(host: string) {
117 expect((await getPageHtml(host)).querySelector('.container h1')?.textContent).toBe(
118 `So fantasticto have you here`
119 );
120 const heroComponentPath = join(global.tmpDir, `src/components/starter/hero/hero.tsx`);
121 const heroComponentTextContent = readFileSync(heroComponentPath, 'utf-8');
122 writeFileSync(
123 heroComponentPath,
124 heroComponentTextContent.replace(
125 `to have <span class="highlight">you</span> here`,
126 `to have <span class="highlight">e2e tests</span> here`
127 )
128 );
129 // wait for the arbitrary amount of time before the app is reloaded
130 await new Promise((r) => setTimeout(r, 2000));
131 expect((await getPageHtml(host)).querySelector('.container h1')?.textContent).toBe(
132 `So fantasticto have e2e tests here`
133 );
134}

Callers 1

serve.spec.tsFile · 0.85

Calls 3

getPageHtmlFunction · 0.90
joinFunction · 0.90
querySelectorMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…