Skip to content

Commit c7cc5f0

Browse files
authored
Run integration in CI. (#11198)
Added a step for packaging IDE which runs integration tests. This is an additional step, not a job, because here I'm sure the package will exist and won't be built unnecessarily twice. Technically I could make a job downloading it from GH action, but didn't want to invest time to rust scripts. Once Bazel will be fully introduced, the integration test will be improved. # Important Notes Fixes #8487
1 parent a2c853c commit c7cc5f0

File tree

5 files changed

+70
-2
lines changed

5 files changed

+70
-2
lines changed

.github/workflows/gui.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,13 @@ jobs:
365365
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
366366
VITE_ENSO_AG_GRID_LICENSE_KEY: ${{ vars.ENSO_AG_GRID_LICENSE_KEY }}
367367
VITE_ENSO_MAPBOX_API_TOKEN: ${{ vars.ENSO_MAPBOX_API_TOKEN }}
368+
- run: xvfb-run corepack pnpm -r --filter enso exec playwright test
369+
env:
370+
DEBUG: "pw:browser log:"
371+
ENSO_TEST_APP_ARGS: --no-sandbox
372+
ENSO_TEST_USER: ${{ secrets.ENSO_CLOUD_TEST_ACCOUNT_USERNAME }}
373+
ENSO_TEST_USER_PASSWORD: ${{ secrets.ENSO_CLOUD_TEST_ACCOUNT_PASSWORD }}
374+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
368375
- if: failure() && runner.os == 'Windows'
369376
name: List files if failed (Windows)
370377
run: Get-ChildItem -Force -Recurse
@@ -428,6 +435,12 @@ jobs:
428435
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
429436
VITE_ENSO_AG_GRID_LICENSE_KEY: ${{ vars.ENSO_AG_GRID_LICENSE_KEY }}
430437
VITE_ENSO_MAPBOX_API_TOKEN: ${{ vars.ENSO_MAPBOX_API_TOKEN }}
438+
- run: corepack pnpm -r --filter enso exec playwright test
439+
env:
440+
DEBUG: "pw:browser log:"
441+
ENSO_TEST_USER: ${{ secrets.ENSO_CLOUD_TEST_ACCOUNT_USERNAME }}
442+
ENSO_TEST_USER_PASSWORD: ${{ secrets.ENSO_CLOUD_TEST_ACCOUNT_PASSWORD }}
443+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
431444
- if: failure() && runner.os == 'Windows'
432445
name: List files if failed (Windows)
433446
run: Get-ChildItem -Force -Recurse
@@ -487,6 +500,12 @@ jobs:
487500
VITE_ENSO_MAPBOX_API_TOKEN: ${{ vars.ENSO_MAPBOX_API_TOKEN }}
488501
WIN_CSC_KEY_PASSWORD: ${{ secrets.MICROSOFT_CODE_SIGNING_CERT_PASSWORD }}
489502
WIN_CSC_LINK: ${{ secrets.MICROSOFT_CODE_SIGNING_CERT }}
503+
- run: corepack pnpm -r --filter enso exec playwright test
504+
env:
505+
DEBUG: "pw:browser log:"
506+
ENSO_TEST_USER: ${{ secrets.ENSO_CLOUD_TEST_ACCOUNT_USERNAME }}
507+
ENSO_TEST_USER_PASSWORD: ${{ secrets.ENSO_CLOUD_TEST_ACCOUNT_PASSWORD }}
508+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
490509
- if: failure() && runner.os == 'Windows'
491510
name: List files if failed (Windows)
492511
run: Get-ChildItem -Force -Recurse

app/ide-desktop/client/src/globals.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,7 @@ declare global {
191191
// === Integration test variables ===
192192

193193
readonly ENSO_TEST?: string
194+
readonly ENSO_TEST_APP_ARGS?: string
194195
readonly ENSO_TEST_USER?: string
195196
readonly ENSO_TEST_USER_PASSWORD?: string
196197
ENSO_TEST_EXEC_PATH?: string

app/ide-desktop/client/tests/createNewProject.spec.ts

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,26 @@ electronTest('Create new project', async page => {
99
await loginAsTestUser(page)
1010
await expect(page.getByRole('button', { name: 'New Project', exact: true })).toBeVisible()
1111
await page.getByRole('button', { name: 'New Project', exact: true }).click()
12-
await expect(page.locator('.GraphNode'), {}).toBeVisible({ timeout: 30000 })
12+
await expect(page.locator('.GraphNode')).toHaveCount(1, { timeout: 30000 })
13+
14+
// We see the node type and visualization, so the engine is running the program
15+
await expect(page.locator('.node-type')).toHaveText('Table')
16+
await expect(page.locator('.TableVisualization')).toBeVisible()
17+
await expect(page.locator('.TableVisualization')).toContainText('Welcome To Enso!')
18+
19+
// We can add new node and see suggestions.
20+
await page.locator('.GraphNode').click()
21+
await page.keyboard.press('Enter')
22+
await expect(page.locator('.ComponentBrowser')).toBeVisible()
23+
const entry = page.locator('.ComponentList .list-variant.selected .component', {
24+
hasText: 'column_count',
25+
})
26+
await expect(entry).toBeVisible()
27+
await entry.click()
28+
await expect(page.locator('.GraphNode'), {}).toHaveCount(2)
29+
await page.locator('.GraphNode', { hasText: 'column_count' }).click()
30+
await page
31+
.locator('.GraphNode', { hasText: 'column_count' })
32+
.getByRole('button', { name: 'Visualization' })
33+
.click()
1334
})

app/ide-desktop/client/tests/electronTest.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
import { _electron, expect, type Page, test } from '@playwright/test'
44

5+
const LOADING_TIMEOUT = 10000
6+
57
/**
68
* Tests run on electron executable.
79
*
@@ -11,9 +13,13 @@ export function electronTest(name: string, body: (page: Page) => Promise<void> |
1113
test(name, async () => {
1214
const app = await _electron.launch({
1315
executablePath: process.env.ENSO_TEST_EXEC_PATH ?? '',
16+
args: process.env.ENSO_TEST_APP_ARGS != null ? process.env.ENSO_TEST_APP_ARGS.split(',') : [],
1417
env: { ...process.env, ['ENSO_TEST']: name },
1518
})
1619
const page = await app.firstWindow()
20+
// Wait until page will be finally loaded: we expect login screen.
21+
// There's bigger timeout, because the page may load longer on CI machines.
22+
await expect(page.getByText('Login to your account')).toBeVisible({ timeout: LOADING_TIMEOUT })
1723
await body(page)
1824
await app.close()
1925
})
@@ -32,6 +38,7 @@ export async function loginAsTestUser(page: Page) {
3238
'Cannot log in; `ENSO_TEST_USER` and `ENSO_TEST_USER_PASSWORD` env variables are not provided',
3339
)
3440
}
41+
await page.getByRole('textbox', { name: 'email' }).click()
3542
await page.keyboard.insertText(process.env.ENSO_TEST_USER)
3643
await page.keyboard.press('Tab')
3744
await page.keyboard.insertText(process.env.ENSO_TEST_USER_PASSWORD)

build/build/src/ci_gen/job.rs

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ use crate::ide::web::env::VITE_ENSO_AG_GRID_LICENSE_KEY;
1414
use crate::ide::web::env::VITE_ENSO_MAPBOX_API_TOKEN;
1515

1616
use ide_ci::actions::workflow::definition::cancel_workflow_action;
17+
use ide_ci::actions::workflow::definition::shell;
1718
use ide_ci::actions::workflow::definition::Access;
1819
use ide_ci::actions::workflow::definition::Job;
1920
use ide_ci::actions::workflow::definition::JobArchetype;
@@ -528,7 +529,26 @@ impl JobArchetype for PackageIde {
528529
RunStepsBuilder::new(
529530
"ide build --backend-source current-ci-run --gui-upload-artifact false",
530531
)
531-
.customize(with_packaging_steps(target.0))
532+
.customize(move |step| {
533+
let mut steps = prepare_packaging_steps(target.0, step);
534+
const TEST_COMMAND: &str = "corepack pnpm -r --filter enso exec playwright test";
535+
let test_step = if target.0 == OS::Linux {
536+
shell(format!("xvfb-run {TEST_COMMAND}"))
537+
// See https://askubuntu.com/questions/1512287/obsidian-appimage-the-suid-sandbox-helper-binary-was-found-but-is-not-configu
538+
.with_env("ENSO_TEST_APP_ARGS", "--no-sandbox")
539+
} else {
540+
shell(TEST_COMMAND)
541+
};
542+
let test_step = test_step
543+
.with_env("DEBUG", "pw:browser log:")
544+
.with_secret_exposed_as(secret::ENSO_CLOUD_TEST_ACCOUNT_USERNAME, "ENSO_TEST_USER")
545+
.with_secret_exposed_as(
546+
secret::ENSO_CLOUD_TEST_ACCOUNT_PASSWORD,
547+
"ENSO_TEST_USER_PASSWORD",
548+
);
549+
steps.push(test_step);
550+
steps
551+
})
532552
.build_job("Package New IDE", target)
533553
}
534554
}

0 commit comments

Comments
 (0)