Skip to content

Commit cd040a1

Browse files
committed
♻️ Use env vars for Playwright tests
1 parent 1c5780f commit cd040a1

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

frontend/playwright.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import { defineConfig, devices } from '@playwright/test';
2+
import 'dotenv/config'
23

34

45
/**
56
* Read environment variables from file.
67
* https://github.com/motdotla/dotenv
78
*/
8-
// require('dotenv').config();
99

1010
/**
1111
* See https://playwright.dev/docs/test-configuration.

frontend/tests/reset-password.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ test("User can reset password successfully using the link", async ({
5050
timeout: 5000,
5151
})
5252

53-
await page.goto(`http://localhost:1080/messages/${emailData.id}.html`)
53+
await page.goto(`${process.env.MAILCATCHER_HOST}/messages/${emailData.id}.html`)
5454

5555
const selector = 'a[href*="/reset-password?token="]'
5656

@@ -103,7 +103,7 @@ test("Weak new password validation", async ({ page, request }) => {
103103
timeout: 5000,
104104
})
105105

106-
await page.goto(`http://localhost:1080/messages/${emailData.id}.html`)
106+
await page.goto(`${process.env.MAILCATCHER_HOST}/messages/${emailData.id}.html`)
107107

108108
const selector = 'a[href*="/reset-password?token="]'
109109
let url = await page.getAttribute(selector, "href")

frontend/tests/utils/mailcatcher.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ async function findEmail({
1010
request,
1111
filter,
1212
}: { request: APIRequestContext; filter?: (email: Email) => boolean }) {
13-
const response = await request.get("http://localhost:1080/messages")
13+
const response = await request.get(`${process.env.MAILCATCHER_HOST}/messages`)
1414

1515
let emails = await response.json()
1616

0 commit comments

Comments
 (0)