Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run integration in CI. #11198

Merged
merged 17 commits into from
Oct 3, 2024
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
19 changes: 19 additions & 0 deletions .github/workflows/gui.yml
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,13 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VITE_ENSO_AG_GRID_LICENSE_KEY: ${{ vars.ENSO_AG_GRID_LICENSE_KEY }}
VITE_ENSO_MAPBOX_API_TOKEN: ${{ vars.ENSO_MAPBOX_API_TOKEN }}
- run: xvfb-run corepack pnpm -r --filter enso exec playwright test
env:
DEBUG: "pw:browser log:"
ENSO_TEST_APP_ARGS: --no-sandbox
ENSO_TEST_USER: ${{ secrets.ENSO_CLOUD_TEST_ACCOUNT_USERNAME }}
ENSO_TEST_USER_PASSWORD: ${{ secrets.ENSO_CLOUD_TEST_ACCOUNT_PASSWORD }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- if: failure() && runner.os == 'Windows'
name: List files if failed (Windows)
run: Get-ChildItem -Force -Recurse
Expand Down Expand Up @@ -428,6 +435,12 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VITE_ENSO_AG_GRID_LICENSE_KEY: ${{ vars.ENSO_AG_GRID_LICENSE_KEY }}
VITE_ENSO_MAPBOX_API_TOKEN: ${{ vars.ENSO_MAPBOX_API_TOKEN }}
- run: corepack pnpm -r --filter enso exec playwright test
env:
DEBUG: "pw:browser log:"
ENSO_TEST_USER: ${{ secrets.ENSO_CLOUD_TEST_ACCOUNT_USERNAME }}
ENSO_TEST_USER_PASSWORD: ${{ secrets.ENSO_CLOUD_TEST_ACCOUNT_PASSWORD }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- if: failure() && runner.os == 'Windows'
name: List files if failed (Windows)
run: Get-ChildItem -Force -Recurse
Expand Down Expand Up @@ -487,6 +500,12 @@ jobs:
VITE_ENSO_MAPBOX_API_TOKEN: ${{ vars.ENSO_MAPBOX_API_TOKEN }}
WIN_CSC_KEY_PASSWORD: ${{ secrets.MICROSOFT_CODE_SIGNING_CERT_PASSWORD }}
WIN_CSC_LINK: ${{ secrets.MICROSOFT_CODE_SIGNING_CERT }}
- run: corepack pnpm -r --filter enso exec playwright test
env:
DEBUG: "pw:browser log:"
ENSO_TEST_USER: ${{ secrets.ENSO_CLOUD_TEST_ACCOUNT_USERNAME }}
ENSO_TEST_USER_PASSWORD: ${{ secrets.ENSO_CLOUD_TEST_ACCOUNT_PASSWORD }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- if: failure() && runner.os == 'Windows'
name: List files if failed (Windows)
run: Get-ChildItem -Force -Recurse
Expand Down
1 change: 1 addition & 0 deletions app/ide-desktop/client/src/globals.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ declare global {
// === Integration test variables ===

readonly ENSO_TEST?: string
readonly ENSO_TEST_APP_ARGS?: string
readonly ENSO_TEST_USER?: string
readonly ENSO_TEST_USER_PASSWORD?: string
ENSO_TEST_EXEC_PATH?: string
Expand Down
23 changes: 22 additions & 1 deletion app/ide-desktop/client/tests/createNewProject.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,26 @@ electronTest('Create new project', async page => {
await loginAsTestUser(page)
await expect(page.getByRole('button', { name: 'New Project', exact: true })).toBeVisible()
await page.getByRole('button', { name: 'New Project', exact: true }).click()
await expect(page.locator('.GraphNode'), {}).toBeVisible({ timeout: 30000 })
await expect(page.locator('.GraphNode')).toHaveCount(1, { timeout: 30000 })

// We see the node type and visualization, so the engine is running the program
await expect(page.locator('.node-type')).toHaveText('Table')
await expect(page.locator('.TableVisualization')).toBeVisible()
await expect(page.locator('.TableVisualization')).toContainText('Welcome To Enso!')

// We can add new node and see suggestions.
await page.locator('.GraphNode').click()
await page.keyboard.press('Enter')
await expect(page.locator('.ComponentBrowser')).toBeVisible()
const entry = page.locator('.ComponentList .list-variant.selected .component', {
hasText: 'column_count',
})
await expect(entry).toBeVisible()
await entry.click()
await expect(page.locator('.GraphNode'), {}).toHaveCount(2)
await page.locator('.GraphNode', { hasText: 'column_count' }).click()
await page
.locator('.GraphNode', { hasText: 'column_count' })
.getByRole('button', { name: 'Visualization' })
.click()
})
7 changes: 7 additions & 0 deletions app/ide-desktop/client/tests/electronTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

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

const LOADING_TIMEOUT = 10000

/**
* Tests run on electron executable.
*
Expand All @@ -11,9 +13,13 @@ export function electronTest(name: string, body: (page: Page) => Promise<void> |
test(name, async () => {
const app = await _electron.launch({
executablePath: process.env.ENSO_TEST_EXEC_PATH ?? '',
args: process.env.ENSO_TEST_APP_ARGS != null ? process.env.ENSO_TEST_APP_ARGS.split(',') : [],
env: { ...process.env, ['ENSO_TEST']: name },
})
const page = await app.firstWindow()
// Wait until page will be finally loaded: we expect login screen.
// There's bigger timeout, because the page may load longer on CI machines.
await expect(page.getByText('Login to your account')).toBeVisible({ timeout: LOADING_TIMEOUT })
await body(page)
await app.close()
})
Expand All @@ -32,6 +38,7 @@ export async function loginAsTestUser(page: Page) {
'Cannot log in; `ENSO_TEST_USER` and `ENSO_TEST_USER_PASSWORD` env variables are not provided',
)
}
await page.getByRole('textbox', { name: 'email' }).click()
await page.keyboard.insertText(process.env.ENSO_TEST_USER)
await page.keyboard.press('Tab')
await page.keyboard.insertText(process.env.ENSO_TEST_USER_PASSWORD)
Expand Down
22 changes: 21 additions & 1 deletion build/build/src/ci_gen/job.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ use crate::ide::web::env::VITE_ENSO_AG_GRID_LICENSE_KEY;
use crate::ide::web::env::VITE_ENSO_MAPBOX_API_TOKEN;

use ide_ci::actions::workflow::definition::cancel_workflow_action;
use ide_ci::actions::workflow::definition::shell;
use ide_ci::actions::workflow::definition::Access;
use ide_ci::actions::workflow::definition::Job;
use ide_ci::actions::workflow::definition::JobArchetype;
Expand Down Expand Up @@ -528,7 +529,26 @@ impl JobArchetype for PackageIde {
RunStepsBuilder::new(
"ide build --backend-source current-ci-run --gui-upload-artifact false",
)
.customize(with_packaging_steps(target.0))
.customize(move |step| {
let mut steps = prepare_packaging_steps(target.0, step);
const TEST_COMMAND: &str = "corepack pnpm -r --filter enso exec playwright test";
let test_step = if target.0 == OS::Linux {
shell(format!("xvfb-run {TEST_COMMAND}"))
// See https://askubuntu.com/questions/1512287/obsidian-appimage-the-suid-sandbox-helper-binary-was-found-but-is-not-configu
.with_env("ENSO_TEST_APP_ARGS", "--no-sandbox")
} else {
shell(TEST_COMMAND)
};
let test_step = test_step
.with_env("DEBUG", "pw:browser log:")
.with_secret_exposed_as(secret::ENSO_CLOUD_TEST_ACCOUNT_USERNAME, "ENSO_TEST_USER")
.with_secret_exposed_as(
secret::ENSO_CLOUD_TEST_ACCOUNT_PASSWORD,
"ENSO_TEST_USER_PASSWORD",
);
steps.push(test_step);
steps
})
.build_job("Package New IDE", target)
}
}
Expand Down
Loading