Skip to content

Commit

Permalink
use locators instead of tabbing around
Browse files Browse the repository at this point in the history
  • Loading branch information
MaggieCabrera committed May 26, 2023
1 parent 89de6e8 commit 0ff31a9
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions test/e2e/specs/editor/blocks/links.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,13 @@ test.describe( 'Links', () => {
await page.keyboard.type( 'https://wordpress.org/gutenberg' );

// Open settings.
await page.keyboard.press( 'Tab' );
await page.keyboard.press( 'Space' );
await page.getByRole( 'button', { name: 'Link Settings' } ).click();

// Navigate to and toggle the "Open in new tab" checkbox.
await page.keyboard.press( 'Tab' );
await page.keyboard.press( 'Space' );
const checkbox = page.getByLabel( 'Open in new tab' );
await checkbox.click();

// Toggle should still have focus and be checked.
const checkbox = page.getByLabel( 'Open in new tab' );
await expect( checkbox ).toBeChecked();
await expect( checkbox ).toBeFocused();

Expand All @@ -46,12 +44,9 @@ test.describe( 'Links', () => {
expect( await editor.getEditedPostContent() ).toMatchSnapshot();

// Tab back to the Submit and apply the link.
await page.keyboard.press( 'Tab' );
await page.keyboard.press( 'Enter' );
await page.getByRole( 'button', { name: 'Apply' } ).click();

// The link should have been inserted.
expect( await editor.getEditedPostContent() ).toMatchSnapshot();
} );

test.describe( 'should contain a label when it should open in a new tab', () => {} );
} );

0 comments on commit 0ff31a9

Please sign in to comment.