From 362da3579ff44a4af145c31a5d8ee79517c50c25 Mon Sep 17 00:00:00 2001 From: Hana Xu Date: Wed, 4 Dec 2024 13:01:09 -0500 Subject: [PATCH] wip e2e --- .../e2e/core/kubernetes/lke-update.spec.ts | 64 +++++++++++++++++++ 1 file changed, 64 insertions(+) diff --git a/packages/manager/cypress/e2e/core/kubernetes/lke-update.spec.ts b/packages/manager/cypress/e2e/core/kubernetes/lke-update.spec.ts index 4d4f89c60cb..da96de3e36c 100644 --- a/packages/manager/cypress/e2e/core/kubernetes/lke-update.spec.ts +++ b/packages/manager/cypress/e2e/core/kubernetes/lke-update.spec.ts @@ -860,6 +860,70 @@ describe('LKE cluster updates', () => { }); }); + it.only('can add and delete node pool tags', () => { + const mockCluster = kubernetesClusterFactory.build({ + k8s_version: latestKubernetesVersion, + }); + + const mockNodePoolNoTags = nodePoolFactory.build({ + id: 1, + type: 'g6-dedicated-4', + }); + + const mockNodePoolWithTags = { + ...mockNodePoolNoTags, + tags: ['test-tag'], + }; + + mockGetCluster(mockCluster).as('getCluster'); + mockGetClusterPools(mockCluster.id, [mockNodePoolNoTags]).as( + 'getNodePoolsNoTags' + ); + mockGetKubernetesVersions().as('getVersions'); + mockUpdateNodePool(mockCluster.id, mockNodePoolWithTags).as('addTag'); + mockUpdateNodePool(mockCluster.id, mockNodePoolNoTags).as('deleteTag'); + mockGetDashboardUrl(mockCluster.id); + mockGetApiEndpoints(mockCluster.id); + + cy.visitWithLogin(`/kubernetes/clusters/${mockCluster.id}`); + cy.wait(['@getCluster', '@getNodePoolsNoTags', '@getVersions']); + + cy.get('[data-qa-node-pool-id="1"]').within(() => { + ui.button.findByTitle('Add a tag').should('be.visible').click(); + + cy.findByLabelText('Create or Select a Tag') + .should('be.visible') + .type(`${mockNodePoolWithTags.tags[0]}`); + + ui.autocompletePopper + .findByTitle(`Create "${mockNodePoolWithTags.tags[0]}"`) + .scrollIntoView() + .should('be.visible') + .click(); + }); + + mockGetClusterPools(mockCluster.id, [mockNodePoolWithTags]).as( + 'getNodePoolsWithTags' + ); + + cy.wait(['@addTag', '@getNodePoolsWithTags']); + + // // Delete the newly added node pool tag. + // cy.get(`[data-qa-tag="${mockNodePoolWithTags.tags[0]}"]`) + // .should('be.visible') + // .within(() => { + // ui.button + // .findByTitle('Delete tag') + // .should('be.visible') + // .should('be.enabled') + // .click(); + // }); + + // cy.wait(['@deleteTag', '@getNodePoolsNoTags']); + // cy.get(`[data-qa-tag="${mockNodePoolWithTags.tags[0]}"]`) + // .should('not.exist') + }); + describe('LKE cluster updates for DC-specific prices', () => { /* * - Confirms node pool resize UI flow using mocked API responses.