Skip to content

Commit

Permalink
Update click handler in spec
Browse files Browse the repository at this point in the history
Seeing if this works better.

Some Stack Overflow answers for reference:
https://stackoverflow.com/a/60695813
https://stackoverflow.com/a/52405269
https://stackoverflow.com/a/44916498

Refs: #2872
  • Loading branch information
shaun-technovation committed Aug 2, 2021
1 parent 672f978 commit 3b66779
Showing 1 changed file with 28 additions and 21 deletions.
49 changes: 28 additions & 21 deletions spec/features/judge/scoring_submissions_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@

then_the_review_page_displays_a_perfect_score_of 80
end

private

def given_there_is_a_submission_from_a_junior_team_that_needs_scoring
Expand All @@ -58,49 +59,49 @@ def when_the_judge_starts_a_new_scoring_session
end

def and_scores_the_ideation_section_perfectly
find("#judge-scores-app li.score-question:nth-child(1) li.score-value", text: "5").click()
find("#judge-scores-app li.score-question:nth-child(2) li.score-value", text: "5").click()
find("#judge-scores-app li.score-question:nth-child(3) li.score-value", text: "5").click()
find("#judge-scores-app li.score-question:nth-child(4) li.score-value", text: "5").click()
find("#judge-scores-app li.score-question:nth-child(1) li.score-value", text: "5").click
find("#judge-scores-app li.score-question:nth-child(2) li.score-value", text: "5").click
find("#judge-scores-app li.score-question:nth-child(3) li.score-value", text: "5").click
find("#judge-scores-app li.score-question:nth-child(4) li.score-value", text: "5").click
find("#judge-scores-app textarea").set("Lorem ipsum dolor sit amet consectetur adipiscing elit iaculis suspendisse natoque magna senectus, tempus nulla maecenas rutrum cursus euismod ante cras posuere proin himenaeos. Nisi primis ullamcorper penatibus vivamus dapibus, risus vel lobortis nam sed convallis, velit a cubilia hendrerit.")
end

def and_scores_the_technical_section_perfectly
find("#judge-scores-app a.button.btn-next", text: "Next: Technical", wait: 10).click()
click_next_button("Next: Technical")

find("#judge-scores-app li.score-question:nth-child(1) li.score-value", text: "5").click()
find("#judge-scores-app li.score-question:nth-child(2) li.score-value", text: "5").click()
find("#judge-scores-app li.score-question:nth-child(3) li.score-value", text: "5").click()
find("#judge-scores-app li.score-question:nth-child(4) li.score-value", text: "5").click()
find("#judge-scores-app li.score-question:nth-child(1) li.score-value", text: "5").click
find("#judge-scores-app li.score-question:nth-child(2) li.score-value", text: "5").click
find("#judge-scores-app li.score-question:nth-child(3) li.score-value", text: "5").click
find("#judge-scores-app li.score-question:nth-child(4) li.score-value", text: "5").click
find("#judge-scores-app textarea").set("Lorem ipsum dolor sit amet consectetur adipiscing elit iaculis suspendisse natoque magna senectus, tempus nulla maecenas rutrum cursus euismod ante cras posuere proin himenaeos. Nisi primis ullamcorper penatibus vivamus dapibus, risus vel lobortis nam sed convallis, velit a cubilia hendrerit.")
end

def and_scores_the_pitch_section_perfectly
find("#judge-scores-app a.button.btn-next", text: "Next: Pitch", wait: 10).click()
click_next_button("Next: Pitch")

find("#judge-scores-app li.score-question:nth-child(1) li.score-value", text: "5").click()
find("#judge-scores-app li.score-question:nth-child(2) li.score-value", text: "5").click()
find("#judge-scores-app li.score-question:nth-child(1) li.score-value", text: "5").click
find("#judge-scores-app li.score-question:nth-child(2) li.score-value", text: "5").click
find("#judge-scores-app textarea").set("Lorem ipsum dolor sit amet consectetur adipiscing elit iaculis suspendisse natoque magna senectus, tempus nulla maecenas rutrum cursus euismod ante cras posuere proin himenaeos. Nisi primis ullamcorper penatibus vivamus dapibus, risus vel lobortis nam sed convallis, velit a cubilia hendrerit.")
end

def and_scores_the_entrepreneurship_section_perfectly
find("#judge-scores-app a.button.btn-next", text: "Next: Entrepreneurship").click()
click_next_button("Next: Entrepreneurship")

find("#judge-scores-app li.score-question:nth-child(1) li.score-value", text: "5").click()
find("#judge-scores-app li.score-question:nth-child(2) li.score-value", text: "5").click()
find("#judge-scores-app li.score-question:nth-child(3) li.score-value", text: "5").click()
find("#judge-scores-app li.score-question:nth-child(4) li.score-value", text: "5").click()
find("#judge-scores-app li.score-question:nth-child(1) li.score-value", text: "5").click
find("#judge-scores-app li.score-question:nth-child(2) li.score-value", text: "5").click
find("#judge-scores-app li.score-question:nth-child(3) li.score-value", text: "5").click
find("#judge-scores-app li.score-question:nth-child(4) li.score-value", text: "5").click
find("#judge-scores-app textarea").set("Lorem ipsum dolor sit amet consectetur adipiscing elit iaculis suspendisse natoque magna senectus, tempus nulla maecenas rutrum cursus euismod ante cras posuere proin himenaeos. Nisi primis ullamcorper penatibus vivamus dapibus, risus vel lobortis nam sed convallis, velit a cubilia hendrerit.")
end

def and_scores_the_overall_section_perfectly
find("#judge-scores-app a.button.btn-next", text: "Next: Overall", wait: 10).click()
click_next_button("Next: Overall")

find("#judge-scores-app li.score-question:nth-child(1) li.score-value", text: "5").click()
find("#judge-scores-app li.score-question:nth-child(2) li.score-value", text: "5").click()
find("#judge-scores-app li.score-question:nth-child(1) li.score-value", text: "5").click
find("#judge-scores-app li.score-question:nth-child(2) li.score-value", text: "5").click
find("#judge-scores-app textarea").set("Lorem ipsum dolor sit amet consectetur adipiscing elit iaculis suspendisse natoque magna senectus, tempus nulla maecenas rutrum cursus euismod ante cras posuere proin himenaeos. Nisi primis ullamcorper penatibus vivamus dapibus, risus vel lobortis nam sed convallis, velit a cubilia hendrerit.")

find("#judge-scores-app a.button.btn-next", text: "Next: Review score", wait: 10).click()
click_next_button("Next: Review score")
end

def and_submits_the_score
Expand All @@ -112,4 +113,10 @@ def then_the_review_page_displays_a_perfect_score_of(perfect_score)

expect(page).to have_content("#{perfect_score} / #{perfect_score}")
end

def click_next_button(button_text)
next_button = find("#judge-scores-app a.button.btn-next", text: button_text)

execute_script("arguments[0].click();", next_button)
end
end

0 comments on commit 3b66779

Please sign in to comment.