From f4914ff386d642eea109d48d7202d916e3d4d829 Mon Sep 17 00:00:00 2001 From: Riqwan Thamir Date: Mon, 1 Jun 2026 14:15:40 +0200 Subject: [PATCH] chore(editor): Fix flaky credentials test in instance AI (#31479) --- .../instance-ai-workflow-setup.spec.ts | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/packages/testing/playwright/tests/e2e/instance-ai/instance-ai-workflow-setup.spec.ts b/packages/testing/playwright/tests/e2e/instance-ai/instance-ai-workflow-setup.spec.ts index aac6cb5608a..0b29bfe0dda 100644 --- a/packages/testing/playwright/tests/e2e/instance-ai/instance-ai-workflow-setup.spec.ts +++ b/packages/testing/playwright/tests/e2e/instance-ai/instance-ai-workflow-setup.spec.ts @@ -901,21 +901,21 @@ test.describe( test('should persist a manually selected existing credential from the dropdown', async ({ n8n, }) => { - // creds are sorted by name, in the dropdown - const firstCrdentialInList = await n8n.api.credentials.createCredential({ - name: SELECT_EXISTING_TARGET_CREDENTIAL_NAME, - type: 'slackApi', - data: { - accessToken: 'xoxb-target-token-for-testing', - }, - }); - const secondCrdentialInList = await n8n.api.credentials.createCredential({ + // Creds are sorted by name in the dropdown; auto-select picks the most recently updated. + const firstCredentialInList = await n8n.api.credentials.createCredential({ name: SELECT_EXISTING_INITIAL_CREDENTIAL_NAME, type: 'slackApi', data: { accessToken: 'xoxb-initial-token-for-testing', }, }); + const secondCredentialInList = await n8n.api.credentials.createCredential({ + name: SELECT_EXISTING_TARGET_CREDENTIAL_NAME, + type: 'slackApi', + data: { + accessToken: 'xoxb-target-token-for-testing', + }, + }); const workflow = await n8n.api.workflows.createWorkflow( createSlackTriggerWorkflow(SELECT_EXISTING_WORKFLOW_NAME), @@ -926,15 +926,15 @@ test.describe( `Set up the workflow named "${SELECT_EXISTING_WORKFLOW_NAME}".`, ); - await expect(n8n.instanceAi.workflowSetup.getCard()).toBeVisible({ timeout: 120_000 }); + await expect(n8n.instanceAi.workflowSetup.getCard()).toBeVisible({ timeout: 12_000 }); await expect .poll(async () => await n8n.instanceAi.workflowSetup.getSelectedCredentialLabel()) - .toBe(firstCrdentialInList.name); + .toBe(secondCredentialInList.name); - await n8n.instanceAi.workflowSetup.selectCredentialById(secondCrdentialInList.id); + await n8n.instanceAi.workflowSetup.selectCredentialById(firstCredentialInList.id); await expect .poll(async () => await n8n.instanceAi.workflowSetup.getSelectedCredentialLabel()) - .toBe(secondCrdentialInList.name); + .toBe(firstCredentialInList.name); await expect(n8n.instanceAi.workflowSetup.getCardCheck()).toBeVisible(); await n8n.instanceAi.workflowSetup.getApplyButton().click(); @@ -945,7 +945,7 @@ test.describe( persisted, 'Slack Trigger', 'slackApi', - secondCrdentialInList.name, + firstCredentialInList.name, ); });