insomnia/packages/insomnia-smoke-test/tests/grpc.test.ts
2022-05-02 16:00:19 +02:00

27 lines
1.1 KiB
TypeScript

import { expect } from '@playwright/test';
import { loadFixture } from '../playwright/paths';
import { test } from '../playwright/test';
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('text=CollectionSmoke gRPCjust now');
await page.click('button:has-text("gRPChello k6")');
await page.click('text=Send');
await expect(statusTag).toContainText('0 OK');
await expect(responseBody).toContainText('hello noname');
});