Skip to content

Commit

Permalink
[Automation] Unable to click continue when specifying a new cloud cre…
Browse files Browse the repository at this point in the history
…dential as part of creating a new cluster (#10938)

[Automation] Added test to validate that providing cloud credentials enables continue button
  • Loading branch information
eva-vashkevich authored May 7, 2024
1 parent f60d943 commit eafedc0
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
5 changes: 5 additions & 0 deletions cypress/e2e/po/edit/base-cloud-credentials.po.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import PagePo from '@/cypress/e2e/po/pages/page.po';
import CruResourcePo from '@/cypress/e2e/po/components/cru-resource.po';
import NameNsDescription from '@/cypress/e2e/po/components/name-ns-description.po';
import ResourceDetailPo from '@/cypress/e2e/po/edit/resource-detail.po';
import AsyncButtonPo from '@/cypress/e2e/po/components/async-button.po';

export default class BaseCloudCredentialsPo extends PagePo {
private static createPath(clusterId: string, id?: string ) {
Expand Down Expand Up @@ -29,4 +30,8 @@ export default class BaseCloudCredentialsPo extends PagePo {
saveCreateForm(): ResourceDetailPo {
return new ResourceDetailPo(this.self());
}

saveButton() {
return new AsyncButtonPo('[data-testid="form-save"]', this.self());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,13 @@ describe('Provision Node driver RKE2 cluster', { testIsolation: 'off', tags: ['@
createRKE2ClusterPage.waitForPage('type=amazonec2&rkeType=rke2');

// create amazon ec2 cloud credential
cloudCredForm.saveButton().expectToBeDisabled();
cloudCredForm.nameNsDescription().name().set(this.ec2CloudCredentialName);
cloudCredForm.accessKey().set(Cypress.env('awsAccessKey'));
cloudCredForm.secretKey().set(Cypress.env('awsSecretKey'), true);
cloudCredForm.defaultRegion().toggle();
cloudCredForm.defaultRegion().clickOptionWithLabel('us-west-1');
cloudCredForm.saveButton().expectToBeEnabled();

cy.intercept('GET', '/v1/management.cattle.io.users?exclude=metadata.managedFields').as('pageLoad');
cloudCredForm.saveCreateForm().cruResource().saveAndWaitForRequests('POST', '/v3/cloudcredentials').then((req) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,14 @@ describe('Provision Node driver RKE2 cluster with Azure', { testIsolation: 'off'
createRKE2ClusterPage.waitForPage('type=azure&rkeType=rke2');

// create Azure cloud credential
cloudCredForm.saveButton().expectToBeDisabled();
cloudCredForm.nameNsDescription().name().set(this.azureCloudCredentialName);
cloudCredForm.environment().toggle();
cloudCredForm.environment().clickOptionWithLabel('AzurePublicCloud');
cloudCredForm.subscriptionId().set(Cypress.env('azureSubscriptionId'));
cloudCredForm.clientId().set(Cypress.env('azureClientId'), true);
cloudCredForm.clientSecret().set(Cypress.env('azureClientSecret'), true);
cloudCredForm.saveButton().expectToBeEnabled();
cloudCredForm.saveCreateForm().cruResource().saveAndWaitForRequests('POST', '/v3/cloudcredentials').then((req) => {
expect(req.response?.statusCode).to.equal(201);
cloudcredentialId = req.response?.body.id;
Expand Down

0 comments on commit eafedc0

Please sign in to comment.