-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
5 changed files
with
78 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
fala/apps/adviser/tests/test_single_category_search_page_journeys_playwright.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
from playwright.sync_api import expect | ||
from fala.playwright.setup import PlaywrightTestSetup | ||
|
||
|
||
class SingleCategorySearchPageEndToEndJourneys(PlaywrightTestSetup): | ||
hlpas_front_page_heading = "Find a legal aid adviser for Housing Loss Prevention Advice Service" | ||
|
||
def test_landing_page(self): | ||
page = self.visit_single_category_search_page("categories=hlpas") | ||
expect(page.h1).to_have_text(f"{self.hlpas_front_page_heading}") | ||
|
||
def test_postcode_search_journey(self): | ||
test_cases = [ | ||
"SW1H 9AJ", | ||
"SE11", | ||
] | ||
for postcode in test_cases: | ||
with self.subTest(postcode=postcode): | ||
page = self.visit_results_page(postcode=postcode) | ||
expect(page.h1).to_have_text("Search results") | ||
expect(page.change_search_grey_box.nth(0)).to_have_text(f"Postcode: {postcode}") | ||
expect(page.item_from_text("in order of closeness")).to_be_visible() | ||
|
||
def test_full_search_journey(self): | ||
page = self.visit_results_page_with_full_search( | ||
"SE11", "Islington Law Centre", ["Housing Loss Prevention Advice Service"] | ||
) | ||
expect(page.h1).to_have_text("Search results") | ||
# this selector matches multiple things so picking out the things we want using 'nth()' | ||
expect(page.change_search_grey_box.nth(0)).to_have_text("Postcode: SE11") | ||
expect(page.change_search_grey_box.nth(1)).to_have_text("Organisation: Islington Law Centre") | ||
expect(page.change_search_grey_box.nth(2)).to_have_text( | ||
"Legal problem: Housing Loss Prevention Advice Service" | ||
) | ||
|
||
def test_invalid_postcode_journey(self): | ||
test_cases = [ | ||
"ZZZ1", | ||
"G12 OGJKLJGK", | ||
"LS25 ghjkhjkh", | ||
"IM4 TESTTTTTTTTTTTT", | ||
] | ||
for postcode in test_cases: | ||
with self.subTest(postcode=postcode): | ||
page = self.browser.new_page() | ||
page.goto(f"{self.live_server_url}") | ||
expect(page.locator("h1")).to_have_text(f"{self.front_page_heading}") | ||
page.get_by_label("Postcode").fill(f"{postcode}") | ||
page.get_by_role("button", name="Search").click() | ||
expect(page.locator("h1")).to_have_text(f"{self.front_page_heading}") | ||
expect(page.locator("css=.govuk-error-summary")).to_be_visible() |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters