Internal: Update behat tests, test user/course creation with travis

Fix login test.
pull/3513/head
Julio Montoya 5 years ago
parent 4321de3a69
commit 3e2811653c
  1. 54
      .travis.yml
  2. 2
      assets/vue/views/Login.vue
  3. 7
      tests/behat/features/bootstrap/FeatureContext.php
  4. 41
      tests/behat/features/createUser.feature
  5. 26
      tests/behat/features/toolExercise.feature
  6. 38
      tests/behat/features/toolLp.feature

@ -102,33 +102,33 @@ script:
# Set to APP_ENV to test # Set to APP_ENV to test
- sed -i "s/APP_ENV='dev'/APP_ENV='test'/g" .env.local - sed -i "s/APP_ENV='dev'/APP_ENV='test'/g" .env.local
- cd tests/behat - cd tests/behat
- ../../vendor/behat/behat/bin/behat features/adminFillUsers.feature -v - ../../vendor/behat/behat/bin/behat features/adminFillUsers.feature -vv
- ../../vendor/behat/behat/bin/behat features/adminSettings.feature -v # - ../../vendor/behat/behat/bin/behat features/adminSettings.feature -v
- ../../vendor/behat/behat/bin/behat features/career.feature -v # - ../../vendor/behat/behat/bin/behat features/career.feature -v
- ../../vendor/behat/behat/bin/behat features/class.feature -v # - ../../vendor/behat/behat/bin/behat features/class.feature -v
- ../../vendor/behat/behat/bin/behat features/companyReports.feature -v # - ../../vendor/behat/behat/bin/behat features/companyReports.feature -v
- ../../vendor/behat/behat/bin/behat features/course.feature -v - ../../vendor/behat/behat/bin/behat features/course.feature -vv
- ../../vendor/behat/behat/bin/behat features/course_user_registration.feature -v # - ../../vendor/behat/behat/bin/behat features/course_user_registration.feature -v
- ../../vendor/behat/behat/bin/behat features/createUser.feature -v # - ../../vendor/behat/behat/bin/behat features/createUser.feature -v
- ../../vendor/behat/behat/bin/behat features/createUserViaCSV.feature -v # - ../../vendor/behat/behat/bin/behat features/createUserViaCSV.feature -v
- ../../vendor/behat/behat/bin/behat features/extraFieldUser.feature -v # - ../../vendor/behat/behat/bin/behat features/extraFieldUser.feature -v
- ../../vendor/behat/behat/bin/behat features/profile.feature -v # - ../../vendor/behat/behat/bin/behat features/profile.feature -v
- ../../vendor/behat/behat/bin/behat features/promotion.feature -v # - ../../vendor/behat/behat/bin/behat features/promotion.feature -v
- ../../vendor/behat/behat/bin/behat features/registration.feature -v # - ../../vendor/behat/behat/bin/behat features/registration.feature -v
- ../../vendor/behat/behat/bin/behat features/sessionAccess.feature -v # - ../../vendor/behat/behat/bin/behat features/sessionAccess.feature -v
- ../../vendor/behat/behat/bin/behat features/sessionManagement.feature -v # - ../../vendor/behat/behat/bin/behat features/sessionManagement.feature -v
- ../../vendor/behat/behat/bin/behat features/socialGroup.feature -v # - ../../vendor/behat/behat/bin/behat features/socialGroup.feature -v
- ../../vendor/behat/behat/bin/behat features/systemAnnouncements.feature -v # - ../../vendor/behat/behat/bin/behat features/systemAnnouncements.feature -v
- ../../vendor/behat/behat/bin/behat features/ticket.feature -v # - ../../vendor/behat/behat/bin/behat features/ticket.feature -v
- ../../vendor/behat/behat/bin/behat features/toolAgenda.feature -v # - ../../vendor/behat/behat/bin/behat features/toolAgenda.feature -v
- ../../vendor/behat/behat/bin/behat features/toolAnnouncement.feature -v # - ../../vendor/behat/behat/bin/behat features/toolAnnouncement.feature -v
- ../../vendor/behat/behat/bin/behat features/toolDocument.feature -v # - ../../vendor/behat/behat/bin/behat features/toolDocument.feature -v
- ../../vendor/behat/behat/bin/behat features/toolExercise.feature -v # - ../../vendor/behat/behat/bin/behat features/toolExercise.feature -v
- ../../vendor/behat/behat/bin/behat features/toolForum.feature -v # - ../../vendor/behat/behat/bin/behat features/toolForum.feature -v
- ../../vendor/behat/behat/bin/behat features/toolGroup.feature -v # - ../../vendor/behat/behat/bin/behat features/toolGroup.feature -v
- ../../vendor/behat/behat/bin/behat features/toolLink.feature -v # - ../../vendor/behat/behat/bin/behat features/toolLink.feature -v
- ../../vendor/behat/behat/bin/behat features/toolLp.feature -v # - ../../vendor/behat/behat/bin/behat features/toolLp.feature -v
- ../../vendor/behat/behat/bin/behat features/toolWork.feature -v # - ../../vendor/behat/behat/bin/behat features/toolWork.feature -v
after_failure: after_failure:
- sudo cat /var/log/apache2/error.log - sudo cat /var/log/apache2/error.log

@ -19,12 +19,14 @@
icon="envelope" icon="envelope"
type="text" type="text"
required required
name="login"
/> />
<b-form-input <b-form-input
v-model="password" v-model="password"
:placeholder=" $t('Password') " :placeholder=" $t('Password') "
icon="lock" icon="lock"
type="password" type="password"
name="password"
required required
/> />
</div> </div>

@ -118,9 +118,10 @@ class FeatureContext extends MinkContext
{ {
$this->visit('/logout'); $this->visit('/logout');
$this->visit('/login'); $this->visit('/login');
$this->fillField('login__username', $username); $this->fillField('login', $username);
$this->fillField('login__password', $username); $this->fillField('password', $username);
$this->pressButton('_submit'); $this->pressButton('Login');
$this->waitForThePageToBeLoaded();
} }
/** /**

@ -4,18 +4,18 @@ Feature: Users management as admin
As an administrator As an administrator
I need to be able to create new users I need to be able to create new users
Scenario: See the users list link on the admin page Background:
Given I am a platform administrator Given I am a platform administrator
And I am on "/main/admin/index.php"
Scenario: See the users list link on the admin page
Given I am on "/main/admin/index.php"
Then I should see "Users list" Then I should see "Users list"
Scenario: See the user creation link on the admin page Scenario: See the user creation link on the admin page
Given I am a platform administrator
And I am on "/main/admin/index.php" And I am on "/main/admin/index.php"
Then I should see "Add a user" Then I should see "Add a user"
Scenario: Create a user with only basic info Scenario: Create a user with only basic info
Given I am a platform administrator
And I am on "/main/admin/user_add.php" And I am on "/main/admin/user_add.php"
And I fill in the following: And I fill in the following:
| firstname | Sammy | | firstname | Sammy |
@ -23,9 +23,34 @@ Feature: Users management as admin
| email | smarshall@example.com | | email | smarshall@example.com |
| username | smarshall | | username | smarshall |
| password | smarshall | | password | smarshall |
And I check the "#send_mail_no" radio button selector
And I press "submit" And I press "submit"
Then I should see "The user has been added" Then I should see "The user has been added"
Scenario: Create a user with wrong username
And I am on "/main/admin/user_add.php"
And I fill in the following:
| firstname | NIÑO |
| lastname | NIÑO |
| email | example@example.com |
| username | NIÑO |
| password | smarshall |
And I check the "#send_mail_no" radio button selector
And I press "submit"
Then I should see "Only letters and numbers allowed"
Scenario: Create a user with wrong email
And I am on "/main/admin/user_add.php"
And I fill in the following:
| firstname | Juls |
| lastname | Juls |
| email | NI -ÑO@example.com |
| username | Juls |
| password | Juls |
And I check the "#send_mail_no" radio button selector
And I press "submit"
Then I should see "The email address is not complete or contains some invalid characters"
Scenario: Search and delete a user Scenario: Search and delete a user
Given I am a platform administrator Given I am a platform administrator
And I am on "/main/admin/user_list.php" And I am on "/main/admin/user_list.php"
@ -36,7 +61,6 @@ Feature: Users management as admin
Then I should see "The user has been deleted" Then I should see "The user has been deleted"
Scenario: Create a HRM user Scenario: Create a HRM user
Given I am a platform administrator
And I am on "/main/admin/user_add.php" And I am on "/main/admin/user_add.php"
And I fill in the following: And I fill in the following:
| firstname | HRM firstname| | firstname | HRM firstname|
@ -44,12 +68,12 @@ Feature: Users management as admin
| email | hrm@example.com | | email | hrm@example.com |
| username | hrm | | username | hrm |
| password | hrm | | password | hrm |
And I check the "#send_mail_no" radio button selector
And I fill in select bootstrap static input "#status_select" select "4" And I fill in select bootstrap static input "#status_select" select "4"
And I press "submit" And I press "submit"
Then I should see "The user has been added" Then I should see "The user has been added"
Scenario: Create a teacher user Scenario: Create a teacher user
Given I am a platform administrator
And I am on "/main/admin/user_add.php" And I am on "/main/admin/user_add.php"
And I fill in the following: And I fill in the following:
| firstname | teacher firstname| | firstname | teacher firstname|
@ -58,11 +82,11 @@ Feature: Users management as admin
| username | teacher | | username | teacher |
| password | teacher | | password | teacher |
And I fill in select bootstrap static input "#status_select" select "1" And I fill in select bootstrap static input "#status_select" select "1"
And I check the "#send_mail_no" radio button selector
And I press "submit" And I press "submit"
Then I should see "The user has been added" Then I should see "The user has been added"
Scenario: Create a student user Scenario: Create a student user
Given I am a platform administrator
And I am on "/main/admin/user_add.php" And I am on "/main/admin/user_add.php"
And I fill in the following: And I fill in the following:
| firstname | student firstname| | firstname | student firstname|
@ -71,11 +95,11 @@ Feature: Users management as admin
| username | student | | username | student |
| password | student | | password | student |
And I fill in select bootstrap static input "#status_select" select "5" And I fill in select bootstrap static input "#status_select" select "5"
And I check the "#send_mail_no" radio button selector
And I press "submit" And I press "submit"
Then I should see "The user has been added" Then I should see "The user has been added"
Scenario: HRM follows teacher Scenario: HRM follows teacher
Given I am a platform administrator
And I am on "/main/admin/user_list.php?keyword=hrm&submit=&_qf__search_simple=" And I am on "/main/admin/user_list.php?keyword=hrm&submit=&_qf__search_simple="
And I should see "HRM lastname" And I should see "HRM lastname"
And I should see "Human Resources Manager" And I should see "Human Resources Manager"
@ -86,7 +110,6 @@ Feature: Users management as admin
Then I should see "The assigned users have been updated" Then I should see "The assigned users have been updated"
Scenario: HRM follows student Scenario: HRM follows student
Given I am a platform administrator
And I am on "/main/admin/user_list.php?keyword=hrm&submit=&_qf__search_simple=" And I am on "/main/admin/user_list.php?keyword=hrm&submit=&_qf__search_simple="
And I should see "HRM lastname" And I should see "HRM lastname"
And I should see "Human Resources Manager" And I should see "Human Resources Manager"

@ -262,13 +262,12 @@ Feature: Exercise tool
# Question 1 # Question 1
Then I should see "Multiple choice" Then I should see "Multiple choice"
And I check the "Answer true" radio button And I check the "Answer true" radio button
And wait for the page to be loaded
Then I press "Next question" Then I press "Next question"
# Question 2
And wait for the page to be loaded And wait for the page to be loaded
# Question 2
And I check the "Answer true" radio button And I check the "Answer true" radio button
And wait for the page to be loaded
Then I press "Next question" Then I press "Next question"
And wait for the page to be loaded
# Question 3 # Question 3
Then I fill in the following: Then I fill in the following:
| choice_id_3_0 | Juliet | | choice_id_3_0 | Juliet |
@ -284,37 +283,41 @@ Feature: Exercise tool
| choice_id_3_10 | cherchent à | | choice_id_3_10 | cherchent à |
| choice_id_3_11 | Übung | | choice_id_3_11 | Übung |
Then I fill in select bootstrap static by text "#choice_id_3_12" select "Ärger" Then I fill in select bootstrap static by text "#choice_id_3_12" select "Ärger"
And wait for the page to be loaded
Then I press "Next question" Then I press "Next question"
And wait for the page to be loaded
# Question 4 - Matching # Question 4 - Matching
Then I select "A" from "choice_id_4_1" Then I select "A" from "choice_id_4_1"
Then I select "B" from "choice_id_4_2" Then I select "B" from "choice_id_4_2"
Then I press "Next question" Then I press "Next question"
And wait for the page to be loaded
# Question 5 - Open question # Question 5 - Open question
Then wait for the page to be loaded Then wait for the page to be loaded
Then I fill the only ckeditor in the page with "Hello you" Then I fill the only ckeditor in the page with "Hello you"
Then wait for the page to be loaded
Then I press "Next question" Then I press "Next question"
And wait for the page to be loaded
# Question 6 - Oral question # Question 6 - Oral question
Then wait for the page to be loaded
Then I press "Next question" Then I press "Next question"
And wait for the page to be loaded
# Question 7 - Exact answers combination # Question 7 - Exact answers combination
Then I check "Answer true" Then I check "Answer true"
Then I press "Next question" Then I press "Next question"
Then wait for the page to be loaded And wait for the page to be loaded
# Question 8 - Unique answer with unknown # Question 8 - Unique answer with unknown
And I check the "Answer true" radio button And I check the "Answer true" radio button
Then I press "Next question" Then I press "Next question"
Then wait for the page to be loaded And wait for the page to be loaded
# Question 9 - Multiple answer true - false - dont know # Question 9 - Multiple answer true - false - dont know
#@todo #@todo
Then I press "Next question" Then I press "Next question"
And wait for the page to be loaded
# Question 10 - Combination true - false - don't-know # Question 10 - Combination true - false - don't-know
#@todo #@todo
Then I press "Next question" Then I press "Next question"
And wait for the page to be loaded
# Question 11 - Global multiple answer # Question 11 - Global multiple answer
Then I check "Answer true" Then I check "Answer true"
Then I press "End test" Then I press "End test"
And wait for the page to be loaded
Then I should see "Hello you" Then I should see "Hello you"
Then I should see "Score for the test: 83 / 117" Then I should see "Score for the test: 83 / 117"
@ -364,22 +367,28 @@ Feature: Exercise tool
And I follow "Start test" And I follow "Start test"
When wait for the page to be loaded When wait for the page to be loaded
And I press "Next question" And I press "Next question"
And wait for the page to be loaded
And I check "oligarchy" And I check "oligarchy"
And I check "oligopoly" And I check "oligopoly"
And I check "timocracy" And I check "timocracy"
And I check "autocracy" And I check "autocracy"
And I press "Next question" And I press "Next question"
And wait for the page to be loaded
And I check the "semantics" radio button And I check the "semantics" radio button
And I press "Next question" And I press "Next question"
And wait for the page to be loaded
And I check the "RNASL" radio button And I check the "RNASL" radio button
And I press "Next question" And I press "Next question"
And wait for the page to be loaded
And I check the "10" radio button And I check the "10" radio button
And I press "Next question" And I press "Next question"
And wait for the page to be loaded
And fill in the following: And fill in the following:
| choice_id_6_0 | words | | choice_id_6_0 | words |
| choice_id_6_1 | fill | | choice_id_6_1 | fill |
| choice_id_6_2 | blanks | | choice_id_6_2 | blanks |
And I press "Next question" And I press "Next question"
And wait for the page to be loaded
And I select "A" from "choice_id_7_1" And I select "A" from "choice_id_7_1"
And I select "B" from "choice_id_7_2" And I select "B" from "choice_id_7_2"
And I select "C" from "choice_id_7_3" And I select "C" from "choice_id_7_3"
@ -389,6 +398,7 @@ Feature: Exercise tool
And I press "Next question" And I press "Next question"
And wait for the page to be loaded And wait for the page to be loaded
And I press "End test" And I press "End test"
And wait for the page to be loaded
Then I should see "Score for the test: 190 / 190" Then I should see "Score for the test: 190 / 190"
And I should see the table "#category_results": And I should see the table "#category_results":
| Categories | Absolute score | Relative score | | Categories | Absolute score | Relative score |

@ -48,8 +48,6 @@ Feature: LP tool
Then I should see "LP 1" Then I should see "LP 1"
And I should see "Document 1" And I should see "Document 1"
And I should see "Exercise 1" And I should see "Exercise 1"
And I am on "/main/lp/lp_controller.php?cid=1&action=list"
Then I should see "LP 1"
# Scenario: Check the PDF export in LP list if hide SCORM PDF link is false # Scenario: Check the PDF export in LP list if hide SCORM PDF link is false
# Given I am on "/main/admin/settings.php?category=Course" # Given I am on "/main/admin/settings.php?category=Course"
@ -65,19 +63,25 @@ Feature: LP tool
# And I am on "/main/lp/lp_controller.php?cid=1&action=list&isStudentView=true" # And I am on "/main/lp/lp_controller.php?cid=1&action=list&isStudentView=true"
# Then I should not see an icon with title "Export to PDF" # Then I should not see an icon with title "Export to PDF"
Scenario: LP exists and LP category exists # Scenario: LP exists and LP category exists
And I am on "/main/lp/lp_controller.php?cid=1&sid=0&gidReq=0&gradebook=0&origin=" # Given I am on course "TEMP" homepage
Then I should see "LP 1" # Then I should see "Learning path"
And I should see "LP category 1" # Then I am on "/main/lp/lp_controller.php?cidReq=TEMP"
# Then I should see "LP 1"
Scenario: Delete a LP # And I should see "LP category 1"
Given I am on "/main/lp/lp_controller.php?cid=1"
And I follow "Delete"
And I confirm the popup
Then I should not see "LP 1"
Scenario: Delete a LP category # Scenario: Delete a LP
Given I am on "/main/lp/lp_controller.php?cid=1" # Given I am not logged
Then I should see "LP category 1" # And I am a platform administrator
And I follow "Delete" # And I am on course "TEMP" homepage
Then I should see "Deleted" # And I am on "/main/lp/lp_controller.php?cid=1&action=list"
# Then I should see "LP category 1"
# And I follow "Delete"
# And I confirm the popup
# Then I should not see "LP 1"
#
# Scenario: Delete a LP category
# Given I am on "/main/lp/lp_controller.php?cid=1"
# Then I should see "LP category 1"
# And I follow "Delete"
# Then I should see "Deleted"

Loading…
Cancel
Save