Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions pages/contact_page.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
from playwright.sync_api import Page

class ContactPage:
def __init__(self, page: Page) -> None:
self.page = page
self.email = page.get_by_test_id("contact-email")
self.phone = page.get_by_test_id("contact-phone")
self.address = page.get_by_test_id("contact-address")
self.hours = page.get_by_test_id("office-hours-row")

def goto(self) -> None:
self.page.goto("/contact")



Comment on lines +13 to +15

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

puoi togliere queste righe con solo spazi, poi manca il newline a fine file e prima di class servono due righe vuote, lo stesso vale per tests/test_contact.py, puoi lanciare black pages/contact_page.py tests/test_contact.py

6 changes: 6 additions & 0 deletions tests/features/contact.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Feature: Contacts

Scenario: Watching Email
When I am on Contact page.
Then I should see the Email "student.office@example.com".

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

anche qui l'ultima riga ha solo spazi e manca il newline a fine file

16 changes: 16 additions & 0 deletions tests/test_contact.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
from playwright.sync_api import Page, expect
from pytest_bdd import given, parsers, scenarios, then, when

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

given non lo usi, puoi toglierlo


from pages.contact_page import ContactPage

scenarios("features/contact.feature")

@when("I am on Contact page.", target_fixture="contact_page")
def open_contact_page(page: Page) -> ContactPage:
contact_page = ContactPage(page)
contact_page.goto()
return contact_page

@then(parsers.parse('I should see the Email "{email}".'))
def see_email(contact_page: ContactPage, email: str) -> None:
expect(contact_page.email).to_have_text(email)
Loading