Skip to content

Commit

Permalink
Flaky Test: Fix "Sorting" test in new-templates-list.spec.js (#64776)
Browse files Browse the repository at this point in the history
* Use claude AI to fix flaky

* Cleaner approach

* Comment cleaning
  • Loading branch information
cbravobernal authored Aug 27, 2024
1 parent 2520296 commit 482c188
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions test/e2e/specs/site-editor/new-templates-list.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,22 @@ test.describe( 'Templates', () => {
test( 'Sorting', async ( { admin, page } ) => {
await admin.visitSiteEditor( { postType: 'wp_template' } );

// Descending by title.
await page.getByRole( 'button', { name: 'View options' } ).click();
await page.getByRole( 'radio', { name: 'Sort descending' } ).click();
// Wait for the template list to be visible.
await expect(
page.locator( '[aria-label="Templates"]' )
).toBeVisible();

const firstTitle = page
.getByRole( 'region', {
name: 'Template',
includeHidden: true,
} )
.getByRole( 'link', { includeHidden: true } )
.first();

// Descending by title.
await page.getByRole( 'button', { name: 'View options' } ).click();
await page.getByRole( 'radio', { name: 'Sort descending' } ).click();
await expect( firstTitle ).toHaveText( 'Tag Archives' );

// Ascending by title.
Expand Down

0 comments on commit 482c188

Please sign in to comment.