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
10 changes: 10 additions & 0 deletions pages/contact_page.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from playwright.sync_api import Page


class ContactPage:
def __init__(self, page: Page) -> None:
self.page = page
self.contact_mail = page.get_by_test_id("contact-email")

def goto(self) -> None:
self.page.goto("/contact")
13 changes: 13 additions & 0 deletions tests/test_contact.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
from playwright.sync_api import Page, expect
from pages.exams_page import ContactPage

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.

ContactPage è in pages.contact_page, con pages.exams_page l'import va in ImportError, la CI fallisce per questo



def test_contact_mail(page: Page) -> None:

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.

il README chiede anche il pattern BDD, puoi scrivere lo scenario in un file .feature in tests/features e implementare gli step con pytest-bdd, come in tests/test_login_bdd.py


contact_page= ContactPage(page)
Comment on lines +6 to +7

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 la riga vuota dopo la def, e manca lo spazio prima di =


# act
ContactPage.goto()

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.

goto() va chiamato su contact_page, sulla classe va in TypeError perché manca self


# assert
expect(page.contact_mail).to_have_text("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.

contact_mail è un attributo di contact_page, page non ce l'ha e va in AttributeError

Loading