Skip to content
Merged
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
27 changes: 27 additions & 0 deletions frontend/.github/workflows/playwright.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Playwright Tests
on:
push:
branches: [ main, master ]
pull_request:
branches: [ main, master ]
jobs:
test:
timeout-minutes: 60
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: lts/*
- name: Install dependencies
run: npm install -g pnpm && pnpm install
- name: Install Playwright Browsers
run: pnpm exec playwright install --with-deps
- name: Run Playwright tests
run: pnpm exec playwright test
- uses: actions/upload-artifact@v4
if: ${{ !cancelled() }}
with:
name: playwright-report
path: playwright-report/
retention-days: 30
7 changes: 7 additions & 0 deletions frontend/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,10 @@ next-env.d.ts
*.log
# Switches based on env
.env

# Playwright
node_modules/
/test-results/
/playwright-report/
/blob-report/
/playwright/.cache/
8 changes: 4 additions & 4 deletions frontend/__tests__/Bookmark/NewBookmarkCard.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -327,8 +327,8 @@ describe("Success Toast", () => {
scrapable: true,
};

axiosMock.onPost(tagsAPI, ["testtag"]).reply(() => {
return [200, expectedResult];
axiosMock.onPost(tagsAPI).reply(() => {
return [200, JSON.stringify(expectedResult)];
});

axiosMock
Expand All @@ -339,14 +339,14 @@ describe("Success Toast", () => {
scrapable: true,
})
.reply(() => {
return [200, expectedBookmark];
return [200, JSON.stringify(expectedBookmark)];
});

await user.click(submit);

// Wait for the success toast to appear
expect(
await screen.findByText("Bookmark added successfully!")
await screen.findByText("Bookmark added successfully!"),
).toBeInTheDocument();
});
});
1 change: 1 addition & 0 deletions frontend/api/Api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ instance.interceptors.response.use(
return response;
},
(error) => {
console.log(error);
if (error.response.status === 401) {
console.log("Error on fetch");
if (failCount > 1) {
Expand Down
39 changes: 24 additions & 15 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,24 +20,24 @@
"@types/react": "19.0.2",
"@types/react-dom": "19.0.2",
"autoprefixer": "10.4.20",
"axios": "^1.7.9",
"axios": "^1.9.0",
"axios-mock-adapter": "^2.1.0",
"bootstrap": "^5.3.3",
"bootstrap": "^5.3.5",
"bootstrap-icons": "^1.11.3",
"dotenv": "^16.4.7",
"dotenv": "^16.5.0",
"eslint": "9.17.0",
"eslint-config-next": "15.1.3",
"formik": "^2.4.6",
"jest": "^29.7.0",
"next": "15.1.3",
"next": "^15.3.1",
"next-router-mock": "^0.9.13",
"postcss": "^8.5.1",
"postcss": "^8.5.3",
"react": "19.0.0",
"react-bootstrap": "^2.10.9",
"react-dom": "19.0.0",
"react-toastify": "^11.0.3",
"rxjs": "^7.8.1",
"sass": "^1.83.4",
"react-toastify": "^11.0.5",
"rxjs": "^7.8.2",
"sass": "^1.87.0",
"tailwindcss": "3.4.17",
"typescript": "5.7.2",
"use-file-picker": "^2.1.2",
Expand All @@ -46,14 +46,16 @@
"yup": "^1.6.1"
},
"devDependencies": {
"@playwright/test": "^1.52.0",
"@testing-library/jest-dom": "^6.6.3",
"@testing-library/react": "^16.2.0",
"@testing-library/react": "^16.3.0",
"@testing-library/user-event": "^14.6.1",
"@vitejs/plugin-react": "^4.3.4",
"@vitest/coverage-v8": "^2.1.8",
"@vitest/ui": "^2.1.8",
"@vitejs/plugin-react": "^4.4.1",
"@vitest/coverage-v8": "^3.1.2",
"@vitest/ui": "^3.1.2",
"jsdom": "^25.0.1",
"vitest": "^2.1.9"
"testcontainers": "^10.24.2",
"vitest": "^3.1.2"
},
"pnpm": {
"overrides": {
Expand All @@ -66,8 +68,15 @@
"qs": "6.5.3",
"moment": "^2.29.4",
"@types/react": "19.0.2",
"@types/react-dom": "19.0.2"
"@types/react-dom": "19.0.2",
"esbuild@<=0.24.2": ">=0.25.0",
"vite@<=4.5.5": ">=4.5.6",
"vite@<4.5.10": ">=4.5.10",
"next@>=15.0.0 <15.2.3": ">=15.2.3",
"vite@<4.5.11": ">=4.5.11",
"vite@<4.5.12": ">=4.5.12",
"vite@<4.5.13": ">=4.5.13"
}
},
"packageManager": "pnpm@10.4.0+sha512.6b849d0787d97f8f4e1f03a9b8ff8f038e79e153d6f11ae539ae7c435ff9e796df6a862c991502695c7f9e8fac8aeafc1ac5a8dab47e36148d183832d886dd52"
"packageManager": "pnpm@10.10.0+sha512.d615db246fe70f25dcfea6d8d73dee782ce23e2245e3c4f6f888249fb568149318637dca73c2c5c8ef2a4ca0d5657fb9567188bfab47f566d1ee6ce987815c39"
}
80 changes: 80 additions & 0 deletions frontend/playwright.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
import { defineConfig, devices } from '@playwright/test';

/**
* Read environment variables from file.
* https://github.com/motdotla/dotenv
*/
// import dotenv from 'dotenv';
// import path from 'path';
// dotenv.config({ path: path.resolve(__dirname, '.env') });

/**
* See https://playwright.dev/docs/test-configuration.
*/
export default defineConfig({
globalSetup: require.resolve('./tests_e2e/setup.ts'),
globalTeardown: require.resolve('./tests_e2e/teardown.ts'),
testDir: './tests_e2e',
/* Run tests in files in parallel */
fullyParallel: true,
/* Fail the build on CI if you accidentally left test.only in the source code. */
forbidOnly: !!process.env.CI,
/* Retry on CI only */
retries: process.env.CI ? 2 : 0,
/* Opt out of parallel tests on CI. */
workers: process.env.CI ? 1 : undefined,
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
reporter: 'html',
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
use: {
/* Base URL to use in actions like `await page.goto('/')`. */
// baseURL: 'http://127.0.0.1:3000',

/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
trace: 'on-first-retry',
},
/* Configure projects for major browsers */
projects: [
{
name: 'chromium',
use: { ...devices['Desktop Chrome'] },
},

{
name: 'firefox',
use: { ...devices['Desktop Firefox'] },
},

{
name: 'webkit',
use: { ...devices['Desktop Safari'] },
},

/* Test against mobile viewports. */
// {
// name: 'Mobile Chrome',
// use: { ...devices['Pixel 5'] },
// },
// {
// name: 'Mobile Safari',
// use: { ...devices['iPhone 12'] },
// },

/* Test against branded browsers. */
// {
// name: 'Microsoft Edge',
// use: { ...devices['Desktop Edge'], channel: 'msedge' },
// },
// {
// name: 'Google Chrome',
// use: { ...devices['Desktop Chrome'], channel: 'chrome' },
// },
],

/* Run your local dev server before starting the tests */
// webServer: {
// command: 'npm run start',
// url: 'http://127.0.0.1:3000',
// reuseExistingServer: !process.env.CI,
// },
});
Loading