From 05b981f471c995cceda99cfa06e030a0d545f720 Mon Sep 17 00:00:00 2001 From: blacksmith-welder Date: Sat, 7 Sep 2024 18:53:59 +0300 Subject: [PATCH] Third person step names (#10) --- .../accessions/accession_create.feature | 6 +-- .../accessions/accession_delete.feature | 20 +++++----- .../accessions/accessions_search.feature | 14 +++---- .../step_definitions/accession_create.rb | 6 +-- .../step_definitions/accession_delete.rb | 6 +-- .../step_definitions/accessions_search.rb | 6 +-- .../digital_object_create.feature | 14 +++---- .../digital-objects/digital_object_create.rb | 6 +-- .../repositories/repository_create.feature | 18 ++++----- .../repositories/repository_create.rb | 4 +- .../update_basic_information.feature | 22 +++++------ .../resources/update_basic_information.rb | 12 +++--- staff-features/shared/step_definitions.rb | 38 +++++++++---------- staff-features/users/user_create.feature | 22 +++++------ staff-features/users/user_create.rb | 10 ++--- 15 files changed, 100 insertions(+), 104 deletions(-) diff --git a/staff-features/accessions/accession_create.feature b/staff-features/accessions/accession_create.feature index aaf1ca1c..58db21d0 100644 --- a/staff-features/accessions/accession_create.feature +++ b/staff-features/accessions/accession_create.feature @@ -1,13 +1,13 @@ Feature: Accession Create Background: - Given I am logged in as an admin user + Given the user is logged in as an administrator Scenario: Accession is created - Given I am on the New Accession page + Given the user is on the New Accession page When the user fills in all the required fields When the user clicks on Save Then a new accession is created Scenario: Accession is not created - Given I am on the New Accession page + Given the user is on the New Accession page When the user does not fill in all the required fields When the user clicks on Save Then a new accession is not created diff --git a/staff-features/accessions/accession_delete.feature b/staff-features/accessions/accession_delete.feature index a7e9433a..c1082d40 100644 --- a/staff-features/accessions/accession_delete.feature +++ b/staff-features/accessions/accession_delete.feature @@ -1,23 +1,23 @@ Feature: Accession Delete Background: - Given I am logged in as an admin user + Given the user is logged in as an administrator Scenario: Accession is deleted from the search results Given an accession has been created And the accession is in the search results - When I click on the checkbox of the accession - And I click on Delete - And I click on Delete Records + When the user clicks on the checkbox of the accession + And the user clicks on Delete + And the user clicks on Delete Records And the message "Records deleted" is displayed And the message "No records found" is displayed Scenario: Accession is deleted from the view page Given an accession has been created - And I am in the accession details page - When I click on Delete - And I confirm the delete action + And the user is on the accession details page + When the user clicks on Delete + And the user confirms the delete action Then the accession is deleted Scenario: Cancel accession delete from the view page Given an accession has been created - And I am in the accession details page - When I click on Delete - When I click on Cancel + And the user is on the accession details page + When the user clicks on Delete + When the user clicks on Cancel Then the accession is not deleted diff --git a/staff-features/accessions/accessions_search.feature b/staff-features/accessions/accessions_search.feature index e699aaea..f30cf2c3 100644 --- a/staff-features/accessions/accessions_search.feature +++ b/staff-features/accessions/accessions_search.feature @@ -1,19 +1,19 @@ Feature: Accessions Search Background: - Given I am logged in as an admin user + Given the user is logged in as an administrator Scenario: Search accession by title Given an accession has been created - When I click on Browse - And I click on Accessions - And I search for the accession title + When the user clicks on Browse + And the user clicks on Accessions + And the user searches for the accession title Then the accession is in the search results Scenario: Sort accessions by title Given two accessions have been created And the accessions are on the search results sorted by ascending title - When I click on Title + When the user clicks on Title Then the accessions are sorted by descending title Scenario: View accession Given an accession has been created When the accession is in the search results - And I click on the View button - Then I can view the accession details page + And the user clicks on the View button + Then the user can view the accession details page diff --git a/staff-features/accessions/step_definitions/accession_create.rb b/staff-features/accessions/step_definitions/accession_create.rb index dfbd2b28..bcc4a045 100644 --- a/staff-features/accessions/step_definitions/accession_create.rb +++ b/staff-features/accessions/step_definitions/accession_create.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -Given('I am on the New Accession page') do +Given('the user is on the New Accession page') do @uuid = SecureRandom.uuid click_on 'Create' @@ -15,10 +15,6 @@ fill_in 'accession_id_0_', with: '' end -When('the user clicks on Save') do - click_button 'Save' -end - Then('a new accession is created') do expect(find('h2').text).to eq "Accession #{@uuid} Accession" expect(find('.alert.alert-success.with-hide-alert').text).to eq 'Accession created' diff --git a/staff-features/accessions/step_definitions/accession_delete.rb b/staff-features/accessions/step_definitions/accession_delete.rb index 53d390bd..44f0b8ee 100644 --- a/staff-features/accessions/step_definitions/accession_delete.rb +++ b/staff-features/accessions/step_definitions/accession_delete.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -Given 'I am in the accession details page' do +Given 'the user is on the accession details page' do visit "#{STAFF_URL}/accessions" fill_in 'filter-text', with: @uuid @@ -16,7 +16,7 @@ end end -When 'I click on the checkbox of the accession' do +When 'the user clicks on the checkbox of the accession' do table_row = find('tr', text: @uuid, match: :first) within table_row do @@ -24,7 +24,7 @@ end end -When 'I confirm the delete action' do +When 'the user confirms the delete action' do within '#confirmChangesModal' do click_on 'Delete' end diff --git a/staff-features/accessions/step_definitions/accessions_search.rb b/staff-features/accessions/step_definitions/accessions_search.rb index d5d9a8d4..b36277f7 100644 --- a/staff-features/accessions/step_definitions/accessions_search.rb +++ b/staff-features/accessions/step_definitions/accessions_search.rb @@ -8,7 +8,7 @@ click_on 'Save' end -When 'I search for the accession title' do +When 'the user searches for the accession title' do fill_in 'filter-text', with: @uuid within '.search-filter' do @@ -26,7 +26,7 @@ end end -When 'I click on the View button' do +When 'the user clicks on the View button' do table_row = find('tr', text: @uuid, match: :first) within table_row do @@ -34,7 +34,7 @@ end end -Then 'I can view the accession details page' do +Then 'the user can view the accession details page' do title = find('h2') expect(title.text).to eq "Accession #{@uuid} Accession" diff --git a/staff-features/digital-objects/digital_object_create.feature b/staff-features/digital-objects/digital_object_create.feature index b9406110..f300612e 100644 --- a/staff-features/digital-objects/digital_object_create.feature +++ b/staff-features/digital-objects/digital_object_create.feature @@ -1,15 +1,15 @@ Feature: Create Digital Object Background: - Given I am logged in as an admin user + Given the user is logged in as an administrator Scenario: Digital Object is created - Given I am on the New Digital Object page - When I fill in Title with a unique id - And I fill in Identifier with a unique id - And I click on Save + Given the user is on the New Digital Object page + When the user fills in Title with a unique id + And the user fills in Identifier with a unique id + And the user clicks on Save Then the digital object is created Scenario: Digital Object is not created because required fields are missing - Given I am on the New Digital Object page - When I click on Save + Given the user is on the New Digital Object page + When the user clicks on Save Then the following error messages are displayed: | Title - Property is required but was missing | | Identifier - Property is required but was missing | diff --git a/staff-features/digital-objects/digital_object_create.rb b/staff-features/digital-objects/digital_object_create.rb index f95eb411..7380605a 100644 --- a/staff-features/digital-objects/digital_object_create.rb +++ b/staff-features/digital-objects/digital_object_create.rb @@ -1,16 +1,16 @@ # frozen_string_literal: true -Given('I am on the New Digital Object page') do +Given('the user is on the New Digital Object page') do @uuid = SecureRandom.uuid visit "#{STAFF_URL}/digital_objects/new" end -When('I fill in Title with a unique id') do +When('the user fills in Title with a unique id') do fill_in 'Title', with: "Digital Object Title #{@uuid}" end -When('I fill in Identifier with a unique id') do +When('the user fills in Identifier with a unique id') do fill_in 'Identifier', with: @uuid end diff --git a/staff-features/repositories/repository_create.feature b/staff-features/repositories/repository_create.feature index d3e32884..466a43d2 100644 --- a/staff-features/repositories/repository_create.feature +++ b/staff-features/repositories/repository_create.feature @@ -1,15 +1,15 @@ Feature: Create repository Scenario: Repository is created from an admin user - Given I am logged in as an admin user - When I click on System - And I click on Manage Repositories - And I click on Create Repository - And I fill in the Repository Short Name - And I fill in the Repository Name - And I click on Save + Given the user is logged in as an administrator + When the user clicks on System + And the user clicks on Manage Repositories + And the user clicks on Create Repository + And the user fills in the Repository Short Name + And the user fills in the Repository Name + And the user clicks on Save Then the message "Repository Created" is displayed And the repository is created Scenario: Repository is not created from a view-only user - Given I am logged in as a view-only user - When I click on System + Given the user is logged in as a view-only user + When the user clicks on System Then the Manage Repositories button should not be in the dropdown menu diff --git a/staff-features/repositories/repository_create.rb b/staff-features/repositories/repository_create.rb index c79141ac..0af0388b 100644 --- a/staff-features/repositories/repository_create.rb +++ b/staff-features/repositories/repository_create.rb @@ -1,12 +1,12 @@ # frozen_string_literal: true -When 'I fill in the Repository Short Name' do +When 'the user fills in the Repository Short Name' do @uuid = SecureRandom.uuid fill_in 'Repository Short Name', with: "Repository Short Name #{@uuid}" end -When 'I fill in the Repository Name' do +When 'the user fills in the Repository Name' do @uuid = SecureRandom.uuid fill_in 'Repository Name', with: "Repository Name #{@uuid}" diff --git a/staff-features/resources/update_basic_information.feature b/staff-features/resources/update_basic_information.feature index be9aca8e..0478f077 100644 --- a/staff-features/resources/update_basic_information.feature +++ b/staff-features/resources/update_basic_information.feature @@ -1,23 +1,23 @@ Feature: Update Resource Basic Information Background: - Given I am logged in as an admin user + Given the user is logged in as an administrator Given a resource has been created Scenario: Successfully update resource basic information - Given I am on the resource edit page - When I select "Records" from "Resource Type" - When I check Publish? - When I check Restrictions Apply? - When I fill in Repository Processing Note with "Repository Processing Note" - When I click on Save Resource + Given the user is on the resource edit page + When the user selects "Records" from "Resource Type" + When the user checks Publish? + When the user checks Restrictions Apply? + When the user fills in Repository Processing Note with "Repository Processing Note" + When the user clicks on Save Resource Then the resource is updated Then Resource Type has value Records Then Publish? is checked Then Restrictions Apply? is checked Then Repository Processing Note has value "Repository Processing Note" Scenario: Revert changes - Given I am on the resource edit page - When I change the resource Title - When I change the resource Identifier - When I click on Revert Changes + Given the user is on the resource edit page + When the user changes the resource Title + When the user changes the resource Identifier + When the user clicks on Revert Changes Then the resource Title does not change Then the resource Identifier does not change diff --git a/staff-features/resources/update_basic_information.rb b/staff-features/resources/update_basic_information.rb index bba541f4..393106d3 100644 --- a/staff-features/resources/update_basic_information.rb +++ b/staff-features/resources/update_basic_information.rb @@ -8,29 +8,29 @@ create_resource(@uuid) end -Given 'I am on the resource edit page' do +Given 'the user is on the resource edit page' do search(@uuid) click_on 'Edit' end -When 'I check Publish?' do +When 'the user checks Publish?' do find('#resource_publish_').check end -When 'I check Restrictions Apply?' do +When 'the user checks Restrictions Apply?' do find('#resource_restrictions_').check end -When 'I fill in Repository Processing Note with {string}' do |value| +When 'the user fills in Repository Processing Note with {string}' do |value| fill_in 'Repository Processing Note', with: value end -When 'I change the resource Title' do +When 'the user changes the resource Title' do fill_in 'resource_title_', with: 'Resource title chagned' end -When 'I change the resource Identifier' do +When 'the user changes the resource Identifier' do fill_in 'resource_id_0_', with: 'Resource identifier chagned' end diff --git a/staff-features/shared/step_definitions.rb b/staff-features/shared/step_definitions.rb index ff9ab670..5e3a35ff 100644 --- a/staff-features/shared/step_definitions.rb +++ b/staff-features/shared/step_definitions.rb @@ -1,10 +1,10 @@ # frozen_string_literal: true -Given 'I am logged in as an admin user' do +Given 'the user is logged in as an administrator' do login_admin end -Given 'I am logged in as a view-only user' do +Given 'the user is logged in as a view-only user' do @uuid = SecureRandom.uuid visit "#{STAFF_URL}/logout" @@ -40,71 +40,71 @@ click_on 'Sign In' end -When 'I click on Delete' do +When 'the user clicks on Delete' do click_on_string 'Delete' end -When 'I click on Cancel' do +When 'the user clicks on Cancel' do click_on_string 'Cancel' end -When 'I click on Delete Records' do +When 'the user clicks on Delete Records' do click_on_string 'Delete Records' end -When 'I click on Browse' do +When 'the user clicks on Browse' do click_on_string 'Browse' end -When 'I click on Accessions' do +When 'the user clicks on Accessions' do click_on_string 'Accessions' end -When 'I click on System' do +When 'the user clicks on System' do click_on_string 'System' end -When 'I click on Manage Repositories' do +When 'the user clicks on Manage Repositories' do click_on_string 'Manage Repositories' end -When 'I click on Create Repository' do +When 'the user clicks on Create Repository' do click_on_string 'Create Repository' end -When 'I click on Save' do +When 'the user clicks on Save' do click_on_string 'Save' end -When 'I click on Save Resource' do +When 'the user clicks on Save Resource' do click_on_string 'Save Resource' end -When 'I click on Revert Changes' do +When 'the user clicks on Revert Changes' do click_on_string 'Revert Changes' end -When 'I click on Create User' do +When 'the user clicks on Create User' do click_on_string 'Create User' end -When 'I click on Create Account' do +When 'the user clicks on Create Account' do click_on_string 'Create Account' end -When 'I click on Title' do +When 'the user clicks on Title' do click_on_string 'Title' end -When 'I fill in {string} with {string}' do |label, value| +When 'the user fills in {string} with {string}' do |label, value| fill_in label, with: value end -When 'I fill in {string} with {string}' do |label, value| +When 'the user fills in {string} with {string}' do |label, value| fill_in label, with: value end -When 'I select {string} from {string}' do |option, label| +When 'the user selects {string} from {string}' do |option, label| select option, from: label end diff --git a/staff-features/users/user_create.feature b/staff-features/users/user_create.feature index 8fde8a49..04bb69bb 100644 --- a/staff-features/users/user_create.feature +++ b/staff-features/users/user_create.feature @@ -1,20 +1,20 @@ Feature: Create User Background: - Given I am logged in as an admin user + Given the user is logged in as an administrator Scenario: User is created - Given I am on the Manage Users page - When I click on Create User - And I fill in the Username - And I fill in the Full name - And I fill in the Password - And I fill in the Confirm password - And I click on Create Account + Given the user is on the Manage Users page + When the user clicks on Create User + And the user fills in the Username + And the user fills in the Full name + And the user fills in the Password + And the user fills in the Confirm password + And the user clicks on Create Account Then the message "User Created" is displayed And the new user should appear in the search results Scenario: User is not created because required fields are missing - Given I am on the Manage Users page - When I click on Create User - And I click on Create Account + Given the user is on the Manage Users page + When the user clicks on Create User + And the user clicks on Create Account Then the following error messages are displayed: | Username - can't be empty | | Full name - Property is required but was missing | diff --git a/staff-features/users/user_create.rb b/staff-features/users/user_create.rb index 19422da4..2d62a526 100644 --- a/staff-features/users/user_create.rb +++ b/staff-features/users/user_create.rb @@ -1,25 +1,25 @@ # frozen_string_literal: true -Given 'I am on the Manage Users page' do +Given 'the user is on the Manage Users page' do click_on 'System' click_on 'Manage Users' end -When 'I fill in the Username' do +When 'the user fills in the Username' do @uuid = SecureRandom.uuid fill_in 'Username', with: "Username #{@uuid}" end -When 'I fill in the Full name' do +When 'the user fills in the Full name' do fill_in 'Full name', with: "Full name #{@uuid}" end -When 'I fill in the Password' do +When 'the user fills in the Password' do fill_in 'Password', with: "password #{@uuid}" end -When 'I fill in the Confirm password' do +When 'the user fills in the Confirm password' do fill_in 'Confirm password', with: "password #{@uuid}" end