insomnia/packages/insomnia-smoke-test/tests/smoke/grpc.test.ts

28 lines
1.1 KiB
TypeScript
Raw Normal View History

2022-05-02 14:00:19 +00:00
import { expect } from '@playwright/test';
import { loadFixture } from '../../playwright/paths';
import { test } from '../../playwright/test';
2022-05-02 14:00:19 +00:00
test('can send gRPC requests', async ({ app, page }) => {
test.slow(process.platform === 'darwin' || process.platform === 'win32', 'Slow app start on these platforms');
const statusTag = page.locator('[data-testid="response-status-tag"]:visible');
const responseBody = page.locator('[data-testid="response-pane"] >> [data-testid="CodeEditor"]:visible', {
has: page.locator('.CodeMirror-activeline'),
});
await page.click('[data-testid="project"]');
await page.click('text=Create');
const text = await loadFixture('grpc.yaml');
await app.evaluate(async ({ clipboard }, text) => clipboard.writeText(text), text);
await page.click('button:has-text("Clipboard")');
await page.click('div[role="dialog"] button:has-text("New")');
2022-05-02 14:00:19 +00:00
await page.click('text=CollectionSmoke gRPCjust now');
2022-05-05 11:30:13 +00:00
await page.click('button:has-text("gRPCsay hi!")');
2022-05-02 14:00:19 +00:00
await page.click('text=Send');
await expect(statusTag).toContainText('0 OK');
2022-05-05 11:30:13 +00:00
await expect(responseBody).toContainText('"reply": "hi"');
2022-05-02 14:00:19 +00:00
});