Skip to content

Commit

Permalink
Widgets E2E tests: Query by label instead of id
Browse files Browse the repository at this point in the history
  • Loading branch information
noisysocks committed Apr 14, 2021
1 parent a199fee commit 968cb98
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions packages/e2e-tests/specs/widgets/adding-widgets.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -496,8 +496,13 @@ describe( 'Widgets screen', () => {
);
await editButton.click();

// TODO: Should query this with role and label.
const titleInput = await legacyWidget.$( '#widget-search-1-title' );
const [ titleLabel ] = await legacyWidget.$x(
'//label[contains(text(), "Title")]'
);
const titleInputId = await titleLabel.evaluate( ( node ) =>
node.getAttribute( 'for' )
);
const titleInput = await page.$( `#${ titleInputId }` );
await titleInput.type( 'Search Title' );

// Trigger the toolbar to appear.
Expand Down

0 comments on commit 968cb98

Please sign in to comment.