mirror of
https://github.com/enso-org/enso.git
synced 2024-12-26 15:11:47 +03:00
4a249688e8
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`.
74 lines
2.6 KiB
TypeScript
74 lines
2.6 KiB
TypeScript
import { expect, test } from 'playwright/test'
|
|
import * as actions from './actions'
|
|
import { mockMethodCallInfo } from './expressionUpdates'
|
|
import { CONTROL_KEY } from './keyboard'
|
|
import * as locate from './locate'
|
|
|
|
test('Main method documentation', async ({ page }) => {
|
|
await actions.goToGraph(page)
|
|
|
|
// Documentation panel hotkey opens right-dock.
|
|
await expect(locate.rightDock(page)).toBeHidden()
|
|
await page.keyboard.press(`${CONTROL_KEY}+D`)
|
|
await expect(locate.rightDock(page)).toBeVisible()
|
|
|
|
// Right-dock displays main method documentation.
|
|
await expect(locate.lexicalContent(locate.rightDock(page))).toHaveText('The main method')
|
|
|
|
// Documentation hotkey closes right-dock.p
|
|
await page.keyboard.press(`${CONTROL_KEY}+D`)
|
|
await expect(locate.rightDock(page)).toBeHidden()
|
|
})
|
|
|
|
test('Doc panel focus (regression #10471)', async ({ page }) => {
|
|
await actions.goToGraph(page)
|
|
|
|
await page.keyboard.press(`${CONTROL_KEY}+D`)
|
|
await page.keyboard.press(`${CONTROL_KEY}+\``)
|
|
await expect(locate.rightDock(page)).toBeVisible()
|
|
await expect(locate.bottomDock(page)).toBeVisible()
|
|
|
|
// Focus code editor.
|
|
await locate.bottomDock(page).click()
|
|
|
|
await page.evaluate(() => {
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
const codeEditor = (window as any).__codeEditorApi
|
|
const docStart = codeEditor.indexOf('The main method')
|
|
codeEditor.placeCursor(docStart + 8)
|
|
})
|
|
await page.keyboard.press('Space')
|
|
await page.keyboard.press('T')
|
|
await page.keyboard.press('E')
|
|
await page.keyboard.press('S')
|
|
await page.keyboard.press('T')
|
|
|
|
const content = await page.evaluate(() => {
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
const codeEditor = (window as any).__codeEditorApi
|
|
return codeEditor.textContent()
|
|
})
|
|
expect(content.includes('The main TEST method')).toBe(true)
|
|
await expect(locate.rightDock(page)).toContainText('The main TEST method')
|
|
})
|
|
|
|
test('Component help', async ({ page }) => {
|
|
await actions.goToGraph(page, false)
|
|
await locate.rightDock(page).getByRole('button', { name: 'Help' }).click()
|
|
await expect(locate.rightDock(page)).toHaveText(/Select a single component/)
|
|
|
|
await locate.graphNodeByBinding(page, 'final').click()
|
|
await expect(locate.rightDock(page)).toHaveText(/No documentation available/)
|
|
|
|
await mockMethodCallInfo(page, 'data', {
|
|
methodPointer: {
|
|
module: 'Standard.Base.Data',
|
|
definedOnType: 'Standard.Base.Data',
|
|
name: 'read',
|
|
},
|
|
notAppliedArguments: [0, 1, 2],
|
|
})
|
|
await locate.graphNodeByBinding(page, 'data').click()
|
|
await expect(locate.rightDock(page)).toHaveText(/Reads a file into Enso/)
|
|
})
|