Skip to content

Commit

Permalink
addressed changes requested from PR review
Browse files Browse the repository at this point in the history
Signed-off-by: Isabela Guimaraes <[email protected]>
  • Loading branch information
IsaSih committed Jan 15, 2025
1 parent 7b0d892 commit bbacde3
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 19 deletions.
1 change: 0 additions & 1 deletion cypress.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ export default defineConfig({
customNodeIp: process.env.CUSTOM_NODE_IP,
customNodeKey: process.env.CUSTOM_NODE_KEY,
gkeServiceAccount: process.env.GKE_SERVICE_ACCOUNT,
gkeProjectId: process.env.GKE_PROJECT_ID
},
e2e: {
fixturesFolder: 'cypress/e2e/blueprints',
Expand Down
8 changes: 0 additions & 8 deletions cypress/e2e/po/components/labeled-select.po.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,4 @@ export default class LabeledSelectPo extends ComponentPo {
filterByName(name: string) {
return this.self().type(name);
}

static getGkeVersionSelect() {
return new LabeledSelectPo('[data-testid="gke-version-select"]');
}

static getGkeZoneSelect() {
return new LabeledSelectPo('[data-testid="gke-zone-select"]');
}
}
4 changes: 0 additions & 4 deletions cypress/e2e/po/edit/base-cloud-credentials.po.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,4 @@ export default class BaseCloudCredentialsPo extends PagePo {
saveButton() {
return new AsyncButtonPo('[data-testid="form-save"]', this.self());
}

authenticateButton() {
return new AsyncButtonPo('[data-testid="action-button-async-button"]', this.self());
}
}
5 changes: 5 additions & 0 deletions cypress/e2e/po/edit/cloud-credentials-gke.po.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import LabeledInputPo from '@/cypress/e2e/po/components/labeled-input.po';
import ButtonFileSelectorPo from '@/cypress/e2e/po/components/button-file-selector.po';
import BaseCloudCredentialsPo from '@/cypress/e2e/po/edit/base-cloud-credentials.po';
import AsyncButtonPo from '@/cypress/e2e/po/components/async-button.po';

export default class GKECloudCredentialsCreateEditPo extends BaseCloudCredentialsPo {
serviceAccount(): LabeledInputPo {
Expand All @@ -10,4 +11,8 @@ export default class GKECloudCredentialsCreateEditPo extends BaseCloudCredential
readFromFile(): Cypress.Chainable {
return ButtonFileSelectorPo.readFromFileButton().click();
}

authenticateButton() {
return new AsyncButtonPo('[data-testid="action-button-async-button"]', this.self());
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import PagePo from '@/cypress/e2e/po/pages/page.po';
import ClusterManagerCreatePagePo from '@/cypress/e2e/po/edit/provisioning.cattle.io.cluster/create/cluster-create.po';
import LabeledInputPo from '@/cypress/e2e/po/components/labeled-input.po';
import LabeledSelectPo from '@/cypress/e2e/po/components/labeled-select.po';
import GKECloudCredentialsCreateEditPo from '@/cypress/e2e/po/edit/cloud-credentials-gke.po';
import AsyncButtonPo from '@/cypress/e2e/po/components/async-button.po';

Expand Down Expand Up @@ -31,4 +32,12 @@ export default class ClusterManagerCreateGKEPagePo extends ClusterManagerCreateP
saveCreateGkeCluster(): AsyncButtonPo {
return new AsyncButtonPo('[data-testid="form-save"]', this.self());
}

static getGkeVersionSelect() {
return new LabeledSelectPo('[data-testid="gke-version-select"]');
}

static getGkeZoneSelect() {
return new LabeledSelectPo('[data-testid="gke-zone-select"]');
}
}
11 changes: 5 additions & 6 deletions cypress/e2e/tests/pages/manager/gke-cluster-provisioning.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import HomePagePo from '@/cypress/e2e/po/pages/home.po';
import ClusterManagerListPagePo from '@/cypress/e2e/po/pages/cluster-manager/cluster-manager-list.po';
import LoadingPo from '@/cypress/e2e/po/components/loading.po';
import ClusterManagerCreateGKEPagePo from '@/cypress/e2e/po/edit/provisioning.cattle.io.cluster/create/cluster-create-gke.po';
import LabeledSelectPo from '@/cypress/e2e/po/components/labeled-select.po';
import { DEFAULT_GCP_ZONE } from '@/pkg/gke/util/gcp';

// will only run this in jenkins pipeline where cloud credentials are stored
Expand All @@ -16,6 +15,7 @@ describe('Deploy GKE cluster with default settings', { tags: ['@manager', '@admi
// clusterId commented out as it will be used for the next tests of this suite, but not being used by the current test
// let clusterId = '';
let clusterDescription = '';
const gkeProjectId = JSON.parse(Cypress.env('gkeServiceAccount')).project_id;

before(() => {
cy.login();
Expand Down Expand Up @@ -69,22 +69,22 @@ describe('Deploy GKE cluster with default settings', { tags: ['@manager', '@admi

// Authenticate GKE credential by providing the Project ID
createGKEClusterPage.waitForPage('type=googlegke&rkeType=rke2');
createGKEClusterPage.authProjectId().set(Cypress.env('gkeProjectId'));
cy.intercept('POST', `/meta/gkeVersions?cloudCredentialId=${ cloudcredentialId }&projectId=${ Cypress.env('gkeProjectId') }&zone=${ gkeDefaultZone }`).as('getGKEVersions');
createGKEClusterPage.authProjectId().set( gkeProjectId );
cy.intercept('POST', `/meta/gkeVersions?cloudCredentialId=${ cloudcredentialId }&projectId=${ gkeProjectId }&zone=${ gkeDefaultZone }`).as('getGKEVersions');
cloudCredForm.authenticateButton().click();
cy.wait('@pageLoad').its('response.statusCode').should('eq', 200);
loadingPo.checkNotExists();

// Verify that gke-zone-select dropdown is set to the default zone
createGKEClusterPage.waitForPage('type=googlegke&rkeType=rke2');
LabeledSelectPo.getGkeZoneSelect().checkOptionSelected(DEFAULT_GCP_ZONE);
ClusterManagerCreateGKEPagePo.getGkeZoneSelect().checkOptionSelected(DEFAULT_GCP_ZONE);

// Get latest GKE kubernetes version and verify that gke-version-select dropdown is set to the default version as defined by versionOptions(); in Config.vue
cy.wait('@getGKEVersions').then(({ response }) => {
expect(response.statusCode).to.eq(200);
gkeVersion = response.body.validMasterVersions[0];
cy.wrap(gkeVersion).as('gkeVersion');
LabeledSelectPo.getGkeVersionSelect().checkOptionSelected(gkeVersion);
ClusterManagerCreateGKEPagePo.getGkeVersionSelect().checkOptionSelected(gkeVersion);
});

// Set the cluster name and description in the Create GKE Page
Expand All @@ -103,7 +103,6 @@ describe('Deploy GKE cluster with default settings', { tags: ['@manager', '@admi
expect(response?.body.gkeConfig).to.have.property('clusterName', this.gkeClusterName);
expect(response?.body).to.have.property('description', clusterDescription);
expect(response?.body.gkeConfig).to.have.property('kubernetesVersion').contains(gkeVersion);
// clusterId = response?.body.id;
});

// Verify that the GKE created cluster is listed in the clusters list and has the Provisioning status
Expand Down

0 comments on commit bbacde3

Please sign in to comment.