Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 18 additions & 4 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,30 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Install pnpm
uses: pnpm/action-setup@v4

- name: Use Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 20
- name: Install pnpm
uses: pnpm/action-setup@v4
cache: 'pnpm'

- name: Cache Playwright browsers
uses: actions/cache@v4
with:
path: ~/.cache/ms-playwright
key: playwright-${{ runner.os }}-${{ hashFiles('pnpm-lock.yaml') }}
restore-keys: |
playwright-${{ runner.os }}-

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Install Playwright Browsers
run: pnpm exec playwright install --with-deps chromium
run: pnpm exec playwright install chromium

- name: E2E Tests
run: pnpm run e2e
- uses: actions/upload-artifact@v4
Expand Down
15 changes: 12 additions & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,30 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Install pnpm
uses: pnpm/action-setup@v4

- name: Use Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 20
- name: Install pnpm
uses: pnpm/action-setup@v4
cache: 'pnpm'

- name: Audit dependencies
run: pnpm audit --audit-level high

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Svelte Diagnostics
run: pnpm run check

- name: Linter
run: pnpm run lint

- name: Unit Tests
run: pnpm run test

- name: Build Console
run: pnpm run build
92 changes: 92 additions & 0 deletions e2e/auth/navigation.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
import { test, type Page } from '@playwright/test';

export function buildAuthUrl(region: string, projectId: string, path: string = ''): string {
return `./project-${region}-${projectId}/auth${path}`;
}

export function buildAuthUrlPattern(region: string, projectId: string, path: string = ''): RegExp {
return new RegExp(`/project-${region}-${projectId}/auth${path}`);
}

export async function navigateToUsers(
page: Page,
region: string,
projectId: string
): Promise<void> {
return test.step('navigate to users', async () => {
const expectedPattern = new RegExp(`/project-${region}-${projectId}/auth(/\\?.*)?$`);
if (expectedPattern.test(page.url())) {
return;
}

await page.goto(buildAuthUrl(region, projectId));
await page.waitForURL(buildAuthUrlPattern(region, projectId));
await page.getByRole('heading', { name: 'Auth' }).waitFor({ state: 'visible' });
});
}

export async function navigateToUser(
page: Page,
region: string,
projectId: string,
userId: string
): Promise<void> {
return test.step(`navigate to user ${userId}`, async () => {
const expectedPattern = new RegExp(
`/project-${region}-${projectId}/auth/user-${userId}(/\\?.*)?$`
);

if (expectedPattern.test(page.url())) {
return;
}

await page.goto(buildAuthUrl(region, projectId, `/user-${userId}`));
await page.waitForURL(buildAuthUrlPattern(region, projectId, `/user-${userId}`));
await page.locator('input[id="name"]').waitFor({ state: 'visible' });
});
}

export async function navigateToTeams(
page: Page,
region: string,
projectId: string
): Promise<void> {
return test.step('navigate to teams', async () => {
await page.goto(buildAuthUrl(region, projectId, '/teams'));
await page.waitForURL(buildAuthUrlPattern(region, projectId, '/teams'));
});
}

export async function navigateToTeam(
page: Page,
region: string,
projectId: string,
teamId: string
): Promise<void> {
return test.step(`navigate to team ${teamId}`, async () => {
await page.goto(buildAuthUrl(region, projectId, `/teams/team-${teamId}`));
await page.waitForURL(buildAuthUrlPattern(region, projectId, `/teams/team-${teamId}`));
});
}

export async function navigateToSecurity(
page: Page,
region: string,
projectId: string
): Promise<void> {
return test.step('navigate to security settings', async () => {
await page.goto(buildAuthUrl(region, projectId, '/security'));
await page.waitForURL(buildAuthUrlPattern(region, projectId, '/security'));
});
}

export async function navigateToTemplates(
page: Page,
region: string,
projectId: string
): Promise<void> {
return test.step('navigate to templates', async () => {
await page.goto(buildAuthUrl(region, projectId, '/templates'));
await page.waitForURL(buildAuthUrlPattern(region, projectId, '/templates'));
});
}
Loading
Loading