From ffd1406d44285ee4543dc01cd68804995e8cd0ce Mon Sep 17 00:00:00 2001 From: Max Schmitt Date: Fri, 11 Oct 2024 13:12:36 +0000 Subject: [PATCH] add isolated test --- tests/library/hit-target.spec.ts | 40 ++++++++++++++++++- tests/library/inspector/cli-codegen-1.spec.ts | 8 +++- 2 files changed, 45 insertions(+), 3 deletions(-) diff --git a/tests/library/hit-target.spec.ts b/tests/library/hit-target.spec.ts index 6bf4085b6b..52f8dabf53 100644 --- a/tests/library/hit-target.spec.ts +++ b/tests/library/hit-target.spec.ts @@ -15,7 +15,7 @@ */ import { contextTest as it, expect } from '../config/browserTest'; -import type { ElementHandle } from 'playwright-core'; +import type { ElementHandle, Page } from 'playwright-core'; declare const renderComponent; declare const e; @@ -464,3 +464,41 @@ it('should click in custom element', async ({ page }) => { await page.locator('input').click(); expect(await page.evaluate('window.__clicked')).toBe(true); }); + +for (const mode of ['same-context', 'different-context'] as const) { + it(`concurrent selectOption in ${mode} should work`, async ({ browser, browserName, isLinux }) => { + it.fixme(browserName === 'webkit' && isLinux, 'https://github.com/microsoft/playwright/issues/33064'); + + const concurrentSelectOption = async (page: Page) => { + const result = []; + await page.exposeFunction('log', (value: string) => result.push(value)); + await page.setContent(` + + `); + await page.locator('select').click(); + await page.selectOption('select', ['1']); + await page.selectOption('select', ['2']); + await page.selectOption('select', []); + await page.selectOption('select', ['1', '2']); + return result; + }; + const context = mode === 'same-context' ? await browser.newContext() : null; + const getPage = () => { + if (mode === 'different-context') + return browser.newPage(); + return context.newPage(); + }; + const [result1, result2] = await Promise.all([concurrentSelectOption(await getPage()), concurrentSelectOption(await getPage())]); + const expected = [ + ['1'], + ['2'], + [], + ['1', '2'], + ]; + expect(result1).toEqual(expected); + expect(result2).toEqual(expected); + }); +} \ No newline at end of file diff --git a/tests/library/inspector/cli-codegen-1.spec.ts b/tests/library/inspector/cli-codegen-1.spec.ts index 4dc0272207..efb152ddcc 100644 --- a/tests/library/inspector/cli-codegen-1.spec.ts +++ b/tests/library/inspector/cli-codegen-1.spec.ts @@ -682,7 +682,9 @@ await page.Locator(\"#age\").SelectOptionAsync(new[] { \"2\" });`); expect(message.text()).toBe('2'); }); - test('should select with multiple attribute', async ({ openRecorder }) => { + test('should select with multiple attribute', async ({ openRecorder, browserName, isLinux }) => { + test.fixme(browserName === 'webkit' && isLinux, 'https://github.com/microsoft/playwright/issues/33064'); + const { page, recorder } = await openRecorder(); await recorder.setContentAndWait(``); @@ -716,7 +718,9 @@ await page.Locator("#age").SelectOptionAsync(new[] { "1", "2" });`); expect(message.text()).toBe('[1,2]'); }); - test('should unselect with multiple attribute', async ({ openRecorder }) => { + test('should unselect with multiple attribute', async ({ openRecorder, browserName, isLinux }) => { + test.fixme(browserName === 'webkit' && isLinux, 'https://github.com/microsoft/playwright/issues/33064'); + const { page, recorder } = await openRecorder(); await recorder.setContentAndWait(``);