-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Digital Object delete #55
Open
kdimopulu
wants to merge
2
commits into
master
Choose a base branch
from
digital_object_delete
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+101
−6
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
staff_features/digital_objects/digital_object_delete.feature
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
Feature: Digital Object Delete | ||
Background: | ||
Given an administrator user is logged in | ||
And a Digital Object has been created | ||
Scenario: Digital Object is deleted from the search results | ||
When the user clicks on 'Browse' | ||
And the user clicks on 'Digital Objects' | ||
And the user filters by text with the Digital Object title | ||
And the user checks the checkbox of the Digital Object | ||
And the user clicks on 'Delete' | ||
And the user clicks on 'Delete Records' | ||
Then the 'Records' deleted message is displayed | ||
And the Digital Object is deleted | ||
Scenario: Digital Object is deleted from the view page | ||
Given the user is on the Digital Object view page | ||
When the user clicks on 'Delete' | ||
And the user clicks on 'Delete' in the modal | ||
Then the Digital Objects page is displayed | ||
And the 'Digital Object' deleted message is displayed | ||
And the Digital Object is deleted | ||
Scenario: Cancel Digital Object delete from the view page | ||
Given the user is on the Digital Object view page | ||
When the user clicks on 'Delete' | ||
And the user clicks on 'Cancel' | ||
Then the user is still on the Digital Object view page | ||
Scenario: Digital Object is deleted from the edit page | ||
Given the user is on the Digital Object edit page | ||
When the user clicks on 'Delete' | ||
And the user clicks on 'Delete' in the modal | ||
Then the Digital Objects page is displayed | ||
And the 'Digital Object' deleted message is displayed | ||
And the Digital Object is deleted |
16 changes: 16 additions & 0 deletions
16
staff_features/digital_objects/step_definitions/digital_object_delete.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# frozen_string_literal: true | ||
|
||
When 'the user checks the checkbox of the Digital Object' do | ||
find('#multiselect-item').check | ||
end | ||
|
||
Then 'the Digital Object is deleted' do | ||
expect(@digital_object_id).to_not eq nil | ||
|
||
visit "#{STAFF_URL}/digital_objects/#{@digital_object_id}/edit" | ||
|
||
expect(find('h2').text).to eq 'Record Not Found' | ||
|
||
expected_text = "The record you've tried to access may no longer exist or you may not have permission to view it." | ||
expect(page).to have_text expected_text | ||
end |
53 changes: 53 additions & 0 deletions
53
staff_features/digital_objects/step_definitions/digital_object_shared.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# frozen_string_literal: true | ||
|
||
Given 'a Digital Object has been created' do | ||
visit "#{STAFF_URL}/digital_objects/new" | ||
|
||
fill_in 'digital_object_digital_object_id_', with: "Digital Object Identifier #{@uuid}" | ||
fill_in 'digital_object_title_', with: "Digital Object Title #{@uuid}" | ||
|
||
click_on 'Save' | ||
|
||
wait_for_ajax | ||
expect(find('.alert.alert-success.with-hide-alert').text).to have_text "Digital Object Digital Object Title #{@uuid} Created" | ||
@digital_object_id = current_url.split('::digital_object_').pop | ||
end | ||
|
||
When 'the user filters by text with the Digital Object title' do | ||
fill_in 'Filter by text', with: "Digital Object Identifier #{@uuid}" | ||
|
||
find('#filter-text').send_keys(:enter) | ||
|
||
rows = [] | ||
checks = 0 | ||
|
||
while checks < 5 | ||
checks += 1 | ||
|
||
begin | ||
rows = all('tr', text: @uuid) | ||
rescue Selenium::WebDriver::Error::JavascriptError | ||
sleep 1 | ||
end | ||
|
||
break if rows.length == 1 | ||
end | ||
end | ||
|
||
Given 'the user is on the Digital Object view page' do | ||
visit "#{STAFF_URL}/digital_objects/#{@digital_object_id}" | ||
end | ||
|
||
Given 'the user is on the Digital Object edit page' do | ||
visit "#{STAFF_URL}/digital_objects/#{@digital_object_id}/edit" | ||
end | ||
|
||
Then 'the Digital Objects page is displayed' do | ||
expect(find('h2').text).to have_text 'Digital Objects' | ||
expect(current_url).to include "#{STAFF_URL}/digital_objects" | ||
end | ||
|
||
Then 'the user is still on the Digital Object view page' do | ||
expect(find('h2').text).to eq "Digital Object Title #{@uuid} Digital Object" | ||
expect(current_url).to include "#{STAFF_URL}/digital_objects/#{@digital_object_id}" | ||
end |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you finding that
wait_for_ajax
is actually necessary here? It probably doesn't hurt (other than the time taken bysleep
), but there shouldn't be any AJAX stuff going on here as theSave
button just does a standard form submit.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When you click on
Save
, the page reloads and then you are in the digital object edit page, which loads the edit form by doing a request atdigital_objects/20/edit?inline=true
. After thewait_for_ajax
, we are expecting a success message, which is part of this inline form.Running this test locally, seems to always succeed without
wait_for_ajax
, but we have experienced failing tests in similar occasions, that is why it is used here.