diff --git a/tests/page/page-click.spec.ts b/tests/page/page-click.spec.ts
index 855d6722aa..e84f66e1d9 100644
--- a/tests/page/page-click.spec.ts
+++ b/tests/page/page-click.spec.ts
@@ -858,3 +858,29 @@ it('should not hang when frame is detached', async ({ page, server, mode }) => {
expect(error).toBeTruthy();
expect(error.message).toMatch(/frame got detached|Frame was detached/);
});
+
+it('should climb dom for inner label with pointer-events:none', async ({ page }) => {
+ await page.setContent('');
+ await page.click('text=Click target');
+ expect(await page.evaluate('__CLICKED')).toBe(true);
+});
+
+it('should climb up to [role=button]', async ({ page }) => {
+ await page.setContent('
Click target
');
+ await page.click('text=Click target');
+ expect(await page.evaluate('__CLICKED')).toBe(true);
+});
+
+it('should climb up to a anchor', async ({ page }) => {
+ // For Firefox its not allowed to return anything: https://bugzilla.mozilla.org/show_bug.cgi?id=1392046
+ // Note the intermediate div - it is necessary, otherwise is not recognized as a clickable link.
+ await page.setContent(`
`);
+ await page.click('#inner');
+ expect(await page.evaluate('__CLICKED')).toBe(true);
+});
+
+it('should climb up to a [role=link]', async ({ page }) => {
+ await page.setContent(`
Inner
`);
+ await page.click('#inner');
+ expect(await page.evaluate('__CLICKED')).toBe(true);
+});
diff --git a/tests/page/retarget.spec.ts b/tests/page/retarget.spec.ts
index b331949725..d955271852 100644
--- a/tests/page/retarget.spec.ts
+++ b/tests/page/retarget.spec.ts
@@ -71,52 +71,6 @@ it('should wait for enclosing enabled button', async ({ page, server }) => {
await promise;
});
-it('inputValue should work on label', async ({ page, server }) => {
- await page.setContent(``);
- await page.fill('input', 'foo');
- expect(await page.locator('label').inputValue()).toBe('foo');
-});
-
-it('should get value of input with label', async ({ page }) => {
- await page.setContent(``);
- expect(await page.inputValue('text=Fill me')).toBe('some value');
- await expect(page.locator('text=Fill me')).toHaveValue('some value');
-});
-
-it('should get value of input with span inside the label', async ({ page }) => {
- await page.setContent(``);
- expect(await page.inputValue('text=Fill me')).toBe('some value');
- await expect(page.locator('text=Fill me')).toHaveValue('some value');
-});
-
-it('should get value of textarea with label', async ({ page }) => {
- await page.setContent(``);
- expect(await page.inputValue('text=Fill me')).toBe('hey');
- await expect(page.locator('text=Fill me')).toHaveValue('hey');
-
- await page.fill('textarea', 'Look at this');
- expect(await page.inputValue('text=Fill me')).toBe('Look at this');
- await expect(page.locator('text=Fill me')).toHaveValue('Look at this');
-});
-
-it('should check the box by label', async ({ page }) => {
- await page.setContent(``);
- await page.check('label');
- expect(await page.evaluate(() => window['checkbox'].checked)).toBe(true);
-});
-
-it('should check the box outside label', async ({ page }) => {
- await page.setContent(``);
- await page.check('label');
- expect(await page.evaluate(() => window['checkbox'].checked)).toBe(true);
-});
-
-it('should check the box inside label w/o id', async ({ page }) => {
- await page.setContent(``);
- await page.check('label');
- expect(await page.evaluate(() => window['checkbox'].checked)).toBe(true);
-});
-
it('should check the box outside shadow dom label', async ({ page }) => {
await page.setContent('');
await page.$eval('div', div => {
@@ -134,86 +88,294 @@ it('should check the box outside shadow dom label', async ({ page }) => {
expect(await page.$eval('input', input => input.checked)).toBe(true);
});
-it('click should climb dom for inner label with pointer-events:none', async ({ page }) => {
- await page.setContent('');
- await page.click('text=Click target');
- expect(await page.evaluate('__CLICKED')).toBe(true);
-});
-
-it('click should climb up to [role=button]', async ({ page }) => {
- await page.setContent('
Click target
');
- await page.click('text=Click target');
- expect(await page.evaluate('__CLICKED')).toBe(true);
-});
-
-it('click should climb up to a anchor', async ({ page }) => {
- // For Firefox its not allowed to return anything: https://bugzilla.mozilla.org/show_bug.cgi?id=1392046
- // Note the intermediate div - it is necessary, otherwise is not recognized as a clickable link.
- await page.setContent(`