2022-06-03 10:44:54 +00:00
|
|
|
import { expect } from '@playwright/test';
|
|
|
|
|
2022-10-11 08:56:12 +00:00
|
|
|
import { test } from '../../playwright/test';
|
2022-06-03 10:44:54 +00:00
|
|
|
|
|
|
|
test('can render Spectral OpenAPI lint errors', async ({ page }) => {
|
2023-06-27 18:46:43 +00:00
|
|
|
await page.getByRole('button', { name: 'New Document' }).click();
|
|
|
|
await page.getByRole('dialog').getByRole('button', { name: 'Create' }).click();
|
2022-06-03 10:44:54 +00:00
|
|
|
await page.click('text=Design');
|
|
|
|
await page.click('text=start from an example');
|
|
|
|
|
|
|
|
const codeEditor = page.locator('.pane-one');
|
|
|
|
await expect(codeEditor).toContainText('openapi: 3.0.0');
|
|
|
|
|
|
|
|
// Cause a lint error
|
|
|
|
await page.locator('[data-testid="CodeEditor"] >> text=info').click();
|
|
|
|
await page.locator('textarea').nth(1).press('Tab');
|
2023-01-11 16:06:46 +00:00
|
|
|
// TODO - fix the locator so we don't rely on `.nth(1)` https://linear.app/insomnia/issue/INS-2255/revisit-codemirror-playwright-selectorfill
|
2022-06-03 10:44:54 +00:00
|
|
|
|
2023-09-11 14:56:17 +00:00
|
|
|
await page.getByLabel('Toggle lint panel').click();
|
2022-06-03 10:44:54 +00:00
|
|
|
await expect(codeEditor).toContainText('oas3-schema Object must have required property "info"');
|
|
|
|
});
|