diff --git a/playwright.config.ts b/playwright.config.ts index 44927e0..fdff474 100644 --- a/playwright.config.ts +++ b/playwright.config.ts @@ -17,7 +17,11 @@ const config: PlaywrightTestConfig = { timeout: 3000 }, // timeout: 10000, - testDir: 'tests' + testDir: 'tests', + use: { + locale: 'en-US', + timezoneId: 'America/Los_Angeles' + } }; export default config; diff --git a/tests/profile.spec.ts b/tests/profile.spec.ts index 46fdd6c..372f9bd 100644 --- a/tests/profile.spec.ts +++ b/tests/profile.spec.ts @@ -1,15 +1,14 @@ -import { test, expect, type ConsoleMessage } from '@playwright/test'; +import { test, type ConsoleMessage } from '@playwright/test'; import { run } from '../prisma/seed'; -// const url = 'http://localhost:5173/profile'; const host = 'http://localhost:5173'; test.beforeEach(async () => { await run(); }); -test.skip('User can create new profile with valid phone number', async ({ page, context }) => { - await page.goto('http://localhost:5173'); +test.only('User can create new profile with valid phone number', async ({ page }) => { + await page.goto(host); await page.waitForTimeout(3000); await page.getByRole('textbox').fill('2016660127'); @@ -25,16 +24,24 @@ test.skip('User can create new profile with valid phone number', async ({ page, page.on('console', retrieveTokenFromServerLog); await new Promise((resolve) => { - let intervalId = setInterval(() => { + const intervalId = setInterval(() => { if (token) { - console.log({ token }); page.off('console', retrieveTokenFromServerLog); clearInterval(intervalId); resolve(); } }, 100); }); - await page.goto(`http://localhost:5173/login/${token!}`); + await page.goto(`${host}/login/${token!}`); await page.waitForURL(`${host}/profile`); - console.log('completed'); + + // if this shows up, then that means the modal is open, which means this is a brand new user, as expected + await page.getByText('Accept').click(); + + await page.getByLabel('first-name').fill('FIRST_NAME'); + await page.getByLabel('last-name').fill('LAST_NAME'); + await page.getByLabel('pronouns').selectOption('SHE_HER_HERS'); + + await page.getByText('Save').click(); + await page.waitForURL(`${host}/household`); });