MDL-45184 tool_licensemanager: Behat fixes
authorJun Pataleta <jun@moodle.com>
Tue, 26 May 2020 04:26:40 +0000 (12:26 +0800)
committerJun Pataleta <jun@moodle.com>
Tue, 26 May 2020 04:29:09 +0000 (12:29 +0800)
* Fix license manager test
* Remove unnecessary @javascript tags
* Remove unnecessary "I log out" steps
* Fix structure so each scenario will have a single Given-When-Then

admin/tool/licensemanager/tests/behat/delete_license.feature
admin/tool/licensemanager/tests/behat/edit_license.feature
admin/tool/licensemanager/tests/behat/license_manager.feature

index f5405ec..9bab27b 100644 (file)
@@ -18,11 +18,10 @@ Feature: Delete custom licenses
     | version[year]  | 2019                                |
     And I press "Save changes"
     And I click on "Delete" "icon" in the "MIT" "table_row"
-    And I click on "Save changes" "button" in the "Delete licence" "dialogue"
+    When I click on "Save changes" "button" in the "Delete licence" "dialogue"
     Then I should not see "MIT Licence" in the "manage-licenses" "table"
-    And I log out
 
-  Scenario: I cannot delete a standard Moodle license
+  Scenario: I cannot delete a standard license
     Given I log in as "admin"
     And I navigate to "Licence > Licence manager" in site administration
     Then I should see "Licence not specified" in the "unknown" "table_row"
index d8dbfb3..d4d73ff 100644 (file)
@@ -15,11 +15,10 @@ Feature: Custom licences
       | version[day]   | 1                                   |
       | version[month] | January                             |
       | version[year]  | 2020                                |
-    And I press "Save changes"
+    When I press "Save changes"
     Then I should see "Licence manager"
     And I should see "MIT Licence" in the "MIT" "table_row"
     And I should see "https://opensource.org/licenses/MIT" in the "MIT" "table_row"
-    And I log out
 
   Scenario: I am only be able to make custom license with a valid url source (including scheme).
     Given I log in as "admin"
@@ -32,19 +31,18 @@ Feature: Custom licences
       | version[day]   | 1                                   |
       | version[month] | January                             |
       | version[year]  | 2020                                |
-    And I press "Save changes"
+    When I press "Save changes"
     Then I should see "Invalid source URL"
     And I set the following fields to these values:
       | source         | mailto:tomdickman@catalyst-au.net   |
     And I press "Save changes"
-    Then I should see "Invalid source URL"
+    And I should see "Invalid source URL"
     And I set the following fields to these values:
       | source         | https://opensource.org/licenses/MIT |
     And I press "Save changes"
-    Then I should see "Licence manager"
+    And I should see "Licence manager"
     And I should see "MIT Licence" in the "MIT" "table_row"
     And I should see "https://opensource.org/licenses/MIT" in the "MIT" "table_row"
-    And I log out
 
   Scenario: Custom license version format must be YYYYMMDD00
     Given I log in as "admin"
@@ -57,10 +55,9 @@ Feature: Custom licences
       | version[day]   | 1                                   |
       | version[month] | March                               |
       | version[year]  | 2019                                |
-    And I press "Save changes"
+    When I press "Save changes"
     Then I should see "Licence manager"
     And I should see "2019030100" in the "MIT" "table_row"
-    And I log out
 
   @javascript
   Scenario: Custom license short name should not be editable after first creation
@@ -77,7 +74,6 @@ Feature: Custom licences
     And I press "Save changes"
     And I should see "Licence manager"
     And I should see "MIT Licence" in the "MIT" "table_row"
-    And I click on "Edit" "icon" in the "MIT" "table_row"
+    When I click on "Edit" "icon" in the "MIT" "table_row"
     Then I should see "Edit licence"
     And the "shortname" "field" should be disabled
-    And I log out
index eae3cc1..2977d12 100644 (file)
@@ -16,23 +16,20 @@ Feature: License manager
     And I should see "Creative Commons - No Commercial" in the "cc-nc" "table_row"
     And I should see "Creative Commons - No Commercial ShareAlike" in the "cc-nc-sa" "table_row"
     And I should see "Creative Commons - ShareAlike" in the "cc-sa" "table_row"
-    And I log out
 
-  @javascript
   Scenario: I should be able to enable and disable licenses
     Given I log in as "admin"
     And I navigate to "Licence > Licence settings" in site administration
     When I set the field "Default site licence" to "Public domain"
     And I press "Save changes"
     And I navigate to "Licence > Licence manager" in site administration
-    Then "Default" "icon" should exist in the "public" "table_row"
-    And "Enable" "icon" should not exist in the "public" "table_row"
-    And "Default" "icon" should not exist in the "cc" "table_row"
-    When I navigate to "Licence > Licence settings" in site administration
+    Then "This is the site default license" "icon" should exist in the "public" "table_row"
+    And "Enable license" "icon" should not exist in the "public" "table_row"
+    And "This is the site default license" "icon" should not exist in the "cc" "table_row"
+    And I navigate to "Licence > Licence settings" in site administration
     And I set the field "Default site licence" to "Creative Commons"
     And I press "Save changes"
     And I navigate to "Licence > Licence manager" in site administration
-    Then "Default" "icon" should exist in the "cc" "table_row"
-    And "Enable" "icon" should not exist in the "cc" "table_row"
-    And "Default" "icon" should not exist in the "public" "table_row"
-    And I log out
+    And "This is the site default license" "icon" should exist in the "cc" "table_row"
+    And "Enable license" "icon" should not exist in the "cc" "table_row"
+    And "This is the site default license" "icon" should not exist in the "public" "table_row"