Make WordPress Core

Changeset 52096


Ignore:
Timestamp:
11/10/2021 01:49:01 AM (5 years ago)
Author:
desrosj
Message:

Build/Test Tools: Make adjustments to how Quick Draft tests confirm expected behavior.

Twenty Twenty-One contained a filter on the_title to change the default post title to “Untitled”.

Whenever possible, the default behavior of Core without theme modifications should be confirmed in tests. The default behavior here is for a post title to be “(no title)” when one is not entered.

This change also makes an adjustment to be more specific when retrieving the text to verify results to prevent dates and post statuses from being pulled in.

Props davidbaumwald, desrosj, peterwilsoncc, hellofromTonya.
Fixes #54409.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/e2e/specs/dashboard.test.js

    r51128 r52096  
    5858
    5959                // Check that new draft appears in Your Recent Drafts section
    60                 const newDraft = await page.waitForSelector( '.drafts .draft-title' );
     60                const newDraft = await page.waitForSelector( '.drafts .draft-title a' );
    6161
    6262                expect(
    6363                        await newDraft.evaluate( ( element ) => element.innerText )
    64                 ).toContain( 'Untitled' );
     64                ).toContain( '(no title)' );
    6565
    6666                // Check that new draft appears in Posts page
    6767                await visitAdminPage( '/edit.php' );
    6868                const postsListDraft = await page.waitForSelector(
    69                         '.type-post.status-draft .title'
     69                        '.type-post.status-draft .title a'
    7070                );
    7171
    7272                expect(
    7373                        await postsListDraft.evaluate( ( element ) => element.innerText )
    74                 ).toContain( 'Untitled' );
     74                ).toContain( '(no title)' );
    7575        } );
    7676} );
Note: See TracChangeset for help on using the changeset viewer.