insomnia/packages/insomnia-smoke-test/tests/critical/bundling.test.ts
Jack Kavanagh 6d5b2a6024
feat(prereq): add simple timeout (#7079)
* add simple timeout

* configurable timeout

* use label for workspace cards

* toggle visible

* add stop

* second timeout

* add test

* fix lint

* exclude from eslint

* fix types
2024-03-01 13:17:21 +01:00

39 lines
2.2 KiB
TypeScript

import { expect } from '@playwright/test';
import { loadFixture } from '../../playwright/paths';
import { test } from '../../playwright/test';
test('can use node-libcurl, httpsnippet, hidden browser window', async ({ app, page }) => {
const statusTag = page.locator('[data-testid="response-status-tag"]:visible');
const responseBody = page.locator('[data-testid="CodeEditor"]:visible', {
has: page.locator('.CodeMirror-activeline'),
});
await page.getByRole('button', { name: 'Create in project' }).click();
const text = await loadFixture('smoke-test-collection.yaml');
await app.evaluate(async ({ clipboard }, text) => clipboard.writeText(text), text);
await page.getByRole('menuitemradio', { name: 'Import' }).click();
await page.locator('[data-test-id="import-from-clipboard"]').click();
await page.getByRole('button', { name: 'Scan' }).click();
await page.getByRole('dialog').getByRole('button', { name: 'Import' }).click();
await page.getByLabel('Smoke tests').click();
await page.getByLabel('Request Collection').getByTestId('send JSON request').press('Enter');
await page.getByTestId('request-pane').getByRole('button', { name: 'Send' }).click();
await expect(statusTag).toContainText('200 OK');
await expect(responseBody).toContainText('"id": "1"');
await page.getByRole('button', { name: 'Preview' }).click();
await page.getByRole('menuitem', { name: 'Raw Data' }).click();
await expect(responseBody).toContainText('{"id":"1"}');
await page.getByLabel('Request Collection').getByTestId('send JSON request').press('Enter');
await page.getByLabel('Request Collection').getByTestId('send JSON request').getByLabel('Request Actions').click();
await page.getByRole('menuitemradio', { name: 'Generate Code' }).click();
await page.getByText('curl --request GET \\').click();
await page.getByRole('button', { name: 'Done' }).click();
await page.getByLabel('Request Collection').getByTestId('sends request with pre-request script').press('Enter');
await page.getByTestId('request-pane').getByRole('button', { name: 'Send' }).click();
await expect(statusTag).toContainText('200 OK');
await page.getByRole('tab', { name: 'Timeline' }).click();
});