Spaces:
Running
Running
File size: 1,556 Bytes
aa9111f |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
// Tests error reporting.
import { test, expect } from '@playwright/test';
import { Workspace } from './lynxkite';
let workspace: Workspace;
test.beforeEach(async ({ browser }) => {
workspace = await Workspace.empty(await browser.newPage());
await workspace.setEnv('PyTorch model'); // Workaround until we fix the default environment
await workspace.setEnv('LynxKite Graph Analytics');
});
test('missing parameter', async () => {
// Test the correct error message is displayed when a required parameter is missing,
// and that the error message is removed when the parameter is filled.
await workspace.addBox('Create scale-free graph');
const graphBox = workspace.getBox('Create scale-free graph 1');
await graphBox.locator('input').fill('');
expect(await graphBox.locator('.error').innerText()).toBe("invalid literal for int() with base 10: ''");
await graphBox.locator('input').fill('10');
await expect(graphBox.locator('.error')).not.toBeVisible();
});
test('unknown operation', async () => {
// Test that the correct error is displayed when the operation does not belong to
// the current environment.
await workspace.addBox('Create scale-free graph');
await workspace.setEnv('LynxScribe');
const csvBox = workspace.getBox('Create scale-free graph 1');
const errorText = await csvBox.locator('.error').innerText();
expect(errorText).toBe('Operation "Create scale-free graph" not found.');
await workspace.setEnv('LynxKite Graph Analytics');
await expect(csvBox.locator('.error')).not.toBeVisible();
});
|