mirror of
https://github.com/enso-org/enso.git
synced 2024-12-23 00:11:45 +03:00
b286adaae4
# Important Notes The command to run the gui dev environment has been changed. Invoking the old command will print a message about that. From now on, use `pnpm dev:gui2` in repository root.
42 lines
1.2 KiB
TypeScript
42 lines
1.2 KiB
TypeScript
import type { Page } from '@playwright/test'
|
|
import type { ExpressionUpdate, MethodCall } from 'ydoc-shared/languageServerTypes'
|
|
|
|
export type ExpressionLocator = string | { binding: string; expr: string }
|
|
|
|
/** Provide method call info for collapsed function call. */
|
|
export async function mockCollapsedFunctionInfo(
|
|
page: Page,
|
|
expression: ExpressionLocator,
|
|
functionName: string,
|
|
) {
|
|
await mockMethodCallInfo(page, expression, {
|
|
methodPointer: {
|
|
module: 'local.Mock_Project.Main',
|
|
definedOnType: 'local.Mock_Project.Main',
|
|
name: functionName,
|
|
},
|
|
notAppliedArguments: [],
|
|
})
|
|
}
|
|
|
|
/** Provide custom method call info for the specific node. */
|
|
export async function mockMethodCallInfo(
|
|
page: Page,
|
|
expression: ExpressionLocator,
|
|
methodCallInfo: MethodCall,
|
|
) {
|
|
await mockExpressionUpdate(page, expression, { methodCall: methodCallInfo })
|
|
}
|
|
|
|
/** Provide custom expression update for the specific node. */
|
|
export async function mockExpressionUpdate(
|
|
page: Page,
|
|
expression: ExpressionLocator,
|
|
update: Partial<ExpressionUpdate>,
|
|
) {
|
|
await page.evaluate(
|
|
({ expression, update }) => (window as any)._mockExpressionUpdate(expression, update),
|
|
{ expression, update },
|
|
)
|
|
}
|