Skip to content

Commit

Permalink
profile test
Browse files Browse the repository at this point in the history
  • Loading branch information
Jessica Ho authored and Jessica Ho committed Feb 25, 2024
1 parent 6a4c4ba commit f4dd39d
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 9 deletions.
6 changes: 5 additions & 1 deletion playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
23 changes: 15 additions & 8 deletions tests/profile.spec.ts
Original file line number Diff line number Diff line change
@@ -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');
Expand All @@ -25,16 +24,24 @@ test.skip('User can create new profile with valid phone number', async ({ page,
page.on('console', retrieveTokenFromServerLog);

await new Promise<void>((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`);
});

0 comments on commit f4dd39d

Please sign in to comment.