insomnia/packages/insomnia-smoke-test/tests/prerelease/design-interactions.test.ts
Hexxa 54050fe69e
fix: user should be able to quickly rename requests by clicking [INS-3250] (#6710)
* fix: use should be able to double click request item and rename it [INS-3250]

* fix: enable double clicking renaming for pinned requests

* fix: use editable input for renaming request name

* fix: incorrect indent

* fix: lint error

* test: add a test for quick renaming
2023-11-02 15:14:26 +01:00

49 lines
2.1 KiB
TypeScript

import { expect } from '@playwright/test';
import { loadFixture } from '../../playwright/paths';
import { test } from '../../playwright/test';
test.describe('Design interactions', async () => {
test.slow(process.platform === 'darwin' || process.platform === 'win32', 'Slow app start on these platforms');
test('Unit Test interactions', async ({ app, page }) => {
// Setup
await page.getByRole('button', { name: 'Create in project' }).click();
const text = await loadFixture('unit-test.yaml');
await app.evaluate(async ({ clipboard }, text) => clipboard.writeText(text), text);
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('unit-test.yaml').click();
// Switch to Test tab
await page.click('a:has-text("Test")');
// Run tests and check results
await page.getByLabel('Run all tests').click();
await expect(page.locator('.app')).toContainText('Request A is found');
await expect(page.locator('.app')).toContainText('Request B is not found');
await expect(page.locator('.app')).toContainText('Tests passed');
// Create a new test suite
await page.click('text=New test suite');
// Rename test suite
await page.getByLabel('Request Collection').getByText('New Suite');
await page.getByRole('button', { name: 'New Suite' }).click();
await page.getByRole('textbox').fill('New Suite 2');
await page.getByRole('textbox').press('Enter');
// Add a new test
await page.getByLabel('New test').click();
// Rename test
await page.getByRole('button', { name: 'Returns 200' }).click();
await page.getByRole('textbox').fill('Returns 200 and works');
await page.getByRole('textbox').press('Enter');
await page.getByRole('heading', { name: 'Returns 200 and works' }).click();
// Use autocomplete inside the test code
// TODO(filipe) - add this in another PR
});
});