Skip to content
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

EES-5287 Added retry mechanism to add image to accordion section text… #5107

Merged
merged 5 commits into from
Jul 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ Create Methodology with some content and images
user adds content to accordion section text block Methodology annex section 2 2
... Adding Methodology annex 2 text block 2 ${METHODOLOGY_ANNEXES_EDITABLE_ACCORDION}
user scrolls up 100
user adds image to accordion section text block Methodology annex section 2 2 test-infographic.png
user adds image to accordion section text block with retry Methodology annex section 2 2 test-infographic.png
... Alt text for the uploaded annex image 3 ${METHODOLOGY_ANNEXES_EDITABLE_ACCORDION}

Verify the editable content is as expected
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ Searching
user presses keys pupil absence
user clicks button Search
user checks page contains button pupil absence
user checks radio is checked Relevance
user checks radio is checked Newest
user checks list item contains testid:publicationsList 1 Pupil absence in schools in England

Removing search
Expand Down
43 changes: 43 additions & 0 deletions tests/robot-tests/tests/libs/admin/manage-content-common.robot
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,7 @@ user adds image to accordion section text block
user clicks button Change image text alternative
user enters text into element label:Text alternative ${alt_text}
user clicks element css:button.ck-button-save
sleep 5
user clicks element xpath://div[@title="Insert paragraph after block"]

# wait for the API to save the image and for the src attribute to be updated before continuing
Expand All @@ -447,6 +448,48 @@ user adds image to accordion section text block
user clicks button Save ${block}
user waits until page finishes loading

user adds image to accordion section text block with retry
[Arguments]
... ${section_name}
... ${block_num}
... ${filename}=test-infographic.png
... ${alt_text}=Alt text for ${filename}
... ${parent}=[data-testid="accordion"]
... ${timeout}= %{TIMEOUT}

${block}= user starts editing accordion section text block ${section_name} ${block_num} ${parent}

# If we don't do this, `Insert paragraph after block` circle button on image doesn't appear
user presses keys ${\n}
user presses keys ARROW_UP

choose file
... xpath://button[span[.="Upload image from computer"]]/input[@type="file"]
... ${FILES_DIR}${filename}

user scrolls down 200

user clicks button Change image text alternative
user enters text into element label:Text alternative ${alt_text}
user clicks element css:button.ck-button-save
sleep 2
user scrolls up 100
wait until keyword succeeds ${timeout} 1 sec user clicks element xpath://div[@title="Insert paragraph after block"]

# wait for the API to save the image and for the src attribute to be updated before continuing
user waits until parent contains element ${block}
... xpath://img[starts-with(@src, "/api/") and @alt="${alt_text}"]

# Workaround to remove the eager "All images must have alternative text" validation error that persists
# even after setting the alt text
user presses keys TAB
user presses keys SHIFT+TAB

user clicks button Save ${block}
user waits until page finishes loading

user scrolls up 100

user adds image without alt text to accordion section text block
[Arguments]
... ${section_name}
Expand Down