Repository navigation
Added a new test to verify the ID number - #12
Andrea-P18 wants to merge 3 commits into
Conversation
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
| @@ -0,0 +1,7 @@ | |||
| { | |||
There was a problem hiding this comment.
questo è un file di configurazione del tuo editor, puoi toglierlo dalla PR
| @@ -0,0 +1,22 @@ | |||
| from playwright.sync_api import Page, expect | |||
There was a problem hiding this comment.
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
| from playwright.sync_api import Page, expect | ||
|
|
||
| def test_email_page(page: Page) -> None: | ||
| # 1. Inserisci l'URL completo (es. "http://localhost:3000/contact" o il sito reale) |
There was a problem hiding this comment.
puoi togliere questi commenti, sono appunti in italiano, e qui l'URL completo non serve perché pytest.ini ha già il base_url
| 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") |
There was a problem hiding this comment.
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
| # 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") | ||
|
|
||
| def test_example(page:Page) -> None: |
There was a problem hiding this comment.
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") |
There was a problem hiding this comment.
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").fill("password123") | ||
| page.get_by_role("button", name="Log in").click() | ||
| page.goto("/profile") | ||
| matr_value = page.locator('dt:text-is("Student ID") + dd') |
There was a problem hiding this comment.
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
No description provided.