This repository has no description
0

Configure Feed

Select the types of activity you want to include in your feed.

test: check login redirect for unauthenticated routes

+164 -10
+29 -9
package-lock.json
··· 9620 9620 "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", 9621 9621 "dev": true 9622 9622 }, 9623 + "node_modules/@playwright/test": { 9624 + "version": "1.59.1", 9625 + "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.59.1.tgz", 9626 + "integrity": "sha512-PG6q63nQg5c9rIi4/Z5lR5IVF7yU5MqmKaPOe0HSc0O2cX1fPi96sUQu5j7eo4gKCkB2AnNGoWt7y4/Xx3Kcqg==", 9627 + "devOptional": true, 9628 + "license": "Apache-2.0", 9629 + "peer": true, 9630 + "dependencies": { 9631 + "playwright": "1.59.1" 9632 + }, 9633 + "bin": { 9634 + "playwright": "cli.js" 9635 + }, 9636 + "engines": { 9637 + "node": ">=18" 9638 + } 9639 + }, 9623 9640 "node_modules/@pnpm/config.env-replace": { 9624 9641 "version": "1.1.0", 9625 9642 "resolved": "https://registry.npmjs.org/@pnpm/config.env-replace/-/config.env-replace-1.1.0.tgz", ··· 24504 24521 } 24505 24522 }, 24506 24523 "node_modules/playwright": { 24507 - "version": "1.56.1", 24508 - "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.56.1.tgz", 24509 - "integrity": "sha512-aFi5B0WovBHTEvpM3DzXTUaeN6eN0qWnTkKx4NQaH4Wvcmc153PdaY2UBdSYKaGYw+UyWXSVyxDUg5DoPEttjw==", 24510 - "dev": true, 24524 + "version": "1.59.1", 24525 + "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.59.1.tgz", 24526 + "integrity": "sha512-C8oWjPR3F81yljW9o5OxcWzfh6avkVwDD2VYdwIGqTkl+OGFISgypqzfu7dOe4QNLL2aqcWBmI3PMtLIK233lw==", 24527 + "devOptional": true, 24528 + "license": "Apache-2.0", 24511 24529 "dependencies": { 24512 - "playwright-core": "1.56.1" 24530 + "playwright-core": "1.59.1" 24513 24531 }, 24514 24532 "bin": { 24515 24533 "playwright": "cli.js" ··· 24522 24540 } 24523 24541 }, 24524 24542 "node_modules/playwright-core": { 24525 - "version": "1.56.1", 24526 - "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.56.1.tgz", 24527 - "integrity": "sha512-hutraynyn31F+Bifme+Ps9Vq59hKuUCz7H1kDOcBs+2oGguKkWTU50bBWrtz34OUWmIwpBTWDxaRPXrIXkgvmQ==", 24528 - "dev": true, 24543 + "version": "1.59.1", 24544 + "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.59.1.tgz", 24545 + "integrity": "sha512-HBV/RJg81z5BiiZ9yPzIiClYV/QMsDCKUyogwH9p3MCP6IYjUFu/MActgYAvK0oWyV9NlwM3GLBjADyWgydVyg==", 24546 + "devOptional": true, 24547 + "license": "Apache-2.0", 24529 24548 "bin": { 24530 24549 "playwright-core": "cli.js" 24531 24550 }, ··· 29505 29524 "web-haptics": "^0.0.6" 29506 29525 }, 29507 29526 "devDependencies": { 29527 + "@playwright/test": "^1.59.1", 29508 29528 "@testing-library/dom": "^10.4.1", 29509 29529 "@testing-library/react": "^16.3.2", 29510 29530 "@testing-library/user-event": "^14.6.1",
+8
src/webapp/.gitignore
··· 1 + 2 + # Playwright 3 + node_modules/ 4 + /test-results/ 5 + /playwright-report/ 6 + /blob-report/ 7 + /playwright/.cache/ 8 + /playwright/.auth/
+26
src/webapp/e2e/auth-redirect.spec.ts
··· 1 + import { test, expect } from '@playwright/test'; 2 + 3 + test('unauthenticated /settings visit redirects to /login', async ({ 4 + page, 5 + }) => { 6 + const response = await page.goto('/settings'); 7 + console.log('status:', response?.status(), 'final url:', page.url()); 8 + 9 + await expect(page).toHaveURL('/login'); 10 + }); 11 + 12 + test('unauthenticated /notifications visit redirects to /login', async ({ 13 + page, 14 + }) => { 15 + const response = await page.goto('/notifications'); 16 + console.log('status:', response?.status(), 'final url:', page.url()); 17 + 18 + await expect(page).toHaveURL('/login'); 19 + }); 20 + 21 + test('unauthenticated /home visit redirects to /login', async ({ page }) => { 22 + const response = await page.goto('/home'); 23 + console.log('status:', response?.status(), 'final url:', page.url()); 24 + 25 + await expect(page).toHaveURL('/login'); 26 + });
+20
src/webapp/e2e/example.spec.ts
··· 1 + import { test, expect } from '@playwright/test'; 2 + 3 + test('has title', async ({ page }) => { 4 + await page.goto('https://playwright.dev/'); 5 + 6 + // Expect a title "to contain" a substring. 7 + await expect(page).toHaveTitle(/Playwright/); 8 + }); 9 + 10 + test('get started link', async ({ page }) => { 11 + await page.goto('https://playwright.dev/'); 12 + 13 + // Click the get started link. 14 + await page.getByRole('link', { name: 'Get started' }).click(); 15 + 16 + // Expects page to have a heading with the name of Installation. 17 + await expect( 18 + page.getByRole('heading', { name: 'Installation' }), 19 + ).toBeVisible(); 20 + });
+1 -1
src/webapp/next-env.d.ts
··· 1 1 /// <reference types="next" /> 2 2 /// <reference types="next/image-types/global" /> 3 - import "./.next/types/routes.d.ts"; 3 + import "./.next/dev/types/routes.d.ts"; 4 4 5 5 // NOTE: This file should not be edited 6 6 // see https://nextjs.org/docs/app/api-reference/config/typescript for more information.
+1
src/webapp/package.json
··· 55 55 "web-haptics": "^0.0.6" 56 56 }, 57 57 "devDependencies": { 58 + "@playwright/test": "^1.59.1", 58 59 "@testing-library/dom": "^10.4.1", 59 60 "@testing-library/react": "^16.3.2", 60 61 "@testing-library/user-event": "^14.6.1",
+79
src/webapp/playwright.config.ts
··· 1 + import { defineConfig, devices } from '@playwright/test'; 2 + 3 + /** 4 + * Read environment variables from file. 5 + * https://github.com/motdotla/dotenv 6 + */ 7 + // import dotenv from 'dotenv'; 8 + // import path from 'path'; 9 + // dotenv.config({ path: path.resolve(__dirname, '.env') }); 10 + 11 + /** 12 + * See https://playwright.dev/docs/test-configuration. 13 + */ 14 + export default defineConfig({ 15 + testDir: './e2e', 16 + /* Run tests in files in parallel */ 17 + fullyParallel: true, 18 + /* Fail the build on CI if you accidentally left test.only in the source code. */ 19 + forbidOnly: !!process.env.CI, 20 + /* Retry on CI only */ 21 + retries: process.env.CI ? 2 : 0, 22 + /* Opt out of parallel tests on CI. */ 23 + workers: process.env.CI ? 1 : undefined, 24 + /* Reporter to use. See https://playwright.dev/docs/test-reporters */ 25 + reporter: 'html', 26 + /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ 27 + use: { 28 + /* Base URL to use in actions like `await page.goto('')`. */ 29 + baseURL: process.env.PLAYWRIGHT_BASE_URL || 'http://127.0.0.1:4000/', 30 + 31 + /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */ 32 + trace: 'on-first-retry', 33 + }, 34 + 35 + /* Configure projects for major browsers */ 36 + projects: [ 37 + { 38 + name: 'chromium', 39 + use: { ...devices['Desktop Chrome'] }, 40 + }, 41 + 42 + { 43 + name: 'firefox', 44 + use: { ...devices['Desktop Firefox'] }, 45 + }, 46 + 47 + { 48 + name: 'webkit', 49 + use: { ...devices['Desktop Safari'] }, 50 + }, 51 + 52 + /* Test against mobile viewports. */ 53 + // { 54 + // name: 'Mobile Chrome', 55 + // use: { ...devices['Pixel 5'] }, 56 + // }, 57 + // { 58 + // name: 'Mobile Safari', 59 + // use: { ...devices['iPhone 12'] }, 60 + // }, 61 + 62 + /* Test against branded browsers. */ 63 + // { 64 + // name: 'Microsoft Edge', 65 + // use: { ...devices['Desktop Edge'], channel: 'msedge' }, 66 + // }, 67 + // { 68 + // name: 'Google Chrome', 69 + // use: { ...devices['Desktop Chrome'], channel: 'chrome' }, 70 + // }, 71 + ], 72 + 73 + /* Run your local dev server before starting the tests */ 74 + // webServer: { 75 + // command: 'npm run start', 76 + // url: 'http://localhost:3000', 77 + // reuseExistingServer: !process.env.CI, 78 + // }, 79 + });