2022-05-02 14:00:19 +00:00
|
|
|
import { expect } from '@playwright/test';
|
|
|
|
|
2022-10-11 08:56:12 +00:00
|
|
|
import { loadFixture } from '../../playwright/paths';
|
|
|
|
import { test } from '../../playwright/test';
|
2022-05-02 14:00:19 +00:00
|
|
|
|
2022-12-14 12:27:39 +00:00
|
|
|
test('can send gRPC requests with reflection', async ({ app, page }) => {
|
2022-05-02 14:00:19 +00:00
|
|
|
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'),
|
|
|
|
});
|
|
|
|
|
2023-08-28 13:53:37 +00:00
|
|
|
await page.getByRole('button', { name: 'Create in project' }).click();
|
2022-05-02 14:00:19 +00:00
|
|
|
|
|
|
|
const text = await loadFixture('grpc.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-06-27 18:46:43 +00:00
|
|
|
await page.getByRole('dialog').getByRole('button', { name: 'Import' }).click();
|
2023-06-27 15:43:51 +00:00
|
|
|
await page.getByText('CollectionPreRelease gRPCjust now').click();
|
2023-03-31 10:53:22 +00:00
|
|
|
|
2023-08-22 16:12:29 +00:00
|
|
|
await page.getByLabel('Request Collection').getByRole('row', { name: 'UnaryWithOutProtoFile' }).click();
|
2023-01-20 14:49:52 +00:00
|
|
|
await expect(page.getByRole('button', { name: 'Select Method' })).toBeDisabled();
|
|
|
|
await page.getByTestId('button-server-reflection').click();
|
2022-12-14 12:27:39 +00:00
|
|
|
|
2023-01-20 14:49:52 +00:00
|
|
|
await page.getByRole('button', { name: 'Select Method' }).click();
|
|
|
|
await page.getByRole('menuitem', { name: 'RouteGuide/GetFeature' }).click();
|
|
|
|
|
|
|
|
await page.getByRole('tab', { name: 'Unary' }).click();
|
|
|
|
await page.getByRole('button', { name: 'Send' }).click();
|
2022-12-07 10:33:15 +00:00
|
|
|
|
|
|
|
// Check for the single Unary response
|
2023-01-20 14:49:52 +00:00
|
|
|
await page.getByRole('tab', { name: 'Response 1' }).click();
|
2022-05-02 14:00:19 +00:00
|
|
|
await expect(statusTag).toContainText('0 OK');
|
2022-12-07 10:33:15 +00:00
|
|
|
await expect(responseBody).toContainText('Berkshire Valley Management Area Trail');
|
2022-05-02 14:00:19 +00:00
|
|
|
});
|