diff --git a/features/delete_image_in_document.feature b/features/delete_image_in_document.feature new file mode 100644 index 00000000..0fa04c43 --- /dev/null +++ b/features/delete_image_in_document.feature @@ -0,0 +1,12 @@ +#language: fr + +Fonctionnalité: Supprimer une image d'une glose + + Scénario: dont on est l'auteur + + Soit un document dont je suis l'auteur affiché comme glose + Et une session active avec mon compte + Et une image "architecture.png" dans une glose + Quand j'essaye de supprimer l'image "architecture.png" d'une glose + Alors je ne vois pas l'image "architecture.png" + \ No newline at end of file diff --git a/features/step_definitions/context.rb b/features/step_definitions/context.rb index bd0aa04a..55e88868 100644 --- a/features/step_definitions/context.rb +++ b/features/step_definitions/context.rb @@ -134,3 +134,7 @@ Soit("un document que l'on consulte") do visit '/146e6e8442f0405b721b79357d00d0a1' end + +Soit ("une image {string} dans une glose") do |image_name| + attach_file("image-input", File.expand_path("./docs/#{image_name}"), make_visible: true) +end \ No newline at end of file diff --git a/features/step_definitions/event.rb b/features/step_definitions/event.rb index ff75c1df..bd7d7bee 100644 --- a/features/step_definitions/event.rb +++ b/features/step_definitions/event.rb @@ -90,3 +90,12 @@ click_on_icon('typeIcon') fill_element('#searchType', type) end + +Quand("j'essaye de supprimer l'image {string} d'une glose") do |image_name| + image = find('img[alt="' + image_name + '"]') + delete_button = image.find(:xpath, 'following-sibling::button[contains(@class, "delete-image")]') + delete_button.click + popup = find('#confirmation-popup', visible: true) + yes_button = popup.find('button.confirm-yes') + yes_button.click +end \ No newline at end of file diff --git a/features/step_definitions/outcome.rb b/features/step_definitions/outcome.rb index 235ddd15..1dd3d2c2 100644 --- a/features/step_definitions/outcome.rb +++ b/features/step_definitions/outcome.rb @@ -106,3 +106,6 @@ expect(find('.list-group')).not_to have_content "Ethnography/Interview" end +Alors("je ne vois pas l'image {string}") do |image_name| + expect(page) +end