Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

chore(ui): add hover-based run test (#21758)

Pavel Feldman49ce5612446a
diff --git a/tests/playwright-test/ui-mode-test-run.spec.ts b/tests/playwright-test/ui-mode-test-run.spec.ts
index ac8c41ed0b..6e75ed37f3 100644
--- a/tests/playwright-test/ui-mode-test-run.spec.ts
+++ b/tests/playwright-test/ui-mode-test-run.spec.ts
@@ -61,6 +61,25 @@ test('should run visible', async ({ runUITest }) => {
`);
});
+test('should run on hover', async ({ runUITest }) => {
+ const page = await runUITest({
+ 'a.test.ts': `
+ import { test, expect } from '@playwright/test';
+ test('passes', () => {});
+ test('fails', () => { expect(1).toBe(2); });
+ `,
+ });
+
+ await page.getByText('passes').hover();
+ await page.getByRole('listitem').filter({ hasText: 'passes' }).getByTitle('Run').click();
+
+ await expect.poll(dumpTestTree(page), { timeout: 15000 }).toBe(`
+ ▼ ◯ a.test.ts
+ ✅ passes <=
+ ◯ fails
+ `);
+});
+
test('should run on double click', async ({ runUITest }) => {
const page = await runUITest({
'a.test.ts': `