insomnia/packages/insomnia-smoke-test/tests/prerelease/cookie-editor-interactions.test.ts
James Gatz 29acc92559
Improve import UX (#5869)
* add import routes and modal

* fix paths

* fix paths

* save

* remove import.ts

* ui

* save

* fix tests

* fix tests

* fix tests

* remove outdated test

* update import tests

* lint and ts fixes

* add section title and fix some style issues

* close modals on import success

* error handling for empty content

* fix api spec imports

* Simplify importResources function

Co-authored-by: Filipe Freire <filipe.r.freire@gmail.com>

* cleanup

* settings import button styles

* remove comment

* update tests

* comment for app-command imports

* fix test lint error

* update comments

* comment out app/import for now

---------

Co-authored-by: Filipe Freire <filipe.r.freire@gmail.com>
2023-03-31 10:53:22 +00:00

61 lines
2.4 KiB
TypeScript

import { loadFixture } from '../../playwright/paths';
import { test } from '../../playwright/test';
test.describe('Cookie editor', async () => {
test.beforeEach(async ({ app, page }) => {
await page.getByTestId('project').click();
await page.getByRole('button', { name: 'Create' }).click();
const text = await loadFixture('simple.yaml');
await app.evaluate(async ({ clipboard }, text) => clipboard.writeText(text), text);
await page.getByRole('menuitem', { name: 'Import' }).click();
await page.getByText('Clipboard').click();
await page.getByRole('button', { name: 'Scan' }).click();
await page.getByRole('button', { name: 'Import' }).click();
await page.getByRole('link', { name: 'Debug' }).click();
});
test('create and send a cookie', async ({ page }) => {
// Open cookie editor
await page.click('button:has-text("Cookies")');
// Edit existing cookie
await page.click('button:has-text("Edit")');
await page.click('pre[role="presentation"]:has-text("bar")');
await page.locator('[data-testid="CookieValue"] >> textarea').nth(1).fill('123');
await page.locator('text=Done').nth(1).click();
// Create a new cookie
await page.getByRole('button', { name: 'Actions' }).click();
await page.getByRole('menuitem', { name: 'Add Cookie' }).click();
await page.getByText('Edit').first().click();
// Try to replace text in Raw view
await page.getByRole('tab', { name: 'Raw' }).click();
await page.locator('text=Raw Cookie String >> input[type="text"]').fill('foo2=bar2; Expires=Tue, 19 Jan 2038 03:14:07 GMT; Domain=localhost; Path=/');
await page.locator('text=Done').nth(1).click();
await page.click('text=Done');
// Send http request
await page.getByRole('button', { name: 'example http' }).click();
await page.click('[data-testid="request-pane"] button:has-text("Send")');
// Check in the timeline that the cookie was sent
await page.getByRole('tab', { name: 'Timeline' }).click();
await page.click('text=foo2=bar2; foo=b123ar');
// Send ws request
await page.getByRole('button', { name: 'example websocket' }).click();
await page.click('text=ws://localhost:4010');
await page.click('[data-testid="request-pane"] >> text=Connect');
// Check in the timeline that the cookie was sent
await page.getByRole('tab', { name: 'Timeline' }).click();
await page.click('text=foo2=bar2; foo=b123ar;');
});
});