mirror of
https://github.com/enso-org/enso.git
synced 2024-12-29 19:32:10 +03:00
Reduce test flakiness (#8947)
Probably fixes the first point in #8942 My guess is that the mockExpressionUpdate may be not set in cases when the test runs before App mounting. To make sure all the setup is done, we wait for `App` widget to being mounted before proceeding. # Important Notes This PR also change the way we run test's server. Before it was always a production build, but this makes development iteration long. Now we test production build only on CI or when `PROD=true` env variable is set.
This commit is contained in:
parent
b8612344ca
commit
fa4b980d67
@ -1,4 +1,6 @@
|
||||
import { type Page } from '@playwright/test'
|
||||
import { expect, type Page } from '@playwright/test'
|
||||
import * as customExpect from './customExpect'
|
||||
import * as locate from './locate'
|
||||
|
||||
// =================
|
||||
// === goToGraph ===
|
||||
@ -7,5 +9,7 @@ import { type Page } from '@playwright/test'
|
||||
/** Perform a successful login. */
|
||||
export async function goToGraph(page: Page) {
|
||||
await page.goto('/')
|
||||
// Originally this clicked the play button but for now that is out of scope.
|
||||
await expect(page.locator('.App')).toBeVisible()
|
||||
// Wait until nodes are loaded.
|
||||
await customExpect.toExist(locate.graphNode(page))
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { expect, Locator, Page, test } from '@playwright/test'
|
||||
import { expect, test, type Locator, type Page } from '@playwright/test'
|
||||
import assert from 'assert'
|
||||
import * as actions from './actions'
|
||||
import { mockExpressionUpdate } from './expressionUpdates'
|
||||
|
@ -12,7 +12,7 @@
|
||||
"build": "npm --workspace enso-dashboard run compile && run-p typecheck build-only",
|
||||
"build:cloud": "cross-env CLOUD_BUILD=true npm run build",
|
||||
"preview": "vite preview",
|
||||
"test": "vitest run && playwright test --reporter=html",
|
||||
"test": "vitest run && playwright test",
|
||||
"test:unit": "vitest",
|
||||
"test:e2e": "playwright test",
|
||||
"story:dev": "histoire dev",
|
||||
|
@ -39,7 +39,6 @@ export default defineConfig({
|
||||
forbidOnly: !!process.env.CI,
|
||||
retries: process.env.CI ? 2 : 0,
|
||||
...(process.env.CI ? { workers: 1 } : {}),
|
||||
reporter: 'line',
|
||||
expect: {
|
||||
timeout: 5000,
|
||||
toHaveScreenshot: { threshold: 0 },
|
||||
@ -110,7 +109,10 @@ export default defineConfig({
|
||||
env: {
|
||||
E2E: 'true',
|
||||
},
|
||||
command: `npx vite build && npx vite preview --port ${PORT} --strictPort`,
|
||||
command:
|
||||
process.env.CI || process.env.PROD
|
||||
? `npx vite build && npx vite preview --port ${PORT} --strictPort`
|
||||
: `npx vite dev --port ${PORT}`,
|
||||
// Build from scratch apparently can take a while on CI machines.
|
||||
timeout: 120 * 1000,
|
||||
port: PORT,
|
||||
|
Loading…
Reference in New Issue
Block a user