Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Amir Ziaei committed Mar 30, 2024
1 parent 8dc5ea7 commit 474d7fb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion apps/app/tests/e2e/instagram-auth.setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,16 @@ setup('authenticate instagram', async ({ page }) => {
.fill(process.env.IG_USERNAME)
await page.getByLabel('Password').fill(process.env.IG_PASSWORD)
await page.getByRole('button', { name: 'Log in', exact: true }).click()
await page.waitForLoadState('networkidle')
if (await page.getByText('Save your login info?').isVisible()) {
await page.getByRole('button', { name: 'Save info' }).click()
}
await page.waitForLoadState('networkidle')
if (await page.getByText('Turn on Notifications').isVisible()) {
await page.getByRole('button', { name: 'Not Now' }).click()
}
await expect(page.getByRole('link', { name: 'Home Home' })).toBeVisible()
await expect(page.getByRole('link', { name: 'Home Home' })).toBeVisible({
timeout: 10_000,
})
await page.context().storageState({ path: authFile })
})
2 changes: 1 addition & 1 deletion apps/app/tests/e2e/smoke.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ test.describe('POST /jokes', () => {
expect(await req.text()).toMatch(/unauthorized/i)
})

test('authorized', async ({ request, page }) => {
test('authenticated', async ({ request, page }) => {
const req = await request.post('/jokes', {
headers: { Authorization: process.env.AUTH_TOKEN },
})
Expand Down

0 comments on commit 474d7fb

Please sign in to comment.