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
- sed -i "s/APP_ENV='dev'/APP_ENV='test'/g" .env.local
- cd tests/behat
- ../../vendor/behat/behat/bin/behat features/adminFillUsers.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/class.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_user_registration.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/extraFieldUser.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/registration.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/socialGroup.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/toolAgenda.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/toolExercise.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/toolLink.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/adminFillUsers.feature -vv
# - ../../vendor/behat/behat/bin/behat features/adminSettings.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/companyReports.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/createUser.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/profile.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/sessionAccess.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/systemAnnouncements.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/toolAnnouncement.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/toolForum.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/toolLp.feature -v
# - ../../vendor/behat/behat/bin/behat features/toolWork.feature -v
after_failure:
- sudo cat /var/log/apache2/error.log

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

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

@ -4,18 +4,18 @@ Feature: Users management as admin
As an administrator
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
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"
Scenario: See the user creation link on the admin page
Given I am a platform administrator
And I am on "/main/admin/index.php"
Then I should see "Add a user"
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 fill in the following:
| firstname | Sammy |
@ -23,9 +23,34 @@ Feature: Users management as admin
| email | smarshall@example.com |
| username | smarshall |
| password | smarshall |
And I check the "#send_mail_no" radio button selector
And I press "submit"
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
Given I am a platform administrator
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"
Scenario: Create a HRM user
Given I am a platform administrator
And I am on "/main/admin/user_add.php"
And I fill in the following:
| firstname | HRM firstname|
@ -44,12 +68,12 @@ Feature: Users management as admin
| email | hrm@example.com |
| username | 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 press "submit"
Then I should see "The user has been added"
Scenario: Create a teacher user
Given I am a platform administrator
And I am on "/main/admin/user_add.php"
And I fill in the following:
| firstname | teacher firstname|
@ -58,11 +82,11 @@ Feature: Users management as admin
| username | teacher |
| password | teacher |
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"
Then I should see "The user has been added"
Scenario: Create a student user
Given I am a platform administrator
And I am on "/main/admin/user_add.php"
And I fill in the following:
| firstname | student firstname|
@ -71,11 +95,11 @@ Feature: Users management as admin
| username | student |
| password | student |
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"
Then I should see "The user has been added"
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 should see "HRM lastname"
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"
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 should see "HRM lastname"
And I should see "Human Resources Manager"

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

@ -48,8 +48,6 @@ Feature: LP tool
Then I should see "LP 1"
And I should see "Document 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
# 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"
# Then I should not see an icon with title "Export to PDF"
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="
Then I should see "LP 1"
And I should see "LP category 1"
Scenario: Delete a LP
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: LP exists and LP category exists
# Given I am on course "TEMP" homepage
# Then I should see "Learning path"
# Then I am on "/main/lp/lp_controller.php?cidReq=TEMP"
# Then I should see "LP 1"
# And I should see "LP category 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"
# Scenario: Delete a LP
# Given I am not logged
# And I am a platform administrator
# And I am on course "TEMP" homepage
# 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