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
7 changes: 7 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,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.

questo è un file di configurazione del tuo editor, puoi toglierlo dalla PR

"python-envs.defaultEnvManager": "ms-python.python:venv",
"python-envs.defaultPackageManager": "ms-python.python:pip",
"githubPullRequests.ignoredPullRequestBranches": [
"main"
]
}
22 changes: 22 additions & 0 deletions tests/test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
from playwright.sync_api import Page, expect

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.

pytest esegue solo i file che si chiamano test_*.py, infatti la CI raccoglie solo i 9 test che c'erano già, puoi chiamarlo ex tests/test_student_id.py


def test_email_page(page: Page) -> None:
# 1. Inserisci l'URL completo (es. "http://localhost:3000/contact" o il sito reale)

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 questi commenti, sono appunti in italiano, e qui l'URL completo non serve perché pytest.ini ha già il base_url

page.goto("/contact")

# 2. Sintassi Python (niente 'const' o ';')
email_value = page.locator('dt:text-is("Email") + dd')

# 3. Verifica (niente 'await' perché stiamo usando la sync_api, e to_contain_text in snake_case)
expect(email_value).to_contain_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.

l'esercizio chiede che l'email sia proprio student.office@example.com, con to_contain_text passa anche se c'è altro testo intorno, puoi usare to_have_text, vale anche per lo student ID alla riga 22


def test_example(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.

la #9 punta allo stesso commit ed è ancora aperta, puoi chiuderla

qui però ci sono tutti e due gli esercizi, puoi lasciare in questa PR solo il test dello student ID e aprirne un'altra per l'email

page.goto("/login")
page.get_by_role("textbox",name="Username").click()
page.get_by_role("textbox",name = "Username").fill("mario")
Comment on lines +14 to +16

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.

mancano gli spazi dopo le virgole e dopo page:, e in name = "Username" vanno tolti, poi prima delle def servono due righe vuote, la riga 6 ha solo spazi e manca il newline a fine file, puoi lanciare black sul file

page.get_by_role("textbox",name="Password").click()
page.get_by_role("textbox",name="Password").fill("password123")
page.get_by_role("button", name="Log in").click()
page.goto("/profile")
matr_value = page.locator('dt:text-is("Student ID") + dd')

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 chiamare matr_value in inglese, ex student_id, e il test con quello che controlla, ex test_student_id al posto di test_example

expect(matr_value).to_contain_text("1000012345")
Loading