From ae1045e6ce667b39c15cb0e5702a9eedbff3ce0d Mon Sep 17 00:00:00 2001 From: Cody Jackson Date: Tue, 1 Apr 2025 18:00:58 -0700 Subject: [PATCH] Looks like we missed a the cloud credentials creator on the create cluster pages Fixes #13802 --- .../cloud-credentials-create.po.ts | 2 +- .../pages/manager/cloud-credential.spec.ts | 31 ++++++++++++++++++- .../SelectCredential.vue | 1 + 3 files changed, 32 insertions(+), 2 deletions(-) diff --git a/cypress/e2e/po/pages/cluster-manager/cloud-credentials-create.po.ts b/cypress/e2e/po/pages/cluster-manager/cloud-credentials-create.po.ts index 9d40133733..5cb679446a 100644 --- a/cypress/e2e/po/pages/cluster-manager/cloud-credentials-create.po.ts +++ b/cypress/e2e/po/pages/cluster-manager/cloud-credentials-create.po.ts @@ -1,5 +1,5 @@ import PagePo from '@/cypress/e2e/po/pages/page.po'; -import CloudCredentialsCreateAWSPagePo from '~/cypress/e2e/po/pages/cluster-manager/cloud-credentials-create-aws.po'; +import CloudCredentialsCreateAWSPagePo from '@/cypress/e2e/po/pages/cluster-manager/cloud-credentials-create-aws.po'; export default class CloudCredentialsCreatePagePo extends PagePo { private static createPath(clusterId: string) { diff --git a/cypress/e2e/tests/pages/manager/cloud-credential.spec.ts b/cypress/e2e/tests/pages/manager/cloud-credential.spec.ts index f840a1f558..22af1fc324 100644 --- a/cypress/e2e/tests/pages/manager/cloud-credential.spec.ts +++ b/cypress/e2e/tests/pages/manager/cloud-credential.spec.ts @@ -4,7 +4,9 @@ import { machinePoolConfigResponse } from '@/cypress/e2e/blueprints/manager/mach import ClusterManagerListPagePo from '@/cypress/e2e/po/pages/cluster-manager/cluster-manager-list.po'; import ClusterManagerEditGenericPagePo from '@/cypress/e2e/po/edit/provisioning.cattle.io.cluster/edit/cluster-edit-generic.po'; import ClusterManagerCreateRke2AzurePagePo from '@/cypress/e2e/po/edit/provisioning.cattle.io.cluster/create/cluster-create-rke2-azure.po'; -import CloudCredentialsCreatePagePo from '~/cypress/e2e/po/pages/cluster-manager/cloud-credentials-create.po'; +import CloudCredentialsCreatePagePo from '@/cypress/e2e/po/pages/cluster-manager/cloud-credentials-create.po'; +import ClusterManagerCreatePagePo from '@/cypress/e2e/po/edit/provisioning.cattle.io.cluster/create/cluster-create.po'; +import CloudCredentialsCreateAWSPagePo from '@/cypress/e2e/po/pages/cluster-manager/cloud-credentials-create-aws.po'; describe('Cloud Credential', { testIsolation: 'off' }, () => { const clusterList = new ClusterManagerListPagePo(); @@ -255,6 +257,33 @@ describe('Cloud Credential', { testIsolation: 'off' }, () => { createCredentialsAwsPo.errorBanner().should('contain.text', errorMessage); }); + it('Ensure we validate credentials and show an error when invalid when creating a credential from the create cluster page', { tags: ['@manager', '@adminUser'] }, () => { + // We're doing this odd page navigation and input verification to ensure we don't run into a very specific error which required this order of events described in https://github.com/rancher/dashboard/issues/13802 + const name = 'name'; + const access = 'access'; + const secret = 'secret'; + const errorMessage = 'Authentication test failed, please check your credentials'; + + const clusterCreate = new ClusterManagerCreatePagePo(); + + clusterCreate.goTo(); + clusterCreate.waitForPage(); + clusterCreate.selectCreate(0); + clusterCreate.rke2PageTitle().should('include', 'Create Amazon EC2'); + + const createCredentialsAwsPo = new CloudCredentialsCreateAWSPagePo(); + + createCredentialsAwsPo.accessKeyInput().set(access); + createCredentialsAwsPo.secretKeyInput().set(secret); + createCredentialsAwsPo.credentialNameInput().set(name); + + createCredentialsAwsPo.credentialNameInput().value().should('eq', name); + + createCredentialsAwsPo.clickCreate(); + // In the previous bug this text would get truncated to the first letter + createCredentialsAwsPo.errorBanner().should('contain.text', errorMessage); + }); + after(() => { for (let i = 0; i < doCreatedCloudCredsIds.length; i++) { cy.deleteRancherResource('v3', `cloudcredentials`, doCreatedCloudCredsIds[i]); diff --git a/shell/edit/provisioning.cattle.io.cluster/SelectCredential.vue b/shell/edit/provisioning.cattle.io.cluster/SelectCredential.vue index fc538b11fa..4cee09440d 100644 --- a/shell/edit/provisioning.cattle.io.cluster/SelectCredential.vue +++ b/shell/edit/provisioning.cattle.io.cluster/SelectCredential.vue @@ -236,6 +236,7 @@ export default {