Compare commits
10 commits
9cd6e6b9e3
...
64e7ea653e
Author | SHA1 | Date | |
---|---|---|---|
Edward Betts | 64e7ea653e | ||
Edward Betts | f9ce216a19 | ||
Edward Betts | 63a854867b | ||
Edward Betts | 6508de06f4 | ||
Edward Betts | 0e3a9d7ea2 | ||
Edward Betts | f6085aae21 | ||
Edward Betts | ebc7bc5721 | ||
Edward Betts | d018905ae5 | ||
Edward Betts | 7aaf878ced | ||
Edward Betts | 67dbfed7b4 |
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
__pycache__
|
||||
.mypy_cache
|
||||
run.fcgi
|
39
check.py
39
check.py
|
@ -1,7 +1,8 @@
|
|||
#!/usr/bin/python3
|
||||
|
||||
import os
|
||||
from datetime import datetime, date
|
||||
import re
|
||||
from datetime import date, datetime
|
||||
|
||||
from playwright.sync_api import Playwright, Request, expect, sync_playwright
|
||||
|
||||
|
@ -54,29 +55,27 @@ def run(playwright: Playwright) -> None:
|
|||
context = browser.new_context()
|
||||
page = context.new_page()
|
||||
|
||||
# hr = HandleResponse()
|
||||
# page.on("requestfinished", hr.requestfinished)
|
||||
hr = HandleResponse()
|
||||
page.on("requestfinished", hr.requestfinished)
|
||||
|
||||
re_month_name = re.compile(r"^([A-Z][a-z]+) (\d{4})$")
|
||||
|
||||
page.goto("https://www.eurotunnel.com/uk/")
|
||||
page.get_by_role("button", name="Accept All Cookies").click()
|
||||
|
||||
page.get_by_role("textbox", name="Outbound").click()
|
||||
|
||||
month = page.locator("div.ui-datepicker-month").first
|
||||
print(month)
|
||||
print(month.text_content())
|
||||
|
||||
page.close()
|
||||
|
||||
context.close()
|
||||
browser.close()
|
||||
|
||||
return
|
||||
|
||||
page.get_by_role("row", name="August 2023").get_by_role("cell").nth(1).click()
|
||||
month_row = page.get_by_role("row", name=re_month_name)
|
||||
month_and_year = month_row.inner_text().strip()
|
||||
if month_and_year == "August 2023":
|
||||
month_row.get_by_role("cell").nth(1).click()
|
||||
else:
|
||||
assert month_and_year == "September 2023"
|
||||
page.get_by_role("cell", name="29").click()
|
||||
|
||||
page.get_by_role("textbox", name="Return").click()
|
||||
page.get_by_role("row", name="September 2023").get_by_role("cell").nth(2).click()
|
||||
page.get_by_role("cell", name="6", exact=True).click()
|
||||
page.get_by_role("row", name="September 2023").get_by_role("cell").nth(1).click()
|
||||
page.get_by_role("cell", name="13", exact=True).click()
|
||||
|
||||
page.get_by_role("button", name="Search and book").click()
|
||||
page.get_by_label("Enter your vehicle registration").fill("KE69HRR")
|
||||
page.get_by_role("button", name="Find").click()
|
||||
|
@ -90,9 +89,7 @@ def run(playwright: Playwright) -> None:
|
|||
|
||||
page.locator("#slots div").filter(has_text="12:00To").locator("span").click()
|
||||
page.locator("div:nth-child(5) > .times > div:nth-child(2) > .radio-button").click()
|
||||
page.locator(
|
||||
"div:nth-child(17) > .d-flex > div > .body > .radio-button"
|
||||
).first.click()
|
||||
page.locator(".ticket:visible").first.click()
|
||||
page.get_by_role("button", name="Confirm and choose return ticket").click()
|
||||
|
||||
expect(page.get_by_text(return_label)).to_be_visible()
|
||||
|
|
Loading…
Reference in a new issue