mirror of
https://github.com/Kong/insomnia.git
synced 2026-10-06 21:14:38 -04:00
fix: de-flake import deep-link cURL auto-scan smoke test (#10555)
## Background
The `value-bearing curl param` smoke test failed intermittently on CI
(run 35832135624, shard 3/6, both retries) while passing on isolated
reruns and in dev mode.
Repro: `npm run test:smoke:build -- --project=Smoke --grep "value-bearing curl param" --repeat-each=20 --workers=4`
→ ~25% first-attempt failure rate.
## Root cause
A value-bearing deep link auto-scans, and the scan result replaces the
pre-scan form within milliseconds of the modal opening. The assertion
`getByText('http://insomnia.rest/')` could only match the transient
pre-scan state — the raw cURL in the textarea's initial text content —
so the test raced against scan completion and lost whenever the scan
landed before the first assertion poll (fast in build mode on CI).
The stable post-scan state never contained the URL text at all: the
scan-results table renders
`{importerSign} resources to be imported from {oriFileName}:`, and the
cURL scan source sets no `oriFileName`, producing the dangling-colon
label "cURL resources to be imported from :".
## Changes
- `import-modal/shared.tsx` — omit the `from {oriFileName}` clause when
a scan result has no source name (cURL deep-link scan). Sources with a
real name (uri, file, clipboard, mcp) keep the existing wording.
- `import-deep-link.test.ts` — assert the stable post-scan state
("cURL resources to be imported:" and "1 Request") instead of the
transient pre-scan form; renamed the test accordingly.
## Verification
- Fixed test: 20/20 passed under the same build-mode + parallel-load
conditions that produced 5/20 flaky before the fix.
- `import deep links` suite: 3/3 passed in build mode.
This commit is contained in:
1 parent
dc02796812
commit
7de40fe4a7
2 files changed
+8
-4
No files matched your search
@@ -49,13 +49,17 @@ test.describe('import deep links', () => {
|
||||
await expect.soft(insomnia.page.getByText('Invalid cURL request')).toHaveCount(0);
|
||||
});
|
||||
|
||||
test('value-bearing curl param pre-populates the cURL tab', async ({ app, insomnia }) => {
|
||||
test('value-bearing curl param auto-scans and shows the detected request', async ({ app, insomnia }) => {
|
||||
const curlCommand = 'curl --request GET --url http://insomnia.rest/';
|
||||
await sendDeepLink(app, `insomnia://app/import?curl=${encodeURIComponent(curlCommand)}`);
|
||||
|
||||
await expect.soft(insomnia.page.getByRole('dialog')).toBeVisible();
|
||||
// A value-bearing param auto-scans: the modal skips the source picker and
|
||||
// shows the detected resources ready to import.
|
||||
await expect.soft(insomnia.page.getByText('http://insomnia.rest/')).toBeVisible();
|
||||
// shows the detected resources ready to import. The scan completes within
|
||||
// milliseconds of the modal opening, so assert on the stable post-scan
|
||||
// state — the pre-scan form (whose textarea value contains the URL) is
|
||||
// replaced as soon as the scan result lands.
|
||||
await expect.soft(insomnia.page.getByText('cURL resources to be imported:')).toBeVisible();
|
||||
await expect.soft(insomnia.page.getByText('1 Request')).toBeVisible();
|
||||
});
|
||||
});
|
||||
@@ -230,7 +230,7 @@ export const ScanResultsTable = ({ scanResults }: { scanResults: ScanResult[] })
|
||||
</Fragment>
|
||||
) : (
|
||||
<Fragment>
|
||||
{getImporterSign(scanResult)} resources to be imported from {scanResult.oriFileName}:
|
||||
{getImporterSign(scanResult)} resources to be imported{scanResult.oriFileName ? ` from ${scanResult.oriFileName}` : ''}:
|
||||
</Fragment>
|
||||
)}
|
||||
</div>
|
||||
|
||||
Reference in new issue
Block a user