11import { test , expect } from "@playwright/test" ;
22import { randomUUID } from "crypto" ;
3- import path from "path" ;
43
54const baseUrl =
65 process . env . E2E_BASE_URL || "vao-main.ovh.fabrique.social.gouv.fr" ;
7- const runLocal = process . env . E2E_LOCAL === "true" ;
6+ const runLocal = process . env . E2E_LOCAL === "true" || false ;
87
98const username = process . env . E2E_USERNAME || `e2e-${ randomUUID ( ) } @test.com` ;
109const password = "Pizza1234567;" ;
@@ -13,6 +12,7 @@ const password = "Pizza1234567;";
1312test . describe . configure ( { mode : "serial" } ) ;
1413
1514function getUrl ( prefix ?: string ) {
15+ console . log ( "getUrl" , { runLocal, prefix, baseUrl } ) ;
1616 if ( runLocal ) {
1717 if ( prefix === "maildev" ) {
1818 return `http://localhost:1080` ;
@@ -21,19 +21,24 @@ function getUrl(prefix?: string) {
2121 }
2222 return `${ runLocal ? "http" : "https" } ://${ prefix ? prefix + "-" : "" } ${ baseUrl } ` ;
2323}
24-
24+ /*
2525async function login(page) {
26- await page . getByLabel ( "Identifiant *Format attendu" ) . click ( ) ;
27- await page . getByLabel ( "Identifiant *Format attendu" ) . fill ( username ) ;
26+ await page
27+ .getByLabel("Identifiant * Format attendu : nom@domaine .fr")
28+ .click();
29+ await page
30+ .getByLabel("Identifiant * Format attendu : nom@domaine.fr")
31+ .fill(username);
2832 await page.getByLabel("Mot de passe * Afficher mot").click();
2933 await page.getByLabel("Mot de passe * Afficher mot").fill(password);
3034 await page.getByRole("button", { name: "Se connecter" }).click();
3135 await expect(page.getByText("Bienvenue PrénomTest NomTest")).toBeVisible();
3236}
33-
37+ */
3438test ( "register_and_login" , async ( { page } ) => {
3539 // register
3640 await page . goto ( `${ getUrl ( ) } /connexion` ) ;
41+ console . log ( "Visiting:" , `${ getUrl ( ) } /connexion` ) ;
3742 await expect ( page . getByText ( "Connexion à VAO" ) ) . toBeVisible ( ) ;
3843
3944 await page . getByRole ( "button" , { name : "Créer un compte" } ) . click ( ) ;
@@ -49,9 +54,23 @@ test("register_and_login", async ({ page }) => {
4954 await page . getByLabel ( "Prénom Veuillez saisir votre" ) . fill ( "PrénomTest" ) ;
5055 await page . getByLabel ( "Numéro de téléphone Veuillez" ) . click ( ) ;
5156 await page . getByLabel ( "Numéro de téléphone Veuillez" ) . fill ( "0123456789" ) ;
57+ await page
58+ . getByLabel (
59+ "SIRET Veuillez indiquer le siret de l´organisme que vous souhaitez rejoindre. Exemple: 1100007200014" ,
60+ )
61+ . click ( ) ;
62+
63+ await page
64+ . getByLabel (
65+ "SIRET Veuillez indiquer le siret de l´organisme que vous souhaitez rejoindre. Exemple: 1100007200014" ,
66+ )
67+ . fill ( "45348443800016" ) ;
68+
5269 await page . getByRole ( "button" , { name : "Créer mon compte" } ) . click ( ) ;
5370 await expect (
54- page . getByText ( "Félicitations, votre compte a bien été créé !" ) ,
71+ page . getByText (
72+ "Votre formulaire a été envoyé. Veuillez valider votre adresse mail en cliquant sur le lien reçu par mail." ,
73+ ) ,
5574 ) . toBeVisible ( ) ;
5675
5776 // validate email
@@ -71,9 +90,10 @@ test("register_and_login", async ({ page }) => {
7190
7291 // login
7392 const page2 = await page2Promise ;
74- await login ( page2 ) ;
93+ // await login(page2);
7594} ) ;
7695
96+ /*
7797test("create_organisateur", async ({ page }) => {
7898 // login
7999 await page.goto(`${getUrl()}`);
@@ -84,12 +104,18 @@ test("create_organisateur", async ({ page }) => {
84104 // étape 1
85105 await page.getByText("Personne physique").click();
86106 await page.getByLabel("Numéro SIRET du titulaire de l’agrément VAO").click();
87- await page . getByLabel ( "Numéro SIRET du titulaire de l’agrément VAO" ) . fill ( "79407263700042" ) ;
88- await page . getByRole ( "button" , { name : "Récupérer les informations de la personne physique" } ) . click ( ) ;
107+ await page
108+ .getByLabel("Numéro SIRET du titulaire de l’agrément VAO")
109+ .fill("79407263700042");
110+ await page
111+ .getByRole("button", {
112+ name: "Récupérer les informations de la personne physique",
113+ })
114+ .click();
89115 await page.waitForSelector('[aria-label="Profession"]', { state: "visible" });
90116 await page
91- . getByLabel ( "Profession" )
92- . selectOption ( "Agriculture, sylviculture et pêche" ) ;
117+ .getByLabel("Profession")
118+ .selectOption("Agriculture, sylviculture et pêche");
93119 await page.getByLabel("numéro de téléphone Veuillez").click();
94120 await page.getByLabel("numéro de téléphone Veuillez").fill("0123456789");
95121 await page.getByRole("button", { name: "Rue Mirabeau 75016 Paris" }).click();
@@ -185,4 +211,6 @@ test("create_organisateur", async ({ page }) => {
185211 // await expect(page.getByText("Fiche organisateur finalisée")).toBeVisible({
186212 // timeout: 10000,
187213 // });
214+
188215});
216+ */
0 commit comments