From 1fe4b7ff385ceff43d26eeaeffabba2461b90051 Mon Sep 17 00:00:00 2001 From: Gexxo1 Date: Fri, 13 Nov 2026 19:02:38 +0100 Subject: [PATCH] test: solved contact email exercise --- tests/contact_email.py | 17 +++++++++++++++++ tests/features/contact.feature | 5 +++++ 2 files changed, 22 insertions(+) create mode 100644 tests/contact_email.py create mode 100644 tests/features/contact.feature diff --git a/tests/contact_email.py b/tests/contact_email.py new file mode 100644 index 0000000..0307657 --- /dev/null +++ b/tests/contact_email.py @@ -0,0 +1,17 @@ +from playwright.sync_api import Page, expect +from pytest_bdd import given, parsers, scenarios, then + +scenarios("features/contact.feature") + + +@given("I am on the contact page") +def open_contact_page(page: Page) -> None: + page.goto("/contact") + + +@then(parsers.parse('I see the contact email "{email}"')) +def verify_contact_email(page: Page, email: str) -> None: + contact_email = page.get_by_test_id("contact-email") + + expect(contact_email).to_have_text(email) + expect(contact_email).to_have_attribute("href", f"mailto:{email}") \ No newline at end of file diff --git a/tests/features/contact.feature b/tests/features/contact.feature new file mode 100644 index 0000000..225d142 --- /dev/null +++ b/tests/features/contact.feature @@ -0,0 +1,5 @@ +Feature: Contact information + + Scenario: View the student office email + Given I am on the contact page + Then I see the contact email "student.office@example.com" \ No newline at end of file