Skip to content

Commit

Permalink
Refactor application page object
Browse files Browse the repository at this point in the history
This changes the page object to use the summary list object rather than
look for the items directly.
  • Loading branch information
thomasleese committed Sep 5, 2023
1 parent 08a2f80 commit 0f5c5df
Show file tree
Hide file tree
Showing 14 changed files with 45 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,29 @@ class Application < SitePrism::Page

element :add_note_button, ".app-inline-action .govuk-button"

section :overview, "#app-application-overview" do
element :name, "div:nth-of-type(1) > dd:nth-of-type(1)"
element :assessor_name, "div:nth-of-type(7) > dd:nth-of-type(1)"
element :reviewer_name, "div:nth-of-type(8) > dd:nth-of-type(1)"
element :status, "div:nth-of-type(10) > dd:nth-of-type(1)"
end

section :summary_list, GovukSummaryList, ".govuk-summary-list"
section :task_list, TaskList, ".app-task-list"

section :management_tasks, ".app-task-list + .govuk-warning-text" do
elements :links, ".govuk-link"
end

def name_summary
summary_list.find_row(key: "Name")
end

def assessor_summary
summary_list.find_row(key: "Assigned to")
end

def reviewer_summary
summary_list.find_row(key: "Reviewer")
end

def status_summary
summary_list.find_row(key: "Status")
end

def preliminary_check_task
task_list.find_item("Preliminary check (qualifications)")
end
Expand Down
2 changes: 2 additions & 0 deletions spec/support/autoload/page_objects/govuk_summary_list.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module PageObjects
class GovukSummaryList < SitePrism::Section
sections :rows, ".govuk-summary-list__row" do
Expand Down
4 changes: 2 additions & 2 deletions spec/system/assessor_interface/assigning_assessor_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def and_i_select_an_assessor
end

def and_the_assessor_is_assigned_to_the_application_form
expect(assessor_application_page.overview.assessor_name.text).to eq(
expect(assessor_application_page.assessor_summary.value).to have_text(
assessor.name,
)
end
Expand All @@ -66,7 +66,7 @@ def and_i_select_a_reviewer
end

def and_the_assessor_is_assigned_as_reviewer_to_the_application_form
expect(assessor_application_page.overview.reviewer_name.text).to eq(
expect(assessor_application_page.reviewer_summary.value).to have_text(
assessor.name,
)
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def given_there_is_an_application_form_with_professional_standing_request
end

def and_i_see_a_waiting_on_status
expect(assessor_application_page.overview.status.text).to eq(
expect(assessor_application_page.status_summary.value).to have_text(
"WAITING ON PROFESSIONAL STANDING",
)
end
Expand All @@ -49,7 +49,9 @@ def when_i_fill_in_the_form
end

def and_i_see_a_not_started_status
expect(assessor_application_page.overview.status.text).to eq("NOT STARTED")
expect(assessor_application_page.status_summary.value).to have_text(
"NOT STARTED",
)
end

def and_the_teacher_receives_a_professional_standing_received_email
Expand Down
Empty file.
10 changes: 7 additions & 3 deletions spec/system/assessor_interface/completing_assessment_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -374,17 +374,21 @@ def when_i_click_on_overview_button
end

def then_the_application_form_is_awarded
expect(assessor_application_page.overview.status.text).to eq("AWARDED")
expect(assessor_application_page.status_summary.value).to have_text(
"AWARDED",
)
end

def then_the_application_form_is_waiting_on
expect(assessor_application_page.overview.status.text).to include(
expect(assessor_application_page.status_summary.value.text).to include(
"WAITING ON",
)
end

def then_the_application_form_is_declined
expect(assessor_application_page.overview.status.text).to eq("DECLINED")
expect(assessor_application_page.status_summary.value).to have_text(
"DECLINED",
)
end

def application_id
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ def and_the_application_english_language_proof_method_is_moi
end

def then_i_see_the_application
expect(assessor_application_page.overview.name.text).to eq(
expect(assessor_application_page.name_summary.value).to have_text(
"#{application_form.given_names} #{application_form.family_name}",
)
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def when_i_click_back_link
end

def then_i_see_the_application
expect(assessor_application_page.overview.name.text).to eq(
expect(assessor_application_page.name_summary.value).to have_text(
"#{application_form.given_names} #{application_form.family_name}",
)
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def given_there_is_an_application_form_with_professional_standing_request
end

def and_i_see_a_waiting_on_status
expect(assessor_application_page.overview.status.text).to eq(
expect(assessor_application_page.status_summary.value).to have_text(
"PRELIMINARY CHECK",
)
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def given_there_is_an_application_form_with_professional_standing_request
end

def and_i_see_a_waiting_on_status
expect(assessor_application_page.overview.status.text).to eq(
expect(assessor_application_page.status_summary.value).to have_text(
"WAITING ON PROFESSIONAL STANDING",
)
end
Expand Down Expand Up @@ -74,7 +74,7 @@ def when_i_fill_in_the_review_form
end

def and_i_see_a_received_status
expect(assessor_application_page.overview.status.text).to eq(
expect(assessor_application_page.status_summary.value).to have_text(
"RECEIVED PROFESSIONAL STANDING",
)
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def given_there_is_an_application_form_with_qualification_request
end

def and_i_see_a_waiting_on_status
expect(assessor_application_page.overview.status.text).to eq(
expect(assessor_application_page.status_summary.value).to have_text(
"WAITING ON QUALIFICATION",
)
end
Expand Down Expand Up @@ -139,11 +139,13 @@ def when_i_go_back_to_overview
end

def and_i_see_a_received_status
expect(assessor_application_page.overview.status.text).to eq("RECEIVED")
expect(assessor_application_page.status_summary.value).to have_text(
"RECEIVED",
)
end

def and_i_see_an_in_progress_status
expect(assessor_application_page.overview.status.text).to eq(
expect(assessor_application_page.status_summary.value).to have_text(
"ASSESSMENT IN PROGRESS",
)
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def given_there_is_an_application_form_with_reference_request
end

def and_i_see_a_waiting_on_status
expect(assessor_application_page.overview.status.text).to eq(
expect(assessor_application_page.status_summary.value).to have_text(
"WAITING ON REFERENCE",
)
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def when_i_click_back_link
end

def then_i_see_the_application
expect(assessor_application_page.overview.name.text).to eq(
expect(assessor_application_page.name_summary.value).to have_text(
"#{application_form.given_names} #{application_form.family_name}",
)
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def given_an_application_form_exists
end

def and_i_click_view_timeline
assessor_application_page.overview.click_link(
assessor_application_page.click_link(
"View timeline of this applications actions",
)
end
Expand Down

0 comments on commit 0f5c5df

Please sign in to comment.