2022-11-29 14:35:23 +00:00
|
|
|
import { loadFixture } from '../../playwright/paths';
|
|
|
|
import { test } from '../../playwright/test';
|
|
|
|
|
|
|
|
test.describe('Cookie editor', async () => {
|
|
|
|
|
|
|
|
test.beforeEach(async ({ app, page }) => {
|
2023-01-20 14:49:52 +00:00
|
|
|
await page.getByRole('button', { name: 'Create' }).click();
|
2022-11-29 14:35:23 +00:00
|
|
|
const text = await loadFixture('simple.yaml');
|
|
|
|
await app.evaluate(async ({ clipboard }, text) => clipboard.writeText(text), text);
|
2023-03-31 10:53:22 +00:00
|
|
|
await page.getByRole('menuitem', { name: 'Import' }).click();
|
|
|
|
await page.getByText('Clipboard').click();
|
|
|
|
await page.getByRole('button', { name: 'Scan' }).click();
|
2023-07-05 16:51:55 +00:00
|
|
|
await page.getByRole('dialog').getByRole('button', { name: 'Import' }).click();
|
2023-06-27 15:43:51 +00:00
|
|
|
await page.getByText('Collectionsimplejust now').click();
|
2022-11-29 14:35:23 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
test('create and send a cookie', async ({ page }) => {
|
|
|
|
|
|
|
|
// Open cookie editor
|
|
|
|
await page.click('button:has-text("Cookies")');
|
|
|
|
|
|
|
|
// Edit existing cookie
|
2023-08-04 17:17:18 +00:00
|
|
|
await page.getByRole('button', { name: 'Edit' }).first().click();
|
2022-11-29 14:35:23 +00:00
|
|
|
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
|
2023-01-20 14:49:52 +00:00
|
|
|
await page.getByRole('button', { name: 'Actions' }).click();
|
|
|
|
await page.getByRole('menuitem', { name: 'Add Cookie' }).click();
|
2023-08-04 17:17:18 +00:00
|
|
|
await page.getByRole('button', { name: 'Edit' }).first().click();
|
2022-11-29 14:35:23 +00:00
|
|
|
|
|
|
|
// Try to replace text in Raw view
|
2023-01-20 14:49:52 +00:00
|
|
|
await page.getByRole('tab', { name: 'Raw' }).click();
|
2022-11-29 14:35:23 +00:00
|
|
|
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
|
2023-01-20 14:49:52 +00:00
|
|
|
await page.getByRole('button', { name: 'example http' }).click();
|
2022-11-29 14:35:23 +00:00
|
|
|
await page.click('[data-testid="request-pane"] button:has-text("Send")');
|
|
|
|
|
|
|
|
// Check in the timeline that the cookie was sent
|
2023-01-20 14:49:52 +00:00
|
|
|
await page.getByRole('tab', { name: 'Timeline' }).click();
|
2022-11-29 14:35:23 +00:00
|
|
|
await page.click('text=foo2=bar2; foo=b123ar');
|
|
|
|
|
|
|
|
// Send ws request
|
2023-01-20 14:49:52 +00:00
|
|
|
await page.getByRole('button', { name: 'example websocket' }).click();
|
2022-11-29 14:35:23 +00:00
|
|
|
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
|
2023-01-20 14:49:52 +00:00
|
|
|
await page.getByRole('tab', { name: 'Timeline' }).click();
|
2022-11-29 14:35:23 +00:00
|
|
|
await page.click('text=foo2=bar2; foo=b123ar;');
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|