Skip to content

Commit 8b01af3

Browse files
babinkarmacharya79samshara
authored andcommitted
Use environment variables in playwright tests
1 parent f4a2b56 commit 8b01af3

File tree

3 files changed

+80
-77
lines changed

3 files changed

+80
-77
lines changed

packages/e2e-tests/.env.example

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#Playwright Base URL
2+
APP_BASE_URL=

packages/e2e-tests/tests/field_report/fieldReport.spec.ts

Lines changed: 70 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -8,80 +8,81 @@ test.describe("test suite for Field report", async () => {
88
await login(
99
page,
1010
process.env.APP_URL,
11-
process.env.USER_NAME,
12-
process.env.PASSWORD
11+
process.env.PLAYWRIGHT_USER_NAME,
12+
process.env.PLAYWRIGHT_USER_PASSWORD
1313
);
1414
});
1515

1616
test("Field report for Event", async ({ page }) => {
1717

18-
const { formName,
19-
country,
20-
district,
21-
disasterType,
22-
date,
23-
title,
24-
govRequest,
25-
nationalsocietyRequest,
26-
num_injured,
27-
gov_num_injured,
28-
other_num_injured,
29-
num_dead,
30-
gov_num_dead,
31-
other_num_dead,
32-
num_missing,
33-
gov_num_missing,
34-
other_num_missing,
35-
num_affected,
36-
gov_num_affected,
37-
other_num_affected,
38-
num_displaced,
39-
other_num_displaced,
40-
gov_num_displaced,
41-
other_sources,
42-
gov_num_assisted,
43-
num_assisted,
44-
num_localstaff,
45-
num_volunteers,
46-
num_expats_delegates,
47-
actionHuman,
48-
actionEvacuation,
49-
actionHealth,
50-
actionShelter,
51-
actionCamp,
52-
actionFirst,
53-
actionPsychosocial,
54-
actionFood,
55-
nationalSocietySummary,
56-
federationSummary,
57-
rcrcSummary,
58-
informationBulletin,
59-
actionOther,
60-
interventionOptionOne,
61-
interventionOptionTwo,
62-
interventionOptionThree,
63-
drefRequested,
64-
emergencyAppeal,
65-
rapidResponse,
66-
emergencyResponse,
67-
originatorName,
68-
originatorTitle,
69-
originatorEmail,
70-
originatorPhone,
71-
nationalName,
72-
nationalTitle,
73-
nationalEmail,
74-
nationalPhone,
75-
ifrcName,
76-
ifrcTitle,
77-
ifrcEmail,
78-
ifrcPhone,
79-
mediaName,
80-
mediaTitle,
81-
mediaEmail,
82-
mediaPhone,
83-
visibiltyOptOne,
84-
visibiltyOptTwo
18+
const {
19+
formName,
20+
country,
21+
district,
22+
disasterType,
23+
date,
24+
title,
25+
govRequest,
26+
nationalsocietyRequest,
27+
num_injured,
28+
gov_num_injured,
29+
other_num_injured,
30+
num_dead,
31+
gov_num_dead,
32+
other_num_dead,
33+
num_missing,
34+
gov_num_missing,
35+
other_num_missing,
36+
num_affected,
37+
gov_num_affected,
38+
other_num_affected,
39+
num_displaced,
40+
other_num_displaced,
41+
gov_num_displaced,
42+
other_sources,
43+
gov_num_assisted,
44+
num_assisted,
45+
num_localstaff,
46+
num_volunteers,
47+
num_expats_delegates,
48+
actionHuman,
49+
actionEvacuation,
50+
actionHealth,
51+
actionShelter,
52+
actionCamp,
53+
actionFirst,
54+
actionPsychosocial,
55+
actionFood,
56+
nationalSocietySummary,
57+
federationSummary,
58+
rcrcSummary,
59+
informationBulletin,
60+
actionOther,
61+
interventionOptionOne,
62+
interventionOptionTwo,
63+
interventionOptionThree,
64+
drefRequested,
65+
emergencyAppeal,
66+
rapidResponse,
67+
emergencyResponse,
68+
originatorName,
69+
originatorTitle,
70+
originatorEmail,
71+
originatorPhone,
72+
nationalName,
73+
nationalTitle,
74+
nationalEmail,
75+
nationalPhone,
76+
ifrcName,
77+
ifrcTitle,
78+
ifrcEmail,
79+
ifrcPhone,
80+
mediaName,
81+
mediaTitle,
82+
mediaEmail,
83+
mediaPhone,
84+
visibiltyOptOne,
85+
visibiltyOptTwo
8586
} = fixtureData;
8687

8788
await page.getByRole("button", { name: "Create a Report" }).click();

packages/e2e-tests/tests/loginLogout.spec.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,26 +5,26 @@ test("Login", async ({ page }) => {
55
await login(
66
page,
77
process.env.APP_URL,
8-
process.env.USER_NAME,
9-
process.env.PASSWORD
8+
process.env.PLAYWRIGHT_USER_NAME,
9+
process.env.PLAYWRIGHT_USER_PASSWORD
1010
);
1111
await expect(page.getByRole("navigation")).toContainText(
12-
process.env.USER_NAME
12+
process.env.PLAYWRIGHT_USER_NAME
1313
);
14-
await page.getByRole("button", { name: process.env.USER_NAME }).click();
14+
await page.getByRole("button", { name: process.env.PLAYWRIGHT_USER_NAME }).click();
1515
});
1616

1717
test("logout", async ({ page }) => {
1818
await login(
1919
page,
2020
process.env.APP_URL,
21-
process.env.USER_NAME,
22-
process.env.PASSWORD
21+
process.env.PLAYWRIGHT_USER_NAME,
22+
process.env.PLAYWRIGHT_USER_PASSWORD
2323
);
2424
await expect(page.getByRole("navigation")).toContainText(
25-
process.env.USER_NAME
25+
process.env.PLAYWRIGHT_USER_NAME
2626
);
27-
await page.getByRole("button", { name: process.env.USER_NAME }).click();
27+
await page.getByRole("button", { name: process.env.PLAYWRIGHT_USER_NAME }).click();
2828
await page.getByRole("button", { name: "Logout" }).click();
2929
await page.getByRole("button", { name: "Ok" }).click();
3030
await expect(page.getByRole("navigation")).toContainText("Login");

0 commit comments

Comments
 (0)