Skip to content

Commit a1113cf

Browse files
committed
TEST : Delete a picture from a document (see #187)
Co-Authored-By: Fabien Petit<[email protected]>
1 parent 396f31f commit a1113cf

File tree

3 files changed

+14
-5
lines changed

3 files changed

+14
-5
lines changed

features/step_definitions/context.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,3 +131,7 @@
131131
Soit("un document que l'on consulte") do
132132
visit '/146e6e8442f0405b721b79357d00d0a1'
133133
end
134+
135+
Soit ("une image {string} dans une glose") do |image_name|
136+
attach_file("image-input", File.expand_path("./docs/#{image_name}"), make_visible: true)
137+
end

features/step_definitions/event.rb

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,11 @@
6060
attach_file("image-input", File.expand_path("./docs/#{image_name}"), make_visible: true)
6161
end
6262

63-
Quand("j'essaye de supprimer une image d'une glose") do
64-
pending # Write code here that turns the phrase above into concrete actions
65-
end
63+
Quand("j'essaye de supprimer l'image {string} d'une glose") do |image_name|
64+
image = find('img[alt="' + image_name + '"]')
65+
delete_button = image.find(:xpath, 'following-sibling::button[contains(@class, "delete-image")]')
66+
delete_button.click
67+
popup = find('#confirmation-popup', visible: true)
68+
yes_button = popup.find('button.confirm-yes')
69+
yes_button.click
70+
end

features/step_definitions/outcome.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,6 @@
8787
expect(page).not_to have_content(title)
8888
end
8989

90-
Alors("l'image disparait dans la glose") do
91-
pending
90+
Alors("je ne vois pas l'image {string}") do |image_name|
91+
expect(page)
9292
end

0 commit comments

Comments
 (0)