mirror of
https://github.com/Kong/insomnia
synced 2024-11-08 14:49:53 +00:00
e3caa557be
* client cert ui * first pass * use import to avoid url onChange timing issue * re order test * use 4001 port, refresh certs * move test to critical * expose cacert create over maain
38 lines
1.8 KiB
TypeScript
38 lines
1.8 KiB
TypeScript
import { getFixturePath, loadFixture } from '../../playwright/paths';
|
|
import { test } from '../../playwright/test';
|
|
|
|
test('can send request with custom ca root certificate', async ({ app, page }) => {
|
|
const text = await loadFixture('smoke-test-collection.yaml');
|
|
await app.evaluate(async ({ clipboard }, text) => clipboard.writeText(text), text);
|
|
|
|
await page.getByRole('button', { name: 'Create in project' }).click();
|
|
await page.getByRole('menuitemradio', { name: 'Import' }).click();
|
|
await page.locator('[data-test-id="import-from-clipboard"]').click();
|
|
await page.getByRole('button', { name: 'Scan' }).click();
|
|
await page.getByRole('dialog').getByRole('button', { name: 'Import' }).click();
|
|
await page.getByText('CollectionSmoke testsjust now').click();
|
|
|
|
await page.getByLabel('Request Collection').getByTestId('sends request with certs').press('Enter');
|
|
|
|
await page.getByRole('button', { name: 'Send' }).click();
|
|
await page.getByText('Error: SSL peer certificate or SSH remote key was not OK').click();
|
|
|
|
// add server and client certs
|
|
await page.getByTestId('workspace-context-dropdown').click();
|
|
await page.getByRole('menuitemradio', { name: 'Settings' }).click();
|
|
const workspaceId = await page.getByTestId('workspace-id').textContent();
|
|
const fixturePath = getFixturePath('certificates');
|
|
await page.evaluate(async ({ workspaceId, fixturePath }) => {
|
|
window.main.database.caCertificate.create({
|
|
parentId: workspaceId,
|
|
path: fixturePath + '/rootCA.pem',
|
|
});
|
|
}, { workspaceId, fixturePath });
|
|
await page.getByRole('button', { name: '' }).click();
|
|
|
|
// test request with certs
|
|
await page.getByRole('button', { name: 'Send' }).click();
|
|
await page.getByText('200 OK').click();
|
|
await page.locator('pre').filter({ hasText: '"id": "1"' }).click();
|
|
});
|