mirror of
https://github.com/enso-org/enso.git
synced 2025-01-03 19:03:22 +03:00
b83c5a15eb
- Close https://github.com/enso-org/cloud-v2/issues/1604 - Add ability to track backend calls - Remove inconsistent integration test code - Add skeleton classes for settings pages # Important Notes None
1.9 KiB
1.9 KiB
Integration tests
Running tests
Execute all commands from the parent directory. Note that all options can be used in any combination.
# Run tests normally
pnpm playwright test
# Open UI to run tests
pnpm playwright test --ui
# Run tests in a specific file only
pnpm playwright test integration-test/dashboard/file-name-here.spec.ts
# Compile the entire app before running the tests.
# DOES NOT hot reload the tests.
# Prefer not using this when you are trying to fix a test;
# prefer using this when you just want to know which tests are failing (if any).
PROD=true pnpm playwright test
Getting started
// ONLY chain methods from `pageActions`.
// Using methods not in `pageActions` is UNDEFINED BEHAVIOR.
// If it is absolutely necessary though, please remember to `await` the method chain.
test('test name here', ({ page }) => mockAllAndLogin({ page }).goToPage.drive())
Perform arbitrary actions (e.g. actions on the API)
test('test name here', ({ page }) =>
mockAllAndLogin({ page }).do((_page, { api }) => {
api.foo()
api.bar()
expect(api.baz()?.quux).toEqual('bar')
}))
Writing new classes extending BaseActions
- Make sure that every method returns either the class itself (
this
) or.into(AnotherActionsClass<Context>)
. - Avoid constructing
new AnotherActionsClass()
- instead prefer.into(AnotherActionsClass<Context>)
and optionally.into(ThisClass<Context>)
if required. - Never construct an
ActionsClass
- In some rare exceptions, it is fine as long as you
await
thePageActions
class - for example inindex.ts
there isawait new StartModalActions().close()
.
- In some rare exceptions, it is fine as long as you
- Methods for locators are fine, but it is not recommended to expose them as it makes it easy to accidentally - i.e. it is fine as long as they are
private
.- In general, avoid exposing any method that returns a
Promise
rather than aPageActions
.
- In general, avoid exposing any method that returns a