From 4940aa51521f69dd5b2e23fe9949b2da190d6b66 Mon Sep 17 00:00:00 2001 From: Andrew Nicols Date: Fri, 12 Jan 2018 09:34:20 +0800 Subject: [PATCH] MDL-61204 user: Fix random failure in behat We need to get into the habit of not using usernames like 'student1' and 'student10' as our matches are non-strict, and the tests become dependent upon DB sort order. This change adds a character after the varying value to act as a delimter for all of these tests. --- user/tests/behat/view_participants.feature | 96 +++++++++++----------- 1 file changed, 48 insertions(+), 48 deletions(-) diff --git a/user/tests/behat/view_participants.feature b/user/tests/behat/view_participants.feature index 34393ca4177..d33cedb8a90 100644 --- a/user/tests/behat/view_participants.feature +++ b/user/tests/behat/view_participants.feature @@ -6,57 +6,57 @@ Feature: View course participants Background: Given the following "users" exist: - | username | firstname | lastname | email | - | teacher1 | Teacher | 1 | teacher1@example.com | - | student1 | Student | 1 | student1@example.com | - | student2 | Student | 2 | student2@example.com | - | student3 | Student | 3 | student3@example.com | - | student4 | Student | 4 | student4@example.com | - | student5 | Student | 5 | student5@example.com | - | student6 | Student | 6 | student6@example.com | - | student7 | Student | 7 | student7@example.com | - | student8 | Student | 8 | student8@example.com | - | student9 | Student | 9 | student9@example.com | - | student10 | Student | 10 | student10@example.com | - | student11 | Student | 11 | student11@example.com | - | student12 | Student | 12 | student12@example.com | - | student13 | Student | 13 | student13@example.com | - | student14 | Student | 14 | student14@example.com | - | student15 | Student | 15 | student15@example.com | - | student16 | Student | 16 | student16@example.com | - | student17 | Student | 17 | student17@example.com | - | student18 | Student | 18 | student18@example.com | - | student19 | Student | 19 | student19@example.com | - | student20 | Student | 20 | student20@example.com | + | username | firstname | lastname | email | + | teacher1x | Teacher | 1x | teacher1x@example.com | + | student1x | Student | 1x | student1x@example.com | + | student2x | Student | 2x | student2x@example.com | + | student3x | Student | 3x | student3x@example.com | + | student4x | Student | 4x | student4x@example.com | + | student5x | Student | 5x | student5x@example.com | + | student6x | Student | 6x | student6x@example.com | + | student7x | Student | 7x | student7x@example.com | + | student8x | Student | 8x | student8x@example.com | + | student9x | Student | 9x | student9x@example.com | + | student10x | Student | 10x | student10x@example.com | + | student11x | Student | 11x | student11x@example.com | + | student12x | Student | 12x | student12x@example.com | + | student13x | Student | 13x | student13x@example.com | + | student14x | Student | 14x | student14x@example.com | + | student15x | Student | 15x | student15x@example.com | + | student16x | Student | 16x | student16x@example.com | + | student17x | Student | 17x | student17x@example.com | + | student18x | Student | 18x | student18x@example.com | + | student19x | Student | 19x | student19x@example.com | + | student20x | Student | 20x | student20x@example.com | And the following "courses" exist: | fullname | shortname | format | | Course 1 | C1 | topics | And the following "course enrolments" exist: | user | course | role | - | teacher1 | C1 | editingteacher | - | student1 | C1 | student | - | student2 | C1 | student | - | student3 | C1 | student | - | student4 | C1 | student | - | student5 | C1 | student | - | student6 | C1 | student | - | student7 | C1 | student | - | student8 | C1 | student | - | student9 | C1 | student | - | student10 | C1 | student | - | student11 | C1 | student | - | student12 | C1 | student | - | student13 | C1 | student | - | student14 | C1 | student | - | student15 | C1 | student | - | student16 | C1 | student | - | student17 | C1 | student | - | student18 | C1 | student | - | student19 | C1 | student | + | teacher1x | C1 | editingteacher | + | student1x | C1 | student | + | student2x | C1 | student | + | student3x | C1 | student | + | student4x | C1 | student | + | student5x | C1 | student | + | student6x | C1 | student | + | student7x | C1 | student | + | student8x | C1 | student | + | student9x | C1 | student | + | student10x | C1 | student | + | student11x | C1 | student | + | student12x | C1 | student | + | student13x | C1 | student | + | student14x | C1 | student | + | student15x | C1 | student | + | student16x | C1 | student | + | student17x | C1 | student | + | student18x | C1 | student | + | student19x | C1 | student | @javascript Scenario: Use select and deselect all buttons - Given I log in as "teacher1" + Given I log in as "teacher1x" And I follow "Course 1" And I follow "Participants" When I press "Select all" @@ -106,14 +106,14 @@ Feature: View course participants @javascript Scenario: Use select all users on this page, select all n users and deselect all Given the following "course enrolments" exist: - | user | course | role | - | student20 | C1 | student | - When I log in as "teacher1" + | user | course | role | + | student20x | C1 | student | + When I log in as "teacher1x" And I follow "Course 1" And I follow "Participants" And I follow "Surname" And I press "Select all users on this page" - Then I should not see "Student 9" + Then I should not see "Student 9x" And the field with xpath "//tbody//tr[1]//input[@class='usercheckbox']" matches value "1" And the field with xpath "//tbody//tr[2]//input[@class='usercheckbox']" matches value "1" And the field with xpath "//tbody//tr[3]//input[@class='usercheckbox']" matches value "1" @@ -158,7 +158,7 @@ Feature: View course participants And the field with xpath "//tbody//tr[20]//input[@class='usercheckbox']" matches value "0" And I press "Select all 21 users" - And I should see "Student 9" + And I should see "Student 9x" And the field with xpath "//tbody//tr[1]//input[@class='usercheckbox']" matches value "1" And the field with xpath "//tbody//tr[2]//input[@class='usercheckbox']" matches value "1" And the field with xpath "//tbody//tr[3]//input[@class='usercheckbox']" matches value "1"