-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6f08f1d
commit 1318c0f
Showing
6 changed files
with
33 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,4 +34,5 @@ coverage | |
.wrangler/tmp | ||
server/prisma-client/ | ||
prisma/app.db* | ||
test-results/ | ||
test-results/ | ||
playwright/.auth |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,12 @@ | ||
import { expect, test } from '@nuxt/test-utils/playwright' | ||
import { uuidv7 } from 'uuidv7' | ||
|
||
test('Can open distapp and show login page', async ({ page, goto }) => { | ||
test('Can open distapp and show get started', async ({ page, goto, context }) => { | ||
await context.clearCookies() | ||
await goto('/') | ||
await expect(page.getByText('DistApp')).toHaveCount(1) | ||
await expect(page.getByText('Get Started')).toHaveCount(1) | ||
}) | ||
|
||
test('User can add organization', async ({ context, goto, page }) => { | ||
test('Logged in user open distapp and show go to apps', async ({ page, goto, context }) => { | ||
await goto('/') | ||
await page.locator('div.p-splitbutton:nth-child(1) > button:nth-child(2)').click() | ||
await page.locator('#pv_id_1_overlay_0_label').click() | ||
await expect(page.locator('.p-dialog-title', { | ||
hasText: 'Add Organization', | ||
})).toBeVisible() | ||
const testId = uuidv7() | ||
const expectedOrgName = `Org Testing ${testId}` | ||
const expectedOrgNameNormalized = `/orgs/org-testing-${testId}` | ||
await page.getByTestId('orgname').fill(expectedOrgName) | ||
await page.getByTestId('orgname').press('Enter') | ||
await expect(page.getByText(expectedOrgName)).toBeVisible() | ||
await expect(page.locator('//a', { | ||
hasText: expectedOrgName, | ||
})).toHaveAttribute('href', expectedOrgNameNormalized) | ||
}) | ||
await expect(page.getByText('Go To Apps')).toHaveCount(1) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { test as setup, expect } from '@playwright/test' | ||
import path from 'path'; | ||
|
||
const authFile = path.join(import.meta.dirname, '../../playwright/.auth/user.json'); | ||
|
||
setup('authenticate', async ({ page }) => { | ||
const domain = process.env.TEST_APP_URL!.replaceAll('https://', '').replaceAll('http://', '').replaceAll(':3000', '') | ||
await page.context().addCookies([{ | ||
name: 'app-auth', | ||
value: process.env.TEST_APP_AUTH_COOKIES!, | ||
httpOnly: false, | ||
secure: true, | ||
sameSite: 'Lax', | ||
path: '/', | ||
domain: domain, | ||
expires: -1, | ||
}]) | ||
|
||
await page.context().storageState({ path: authFile }); | ||
}) |