In #2068063: Change "Save and keep un-/published" buttons to a "Published" checkbox and an included "Save" button the text of the node edit 'save' button will be simplified, from the current varying 'save and publish', 'save and unpublish', 'save and keep published' and ''save and keep unpublished'. The new version will have a simple 'published' checkbox for users who have the autority to alter the status, and a consistent 'save' button. This change will be done at core 8.4 but it is not going to be back-ported to 8.3 - see comment #220 for details.

The Scheduler tests have many ocurrences of the text of a button to click. This will need to be changed so that the tests continue to pass. The change will be made to core 8.4.x (sometime) but not at 8.3.x. We want our tests to pass at both 8.4 and 8.3 hence we need to develop ways to cope with this.

The above four text strings are used in 13 of Scheduler's 22 test files:

  • SchedulerApiTest
  • SchedulerBasicTest
  • SchedulerDefaultTimeTest
  • SchedulerMetaInformationTest
  • SchedulerMultilingualTest
  • SchedulerPastDatesTest
  • SchedulerPermissionsTest
  • SchedulerRequiredTest
  • SchedulerRulesActionsTest
  • SchedulerRulesConditionsTest
  • SchedulerRulesEventsTest
  • SchedulerTokenReplaceTest
  • SchedulerValidationTest

Possible solutions

The fixes will vary from file to file. The two main ideas are:

  1. Alter the test to run as a user without 'administer content' permission. Then they will always get the consistent 'save' button in both 8.3 and 8.4
  2. Look for the 'published status' checkbox on the page, via xpath, and use this for conditional coding

Comments

jonathan1055 created an issue. See original summary.

jonathan1055’s picture

Issue summary: View changes

Listed the files affected and some possible solutions.

jonathan1055’s picture

Issue summary: View changes
Status: Active » Needs review
StatusFileSize
new7.7 KB

Patch for the first two test files: APItest and BasicTest. The change here is to run the tests via a normal scheduler user not an admin user. This means that the 'save and publish' button will not be shown in 8.3 or in 8.4, either now or after the core change has been made. This required a little alteration to the test files, for example re-setting the 'sticky' value using $node->set('sticky', FALSE) instead of via the edit page. This is fine, as it does not affect the validity of the tests.

  • jonathan1055 committed 058976b on 8.x-1.x
    Issue #2873108 by jonathan1055: Prepare for SAVE button in API and Basic...
  • jonathan1055 committed 4f8bdc6 on 8.x-1.x
    Issue #2873108 by jonathan1055: Add $schedulerUser to...
jonathan1055’s picture

Five test files (DefaultTime, MetaInformation, PastDates, Required and Token) can be sorted by changing from adminUser to schedulerUser and adjusting the button text.

Status: Needs review » Needs work

The last submitted patch, 5: 2873108-5.save-button-change-adminuser-to-scheduleruser.patch, failed testing.

jonathan1055’s picture

Status: Needs work » Needs review
StatusFileSize
new14.01 KB

The failure is not related to this patch, as the committed codebase started to fail (but was OK at last commit). Just to check, here is a patch which puts back the change to API test .info.yml

Status: Needs review » Needs work

The last submitted patch, 7: 2873108-7.save-button-change-adminuser-to-scheduleruser.patch, failed testing.

jonathan1055’s picture

Status: Needs work » Needs review

OK, so the failure was not caused by the change yesterday. Maybe something in core 8.3 and 8.4 has changed, because the tests still pass OK at 8.2 (all run at 7:40 GMT this morning 30 April)

See #2874410: Tests with assertFieldById fail to find field at 8.3 and 8.4, ok at 8.2

  • jonathan1055 committed 8964952 on 8.x-1.x
    Issue #2873108 by jonathan1055: Change adminUser to schedulerUser in...

Status: Needs review » Needs work

The last submitted patch, 7: 2873108-7.save-button-change-adminuser-to-scheduleruser.patch, failed testing.

jonathan1055’s picture

Status: Needs work » Needs review
StatusFileSize
new10.22 KB

Ha, the test took so long to start, I had already committed the code.

The tests for Multilingual, Permissions and Validation need to be run with a user who has admin permissions, as they change the published state. Hence these three use xpath to see if a 'status' checkbox exists, and use alternative button text.

  • jonathan1055 committed bd1eca4 on 8.x-1.x
    Issue #2873108 by jonathan1055: Amend tests for 'save' button, use xpath...

  • jonathan1055 committed c05f941 on 8.x-1.x
    Issue #2873108 by jonathan1055: Amend tests fo 'save' button -...
jonathan1055’s picture

Title: Amend tests in preparation for change to 'save' button » Amend tests in preparation for core 8.4 change to 'save' button
Status: Needs review » Fixed
Related issues: +#2068063: Change "Save and keep un-/published" buttons to a "Published" checkbox and an included "Save" button

I think this can now be marked as fixed. We cannot be totally sure until the change in #2068063: Change "Save and keep un-/published" buttons to a "Published" checkbox and an included "Save" button has been committed, but I have checked that our tests all pass in an environment where 2068063-247.patch has been applied.

jonathan1055’s picture

Title: Amend tests in preparation for core 8.4 change to 'save' button » Amend Scheduler tests in preparation for core 8.4 change to 'save' button
Issue summary: View changes

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.