enso/app/gui2/e2e/componentBrowser.spec.ts
Adam Obuchowicz be2ae3279c
E2E Tests in CI (#8462)
Fixes #8433 

* Adds E2E test to `test` script in gui2 (without server)
* Add options to `run` script to specify what test should be run: `unit` (default), `e2e`, or `ci` (which runs both unit and e2e without watching/spawning report server).
* The CI test step now checks e2e tests.

### Important Notes

~~One of e2e tests was disabled because it caught the regression on develop: #8476 ~~
2023-12-12 15:27:40 +01:00

24 lines
1.1 KiB
TypeScript

import { expect, test } from '@playwright/test'
import * as actions from './actions'
import * as customExpect from './customExpect'
import * as locate from './locate'
test('component browser shows entries, and creates a new node', async ({ page }) => {
await actions.goToGraph(page)
await locate.graphEditor(page).click()
await locate.graphEditor(page).press('Enter')
await customExpect.toExist(locate.componentBrowser(page))
await customExpect.toExist(locate.componentBrowserEntry(page))
let nodeCount = await locate.graphNode(page).count()
await locate.componentBrowserEntry(page).last().click()
await expect(locate.componentBrowser(page)).not.toBeVisible()
await expect(locate.graphNode(page)).toHaveCount(nodeCount + 1)
// Clicking at highlighted entry should also work.
nodeCount = await locate.graphNode(page).count()
await locate.graphEditor(page).press('Enter')
await locate.componentBrowserSelectedEntry(page).first().click()
await expect(locate.componentBrowser(page)).not.toBeVisible()
await expect(locate.graphNode(page)).toHaveCount(nodeCount + 1)
})