enso/app/ide-desktop/client/tests/setup.ts
Adam Obuchowicz e6b904d012
Integration Tests (#11186)
A stub for integration tests to be run locally; part of #8487

To run tests, you need to:
1. Build IDE package: `./run ide build`
2. set ENSO_TEST_USER and ENSO_TEST_USER_PASSWORD to some working credentials (I used my personal account, but there will be also test user soon)
3. run `corepack pnpm -r --filter enso exec playwright test`

The tests are run with a separate projects directory set up in tmpdir, so any local workspace dir is not affected.

The only test so far just checks if it's possible to log in and create a new project.
2024-09-27 15:11:13 +00:00

31 lines
785 B
TypeScript

/** @file {@link setup} function for all tests. */
import * as fs from 'node:fs'
const POSSIBLE_EXEC_PATHS = [
'../../../dist/ide/linux-unpacked/enso',
'../../../dist/ide/win-unpacked/Enso.exe',
'../../../dist/ide/mac/Enso.app/Contents/MacOS/Enso',
'../../../dist/ide/mac-arm64/Enso.app/Contents/MacOS/Enso',
]
/**
* Setup for all tests: checks if and where electron exec is.
* @throws when no Enso package could be found.
*/
export default function setup() {
const execPath = POSSIBLE_EXEC_PATHS.find(path => {
try {
fs.accessSync(path, fs.constants.X_OK)
return true
} catch (err) {
return false
}
})
if (execPath != null) {
process.env.ENSO_TEST_EXEC_PATH = execPath
} else {
throw Error('Cannot find Enso package')
}
}