Add traces to integration tests

This commit is contained in:
Adam Obuchowicz 2024-11-19 17:11:13 +01:00
parent 579399db0a
commit 4fba551076
4 changed files with 35 additions and 0 deletions

View File

@ -372,6 +372,12 @@ jobs:
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()
name: Upload Test Traces
uses: actions/upload-artifact@v4
with:
name: test-traces
path: app/ide-desktop/client/test-traces
- run: rm $HOME/.enso/credentials
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@ -444,6 +450,12 @@ jobs:
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()
name: Upload Test Traces
uses: actions/upload-artifact@v4
with:
name: test-traces
path: app/ide-desktop/client/test-traces
- run: rm $HOME/.enso/credentials
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@ -512,6 +524,12 @@ jobs:
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()
name: Upload Test Traces
uses: actions/upload-artifact@v4
with:
name: test-traces
path: app/ide-desktop/client/test-traces
- run: rm $HOME/.enso/credentials
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

1
.gitignore vendored
View File

@ -180,5 +180,6 @@ test-results
##########################
test-results/
test-traces/
playwright-report/
playwright/.cache/

View File

@ -23,13 +23,16 @@ export function electronTest(
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 },
tracesDir: 'test-traces',
})
const page = await app.firstWindow()
await app.context().tracing.start({ screenshots: true, snapshots: true, sources: true })
// 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 })
const projectsDir = pathModule.join(os.tmpdir(), 'enso-test-projects', name)
await body({ page, projectsDir })
await app.context().tracing.stop({ path: `${name}.zip` })
await app.close()
})
}

View File

@ -17,6 +17,7 @@ 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::step::Argument;
use ide_ci::actions::workflow::definition::Access;
use ide_ci::actions::workflow::definition::Job;
use ide_ci::actions::workflow::definition::JobArchetype;
@ -555,6 +556,18 @@ impl JobArchetype for PackageIde {
);
steps.push(test_step);
let upload_test_traces_step = Step {
r#if: Some("failure()".into()),
name: Some("Upload Test Traces".into()),
uses: Some("actions/upload-artifact@v4".into()),
with: Some(Argument::Other(BTreeMap::from_iter([
("name".into(), "test-traces".into()),
("path".into(), "app/ide-desktop/client/test-traces".into()),
]))),
..Default::default()
};
steps.push(upload_test_traces_step);
// After the E2E tests run, they create a credentials file in user home directory.
// If that file is not cleaned up, future runs of our tests may randomly get
// authenticated into Enso Cloud. We want to run tests as an authenticated