diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 03c79e2342..7da4efa72d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -29,7 +29,7 @@ jobs: - name: Build website run: node --run build:website - name: Install Playwright Browsers - run: npx playwright install chromium + run: npx playwright install chromium firefox - name: Test run: node --run test timeout-minutes: 4 diff --git a/package.json b/package.json index 65047a6ef9..d01ea70c1f 100644 --- a/package.json +++ b/package.json @@ -67,7 +67,7 @@ "@typescript-eslint/parser": "^8.33.1", "@vitejs/plugin-react": "^4.5.2", "@vitest/browser": "^3.2.3", - "@vitest/coverage-v8": "^3.2.3", + "@vitest/coverage-istanbul": "^3.2.3", "@vitest/eslint-plugin": "^1.2.1", "@wyw-in-js/rollup": "^0.7.0", "@wyw-in-js/vite": "^0.7.0", diff --git a/test/browser/column/renderEditCell.test.tsx b/test/browser/column/renderEditCell.test.tsx index 2a3efc9dfc..150752e3fd 100644 --- a/test/browser/column/renderEditCell.test.tsx +++ b/test/browser/column/renderEditCell.test.tsx @@ -22,7 +22,7 @@ describe('Editor', () => { await userEvent.keyboard('2'); await userEvent.tab(); await expect.element(editor).not.toBeInTheDocument(); - expect(getCellsAtRowIndex(0)[0]).toHaveTextContent(/^12$/); + expect(getCellsAtRowIndex(0)[0]).toHaveTextContent(12); }); it('should open and commit changes on enter', async () => { @@ -42,7 +42,7 @@ describe('Editor', () => { page.render(); await userEvent.click(getCellsAtRowIndex(0)[0]); await userEvent.keyboard('123{enter}'); - expect(getCellsAtRowIndex(0)[0]).toHaveTextContent(/^1123$/); + expect(getCellsAtRowIndex(0)[0]).toHaveTextContent('123'); }); it('should close editor and discard changes on escape', async () => { @@ -99,7 +99,8 @@ describe('Editor', () => { const editor = page.getByRole('spinbutton', { name: 'col1-editor' }); await expect.element(editor).not.toBeInTheDocument(); expect(getGrid().element().scrollTop).toBe(2000); - await userEvent.keyboard('123'); + // `1{backspace}` is needed to fix tests in FF + await userEvent.keyboard('1{backspace}123'); expect(getCellsAtRowIndex(0)).toHaveLength(2); await expect.element(editor).toHaveValue(123); expect(getGrid().element().scrollTop).toBe(0); @@ -193,9 +194,9 @@ describe('Editor', () => { }} /> ); - await userEvent.click(getCellsAtRowIndex(0)[1]); + await userEvent.dblClick(getCellsAtRowIndex(0)[1]); await userEvent.keyboard('yz{enter}'); - expect(getCellsAtRowIndex(0)[1]).toHaveTextContent(/^a1yz$/); + expect(getCellsAtRowIndex(0)[1]).toHaveTextContent('yz'); await userEvent.keyboard('x'); await expect .element(page.getByRole('textbox', { name: 'col2-editor' })) diff --git a/vite.config.ts b/vite.config.ts index 028bfc2e4e..66baba5305 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -75,18 +75,16 @@ export default defineConfig(({ command, isPreview }) => ({ server: { open: true }, - optimizeDeps: { - include: ['@vitest/coverage-v8/browser'] - }, test: { globals: true, + maxWorkers: 4, coverage: { - provider: 'v8', + provider: 'istanbul', enabled: isCI, include: ['src/**/*.{ts,tsx}'], reporter: ['json'] }, - testTimeout: isCI ? 10000 : 5000, + testTimeout: 20_000, restoreMocks: true, sequence: { shuffle: true @@ -104,6 +102,10 @@ export default defineConfig(({ command, isPreview }) => ({ { browser: 'chromium', context: { viewport } + }, + { + browser: 'firefox', + context: { viewport } } ], commands: { resizeColumn, dragFill },