File tree Expand file tree Collapse file tree 2 files changed +74
-0
lines changed Expand file tree Collapse file tree 2 files changed +74
-0
lines changed Original file line number Diff line number Diff line change
1
+ Feature : Agent Delete
2
+ Background :
3
+ Given an administrator user is logged in
4
+ And an Agent has been created
5
+ Scenario : Agent is deleted from the search results
6
+ When the user clicks on 'Browse'
7
+ And the user clicks on 'Agents'
8
+ And the user filters by text with the Agent name
9
+ And the user checks the checkbox of the Agent
10
+ And the user clicks on 'Delete'
11
+ And the user clicks on 'Delete Records'
12
+ Then the 'Agents' deleted message is displayed
13
+ And the Agent is deleted
14
+ Scenario : Agent is deleted from the view page
15
+ Given the user is on the Agent view page
16
+ When the user clicks on 'Delete'
17
+ And the user clicks on 'Delete' in the modal
18
+ Then the Agents page is displayed
19
+ And the 'Agent' deleted message is displayed
20
+ And the Agent is deleted
21
+ Scenario : Cancel Agent delete from the view page
22
+ Given the user is on the Agent view page
23
+ When the user clicks on 'Delete'
24
+ And the user clicks on 'Cancel'
25
+ Then the user is still on the Agent view page
Original file line number Diff line number Diff line change
1
+ # frozen_string_literal: true
2
+
3
+ When 'the user filters by text with the Agent name' do
4
+ fill_in 'Filter by text' , with : @uuid
5
+
6
+ find ( '#filter-text' ) . send_keys ( :enter )
7
+
8
+ rows = [ ]
9
+ checks = 0
10
+
11
+ while checks < 5
12
+ checks += 1
13
+
14
+ begin
15
+ rows = all ( 'tr' , text : @uuid )
16
+ rescue Selenium ::WebDriver ::Error ::JavascriptError
17
+ sleep 1
18
+ end
19
+
20
+ break if rows . length == 1
21
+ end
22
+ end
23
+
24
+ When 'the user checks the checkbox of the Agent' do
25
+ find ( '#multiselect-item' ) . check
26
+ end
27
+
28
+ Then 'the Agent is deleted' do
29
+ expect ( @agent_id ) . to_not eq nil
30
+
31
+ visit "#{ STAFF_URL } /agents/agent_person/#{ @agent_id } /edit"
32
+
33
+ expect ( find ( 'h2' ) . text ) . to eq 'Record Not Found'
34
+
35
+ expected_text = "The record you've tried to access may no longer exist or you may not have permission to view it."
36
+ expect ( page ) . to have_text expected_text
37
+ end
38
+
39
+ Given 'the user is on the Agent view page' do
40
+ visit "#{ STAFF_URL } /agents/agent_person/#{ @agent_id } "
41
+ end
42
+
43
+ Then 'the Agents page is displayed' do
44
+ expect ( find ( 'h2' ) . text ) . to have_text 'Agents'
45
+ end
46
+
47
+ Then 'the user is still on the Agent view page' do
48
+ expect ( current_url ) . to include "agents/agent_person/#{ @agent_id } "
49
+ end
You can’t perform that action at this time.
0 commit comments