diff --git a/tests/import/insomnia/import-insomnia-v4-environments.spec.ts b/tests/import/insomnia/import-insomnia-v4-environments.spec.ts index 6d8d559d04f..3e44aa4c721 100644 --- a/tests/import/insomnia/import-insomnia-v4-environments.spec.ts +++ b/tests/import/insomnia/import-insomnia-v4-environments.spec.ts @@ -1,6 +1,6 @@ import { test, expect } from '../../../playwright'; import * as path from 'path'; -import { openCollection, closeAllCollections } from '../../utils/page/actions'; +import { openCollection, closeAllCollections, getEnvVarValueLine } from '../../utils/page/actions'; test.describe('Import Insomnia v4 Collection - Environment Import', () => { test.afterEach(async ({ page }) => { @@ -74,53 +74,21 @@ test.describe('Import Insomnia v4 Collection - Environment Import', () => { .first() .click(); - // Gate on the env-switch flatten pass having fully landed before - // per-row asserts. The flatten renders top-level keys first and the - // deepest nested keys (array-indexed `user.roles[*]`) last; on slow - // runners the trailing batch can take longer than the 5s default. - // Waiting on the deepest asserted key here guarantees every shallower - // input is also in DOM by the time the per-input asserts below run. - await page.locator('input[value="user.roles[1]"]').waitFor({ state: 'visible', timeout: 15000 }); - // **Assertion 1: Basic Variables (Top-level keys)** // Verifies that simple key-value pairs from the base environment are imported correctly - const v4BaseUrlInput = page.locator('input[value="baseUrl"]'); - const v4AuthTokenInput = page.locator('input[value="authToken"]'); - await expect(v4BaseUrlInput).toBeVisible(); - await expect(v4AuthTokenInput).toBeVisible(); - - // Assert: Top-level string values are preserved exactly as in the source - const baseUrlRow = page.locator('tbody tr').filter({ has: page.locator('input[value="baseUrl"]') }); - await expect(baseUrlRow.locator('.CodeMirror-line').first()).toHaveText('https://api.example.com'); - const authTokenRow = page.locator('tbody tr').filter({ has: page.locator('input[value="authToken"]') }); - await expect(authTokenRow.locator('.CodeMirror-line').first()).toHaveText('your_auth_token_here'); + await expect(await getEnvVarValueLine(page, 'baseUrl')).toHaveText('https://api.example.com'); + await expect(await getEnvVarValueLine(page, 'authToken')).toHaveText('your_auth_token_here'); // **Assertion 2: Nested Object Flattening** // Verifies that nested objects are flattened to dot-notation keys (e.g., user.name, user.id) - const v4UserNameInput = page.locator('input[value="user.name"]'); - const v4UserIdInput = page.locator('input[value="user.id"]'); - await expect(v4UserNameInput).toBeVisible(); - await expect(v4UserIdInput).toBeVisible(); - - // Assert: Nested object properties are accessible via dot notation - const userNameRow = page.locator('tbody tr').filter({ has: page.locator('input[value="user.name"]') }); - await expect(userNameRow.locator('.CodeMirror-line').first()).toHaveText('admin'); - // Assert: Numeric values are converted to strings and preserved - const userIdRow = page.locator('tbody tr').filter({ has: page.locator('input[value="user.id"]') }); - await expect(userIdRow.locator('.CodeMirror-line').first()).toHaveText('123'); + await expect(await getEnvVarValueLine(page, 'user.name')).toHaveText('admin'); + // Numeric values are converted to strings and preserved + await expect(await getEnvVarValueLine(page, 'user.id')).toHaveText('123'); // **Assertion 3: Array Flattening** // Verifies that arrays are flattened using JavaScript-style square bracket notation (e.g., user.roles[0], user.roles[1]) - const v4UserRoles0Input = page.locator('input[value="user.roles[0]"]'); - const v4UserRoles1Input = page.locator('input[value="user.roles[1]"]'); - await expect(v4UserRoles0Input).toBeVisible(); - await expect(v4UserRoles1Input).toBeVisible(); - - // Assert: Array elements are accessible via JavaScript-style square bracket notation - const userRoles0Row = page.locator('tbody tr').filter({ has: page.locator('input[value="user.roles[0]"]') }); - await expect(userRoles0Row.locator('.CodeMirror-line').first()).toHaveText('admin'); - const userRoles1Row = page.locator('tbody tr').filter({ has: page.locator('input[value="user.roles[1]"]') }); - await expect(userRoles1Row.locator('.CodeMirror-line').first()).toHaveText('user'); + await expect(await getEnvVarValueLine(page, 'user.roles[0]')).toHaveText('admin'); + await expect(await getEnvVarValueLine(page, 'user.roles[1]')).toHaveText('user'); }); await test.step('Test Staging Environment - verify merging with base', async () => { @@ -130,46 +98,22 @@ test.describe('Import Insomnia v4 Collection - Environment Import', () => { .first() .click(); - // Gate on the env-switch flatten pass having fully landed before - // per-row asserts. Inherited deep keys (like `user.roles[0]`) are the - // last to merge in for a sub-env; waiting on it here guarantees every - // other input is also in DOM by the time the per-input asserts run. - await page.locator('input[value="user.roles[0]"]').waitFor({ state: 'visible', timeout: 15000 }); - // **Assertion 1: Top-level Variable Override** // Verifies that staging environment overrides base environment values - const v4StagingBaseUrlInput = page.locator('input[value="baseUrl"]'); - await expect(v4StagingBaseUrlInput).toBeVisible(); - // Assert: Staging overrides baseUrl with its own value - const stagingBaseUrlRow = page.locator('tbody tr').filter({ has: page.locator('input[value="baseUrl"]') }); - await expect(stagingBaseUrlRow.locator('.CodeMirror-line').first()).toHaveText('https://staging-api.example.com'); + await expect(await getEnvVarValueLine(page, 'baseUrl')).toHaveText('https://staging-api.example.com'); // **Assertion 2: Top-level Variable Inheritance** - // Verifies that staging environment inherits base environment values when not overridden - const v4StagingAuthTokenInput = page.locator('input[value="authToken"]'); - await expect(v4StagingAuthTokenInput).toBeVisible(); - // Assert: Staging inherits authToken from base (not overridden in staging) - const stagingAuthTokenRow = page.locator('tbody tr').filter({ has: page.locator('input[value="authToken"]') }); - await expect(stagingAuthTokenRow.locator('.CodeMirror-line').first()).toHaveText('your_auth_token_here'); + // Staging inherits authToken from base (not overridden in staging) + await expect(await getEnvVarValueLine(page, 'authToken')).toHaveText('your_auth_token_here'); // **Assertion 3: Nested Object Variable Override and Inheritance** // Verifies that nested object properties can be selectively overridden while inheriting others - const v4StagingUserNameInput = page.locator('input[value="user.name"]'); - const v4StagingUserIdInput = page.locator('input[value="user.id"]'); - const v4StagingUserRoles0Input = page.locator('input[value="user.roles[0]"]'); - await expect(v4StagingUserNameInput).toBeVisible(); - await expect(v4StagingUserIdInput).toBeVisible(); - await expect(v4StagingUserRoles0Input).toBeVisible(); - - // Assert: Staging overrides user.name with its own value - const stagingUserNameRow = page.locator('tbody tr').filter({ has: page.locator('input[value="user.name"]') }); - await expect(stagingUserNameRow.locator('.CodeMirror-line').first()).toHaveText('staging_admin'); - // Assert: Staging inherits user.id from base (not overridden in staging) - const stagingUserIdRow = page.locator('tbody tr').filter({ has: page.locator('input[value="user.id"]') }); - await expect(stagingUserIdRow.locator('.CodeMirror-line').first()).toHaveText('123'); - // Assert: Staging inherits user.roles[0] from base (not overridden in staging) - const stagingUserRoles0Row = page.locator('tbody tr').filter({ has: page.locator('input[value="user.roles[0]"]') }); - await expect(stagingUserRoles0Row.locator('.CodeMirror-line').first()).toHaveText('admin'); + // Staging overrides user.name with its own value + await expect(await getEnvVarValueLine(page, 'user.name')).toHaveText('staging_admin'); + // Staging inherits user.id from base (not overridden in staging) + await expect(await getEnvVarValueLine(page, 'user.id')).toHaveText('123'); + // Staging inherits user.roles[0] from base (not overridden in staging) + await expect(await getEnvVarValueLine(page, 'user.roles[0]')).toHaveText('admin'); }); await test.step('Test Development Environment - verify new variables', async () => { @@ -179,40 +123,17 @@ test.describe('Import Insomnia v4 Collection - Environment Import', () => { .first() .click(); - // Gate on the env-switch merge pass having fully landed before - // per-row asserts. The sub-env's newly-added keys (`newFeature.*`) - // are the last to merge in; waiting on the deepest of those here - // guarantees every other input is also in DOM by the time the - // per-input asserts below run. - await page.locator('input[value="newFeature.version"]').waitFor({ state: 'visible', timeout: 15000 }); - // **Assertion 1: Multiple Top-level Variable Overrides** // Verifies that development environment can override multiple base environment values - const v4DevBaseUrlInput = page.locator('input[value="baseUrl"]'); - const v4DevAuthTokenInput = page.locator('input[value="authToken"]'); - await expect(v4DevBaseUrlInput).toBeVisible(); - await expect(v4DevAuthTokenInput).toBeVisible(); - - // Assert: Development overrides baseUrl with its own value - const devBaseUrlRow = page.locator('tbody tr').filter({ has: page.locator('input[value="baseUrl"]') }); - await expect(devBaseUrlRow.locator('.CodeMirror-line').first()).toHaveText('https://dev-api.example.com'); - // Assert: Development overrides authToken with its own value - const devAuthTokenRow = page.locator('tbody tr').filter({ has: page.locator('input[value="authToken"]') }); - await expect(devAuthTokenRow.locator('.CodeMirror-line').first()).toHaveText('dev_token_123'); + await expect(await getEnvVarValueLine(page, 'baseUrl')).toHaveText('https://dev-api.example.com'); + await expect(await getEnvVarValueLine(page, 'authToken')).toHaveText('dev_token_123'); // **Assertion 2: New Nested Variables Addition** // Verifies that development environment can add completely new nested variables not present in base - const v4NewFeatureEnabledInput = page.locator('input[value="newFeature.enabled"]'); - const v4NewFeatureVersionInput = page.locator('input[value="newFeature.version"]'); - await expect(v4NewFeatureEnabledInput).toBeVisible(); - await expect(v4NewFeatureVersionInput).toBeVisible(); - - // Assert: New boolean variable is added and converted to string - const newFeatureEnabledRow = page.locator('tbody tr').filter({ has: page.locator('input[value="newFeature.enabled"]') }); - await expect(newFeatureEnabledRow.locator('.CodeMirror-line').first()).toHaveText('true'); - // Assert: New numeric variable is added and converted to string with full precision - const newFeatureVersionRow = page.locator('tbody tr').filter({ has: page.locator('input[value="newFeature.version"]') }); - await expect(newFeatureVersionRow.locator('.CodeMirror-line').first()).toHaveText('2.099123123'); + // New boolean variable is added and converted to string + await expect(await getEnvVarValueLine(page, 'newFeature.enabled')).toHaveText('true'); + // New numeric variable is added and converted to string with full precision + await expect(await getEnvVarValueLine(page, 'newFeature.version')).toHaveText('2.099123123'); }); await test.step('Close environment tab', async () => { diff --git a/tests/import/insomnia/import-insomnia-v5-environments.spec.ts b/tests/import/insomnia/import-insomnia-v5-environments.spec.ts index 00d4ec34f9b..3c9a0436b58 100644 --- a/tests/import/insomnia/import-insomnia-v5-environments.spec.ts +++ b/tests/import/insomnia/import-insomnia-v5-environments.spec.ts @@ -1,6 +1,6 @@ import { test, expect } from '../../../playwright'; import * as path from 'path'; -import { openCollection, closeAllCollections } from '../../utils/page/actions'; +import { openCollection, closeAllCollections, getEnvVarValueLine } from '../../utils/page/actions'; test.describe('Import Insomnia v5 Collection - Environment Import', () => { test.afterEach(async ({ page }) => { @@ -71,67 +71,28 @@ test.describe('Import Insomnia v5 Collection - Environment Import', () => { .first() .click(); - // Gate on the env-switch flatten pass having fully landed before - // per-row asserts. The flatten renders top-level keys first and the - // deepest nested keys (`config.*`) last; on slow runners the trailing - // batch can take longer than the 5s default. Waiting on the deepest - // key here guarantees every shallower input is also in DOM by the - // time the per-input asserts below run. - await page.locator('input[value="config.debug"]').waitFor({ state: 'visible', timeout: 15000 }); - // **Assertion 1: Basic Variables (Top-level keys)** // Verifies that simple key-value pairs from the base environment are imported correctly - const baseUrlInput = page.locator('input[value="base_url"]'); - const authTokenInput = page.locator('input[value="auth_token"]'); - await expect(baseUrlInput).toBeVisible(); - await expect(authTokenInput).toBeVisible(); - - // Assert: Top-level string values are preserved exactly as in the source - const baseUrlRow = page.locator('tbody tr').filter({ has: page.locator('input[value=\"base_url\"]') }); - await expect(baseUrlRow.locator('.CodeMirror-line').first()).toHaveText('https://api.example.com'); - const authTokenRow = page.locator('tbody tr').filter({ has: page.locator('input[value=\"auth_token\"]') }); - await expect(authTokenRow.locator('.CodeMirror-line').first()).toHaveText('your_auth_token_here'); + await expect(await getEnvVarValueLine(page, 'base_url')).toHaveText('https://api.example.com'); + await expect(await getEnvVarValueLine(page, 'auth_token')).toHaveText('your_auth_token_here'); // **Assertion 2: Nested Object Flattening** // Verifies that nested objects are flattened to dot-notation keys (e.g., user.name, user.id) - const userNameInput = page.locator('input[value="user.name"]'); - const userIdInput = page.locator('input[value="user.id"]'); - await expect(userNameInput).toBeVisible(); - await expect(userIdInput).toBeVisible(); - - // Assert: Nested object properties are accessible via dot notation - const userNameRow = page.locator('tbody tr').filter({ has: page.locator('input[value=\"user.name\"]') }); - await expect(userNameRow.locator('.CodeMirror-line').first()).toHaveText('admin'); + await expect(await getEnvVarValueLine(page, 'user.name')).toHaveText('admin'); // Assert: Numeric values are converted to strings and preserved - const userIdRow = page.locator('tbody tr').filter({ has: page.locator('input[value=\"user.id\"]') }); - await expect(userIdRow.locator('.CodeMirror-line').first()).toHaveText('123'); + await expect(await getEnvVarValueLine(page, 'user.id')).toHaveText('123'); // **Assertion 3: Array Flattening** // Verifies that arrays are flattened using JavaScript-style square bracket notation (e.g., user.roles[0], user.roles[1]) - const userRoles0Input = page.locator('input[value="user.roles[0]"]'); - const userRoles1Input = page.locator('input[value="user.roles[1]"]'); - await expect(userRoles0Input).toBeVisible(); - await expect(userRoles1Input).toBeVisible(); - - // Assert: Array elements are accessible via JavaScript-style square bracket notation - const userRoles0Row = page.locator('tbody tr').filter({ has: page.locator('input[value=\"user.roles[0]\"]') }); - await expect(userRoles0Row.locator('.CodeMirror-line').first()).toHaveText('admin'); - const userRoles1Row = page.locator('tbody tr').filter({ has: page.locator('input[value=\"user.roles[1]\"]') }); - await expect(userRoles1Row.locator('.CodeMirror-line').first()).toHaveText('user'); + await expect(await getEnvVarValueLine(page, 'user.roles[0]')).toHaveText('admin'); + await expect(await getEnvVarValueLine(page, 'user.roles[1]')).toHaveText('user'); // **Assertion 4: Deeply Nested Config Objects** // Verifies that deeply nested objects are properly flattened (e.g., config.timeout, config.debug) - const configTimeoutInput = page.locator('input[value="config.timeout"]'); - const configDebugInput = page.locator('input[value="config.debug"]'); - await expect(configTimeoutInput).toBeVisible(); - await expect(configDebugInput).toBeVisible(); - - // Assert: Numeric values in nested objects are converted to strings - const configTimeoutRow = page.locator('tbody tr').filter({ has: page.locator('input[value=\"config.timeout\"]') }); - await expect(configTimeoutRow.locator('.CodeMirror-line').first()).toHaveText('30000'); - // Assert: Boolean values in nested objects are converted to strings - const configDebugRow = page.locator('tbody tr').filter({ has: page.locator('input[value=\"config.debug\"]') }); - await expect(configDebugRow.locator('.CodeMirror-line').first()).toHaveText('true'); + // Numeric values in nested objects are converted to strings + await expect(await getEnvVarValueLine(page, 'config.timeout')).toHaveText('30000'); + // Boolean values in nested objects are converted to strings + await expect(await getEnvVarValueLine(page, 'config.debug')).toHaveText('true'); }); await test.step('Test Staging Environment - verify merging and overrides', async () => { @@ -141,55 +102,27 @@ test.describe('Import Insomnia v5 Collection - Environment Import', () => { .first() .click(); - // Gate on the env-switch flatten pass having fully landed before - // per-row asserts. The deepest overridden key (`config.debug`) lands - // last in this env; waiting on it here guarantees every shallower - // input is also in DOM by the time the per-input asserts run. - await page.locator('input[value="config.debug"]').waitFor({ state: 'visible', timeout: 15000 }); - // **Assertion 1: Top-level Variable Override** // Verifies that staging environment overrides base environment values - const stagingBaseUrlInput = page.locator('input[value="base_url"]'); - await expect(stagingBaseUrlInput).toBeVisible(); - // Assert: Staging overrides base_url with its own value - const baseUrlRow = page.locator('tbody tr').filter({ has: page.locator('input[value=\"base_url\"]') }); - await expect(baseUrlRow.locator('.CodeMirror-line').first()).toHaveText('https://staging-api.example.com'); + await expect(await getEnvVarValueLine(page, 'base_url')).toHaveText('https://staging-api.example.com'); // **Assertion 2: Top-level Variable Inheritance** - // Verifies that staging environment inherits base environment values when not overridden - const stagingAuthTokenInput = page.locator('input[value="auth_token"]'); - await expect(stagingAuthTokenInput).toBeVisible(); - // Assert: Staging inherits auth_token from base (not overridden in staging) - const authTokenRow = page.locator('tbody tr').filter({ has: page.locator('input[value=\"auth_token\"]') }); - await expect(authTokenRow.locator('.CodeMirror-line').first()).toHaveText('your_auth_token_here'); + // Staging inherits auth_token from base (not overridden in staging) + await expect(await getEnvVarValueLine(page, 'auth_token')).toHaveText('your_auth_token_here'); // **Assertion 3: Nested Object Variable Override and Inheritance** // Verifies that nested object properties can be selectively overridden while inheriting others - const stagingUserNameInput = page.locator('input[value="user.name"]'); - const stagingUserIdInput = page.locator('input[value="user.id"]'); - await expect(stagingUserNameInput).toBeVisible(); - await expect(stagingUserIdInput).toBeVisible(); - - // Assert: Staging overrides user.name with its own value - const userNameRow = page.locator('tbody tr').filter({ has: page.locator('input[value=\"user.name\"]') }); - await expect(userNameRow.locator('.CodeMirror-line').first()).toHaveText('staging_admin'); - // Assert: Staging inherits user.id from base (not overridden in staging) - const userIdRow = page.locator('tbody tr').filter({ has: page.locator('input[value=\"user.id\"]') }); - await expect(userIdRow.locator('.CodeMirror-line').first()).toHaveText('123'); + // Staging overrides user.name with its own value + await expect(await getEnvVarValueLine(page, 'user.name')).toHaveText('staging_admin'); + // Staging inherits user.id from base (not overridden in staging) + await expect(await getEnvVarValueLine(page, 'user.id')).toHaveText('123'); // **Assertion 4: Deeply Nested Config Override** // Verifies that deeply nested object properties can be overridden - const stagingConfigTimeoutInput = page.locator('input[value="config.timeout"]'); - const stagingConfigDebugInput = page.locator('input[value="config.debug"]'); - await expect(stagingConfigTimeoutInput).toBeVisible(); - await expect(stagingConfigDebugInput).toBeVisible(); - - // Assert: Staging overrides config.timeout with its own value - const configTimeoutRow = page.locator('tbody tr').filter({ has: page.locator('input[value=\"config.timeout\"]') }); - await expect(configTimeoutRow.locator('.CodeMirror-line').first()).toHaveText('60000'); - // Assert: Staging overrides config.debug with its own value - const configDebugRow = page.locator('tbody tr').filter({ has: page.locator('input[value=\"config.debug\"]') }); - await expect(configDebugRow.locator('.CodeMirror-line').first()).toHaveText('false'); + // Staging overrides config.timeout with its own value + await expect(await getEnvVarValueLine(page, 'config.timeout')).toHaveText('60000'); + // Staging overrides config.debug with its own value + await expect(await getEnvVarValueLine(page, 'config.debug')).toHaveText('false'); }); await test.step('Test Development Environment - verify new variables', async () => { @@ -199,47 +132,21 @@ test.describe('Import Insomnia v5 Collection - Environment Import', () => { .first() .click(); - // Gate on the env-switch flatten pass having fully landed before - // per-row asserts. Inherited base keys (like `user.roles[0]`) are the - // last to merge in for a sub-env; waiting on it here guarantees every - // other input is also in DOM by the time the per-input asserts run. - await page.locator('input[value="user.roles[0]"]').waitFor({ state: 'visible', timeout: 15000 }); - // **Assertion 1: Multiple Top-level Variable Overrides** // Verifies that development environment can override multiple base environment values - const devBaseUrlInput = page.locator('input[value="base_url"]'); - const devAuthTokenInput = page.locator('input[value="auth_token"]'); - await expect(devBaseUrlInput).toBeVisible(); - await expect(devAuthTokenInput).toBeVisible(); - - // Assert: Development overrides base_url with its own value - const baseUrlRow = page.locator('tbody tr').filter({ has: page.locator('input[value=\"base_url\"]') }); - await expect(baseUrlRow.locator('.CodeMirror-line').first()).toHaveText('https://dev-api.example.com'); - // Assert: Development overrides auth_token with its own value - const authTokenRow = page.locator('tbody tr').filter({ has: page.locator('input[value=\"auth_token\"]') }); - await expect(authTokenRow.locator('.CodeMirror-line').first()).toHaveText('dev_token_123'); + await expect(await getEnvVarValueLine(page, 'base_url')).toHaveText('https://dev-api.example.com'); + await expect(await getEnvVarValueLine(page, 'auth_token')).toHaveText('dev_token_123'); // **Assertion 2: New Nested Variables Addition** // Verifies that development environment can add completely new nested variables not present in base - const newFeatureEnabledInput = page.locator('input[value="new_feature.enabled"]'); - const newFeatureVersionInput = page.locator('input[value="new_feature.version"]'); - await expect(newFeatureEnabledInput).toBeVisible(); - await expect(newFeatureVersionInput).toBeVisible(); - - // Assert: New boolean variable is added and converted to string - const newFeatureEnabledRow = page.locator('tbody tr').filter({ has: page.locator('input[value=\"new_feature.enabled\"]') }); - await expect(newFeatureEnabledRow.locator('.CodeMirror-line').first()).toHaveText('true'); - // Assert: New numeric variable is added and converted to string with full precision - const newFeatureVersionRow = page.locator('tbody tr').filter({ has: page.locator('input[value=\"new_feature.version\"]') }); - await expect(newFeatureVersionRow.locator('.CodeMirror-line').first()).toHaveText('2.099123123'); + // New boolean variable is added and converted to string + await expect(await getEnvVarValueLine(page, 'new_feature.enabled')).toHaveText('true'); + // New numeric variable is added and converted to string with full precision + await expect(await getEnvVarValueLine(page, 'new_feature.version')).toHaveText('2.099123123'); // **Assertion 3: Base Variable Inheritance** - // Verifies that development environment still inherits base variables that are not overridden - const devUserRoles0Input = page.locator('input[value="user.roles[0]"]'); - await expect(devUserRoles0Input).toBeVisible(); - // Assert: Development inherits user.roles[0] from base (not overridden in development) - const userRoles0Row = page.locator('tbody tr').filter({ has: page.locator('input[value=\"user.roles[0]\"]') }); - await expect(userRoles0Row.locator('.CodeMirror-line').first()).toHaveText('admin'); + // Development inherits user.roles[0] from base (not overridden in development) + await expect(await getEnvVarValueLine(page, 'user.roles[0]')).toHaveText('admin'); }); await test.step('Close environment tab', async () => { diff --git a/tests/import/postman/import-file-format-options.spec.ts b/tests/import/postman/import-file-format-options.spec.ts index aa3697d4c91..eb4eccef15b 100644 --- a/tests/import/postman/import-file-format-options.spec.ts +++ b/tests/import/postman/import-file-format-options.spec.ts @@ -55,5 +55,10 @@ test.describe('Import Collection File Format Options toggle', () => { await expect(locationModal.locator('#format')).toHaveCount(0); }); + + await test.step('Dismiss the location modal so it does not leak into the next test', async () => { + await page.keyboard.press('Escape'); + await expect(locationModal).toBeHidden(); + }); }); }); diff --git a/tests/utils/page/actions.ts b/tests/utils/page/actions.ts index d19f0017272..03575774b48 100644 --- a/tests/utils/page/actions.ts +++ b/tests/utils/page/actions.ts @@ -2002,9 +2002,26 @@ const scrollVirtuosoRowIntoView = async (page: Page, target: Locator) => { await target.scrollIntoViewIfNeeded().catch(() => {}); }; +/** + * + * The table is virtualized (react-virtuoso), so only the rows within the + * scroll viewport are mounted in the DOM. On a small window (e.g. CI) the + * bottom rows are culled until scrolled into view. This reveals the target row + * first so the assertion doesn't depend on the window being tall enough to + * mount every row at once. + */ +const getEnvVarValueLine = async (page: Page, name: string): Promise => { + const input = page.locator(`input[value="${name}"]`); + await scrollVirtuosoRowIntoView(page, input); + await expect(input).toBeVisible(); + const row = page.locator('tbody tr').filter({ has: input }); + return row.locator('.CodeMirror-line').first(); +}; + export { waitForReadyPage, scrollVirtuosoRowIntoView, + getEnvVarValueLine, dismissImportIssuesToasts, closeAllCollections, openCollection,