mirror of
https://github.com/Kong/insomnia
synced 2024-11-08 14:49:53 +00:00
45d9d4ece5
* add /cookies endpoint to smoke test mock server * add smoke test steps for /cookies endpoint * Update packages/insomnia-smoke-test/tests/app.test.ts Co-authored-by: James Gatz <jamesgatzos@gmail.com>
50 lines
2.5 KiB
TypeScript
50 lines
2.5 KiB
TypeScript
import { expect } from '@playwright/test';
|
|
|
|
import { loadFixture } from '../playwright/paths';
|
|
import { test } from '../playwright/test';
|
|
|
|
test('url field is focused for first time users', async ({ page }) => {
|
|
const urlInput = ':nth-match(textarea, 2)';
|
|
const locator = page.locator(urlInput);
|
|
await expect(locator).toBeFocused();
|
|
});
|
|
|
|
test('can send requests', async ({ app, page }) => {
|
|
await page.click('[data-testid="project"]');
|
|
await page.click('text=Create');
|
|
|
|
const text = await loadFixture('smoke-test-collection.yaml');
|
|
await app.evaluate(async ({ clipboard }, text) => clipboard.writeText(text), text);
|
|
|
|
await page.click('button:has-text("Clipboard")');
|
|
await page.click('text=CollectionSmoke testsjust now');
|
|
|
|
await page.click('button:has-text("GETdelayed request")');
|
|
await page.click('text=http://127.0.0.1:4010/delay/seconds/20Send >> button');
|
|
await page.click('text=Loading...Cancel Request >> button');
|
|
await page.click('text=Request was cancelled');
|
|
await page.click('button:has-text("GETsend JSON request")');
|
|
await page.click('text=http://127.0.0.1:4010/pets/1Send >> button');
|
|
await page.click('text=200 OK');
|
|
await page.click('button:has-text("GETsends dummy.csv request and shows rich response")');
|
|
await page.click('text=http://127.0.0.1:4010/file/dummy.csvSend >> button');
|
|
await page.click('text=200 OK');
|
|
await page.click('button:has-text("GETsends dummy.xml request and shows raw response")');
|
|
await page.click('text=http://127.0.0.1:4010/file/dummy.xmlSend >> button');
|
|
await page.click('text=200 OK');
|
|
await page.click('button:has-text("GETsends dummy.pdf request and shows rich response")');
|
|
await page.click('text=http://127.0.0.1:4010/file/dummy.pdfSend >> button');
|
|
await page.click('text=200 OK');
|
|
await page.click('button:has-text("GETsends request with basic authentication")');
|
|
await page.click('text=http://127.0.0.1:4010/auth/basicSend >> button');
|
|
await page.click('text=200 OK');
|
|
|
|
// Send request, check if no cookie was sent (server will reply with received cookies + a new cookie as response)
|
|
await page.click('button:has-text("GETsends request with cookie and get cookie in response")');
|
|
await page.click('text=http://127.0.0.1:4010/cookiesSend >> button');
|
|
await page.click('text=undefined');
|
|
// Send request, check if new cookie sent by server in previous request is now also sent
|
|
await page.click('text=http://127.0.0.1:4010/cookiesSend >> button');
|
|
await page.click('text=insomnia-test-cookie=value123');
|
|
});
|