Commit b1b99737 authored by Steven Spinelli's avatar Steven Spinelli Committed by Robert Lyon
Browse files

Behat: Bug 1829290 Adding expiry date column in user CSV uploads

Change-Id: Ic8c04d884b410253c75421351ffb7346e98b95de
parent 513d37c0
......@@ -14,7 +14,7 @@ Background:
| username | password | email | firstname | lastname | institution | authname | role |
| StaffA | Kupuh1pa! | StaffA@example.com | Alexei | Staff | instone | internal | staff |
Scenario: Admin to add an user (Bug 1703721)
Scenario: Admin to add an user (Bug 1703721)
Given I log in as "admin" with password "Kupuh1pa!"
And I choose "Add user" in "People" from administration menu
And I set the following fields to these values:
......@@ -34,7 +34,7 @@ Background:
Then I should see "New user account created successfully"
And I expand "Institution settings - Institution One" node
And the field "Institution administrator" matches value "1"
#Login as Institution admin
# Login as Institution admin
And I should see "Log in as this user"
And I scroll to the top
And I follow "Log in as this user"
......@@ -47,29 +47,29 @@ Background:
And I click on "Show administration menu"
And I should see "Groups" in the "Administration menu" property
And I should not see "Extensions" in the "Administration menu" property
#Checking multiple journals
# Checking multiple journals
And I choose "Journals" in "Create" from main menu
And I should see "Create journal"
And I log out
# Test for logout confirmation
And I should see "You have been logged out successfully"
#login as staff user
# Login as staff user
Given I log in as "StaffA" with password "Kupuh1pa!"
And I click on "Show administration menu"
And I should see "Reports" in the "Administration menu" property
And I should not see "Groups" in the "Administration menu" property
#Site admin role already tested in menu_navigation.feature file
# Site admin role already tested in menu_navigation.feature file
Scenario: Create users by csv (Bug 1426983)
Given I log in as "admin" with password "Kupuh1pa!"
#Adding 50 Users by csv
# Adding 50 Users by csv
And I choose "Add users by CSV" in "People" from administration menu
And I attach the file "50users_new.csv" to "CSV file"
And I select "Institution One" from "uploadcsv_authinstance"
And I press "Add users by CSV"
Then I should see "Your CSV file was processed successfully"
And I should see "New users added: 50."
#Upload 20 users by csv by choosing the switch update users
# Upload 20 users by csv by choosing the switch update users
And I choose "Add users by CSV" in "People" from administration menu
And I attach the file "20users_update.csv" to "CSV file"
And I select "Institution One" from "uploadcsv_authinstance"
......@@ -78,7 +78,7 @@ Scenario: Create users by csv (Bug 1426983)
Then I should see "Your CSV file was processed successfully"
And I should see "Users updated: 20."
And I log out
#Check that we update the fields, password change and email recieved
# Check that we update the fields, password change and email recieved
Given I log in as "user0005" with password "cH@ngeme3"
And I should see "You are required to change your password before you can proceed."
And I fill in "New password" with "dr@Gon123"
......@@ -95,12 +95,42 @@ Scenario: Create users by csv (Bug 1426983)
And I follow "General"
And the "Occupation" field should contain "Hairdresser"
And I log out
#login back as admin
# Login back as admin
Given I log in as "admin" with password "Kupuh1pa!"
And I choose "User search" in "People" from administration menu
# Check that we can delete a user after upload (Bug #1558864)
# Check that we can delete a user after upload (Bug #1558864)
And I follow "user0005"
And I follow "Suspend or delete this user"
And I scroll to the id "delete"
And I press and confirm "Delete user"
And I should see "User deleted successfully"
Scenario: Check for error messages for the following expiry dates when uploading users via CSV
a) expire date used is in the past
b) expire date is wrong format
Given I log in as "admin" with password "Kupuh1pa!"
# Adding 7 Users by csv with expiry date errors
And I choose "Add users by CSV" in "Users" from administration menu
And I attach the file "7usersnew-errors.csv" to "CSV file"
And I select "Institution One" from "uploadcsv_authinstance"
And I press "Add users by CSV"
Then I should see "There was an error with submitting this form. Please check the marked fields and try again."
And I should see "Error on line 2: The expiry \"today\" cannot be in the past."
And I should see "Error on line 3: The expiry \"2025-01--30\" is invalid. Please use a valid date format."
And I should see "Error on line 4: The expiry \"2025/01-29\" is invalid. Please use a valid date format."
And I should see "Error on line 5: The expiry \"Marych 27, 2025\" is invalid. Please use a valid date format."
Scenario: Adding user using different expiry date formats via CSV upload
a) 2025-01-30 (Dashes)
b) 2025/01/29 (forward slash)
c) March 27, 2025 (month written full)
d) 20-JUN-2025 (month abbv)
e) Thu, May 8, 25 (day abbv and month written full)
Given I log in as "admin" with password "Kupuh1pa!"
# Adding 7 Users by csv with corrected expiry date formats
And I choose "Add users by CSV" in "Users" from administration menu
And I attach the file "7usersnew-correctdates.csv" to "CSV file"
And I select "Institution One" from "uploadcsv_authinstance"
And I press "Add users by CSV"
Then I should see "Your CSV file was processed successfully."
And I should see "New users added: 6."
username,password,email,firstname,lastname,expiry
user0001,cH@ngeme1,user1@example.org,User0001,User0001,"tomorrow"
user0002,cH@ngeme1,user2@example.org,User0002,User0002,2025-01-30
user0003,cH@ngeme2,user3@example.org,User0003,User0003,2025/01/29
user0004,cH@ngeme2,user4@example.org,User0004,User0004,"March 27, 2025"
user0005,cH@ngeme3,user5@example.org,User0005,User0005,05/08/25
user0006,cH@ngeme3,user6@example.org,User0006,User0006,"Wed, May 8, 25"
username,password,email,firstname,lastname,expiry
user0001,cH@ngeme1,user1@example.org,User0001,User0001,"today"
user0002,cH@ngeme1,user2@example.org,User0002,User0002,2025-01--30
user0003,cH@ngeme2,user3@example.org,User0003,User0003,2025/01-29
user0004,cH@ngeme2,user4@example.org,User0004,User0004,"Marych 27, 2025"
user0005,cH@ngeme3,user5@example.org,User0005,User0005,26-JUN-2025
user0006,cH@ngeme3,user6@example.org,User0006,User0006,"Thu, May 8, 25"
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment