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
test: add a test for hidden shadow host (#6008)
Dmitry Gozmanceb4bc25d939
diff --git a/test/page/page-wait-for-selector-2.spec.ts b/test/page/page-wait-for-selector-2.spec.tsindex dad6016639..9cd795b999 100644--- a/test/page/page-wait-for-selector-2.spec.ts+++ b/test/page/page-wait-for-selector-2.spec.ts@@ -250,3 +250,21 @@ it('should allow you to select an element with single slash xpath', async ({pageconst waitForXPath = page.waitForSelector('//html/body/div');expect(await page.evaluate(x => x.textContent, await waitForXPath)).toBe('some text');});++it('should correctly handle hidden shadow host', async ({page, server}) => {+ await page.setContent(`+ <x-host hidden></x-host>+ <script>+ const host = document.querySelector('x-host');+ const root = host.attachShadow({ mode: 'open' });+ const style = document.createElement('style');+ style.textContent = ':host([hidden]) { display: none; }';+ root.appendChild(style);+ const child = document.createElement('div');+ child.textContent = 'Find me';+ root.appendChild(child);+ </script>+ `);+ expect(await page.textContent('div')).toBe('Find me');+ await page.waitForSelector('div', { state: 'hidden' });+});