Skip to content

Commit b6e53d0

Browse files
committed
fix e2e
1 parent 9c080f0 commit b6e53d0

4 files changed

Lines changed: 31 additions & 12 deletions

File tree

packages/insomnia-smoke-test/tests/smoke/after-response-script-features.test.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,11 @@ import { test } from '../../playwright/test';
66
test.describe('after-response script features tests', () => {
77
test.slow(process.platform === 'darwin' || process.platform === 'win32', 'Slow app start on these platforms');
88

9-
test('after-response scripts: transient vars, assertions, and environment/global persistence', async ({ page, app, insomnia }) => {
9+
test('after-response scripts: transient vars, assertions, and environment/global persistence', async ({
10+
page,
11+
app,
12+
insomnia,
13+
}) => {
1014
// import global environment
1115
const globalEnvText = await loadFixture('script-global-environment.yaml');
1216
await app.evaluate(async ({ clipboard }, text) => clipboard.writeText(text), globalEnvText);
@@ -118,6 +122,7 @@ test.describe('after-response script features tests', () => {
118122
await page.getByText('log: baseGlobals base').click();
119123
// view sub environment has been updated
120124
await page.getByLabel('Select a Project Environment').click();
125+
await page.getByRole('option', { name: 'Script Environment', exact: true }).hover();
121126
await page.getByLabel('Edit Script Environment').click();
122127
await page.getByLabel('Environment name').getByText('Sub Script Env').first().click();
123128
let globalSubEditor = page.getByTestId('CodeEditor').locator('.CodeMirror-line');
@@ -139,7 +144,11 @@ test.describe('after-response script features tests', () => {
139144
});
140145
});
141146

142-
test('insomnia.expect covers each matcher (equal/property/lengthOf/include/within/keys) and test.skip is reported', async ({ page, app, insomnia }) => {
147+
test('insomnia.expect covers each matcher (equal/property/lengthOf/include/within/keys) and test.skip is reported', async ({
148+
page,
149+
app,
150+
insomnia,
151+
}) => {
143152
const text = await loadFixture('after-response-collection.yaml');
144153
await app.evaluate(async ({ clipboard }, text) => clipboard.writeText(text), text);
145154

packages/insomnia-smoke-test/tests/smoke/environment-editor-interactions.test.ts

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ test.describe('Environment Editor', () => {
2424
await page.getByRole('row', { name: 'New Environment' }).waitFor({ state: 'visible' });
2525
await page.getByRole('row', { name: 'New Environment' }).click();
2626
await page.getByRole('dialog').getByRole('button', { name: 'Close' }).click();
27-
27+
2828
// wait for the Manage Environments dialog to close before interacting with the picker
2929
await page.getByRole('heading', { name: 'Manage Environments' }).waitFor({ state: 'hidden' });
3030

@@ -35,7 +35,7 @@ test.describe('Environment Editor', () => {
3535
// send request: verify variables fall back to base env (new env is empty)
3636
await insomnia.navigationSidebar.clickRequestOrFolder('New Request');
3737
await page.getByRole('button', { name: 'Send' }).click();
38-
38+
3939
// wait for a response before switching to console
4040
await page.locator('[data-testid="response-status-tag"]:visible').waitFor({ state: 'visible', timeout: 25_000 });
4141
await page.getByRole('tab', { name: 'Console' }).click();
@@ -91,7 +91,7 @@ test.describe('Environment Editor', () => {
9191

9292
// blur the editor before closing so the debounce flush is triggered by the button's mousedown
9393
await dialog.getByRole('button', { name: 'Close' }).click();
94-
94+
9595
// wait for the Manage Environments dialog to fully close before navigating
9696
await page.getByRole('heading', { name: 'Manage Environments' }).waitFor({ state: 'hidden' });
9797
await page.getByLabel('Manage collection environments').press('Escape');
@@ -166,14 +166,14 @@ test.describe('Environment Editor', () => {
166166
await page.getByRole('menuitemradio', { name: 'JSON' }).click();
167167
await waitForSync();
168168
await secondRow.getByRole('button', { name: 'Edit JSON' }).click();
169-
169+
170170
// wait for the JSON modal before typing
171171
await page.getByRole('dialog').getByTestId('CodeEditor').waitFor({ state: 'visible' });
172172
const bodyEditor = page.getByRole('dialog').getByTestId('CodeEditor').getByRole('textbox');
173173
await bodyEditor.focus();
174174
await page.keyboard.press('ControlOrMeta+a');
175175
await page.keyboard.type('{"anotherString":"kvAnotherStr","anotherNumber": 12345}');
176-
176+
177177
// submit and wait for the JSON modal to fully close before proceeding
178178
await page.getByRole('button', { name: 'Modal Submit' }).click();
179179
await page.getByRole('dialog', { name: 'Modal' }).waitFor({ state: 'hidden' });
@@ -186,7 +186,9 @@ test.describe('Environment Editor', () => {
186186
// dismiss the environment picker dropdown if it appeared
187187
await page.locator('body').click();
188188
try {
189-
await page.getByRole('listbox', { name: 'Select a Collection Environment' }).waitFor({ state: 'hidden', timeout: 3000 });
189+
await page
190+
.getByRole('listbox', { name: 'Select a Collection Environment' })
191+
.waitFor({ state: 'hidden', timeout: 3000 });
190192
} catch {
191193
await page.keyboard.press('Escape');
192194
}
@@ -245,7 +247,9 @@ test.describe('Environment Editor', () => {
245247
// dismiss the environment picker dropdown if it appeared
246248
await page.locator('body').click();
247249
try {
248-
await page.getByRole('listbox', { name: 'Select a Collection Environment' }).waitFor({ state: 'hidden', timeout: 3000 });
250+
await page
251+
.getByRole('listbox', { name: 'Select a Collection Environment' })
252+
.waitFor({ state: 'hidden', timeout: 3000 });
249253
} catch {
250254
await page.keyboard.press('Escape');
251255
}
@@ -290,6 +294,8 @@ test.describe('Environment Editor', () => {
290294
await page.getByLabel('Add Project Environment').click();
291295
await page.getByPlaceholder('Enter a name for your Environment').fill('My New Project Env');
292296
await page.getByRole('button', { name: 'Create', exact: true }).click();
297+
await expect.soft(insomnia.navigationSidebar.workspaceRow('My New Project Env')).toBeVisible();
298+
await insomnia.pressEscape();
293299

294300
// creating navigates into the new environment's own page; go back to the collection
295301
await insomnia.navigationSidebar.selectWorkspace('My first collection');
@@ -300,7 +306,9 @@ test.describe('Environment Editor', () => {
300306
await expect.soft(page.getByRole('option', { name: 'My New Project Env' })).toBeVisible();
301307
});
302308

303-
test('Add Sub Environment and Add Private Sub Environment create environments with the correct privacy', async ({ page }) => {
309+
test('Add Sub Environment and Add Private Sub Environment create environments with the correct privacy', async ({
310+
page,
311+
}) => {
304312
await page.getByRole('button', { name: 'Create request collection', exact: true }).click();
305313

306314
await page.getByLabel('Select a Collection Environment').click();

packages/insomnia-smoke-test/tests/smoke/pre-request-script-features.test.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -529,7 +529,7 @@ test.describe('pre-request features tests', () => {
529529

530530
// activate global environment
531531
await page.getByLabel('Select a Project Environment').click();
532-
await page.getByRole('option', { name: 'Base Script Env' }).click();
532+
await page.getByRole('option', { name: 'Script Environment', exact: true }).click();
533533
await page.locator('body').click();
534534
// send
535535
await page.getByTestId('request-pane').getByRole('button', { name: 'Send' }).click();
@@ -539,6 +539,7 @@ test.describe('pre-request features tests', () => {
539539
await page.getByText('log: baseGlobals base').click();
540540
// view base environment has been updated
541541
await page.getByLabel('Select a Project Environment').click();
542+
await page.getByRole('option', { name: 'Script Environment', exact: true }).hover();
542543
await page.getByLabel('Edit Script Environment').click();
543544
await page.getByLabel('Environment name').getByText('Base Script Env').click();
544545
const globalBaseEditor = page.getByTestId('CodeEditor').locator('.CodeMirror-line');
@@ -565,6 +566,7 @@ test.describe('pre-request features tests', () => {
565566
await page.getByText('log: baseGlobals base').click();
566567
// view sub environment has been updated
567568
await page.getByLabel('Select a Project Environment').click();
569+
await page.getByRole('option', { name: 'Script Environment', exact: true }).hover();
568570
await page.getByLabel('Edit Script Environment').click();
569571
await page.getByLabel('Environment name').getByText('Sub Script Env').first().click();
570572
const globalSubEditor = page.getByTestId('CodeEditor').locator('.CodeMirror-line');

packages/insomnia/src/ui/components/environment-picker.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ export const EnvironmentPicker = ({
237237
`/organization/${organizationId}/project/${projectId}/workspace/${item.workspaceId}/environment`,
238238
)
239239
}
240-
className="hide aspect-square h-5 shrink-0 items-center justify-center rounded-xs text-xs text-(--color-font) opacity-0 ring-1 ring-transparent transition-all group-hover:flex group-hover:opacity-100 group-focus:opacity-100 hover:bg-(--hl-xs) focus:opacity-100 focus:ring-(--hl-md) focus:ring-inset"
240+
className="hide aspect-square h-5 shrink-0 items-center justify-center rounded-xs text-xs text-(--color-font) opacity-0 ring-1 ring-transparent transition-all group-hover:flex group-hover:opacity-100 group-focus:flex group-focus:opacity-100 hover:bg-(--hl-xs) focus:opacity-100 focus:ring-(--hl-md) focus:ring-inset"
241241
>
242242
<Icon icon="edit" />
243243
</Button>

0 commit comments

Comments
 (0)