mirror of
https://github.com/enso-org/enso.git
synced 2024-12-26 15:21:41 +03:00
8edf49343f
fixes #9730 Added a `logEvent` method to remote backend implementation in dashboard. Added an always-present remote backend instance that can be used for logging even when running a local project (intentional behavior). # Important Notes Because the backend implementation requires access to always fresh session token, the logger needs to be periodically updated on GUI side, so it can continue to function. To accomplish that, I simplified the app loading logic to treat GUI as an ordinary react component, so its props can be updated with normal react rendering flow. That refactor also removed the dynamic GUI asset loading code that was only needed for Rust GUI.
42 lines
1.2 KiB
TypeScript
42 lines
1.2 KiB
TypeScript
import type { Page } from '@playwright/test'
|
|
import type { ExpressionUpdate, MethodCall } from '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 },
|
|
)
|
|
}
|