this repo has no description
0
fork

Configure Feed

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

Simple e2e tests for logged-out cases

+204 -5
+29
.github/workflows/playwright.yml
··· 1 + name: Playwright Tests 2 + on: 3 + push: 4 + branches: 5 + - main 6 + pull_request: 7 + branches: 8 + - main 9 + jobs: 10 + test: 11 + timeout-minutes: 60 12 + runs-on: ubuntu-latest 13 + steps: 14 + - uses: actions/checkout@v4 15 + - uses: actions/setup-node@v4 16 + with: 17 + node-version: lts/* 18 + - name: Install dependencies 19 + run: npm ci 20 + - name: Install Playwright Browsers 21 + run: npx playwright install --with-deps 22 + - name: Run Playwright tests 23 + run: npx playwright test 24 + - uses: actions/upload-artifact@v4 25 + if: ${{ !cancelled() }} 26 + with: 27 + name: playwright-report 28 + path: playwright-report/ 29 + retention-days: 30
+7 -1
.gitignore
··· 30 30 sonda-report.html 31 31 32 32 # Compiled locale files 33 - src/locales/*.js 33 + src/locales/*.js 34 + 35 + # Playwright 36 + /test-results/ 37 + /playwright-report/ 38 + /blob-report/ 39 + /playwright/.cache/
+79 -4
package-lock.json
··· 54 54 "@lingui/babel-plugin-lingui-macro": "~5.3.2", 55 55 "@lingui/cli": "~5.3.2", 56 56 "@lingui/vite-plugin": "~5.3.2", 57 + "@playwright/test": "~1.52.0", 57 58 "@preact/preset-vite": "~2.10.1", 59 + "@types/node": "~22.15.30", 58 60 "postcss": "~8.5.4", 59 61 "postcss-dark-theme-class": "~1.3.0", 60 62 "postcss-preset-env": "~10.2.0", ··· 3682 3684 "moo": "^0.5.1" 3683 3685 } 3684 3686 }, 3687 + "node_modules/@playwright/test": { 3688 + "version": "1.52.0", 3689 + "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.52.0.tgz", 3690 + "integrity": "sha512-uh6W7sb55hl7D6vsAeA+V2p5JnlAqzhqFyF0VcJkKZXkgnFcVG9PziERRHQfPLfNGx1C292a4JqbWzhR8L4R1g==", 3691 + "dev": true, 3692 + "license": "Apache-2.0", 3693 + "dependencies": { 3694 + "playwright": "1.52.0" 3695 + }, 3696 + "bin": { 3697 + "playwright": "cli.js" 3698 + }, 3699 + "engines": { 3700 + "node": ">=18" 3701 + } 3702 + }, 3685 3703 "node_modules/@preact/preset-vite": { 3686 3704 "version": "2.10.1", 3687 3705 "resolved": "https://registry.npmjs.org/@preact/preset-vite/-/preset-vite-2.10.1.tgz", ··· 4160 4178 } 4161 4179 }, 4162 4180 "node_modules/@types/node": { 4163 - "version": "18.11.17", 4164 - "resolved": "https://registry.npmjs.org/@types/node/-/node-18.11.17.tgz", 4165 - "integrity": "sha512-HJSUJmni4BeDHhfzn6nF0sVmd1SMezP7/4F0Lq+aXzmp2xm9O7WXrUtHW/CHlYVtZUbByEvWidHqRtcJXGF2Ng==", 4181 + "version": "22.15.30", 4182 + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.15.30.tgz", 4183 + "integrity": "sha512-6Q7lr06bEHdlfplU6YRbgG1SFBdlsfNC4/lX+SkhiTs0cpJkOElmWls8PxDFv4yY/xKb8Y6SO0OmSX4wgqTZbA==", 4166 4184 "devOptional": true, 4167 - "license": "MIT" 4185 + "license": "MIT", 4186 + "dependencies": { 4187 + "undici-types": "~6.21.0" 4188 + } 4168 4189 }, 4169 4190 "node_modules/@types/parse-json": { 4170 4191 "version": "4.0.2", ··· 7752 7773 "node": ">=8" 7753 7774 } 7754 7775 }, 7776 + "node_modules/playwright": { 7777 + "version": "1.52.0", 7778 + "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.52.0.tgz", 7779 + "integrity": "sha512-JAwMNMBlxJ2oD1kce4KPtMkDeKGHQstdpFPcPH3maElAXon/QZeTvtsfXmTMRyO9TslfoYOXkSsvao2nE1ilTw==", 7780 + "dev": true, 7781 + "license": "Apache-2.0", 7782 + "dependencies": { 7783 + "playwright-core": "1.52.0" 7784 + }, 7785 + "bin": { 7786 + "playwright": "cli.js" 7787 + }, 7788 + "engines": { 7789 + "node": ">=18" 7790 + }, 7791 + "optionalDependencies": { 7792 + "fsevents": "2.3.2" 7793 + } 7794 + }, 7795 + "node_modules/playwright-core": { 7796 + "version": "1.52.0", 7797 + "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.52.0.tgz", 7798 + "integrity": "sha512-l2osTgLXSMeuLZOML9qYODUQoPPnUsKsb5/P6LJ2e6uPKXUdPK5WYhN4z03G+YNbWmGDY4YENauNu4ZKczreHg==", 7799 + "dev": true, 7800 + "license": "Apache-2.0", 7801 + "bin": { 7802 + "playwright-core": "cli.js" 7803 + }, 7804 + "engines": { 7805 + "node": ">=18" 7806 + } 7807 + }, 7808 + "node_modules/playwright/node_modules/fsevents": { 7809 + "version": "2.3.2", 7810 + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", 7811 + "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", 7812 + "dev": true, 7813 + "hasInstallScript": true, 7814 + "license": "MIT", 7815 + "optional": true, 7816 + "os": [ 7817 + "darwin" 7818 + ], 7819 + "engines": { 7820 + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" 7821 + } 7822 + }, 7755 7823 "node_modules/pofile": { 7756 7824 "version": "1.1.4", 7757 7825 "resolved": "https://registry.npmjs.org/pofile/-/pofile-1.1.4.tgz", ··· 9867 9935 "funding": { 9868 9936 "url": "https://github.com/sponsors/ljharb" 9869 9937 } 9938 + }, 9939 + "node_modules/undici-types": { 9940 + "version": "6.21.0", 9941 + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.21.0.tgz", 9942 + "integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==", 9943 + "devOptional": true, 9944 + "license": "MIT" 9870 9945 }, 9871 9946 "node_modules/unicode-canonical-property-names-ecmascript": { 9872 9947 "version": "2.0.1",
+2
package.json
··· 62 62 "@lingui/babel-plugin-lingui-macro": "~5.3.2", 63 63 "@lingui/cli": "~5.3.2", 64 64 "@lingui/vite-plugin": "~5.3.2", 65 + "@playwright/test": "~1.52.0", 65 66 "@preact/preset-vite": "~2.10.1", 67 + "@types/node": "~22.15.30", 66 68 "postcss": "~8.5.4", 67 69 "postcss-dark-theme-class": "~1.3.0", 68 70 "postcss-preset-env": "~10.2.0",
+50
playwright.config.js
··· 1 + // @ts-check 2 + import { defineConfig, devices } from '@playwright/test'; 3 + 4 + /** 5 + * Read environment variables from file. 6 + * https://github.com/motdotla/dotenv 7 + */ 8 + // import dotenv from 'dotenv'; 9 + // import path from 'path'; 10 + // dotenv.config({ path: path.resolve(__dirname, '.env') }); 11 + 12 + /** 13 + * @see https://playwright.dev/docs/test-configuration 14 + */ 15 + export default defineConfig({ 16 + testDir: './tests', 17 + /* Run tests in files in parallel */ 18 + fullyParallel: true, 19 + /* Fail the build on CI if you accidentally left test.only in the source code. */ 20 + forbidOnly: !!process.env.CI, 21 + /* Retry on CI only */ 22 + retries: process.env.CI ? 2 : 0, 23 + /* Opt out of parallel tests on CI. */ 24 + workers: process.env.CI ? 1 : undefined, 25 + /* Reporter to use. See https://playwright.dev/docs/test-reporters */ 26 + reporter: 'html', 27 + /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ 28 + use: { 29 + /* Base URL to use in actions like `await page.goto('/')`. */ 30 + baseURL: 'http://localhost:5173', 31 + 32 + /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */ 33 + trace: 'on-first-retry', 34 + }, 35 + 36 + /* Configure projects for major browsers */ 37 + projects: [ 38 + { 39 + name: 'Mobile Safari', 40 + use: { ...devices['iPhone 13 Mini'] }, 41 + }, 42 + ], 43 + 44 + /* Run your local dev server before starting the tests */ 45 + webServer: { 46 + command: 'npm run dev', 47 + url: 'http://localhost:5173', 48 + reuseExistingServer: !process.env.CI, 49 + }, 50 + });
+37
tests/logged-out-view.spec.js
··· 1 + // @ts-check 2 + import { expect, test } from '@playwright/test'; 3 + 4 + test('has welcome page', async ({ page }) => { 5 + await page.goto('/'); 6 + await expect(page.locator('#welcome')).toBeVisible(); 7 + }); 8 + 9 + test('loads post page and works', async ({ page }) => { 10 + await page.route('**/api/v1/statuses/123', async (route) => { 11 + await route.fulfill({ 12 + json: { 13 + id: '123', 14 + created_at: '2024-01-01T12:00:00.000Z', 15 + account: { 16 + id: '1', 17 + username: 'testuser', 18 + display_name: 'Test User', 19 + acct: 'testuser@test.social', 20 + }, 21 + content: '<p>This is a test post</p>', 22 + }, 23 + }); 24 + }); 25 + 26 + await page.route('**/api/v1/statuses/123/context', async (route) => { 27 + await route.fulfill({ 28 + json: { 29 + ancestors: [], 30 + descendants: [], 31 + }, 32 + }); 33 + }); 34 + 35 + await page.goto('/#/test.social/s/123'); 36 + await expect(page.locator('text=This is a test post')).toBeVisible(); 37 + });