-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
44 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
from playwright.sync_api import Page, expect | ||
from model_bakery import baker | ||
from sv.models import FicheZoneDelimitee, ZoneInfestee, FicheDetection | ||
|
||
|
||
def test_fichezonedelimitee_with_zoneinfestee_detail(live_server, page: Page, mocked_authentification_user) -> None: | ||
fichezonedelimitee = baker.make( | ||
FicheZoneDelimitee, createur=mocked_authentification_user.agent.structure, _fill_optional=True | ||
) | ||
zoneinfestee1 = baker.make(ZoneInfestee, fiche_zone_delimitee=fichezonedelimitee, _fill_optional=True) | ||
fd_fzd = baker.make(FicheDetection, hors_zone_infestee=fichezonedelimitee) | ||
fd_zi1 = baker.make(FicheDetection, zone_infestee=zoneinfestee1) | ||
page.goto(f"{live_server.url}{fichezonedelimitee.get_absolute_url()}") | ||
expect(page.get_by_role("heading", name=f"Fiche zone délimitée n° {fichezonedelimitee.numero}")).to_be_visible() | ||
expect(page.get_by_text(str(fichezonedelimitee.organisme_nuisible))).to_be_visible() | ||
expect(page.get_by_text(str(fichezonedelimitee.statut_reglementaire))).to_be_visible() | ||
expect( | ||
page.get_by_text(fichezonedelimitee.get_caracteristiques_principales_zone_delimitee_display()) | ||
).to_be_visible() | ||
expect(page.get_by_text(fichezonedelimitee.commentaire)).to_be_visible() | ||
expect( | ||
page.get_by_text(f"{fichezonedelimitee.rayon_zone_tampon} {fichezonedelimitee.unite_rayon_zone_tampon}") | ||
).to_be_visible() | ||
expect( | ||
page.get_by_text(f"{fichezonedelimitee.surface_tampon_totale} {fichezonedelimitee.unite_surface_tampon_totale}") | ||
).to_be_visible() | ||
if fichezonedelimitee.is_zone_tampon_toute_commune: | ||
expect(page.get_by_text("La zone tampon s'étend à toute la ou les communes")).to_be_visible() | ||
expect(page.get_by_text(f"{str(fichezonedelimitee.createur)}")).to_be_visible() | ||
expect(page.get_by_text(fichezonedelimitee.date_creation.strftime("%d/%m/%Y"))).to_be_visible() | ||
expect(page.get_by_role("link", name=f"{str(fd_fzd.numero)}")).to_be_visible() | ||
expect(page.get_by_text(f"{zoneinfestee1.nom}")).to_be_visible() | ||
expect(page.get_by_text(f"{zoneinfestee1.rayon} {zoneinfestee1.unite_rayon}")).to_be_visible() | ||
expect( | ||
page.get_by_text(f"{zoneinfestee1.surface_infestee_totale} {zoneinfestee1.unite_surface_infestee_totale}") | ||
).to_be_visible() | ||
expect(page.get_by_role("link", name=f"{str(fd_zi1.numero)}")).to_be_visible() |