2023-08-11 08:22:01 +00:00
|
|
|
import { expect } from '@playwright/test';
|
|
|
|
|
|
|
|
import { loadFixture } from '../../playwright/paths';
|
|
|
|
import { test } from '../../playwright/test';
|
|
|
|
|
|
|
|
test('can send requests', 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'),
|
|
|
|
});
|
2023-08-28 13:53:37 +00:00
|
|
|
await page.getByRole('button', { name: 'Create in project' }).click();
|
2023-08-11 08:22:01 +00:00
|
|
|
const text = await loadFixture('smoke-test-collection.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-08-11 08:22:01 +00:00
|
|
|
await page.getByRole('button', { name: 'Scan' }).click();
|
|
|
|
await page.getByRole('dialog').getByRole('button', { name: 'Import' }).click();
|
|
|
|
await page.getByText('CollectionSmoke testsjust now').click();
|
|
|
|
|
2023-11-02 14:14:26 +00:00
|
|
|
await page.getByLabel('Request Collection').getByTestId('send JSON request').press('Enter');
|
2023-08-11 08:22:01 +00:00
|
|
|
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"}');
|
2023-11-02 14:14:26 +00:00
|
|
|
await page.getByLabel('Request Collection').getByTestId('send JSON request').press('Enter');
|
|
|
|
await page.getByLabel('Request Collection').getByTestId('send JSON request').getByLabel('Request Actions').click();
|
2023-08-22 16:12:29 +00:00
|
|
|
await page.getByRole('menuitemradio', { name: 'Generate Code' }).click();
|
2023-08-15 11:26:55 +00:00
|
|
|
await page.getByText('curl --request GET \\').click();
|
|
|
|
await page.getByRole('button', { name: 'Done' }).click();
|
2023-08-11 08:22:01 +00:00
|
|
|
});
|