enso/app/gui/e2e/project-view/fullscreenVisualisation.spec.ts
Adam Obuchowicz 4a249688e8
Unify Frontend App (#11287)
Fixes #10668
Fixes #8484

Summary of changes:
* `gui2` and `dashboard` are merged to `gui` directory. Various configs were merged (package.json, playwrigth, TS...). The src and e2e directories are split to `dashboard` and `project-view` for now.
* E2E tests run two servers on different ports. The tests are organized in projects. This is also to be changed soon, as we plan to [use better mocking in GUI/ProjectView](#9726)
* ESlint configs were merged to central `eslint.config.mjs`, and that file was moved to repository root. We kept the dashboard lints, but they can be relaxed. The dashboard code was changed to meet GUI lints.
* Also, the versions of linter plugins were bumped, and code fixed.
* The ide-desktop/client no longer has `dashboard` dependency - the only type used there was moved to common package.
* `common` package moved to `app`.
2024-10-11 18:23:02 +00:00

67 lines
2.0 KiB
TypeScript

import { test } from '@playwright/test'
import assert from 'assert'
import * as actions from './actions'
import { computedContent } from './css'
import { expect } from './customExpect'
import * as locate from './locate'
import { graphNodeByBinding } from './locate'
/**
Scenario: We open the default visualisation of the `aggregated` node. We then make it fullscreen and expect it to show
the JSON data of the node. We also expect it to cover the whole screen and to have a button to exit fullscreen mode.
*/
test('Load Fullscreen Visualisation', async ({ page }) => {
await actions.goToGraph(page)
const aggregatedNode = graphNodeByBinding(page, 'aggregated')
await aggregatedNode.click()
await page.keyboard.press('Space')
await page.waitForTimeout(1000)
const fullscreenButton = locate.enterFullscreenButton(aggregatedNode)
await fullscreenButton.click()
const vis = locate.jsonVisualization(page)
await expect(vis).toExist()
await expect(locate.exitFullscreenButton(page)).toExist()
// Wait for entering-fullscreen animation.
await vis.elementHandle().then((el) => el!.waitForElementState('stable'))
const visBoundingBox = await vis.boundingBox()
expect(visBoundingBox?.height).toBeGreaterThan(600)
expect(visBoundingBox?.width).toBe(1920)
const element = await vis.elementHandle()
assert(element != null)
const textContent = await computedContent(element)
const jsonContent = JSON.parse(textContent)
expect(jsonContent).toEqual({
axis: {
x: {
label: 'x-axis label',
scale: 'linear',
},
y: {
label: 'y-axis label',
scale: 'logarithmic',
},
},
points: {
labels: 'visible',
},
data: [
{
x: 0.1,
y: 0.7,
label: 'foo',
color: '#FF0000',
shape: 'circle',
size: 0.2,
},
{
x: 0.4,
y: 0.2,
label: 'baz',
color: '#0000FF',
shape: 'square',
size: 0.3,
},
],
})
})