2022-11-09 14:34:34 +00:00
|
|
|
import { expect } from '@playwright/test';
|
|
|
|
|
|
|
|
import { loadFixture } from '../../playwright/paths';
|
|
|
|
import { test } from '../../playwright/test';
|
|
|
|
|
|
|
|
test.describe('Debug-Sidebar', async () => {
|
2022-12-06 12:01:30 +00:00
|
|
|
test.slow(process.platform === 'darwin' || process.platform === 'win32', 'Slow app start on these platforms');
|
2022-11-09 14:34:34 +00:00
|
|
|
test.beforeEach(async ({ app, page }) => {
|
2023-08-28 13:53:37 +00:00
|
|
|
await page.getByRole('button', { name: 'Create in project' }).click();
|
2022-11-09 14:34:34 +00:00
|
|
|
const text = await loadFixture('simple.yaml');
|
|
|
|
await app.evaluate(async ({ clipboard }, text) => clipboard.writeText(text), text);
|
2023-08-28 13:53:37 +00:00
|
|
|
await page.getByRole('menuitemradio', { name: 'Import' }).click();
|
2023-09-24 23:12:50 +00:00
|
|
|
await page.locator('[data-test-id="import-from-clipboard"]').click();
|
2023-03-31 10:53:22 +00:00
|
|
|
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-09 14:34:34 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
test.describe('Interact with sidebar', async () => {
|
2023-08-30 08:57:14 +00:00
|
|
|
test('Open Properties in Request Sidebar', async ({ page }) => {
|
2023-08-22 16:12:29 +00:00
|
|
|
const requestLocator = page.getByLabel('Request Collection').getByRole('row', { name: 'example http' });
|
|
|
|
await requestLocator.click();
|
|
|
|
await requestLocator.getByLabel('Request Actions').click();
|
|
|
|
await page.getByRole('menuitemradio', { name: 'Settings' }).click();
|
2023-08-04 17:17:18 +00:00
|
|
|
await page.getByRole('tab', { name: 'Preview' }).click();
|
2022-11-09 14:34:34 +00:00
|
|
|
// Close settings modal
|
|
|
|
await page.locator('.app').press('Escape');
|
|
|
|
|
2023-08-30 08:57:14 +00:00
|
|
|
const grpc = page.getByLabel('Request Collection').getByRole('row', { name: 'example grpc' });
|
|
|
|
await grpc.click();
|
|
|
|
await grpc.getByLabel('Request Actions').click();
|
2023-08-22 16:12:29 +00:00
|
|
|
await page.getByRole('menuitemradio', { name: 'Settings' }).click();
|
2022-11-09 14:34:34 +00:00
|
|
|
// Close settings modal
|
|
|
|
await page.locator('.app').press('Escape');
|
|
|
|
|
2023-08-30 08:57:14 +00:00
|
|
|
const ws = page.getByLabel('Request Collection').getByRole('row', { name: 'example websocket' });
|
|
|
|
await ws.click();
|
|
|
|
await ws.getByLabel('Request Actions').click();
|
2023-08-22 16:12:29 +00:00
|
|
|
await page.getByRole('menuitemradio', { name: 'Settings' }).click();
|
2023-08-04 17:17:18 +00:00
|
|
|
await page.getByRole('tab', { name: 'Preview' }).click();
|
2022-11-09 14:34:34 +00:00
|
|
|
// Close settings modal
|
|
|
|
await page.locator('.app').press('Escape');
|
|
|
|
|
2023-08-30 08:57:14 +00:00
|
|
|
const gql = page.getByLabel('Request Collection').getByRole('row', { name: 'example graphql' });
|
|
|
|
await gql.click();
|
|
|
|
await gql.getByLabel('Request Actions').click();
|
2023-08-22 16:12:29 +00:00
|
|
|
await page.getByRole('menuitemradio', { name: 'Settings' }).click();
|
2023-08-04 17:17:18 +00:00
|
|
|
await page.getByRole('tab', { name: 'Preview' }).click();
|
2022-11-09 14:34:34 +00:00
|
|
|
// Close settings modal
|
|
|
|
await page.locator('.app').press('Escape');
|
2023-08-22 16:12:29 +00:00
|
|
|
const folderLocator = page.getByLabel('Request Collection').getByRole('row', { name: 'test folder' });
|
|
|
|
await folderLocator.click();
|
|
|
|
await folderLocator.getByLabel('Request Group Actions').click();
|
|
|
|
await page.getByRole('menuitemradio', { name: 'Settings' }).click();
|
2023-08-04 17:17:18 +00:00
|
|
|
await page.getByRole('tab', { name: 'Preview' }).click();
|
2023-08-30 08:57:14 +00:00
|
|
|
// Close settings modal
|
|
|
|
await page.locator('.app').press('Escape');
|
2022-11-09 14:34:34 +00:00
|
|
|
});
|
|
|
|
|
2022-11-21 17:30:50 +00:00
|
|
|
test('Open properties of the collection', async ({ page }) => {
|
2023-09-24 23:12:50 +00:00
|
|
|
await page.getByLabel('Workspace actions', { exact: true }).click();
|
|
|
|
await page.getByRole('menuitemradio', { name: 'Settings' }).click();
|
2023-07-05 16:51:55 +00:00
|
|
|
await page.getByText('Collection Settings').click();
|
2022-11-09 14:34:34 +00:00
|
|
|
});
|
|
|
|
|
2022-11-30 09:51:36 +00:00
|
|
|
test('Filter by request name', async ({ page }) => {
|
2023-08-30 08:57:14 +00:00
|
|
|
await page.getByLabel('Request filter').click();
|
|
|
|
await page.getByLabel('Request filter').fill('example http');
|
2023-08-22 16:12:29 +00:00
|
|
|
await page.getByLabel('Request Collection').getByRole('row', { name: 'example http' }).click();
|
2022-11-09 14:34:34 +00:00
|
|
|
});
|
|
|
|
|
2022-12-06 12:01:30 +00:00
|
|
|
test('Filter by a folder name', async ({ page }) => {
|
2023-08-30 08:57:14 +00:00
|
|
|
await page.getByLabel('Request filter').click();
|
|
|
|
await page.getByLabel('Request filter').fill('test folder');
|
|
|
|
await page.getByLabel('Request filter').press('Enter');
|
2023-08-22 16:12:29 +00:00
|
|
|
await page.getByLabel('Request Collection').getByRole('row', { name: 'test folder' }).click();
|
2022-11-09 14:34:34 +00:00
|
|
|
});
|
|
|
|
|
2022-12-13 17:46:54 +00:00
|
|
|
test('Open Generate code', async ({ page }) => {
|
2023-08-22 16:12:29 +00:00
|
|
|
const requestLocator = page.getByLabel('Request Collection').getByRole('row', { name: 'example http' });
|
|
|
|
await requestLocator.click();
|
|
|
|
await requestLocator.getByLabel('Request Actions').click();
|
|
|
|
await page.getByRole('menuitemradio', { name: 'Generate Code' }).click();
|
2022-12-13 17:46:54 +00:00
|
|
|
await page.locator('[data-testid="CodeEditor"] >> text=curl').click();
|
|
|
|
await page.locator('text=Done').click();
|
|
|
|
});
|
|
|
|
|
|
|
|
test.skip('Use Copy as Curl for a request', async ({}) => {
|
|
|
|
// TODO: implement this in a separate ticket
|
2022-11-09 14:34:34 +00:00
|
|
|
});
|
|
|
|
|
2022-12-06 12:01:30 +00:00
|
|
|
test('Pin a Request', async ({ page }) => {
|
2023-08-22 16:12:29 +00:00
|
|
|
const requestLocator = page.getByLabel('Request Collection').getByRole('row', { name: 'example http' });
|
|
|
|
await requestLocator.click();
|
|
|
|
await requestLocator.getByLabel('Request Actions').click();
|
|
|
|
await page.getByRole('menuitemradio', { name: 'Pin' }).click();
|
2022-12-06 12:01:30 +00:00
|
|
|
// Click pinned request on pinned request list
|
2023-08-22 16:12:29 +00:00
|
|
|
const pinnedRequestLocator = page.getByLabel('Pinned Requests').getByRole('row', { name: 'example http' });
|
|
|
|
await pinnedRequestLocator.click();
|
|
|
|
|
|
|
|
await requestLocator.click();
|
2022-11-09 14:34:34 +00:00
|
|
|
});
|
|
|
|
|
2022-12-06 12:01:30 +00:00
|
|
|
test('Delete Request', async ({ page }) => {
|
2023-08-22 16:12:29 +00:00
|
|
|
const requestLocator = page.getByLabel('Request Collection').getByRole('row', { name: 'example http' });
|
|
|
|
await requestLocator.click();
|
|
|
|
await requestLocator.getByLabel('Request Actions').click();
|
|
|
|
await page.getByRole('menuitemradio', { name: 'Delete' }).click();
|
2022-12-06 12:01:30 +00:00
|
|
|
await expect(page.locator('.app')).not.toContainText('example http');
|
2022-11-09 14:34:34 +00:00
|
|
|
});
|
|
|
|
|
2022-12-06 12:01:30 +00:00
|
|
|
test('Rename a request', async ({ page }) => {
|
2023-08-22 16:12:29 +00:00
|
|
|
const requestLocator = page.getByLabel('Request Collection').getByRole('row', { name: 'example http' });
|
|
|
|
await requestLocator.click();
|
|
|
|
await requestLocator.getByLabel('Request Actions').click();
|
|
|
|
await page.getByRole('menuitemradio', { name: 'Rename' }).click();
|
2022-12-06 12:01:30 +00:00
|
|
|
await page.locator('text=Rename RequestName Rename >> input[type="text"]').fill('example http1');
|
|
|
|
await page.locator('div[role="dialog"] button:has-text("Rename")').click();
|
2023-08-22 16:12:29 +00:00
|
|
|
await page.getByLabel('Request Collection').getByRole('row', { name: 'example http1' }).click();
|
2022-11-09 14:34:34 +00:00
|
|
|
});
|
|
|
|
|
2023-08-22 07:18:25 +00:00
|
|
|
test('Update a request folder via settings', async ({ page }) => {
|
2023-08-22 16:12:29 +00:00
|
|
|
const folderLocator = page.getByLabel('Request Collection').getByRole('row', { name: 'test folder' });
|
|
|
|
await folderLocator.click();
|
|
|
|
await folderLocator.getByLabel('Request Group Actions').click();
|
|
|
|
await page.getByRole('menuitemradio', { name: 'Settings' }).click();
|
2023-08-22 07:18:25 +00:00
|
|
|
await page.getByPlaceholder('test folder').fill('test folder1');
|
|
|
|
await page.locator('.app').press('Escape');
|
2023-08-22 16:12:29 +00:00
|
|
|
await page.getByLabel('Request Collection').getByRole('row', { name: 'test folder1' }).click();
|
2023-08-22 07:18:25 +00:00
|
|
|
});
|
|
|
|
|
2022-11-10 17:54:13 +00:00
|
|
|
test('Create a new HTTP request', async ({ page }) => {
|
2023-08-22 16:12:29 +00:00
|
|
|
await page.getByLabel('Create in collection').click();
|
|
|
|
await page.getByRole('menuitemradio', { name: 'Http Request' }).click();
|
2022-11-10 17:54:13 +00:00
|
|
|
await expect(page.locator('.app')).toContainText('New Request');
|
2022-11-09 14:34:34 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
// TODO: more scenarios will be added in follow-up iterations of increasing test coverage
|
2022-11-17 16:45:07 +00:00
|
|
|
});
|
2022-11-09 14:34:34 +00:00
|
|
|
});
|