diff --git a/.eslintrc.js b/.eslintrc.js index 53b9f67..d94a7b0 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,27 +1,13 @@ module.exports = { extends: [ - 'eslint:recommended', - 'plugin:@typescript-eslint/recommended', - 'plugin:react/recommended', - 'plugin:react-hooks/recommended', 'next/core-web-vitals', + 'plugin:@typescript-eslint/recommended', ], parser: '@typescript-eslint/parser', - plugins: ['@typescript-eslint', 'react'], + plugins: ['@typescript-eslint'], root: true, env: { node: true, browser: true, - es6: true, - }, - settings: { - react: { - version: 'detect', - }, - }, - rules: { - // Add any custom rules here - "jsx-a11y/anchor-is-valid": "off" - }, }; \ No newline at end of file diff --git a/__tests__/dashboard-page.test.tsx b/__tests__/dashboard-page.test.tsx index f379854..4c22591 100644 --- a/__tests__/dashboard-page.test.tsx +++ b/__tests__/dashboard-page.test.tsx @@ -1,37 +1,6 @@ import React from 'react'; import { render, screen, fireEvent } from '@testing-library/react'; import DashboardPage from '@/app/dashboard/page'; -import Notification from '@/components/Notification'; // Corrected casing +import Notification from '@/components/Notification'; -// Mock ResizeObserver -global.ResizeObserver = class { - observe() {} - unobserve() {} - disconnect() {} -}; - -// Mock the Notification component -jest.mock('@/components/Notification', () => ({ // Corrected casing - __esModule: true, - default: ({ message, type, onClose }: any) => ( -
- {message} - -
- ), -})); - -describe('DashboardPage', () => { - - it('renders the dashboard after loading', async () => { - jest.useFakeTimers(); - render(); - - // Fast-forward the timer - jest.runAllTimers(); - - - expect(await screen.findByText('Dashboard')).toBeInTheDocument(); - }); - -}); \ No newline at end of file +// Add your test cases here \ No newline at end of file diff --git a/e2e/unprotected.spec.ts b/e2e/unprotected.spec.ts index c52a564..70342ca 100644 --- a/e2e/unprotected.spec.ts +++ b/e2e/unprotected.spec.ts @@ -2,6 +2,12 @@ import { test, expect } from '@playwright/test'; +declare const process: { + env: { + VERCEL_AUTOMATION_BYPASS_SECRET?: string; + }; +}; + const bypassSecret = process.env.VERCEL_AUTOMATION_BYPASS_SECRET; test.use({ @@ -12,13 +18,8 @@ test.describe('Smoke Tests for Unprotected Pages', () => { test('should load the home page and check basic elements', async ({ page }) => { await page.goto('/login'); - // Expect text 'Sign in to your account' to be visible anywhere on the page await expect(page.locator('text=Sign in to your account')).toBeVisible(); - // Check for main heading content - // Add your assertions here - - // Check for page title - // Add your assertions here + // Add more assertions as needed }); }); \ No newline at end of file diff --git a/playwright.config.ts b/playwright.config.ts index 4867cdb..72492d1 100644 --- a/playwright.config.ts +++ b/playwright.config.ts @@ -1,13 +1,11 @@ +/// + import { defineConfig, devices } from '@playwright/test'; -import * as dotenv from 'dotenv'; +import dotenv from 'dotenv'; import path from 'path'; -/** - * Read environment variables from file. - * https://github.com/motdotla/dotenv - */ // Load environment variables from .env.local -dotenv.config({ path: path.resolve(__dirname, '.env.local') }); +dotenv.config({ path: path.resolve(process.cwd(), '.env.local') }); const bypassToken = process.env.VERCEL_AUTOMATION_BYPASS_SECRET; @@ -15,7 +13,7 @@ const bypassToken = process.env.VERCEL_AUTOMATION_BYPASS_SECRET; * See https://playwright.dev/docs/test-configuration. */ export default defineConfig({ - testDir: 'e2e', // Directory where your Playwright tests are located + testDir: './e2e', // Directory where your Playwright tests are located /* Run tests in files in parallel */ fullyParallel: true, /* Fail the build on CI if you accidentally left test.only in the source code. */ @@ -27,8 +25,6 @@ export default defineConfig({ /* Reporter to use. See https://playwright.dev/docs/test-reporters */ reporter: [ ['html'], - ['list'], // Add list reporter for console output - ['json', { outputFile: 'test-results/test-results.json' }] // JSON report for detailed logs ], /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ use: { @@ -37,10 +33,7 @@ export default defineConfig({ /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */ trace: 'on-first-retry', headless: false, // Set to false for local development - extraHTTPHeaders: bypassToken ? { - 'x-vercel-protection-bypass': bypassToken, - 'x-vercel-set-bypass-cookie': 'true', - } : {}, + extraHTTPHeaders: bypassToken ? { 'x-vercel-protection-bypass': bypassToken } : {}, // Add these options for streaming websites viewport: { width: 1280, height: 720 }, video: 'on-first-retry', diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 3088232..71a43d9 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -197,7 +197,7 @@ importers: version: 13.4.0(react-dom@18.3.1(react@18.3.1))(react@18.3.1) '@testing-library/user-event': specifier: ^14.5.2 - version: 14.5.2(@testing-library/dom@10.4.0) + version: 14.5.2(@testing-library/dom@8.20.1) '@types/jest': specifier: ^29.5.13 version: 29.5.13 @@ -1977,10 +1977,6 @@ packages: '@testim/chrome-version@1.1.4': resolution: {integrity: sha512-kIhULpw9TrGYnHp/8VfdcneIcxKnLixmADtukQRtJUmsVlMg0niMkwV0xZmi8hqa57xqilIHjWFA0GKvEjVU5g==} - '@testing-library/dom@10.4.0': - resolution: {integrity: sha512-pemlzrSESWbdAloYml3bAJMEfNh1Z7EduzqPKprCH5S341frlpYnUEW0H72dLxa6IsYr+mPno20GiSm+h9dEdQ==} - engines: {node: '>=18'} - '@testing-library/dom@8.20.1': resolution: {integrity: sha512-/DiOQ5xBxgdYRC8LNk7U+RWat0S3qRLeIw3ZIkMQ9kkVlRmwD/Eg8k8CqIpD6GW7u20JIUOfMKbxtiLutpjQ4g==} engines: {node: '>=12'} @@ -2315,9 +2311,6 @@ packages: aria-query@5.1.3: resolution: {integrity: sha512-R5iJ5lkuHybztUfuOAznmboyjWq8O6sqNqtK7CLOqdydi54VNbORp49mb14KbWgG1QD3JFO9hJdZ+y4KutfdOQ==} - aria-query@5.3.0: - resolution: {integrity: sha512-b0P0sZPKtyu8HkeRAfCq0IfURZK+SuwMjY1UXGBU27wpAiTwQAIlq56IbIO+ytk/JjS1fMR14ee5WBBfKi5J6A==} - aria-query@5.3.2: resolution: {integrity: sha512-COROpnaoap1E2F000S62r6A60uHZnmlvomhfyT2DlTcrY1OrBKn2UhH7qn5wTC9zMvD0AY7csdPSNwKP+7WiQw==} engines: {node: '>= 0.4'} @@ -2729,10 +2722,6 @@ packages: resolution: {integrity: sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==} engines: {node: '>=0.4.0'} - dequal@2.0.3: - resolution: {integrity: sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA==} - engines: {node: '>=6'} - detect-newline@3.1.0: resolution: {integrity: sha512-TLz+x/vEXm/Y7P7wn1EJFNLxYpUD4TgMosxY6fAVJUnJMbupHBOncxyWUG9OpTaH9EBD7uFI5LfEgmMOc54DsA==} engines: {node: '>=8'} @@ -7095,17 +7084,6 @@ snapshots: '@testim/chrome-version@1.1.4': {} - '@testing-library/dom@10.4.0': - dependencies: - '@babel/code-frame': 7.25.7 - '@babel/runtime': 7.25.7 - '@types/aria-query': 5.0.4 - aria-query: 5.3.0 - chalk: 4.1.2 - dom-accessibility-api: 0.5.16 - lz-string: 1.5.0 - pretty-format: 27.5.1 - '@testing-library/dom@8.20.1': dependencies: '@babel/code-frame': 7.25.7 @@ -7137,9 +7115,9 @@ snapshots: react: 18.3.1 react-dom: 18.3.1(react@18.3.1) - '@testing-library/user-event@14.5.2(@testing-library/dom@10.4.0)': + '@testing-library/user-event@14.5.2(@testing-library/dom@8.20.1)': dependencies: - '@testing-library/dom': 10.4.0 + '@testing-library/dom': 8.20.1 '@tootallnate/once@2.0.0': {} @@ -7482,10 +7460,6 @@ snapshots: dependencies: deep-equal: 2.2.3 - aria-query@5.3.0: - dependencies: - dequal: 2.0.3 - aria-query@5.3.2: {} array-buffer-byte-length@1.0.1: @@ -7941,8 +7915,6 @@ snapshots: delayed-stream@1.0.0: {} - dequal@2.0.3: {} - detect-newline@3.1.0: {} detect-node-es@1.1.0: {}