Skip to content

Commit d46174a

Browse files
authored
Fleetqa/adding close popup window function (#320)
* Adding pop-up window close function to allow failing tests to pass * moving close pop window into other cluster functions. Makink string mandatory in e2e.ts * more pop up windows additions
1 parent 2d0c0ff commit d46174a

File tree

4 files changed

+80
-3
lines changed

4 files changed

+80
-3
lines changed

tests/cypress/e2e/unit_tests/p0_fleet.spec.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -285,10 +285,14 @@ if (!/\/2\.8/.test(Cypress.env('rancher_version'))) {
285285
// Re-add the key to avoid other girepos to be stalled
286286
cy.clickButton('Add')
287287
cy.get("section[id='data'] input[placeholder='e.g. foo']").type('known_hosts');
288-
cy.wait(500); // Needs time for previous command to finnish
288+
cy.wait(500); // Needs time for previous command to finish
289289
cy.clickButton('Save')
290-
cy.wait(500); // Needs time for previous command to finnish
291-
290+
cy.wait(500); // Needs time for previous command to finish
291+
292+
// TODO: remove once this bug is fixed:
293+
// https://github.com/rancher/dashboard/issues/14295#issuecomment-2862105017
294+
cy.closePopWindow('ConfigMap Creation Warning')
295+
292296
// Verify gitrepo is added using default knownhost
293297
cy.accesMenuSelection('Continuous Delivery', 'Git Repos')
294298
cy.fleetNamespaceToggle('fleet-local')

tests/cypress/e2e/unit_tests/p1_fleet.spec.ts

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,11 @@ describe('Test Self-Healing of resource modification when correctDrift option us
234234
// TODO: remove or rework when possible
235235
cy.wait(2000);
236236
cy.open3dotsMenu(repoName, 'Force Update');
237+
238+
// TODO: remove once this bug is fixed:
239+
// https://github.com/rancher/dashboard/issues/14295#issuecomment-2862105017
240+
cy.closePopWindow('Warning')
241+
237242
cy.checkGitRepoStatus(repoName, '1 / 1', '1 / 1');
238243
cy.checkApplicationStatus(appName);
239244

@@ -569,6 +574,11 @@ if (!/\/2\.7/.test(Cypress.env('rancher_version')) && !/\/2\.8/.test(Cypress.env
569574
cy.accesMenuSelection('local', 'Workloads', 'Deployments');
570575
cy.filterInSearchBox('nginx-test-polling');
571576
cy.wait(500);
577+
578+
// TODO: remove once this bug is fixed:
579+
// https://github.com/rancher/dashboard/issues/14295#issuecomment-2862105017
580+
cy.closePopWindow('Warning')
581+
572582
cy.log('HERE WE SHOULD SEE 2/2');
573583
cy.contains('tr.main-row', 'nginx-test-polling', { timeout: 20000 }).should('be.visible');
574584
cy.screenshot('Screenshot BEFORE reloading should be 2/2');
@@ -620,9 +630,19 @@ if (!/\/2\.7/.test(Cypress.env('rancher_version')) && !/\/2\.8/.test(Cypress.env
620630
cy.accesMenuSelection('Continuous Delivery', 'Git Repos');
621631
cy.fleetNamespaceToggle('fleet-local');
622632
cy.open3dotsMenu(repoName, 'Pause');
633+
634+
// TODO: remove once this bug is fixed:
635+
// https://github.com/rancher/dashboard/issues/14295#issuecomment-2862105017
636+
cy.closePopWindow('Warning')
637+
623638
cy.verifyTableRow(0, 'Paused');
624639
cy.wait(2000); // Wait to let time for pause to take effect.
625640
cy.open3dotsMenu(repoName, 'Unpause');
641+
642+
// TODO: remove once this bug is fixed:
643+
// https://github.com/rancher/dashboard/issues/14295#issuecomment-2862105017
644+
cy.closePopWindow('Warning')
645+
626646
cy.verifyTableRow(0, 'Active');
627647
// Verify deployment changes to 5?
628648
cy.accesMenuSelection('local', 'Workloads', 'Deployments');
@@ -932,6 +952,8 @@ describe("Test Application deployment based on 'clusterSelector'", { tags: '@p1'
932952
cy.removeClusterLabels(dsCluster, key, value);
933953
}
934954
)
955+
956+
935957
cy.deleteAllFleetRepos();
936958
})
937959

@@ -985,6 +1007,12 @@ describe("Test Application deployment based on 'clusterSelector'", { tags: '@p1'
9851007
// Create a GitRepo targeting cluster group created from YAML.
9861008
cy.clickNavMenu(['Git Repos']);
9871009
cy.wait(500);
1010+
1011+
1012+
// TODO: remove once this bug is fixed:
1013+
// https://github.com/rancher/dashboard/issues/14295#issuecomment-2862105017
1014+
cy.closePopWindow('Warning')
1015+
9881016
cy.clickButton('Add Repository');
9891017
cy.contains('Git Repo:').should('be.visible');
9901018
cy.clickButton('Edit as YAML');
@@ -1061,6 +1089,12 @@ describe("Test Application deployment based on 'clusterSelector'", { tags: '@p1'
10611089
// Create a GitRepo targeting cluster group created from YAML.
10621090
cy.clickNavMenu(['Git Repos']);
10631091
cy.wait(500);
1092+
1093+
1094+
// TODO: remove once this bug is fixed:
1095+
// https://github.com/rancher/dashboard/issues/14295#issuecomment-2862105017
1096+
cy.closePopWindow('Warning')
1097+
10641098
cy.clickButton('Add Repository');
10651099
cy.contains('Git Repo:').should('be.visible');
10661100
cy.clickButton('Edit as YAML');
@@ -1111,6 +1145,11 @@ describe("Test Application deployment based on 'clusterGroupSelector'", { tags:
11111145
cy.removeClusterLabels(dsCluster, key, value);
11121146
}
11131147
)
1148+
1149+
// TODO: remove once this bug is fixed:
1150+
// https://github.com/rancher/dashboard/issues/14295#issuecomment-2862105017
1151+
cy.closePopWindow('Warning')
1152+
11141153
cy.deleteClusterGroups();
11151154
cy.deleteAllFleetRepos();
11161155
})
@@ -1169,6 +1208,11 @@ describe("Test Application deployment based on 'clusterGroupSelector'", { tags:
11691208
// Create a GitRepo targeting cluster group created from YAML.
11701209
cy.clickNavMenu(['Git Repos']);
11711210
cy.wait(500);
1211+
1212+
// TODO: remove once this bug is fixed:
1213+
// https://github.com/rancher/dashboard/issues/14295#issuecomment-2862105017
1214+
cy.closePopWindow('Warning')
1215+
11721216
cy.clickButton('Add Repository');
11731217
cy.contains('Git Repo:').should('be.visible');
11741218
cy.clickButton('Edit as YAML');

tests/cypress/support/commands.ts

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -621,6 +621,11 @@ Cypress.Commands.add('upgradeFleet', () => {
621621

622622
// Add label to the imported cluster(s)
623623
Cypress.Commands.add('assignClusterLabel', (clusterName, key, value) => {
624+
625+
// TODO: remove once this bug is fixed:
626+
// https://github.com/rancher/dashboard/issues/14295#issuecomment-2862105017
627+
cy.closePopWindow('Warning')
628+
624629
cy.filterInSearchBox(clusterName);
625630
cy.open3dotsMenu(clusterName, 'Edit Config');
626631
cy.clickButton('Add Label');
@@ -636,6 +641,12 @@ Cypress.Commands.add('assignClusterLabel', (clusterName, key, value) => {
636641
// Create clusterGroup based on label assigned to the cluster
637642
Cypress.Commands.add('createClusterGroup', (clusterGroupName, key, value, bannerMessageToAssert, assignClusterGroupLabel=false, clusterGroupLabelKey, clusterGroupLabelValue) => {
638643
cy.fleetNamespaceToggle('fleet-default');
644+
645+
646+
// TODO: remove once this bug is fixed:
647+
// https://github.com/rancher/dashboard/issues/14295#issuecomment-2862105017
648+
cy.closePopWindow('Warning')
649+
639650
cy.clickButton('Create');
640651
cy.get('input[placeholder="A unique name"]').type(clusterGroupName);
641652
cy.clickButton('Add Rule');
@@ -685,6 +696,11 @@ Cypress.Commands.add('removeClusterLabels', (clusterName, key, value) => {
685696
cy.accesMenuSelection('Continuous Delivery', 'Git Repos');
686697
cy.clickNavMenu(['Clusters']);
687698
cy.contains('.title', 'Clusters').should('be.visible');
699+
700+
// TODO: remove once this bug is fixed:
701+
// https://github.com/rancher/dashboard/issues/14295#issuecomment-2862105017
702+
cy.closePopWindow('Warning')
703+
688704
cy.filterInSearchBox(clusterName);
689705
cy.open3dotsMenu(clusterName, 'Edit Config');
690706
cy.contains('.title', 'Cluster:').should('be.visible');
@@ -1022,3 +1038,15 @@ Cypress.Commands.add('deleteConfigMap', (configMapName) => {
10221038
cy.filterInSearchBox(configMapName);
10231039
cy.deleteAll(false);
10241040
})
1041+
1042+
// Command to remove pop-ups if they appear
1043+
// Note: this should be MOMENTARY and a bug should be filed
1044+
// Remove them once bug is fixed
1045+
Cypress.Commands.add('closePopWindow', (windowMessage) => {
1046+
cy.get('body').then(($body) => {
1047+
if ($body.find('.growl-text-title').text().includes(windowMessage)) {
1048+
cy.log('POP UP WINDOW FOUND. CLOSING IT. PLEASE INVESTIGATE CAUSE');
1049+
cy.get('i.close.hand.icon.icon-close').should('be.visible').click();
1050+
}
1051+
})
1052+
})

tests/cypress/support/e2e.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ declare global {
6666
createNewFleetWorkspace(newWorkspaceName: string): Chainable<Element>;
6767
createConfigMap(configMapName: string): Chainable<Element>;
6868
deleteConfigMap(configMapName: string): Chainable<Element>;
69+
closePopWindow(windowMessage: string): Chainable<Element>;
6970
}
7071
}
7172
}

0 commit comments

Comments
 (0)