Make WordPress Core

Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#54409 closed defect (bug) (fixed)

E2E Tests: Update test for saved draft with no title

Reported by: davidbaumwald's profile davidbaumwald Owned by: desrosj's profile desrosj
Milestone: 5.9 Priority: normal
Severity: normal Version: 5.9
Component: Build/Test Tools Keywords: has-patch has-unit-tests
Focuses: Cc:

Description

When [52093] changed the default theme to TwentyTwenty Two, E2E tests failed when testing that draft posts created on the dashboard(with an empty title) resulted in a different title than expected.

After investigation, it was noted that the previous TwentyTwenty One theme included a the_title filter that changed all empty post titles to "Untitled". This is the result that the E2E tests were expecting.

However, given that historically, tests are usually crafted for default behavior(see [38838] as one example), the E2E tests for drafts saved with no title should be updated to expect "(no title)". Additionally, the test should also be updated with a more tightly scoped selector to only select the link text, not any child tags, e.g. <time>.

Change History (3)

This ticket was mentioned in PR #1856 on WordPress/wordpress-develop by desrosj.


3 years ago
#1

  • Keywords has-patch has-unit-tests added; needs-patch removed

#2 @desrosj
3 years ago

  • Resolution set to fixed
  • Status changed from assigned to closed

In 52096:

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.

Note: See TracTickets for help on using tickets.