Debug head test (#5638)

* Created Debug Head tests

* Added Open Generate code and copy as curl test

* delete duplicate debug-head file

* trying to add data-testid

* add todo messages

* revert datatestid for codemirror

* revert datatestid for codemirror

* fix

Co-authored-by: Filipe Freire <livrofubia@gmail.com>
This commit is contained in:
kreosus
2023-01-11 10:06:46 -06:00
committed by GitHub
parent ba86acea67
commit 08edada6b8
3 changed files with 77 additions and 9 deletions

View File

@@ -1,9 +0,0 @@
import { expect } from '@playwright/test';
import { test } from '../../playwright/test';
test('Basic interactions', async ({ }) => {
// TODO(filfreire): add a few scenarios ported from the release checklist
await expect(true).toBeTruthy();
});

View File

@@ -0,0 +1,76 @@
import { test } from '../../playwright/test';
test('Select body dropdown', async ({ page }) => {
await page.locator('div[role="tab"]:has-text("Body")').click();
await page.locator('button:has-text("JSON")').click();
});
test('Select auth dropdown', async ({ page }) => {
await page.locator('div[role="tab"]:has-text("Auth")').click();
await page.locator('[aria-label="Request pane tabs"] >> text=Auth').click();
await page.locator('button:has-text("OAuth 1.0")').click();
});
test('Open query parameters', async ({ page }) => {
await page.locator('[data-testid="request-pane"] >> text=Query').click();
await page.locator('text=Headers').click();
});
test('Open headers', async ({ page }) => {
await page.locator('text=Headers').click();
});
test('Open docs', async ({ page }) => {
await page.locator('text=Docs').click();
});
test('Add description to docs', async ({ page }) => {
await page.locator('text=Docs').click();
await page.locator('text=Add Description').click();
await page.locator('[data-testid="CodeEditor"] pre[role="presentation"]:has-text("")').click();
await page.locator('textarea').nth(1).fill('new request'); // this works
// TODO - fix the locator so we don't rely on `.nth(1)` https://linear.app/insomnia/issue/INS-2255/revisit-codemirror-playwright-selectorfill
});
test('WS select body type dropdown', async ({ page }) => {
await page.locator('[data-testid="SidebarFilter"] [data-testid="SidebarCreateDropdown"] button').click();
await page.locator('button:has-text("WebSocket Request")').first().click();
await page.locator('[aria-label="Websocket request pane tabs"] >> text=JSON').click();
await page.locator('#dropdowns-container button:has-text("JSON")').click();
});
test('WS select auth type dropdown', async ({ page }) => {
await page.locator('[data-testid="SidebarFilter"] [data-testid="SidebarCreateDropdown"] button').click();
await page.locator('button:has-text("WebSocket Request")').first().click();
await page.locator('div[role="tab"]:has-text("Auth")').click();
});
test('WS open query parameters', async ({ page }) => {
await page.locator('[data-testid="SidebarFilter"] [data-testid="SidebarCreateDropdown"] button').click();
await page.locator('button:has-text("WebSocket Request")').first().click();
await page.locator('text=Query').click();
});
test('WS open headers', async ({ page }) => {
await page.locator('[data-testid="SidebarFilter"] [data-testid="SidebarCreateDropdown"] button').click();
await page.locator('button:has-text("WebSocket Request")').first().click();
await page.locator('text=Headers').click();
});
test('WS open docs', async ({ page }) => {
await page.locator('[data-testid="SidebarFilter"] [data-testid="SidebarCreateDropdown"] button').click();
await page.locator('button:has-text("WebSocket Request")').first().click();
await page.locator('text=Docs').click();
});
test('WS add description', async ({ page }) => {
await page.locator('[data-testid="SidebarFilter"] [data-testid="SidebarCreateDropdown"] button').click();
await page.locator('button:has-text("WebSocket Request")').first().click();
await page.locator('text=Docs').click();
await page.locator('text=Add Description').click();
await page.locator('[data-testid="CodeEditor"] pre[role="presentation"]:has-text("")').click();
await page.locator('textarea').nth(1).fill('new wss');
// TODO - fix the locator so we don't rely on `.nth(1)` https://linear.app/insomnia/issue/INS-2255/revisit-codemirror-playwright-selectorfill
});

View File

@@ -12,6 +12,7 @@ test('can render Spectral OpenAPI lint errors', async ({ page }) => {
// Cause a lint error
await page.locator('[data-testid="CodeEditor"] >> text=info').click();
await page.locator('textarea').nth(1).press('Tab');
// TODO - fix the locator so we don't rely on `.nth(1)` https://linear.app/insomnia/issue/INS-2255/revisit-codemirror-playwright-selectorfill
await expect(codeEditor).toContainText('oas3-schema Object must have required property "info"');
});