From 9f9d661cdf56a96b8dc7f57c7ba2078b0cc8bb61 Mon Sep 17 00:00:00 2001 From: Davit Date: Sun, 30 Jun 2024 21:55:59 +0400 Subject: [PATCH] test files --- cypress/e2e/organizations/notifications.cy.ts | 7 +++- cypress/e2e/rbac/maintainer.cy.ts | 4 ++- .../actions/deployment/DeploymentAction.ts | 36 ++++++++++++++----- .../actions/settings/SettingsAction.ts | 3 +- 4 files changed, 38 insertions(+), 12 deletions(-) diff --git a/cypress/e2e/organizations/notifications.cy.ts b/cypress/e2e/organizations/notifications.cy.ts index 13ad8136..82644d34 100644 --- a/cypress/e2e/organizations/notifications.cy.ts +++ b/cypress/e2e/organizations/notifications.cy.ts @@ -57,10 +57,15 @@ describe('Org Notifications page', () => { slack: { name: slackName }, } = testData.organizations.notifications; + cy.waitForNetworkIdle('@idle', 500); notifications.doDeleteNotification(webhooknName); + cy.waitForNetworkIdle('@idle', 500); notifications.doDeleteNotification(emailName); + cy.waitForNetworkIdle('@idle', 500); notifications.doDeleteNotification(teamsName); + cy.waitForNetworkIdle('@idle', 500); notifications.doDeleteNotification(rocketChatName); + cy.waitForNetworkIdle('@idle', 500); notifications.doDeleteNotification(slackName); }); -}); +}); \ No newline at end of file diff --git a/cypress/e2e/rbac/maintainer.cy.ts b/cypress/e2e/rbac/maintainer.cy.ts index 971df7d2..9c89fcc5 100644 --- a/cypress/e2e/rbac/maintainer.cy.ts +++ b/cypress/e2e/rbac/maintainer.cy.ts @@ -28,6 +28,7 @@ const task = new TaskAction(); describe('MAINTAINER permission test suites', () => { beforeEach(() => { cy.login(Cypress.env('user_maintainer'), Cypress.env('user_maintainer')); + registerIdleHandler('idle'); }); context('Settings', () => { @@ -39,6 +40,7 @@ describe('MAINTAINER permission test suites', () => { it('Deletes SSH key', () => { cy.visit(`${Cypress.env('url')}/settings`); + cy.waitForNetworkIdle('@idle', 500); settings.deleteSshKey(testData.ssh.name); }); @@ -303,4 +305,4 @@ describe('MAINTAINER permission test suites', () => { task.doCancelTask(); }); }); -}); +}); \ No newline at end of file diff --git a/cypress/support/actions/deployment/DeploymentAction.ts b/cypress/support/actions/deployment/DeploymentAction.ts index 2a87d556..0da19e03 100644 --- a/cypress/support/actions/deployment/DeploymentAction.ts +++ b/cypress/support/actions/deployment/DeploymentAction.ts @@ -43,17 +43,37 @@ export default class deploymentAction { .should('include.text', 'There was a problem cancelling deployment.'); } doLogViewerCheck() { - deployment.getAccordionHeadings().then($headings => { - for (let i = 0; i < $headings.length - 1; i++) { - cy.wrap($headings.eq(i)).click(); - } - - for (let i = 0; i < $headings.length - 1; i++) { - cy.wrap($headings.eq(i)).next().next().getBySel('section-details').getBySel('log-text').should('exist'); + cy.get('body').then($body => { + if ($body.find('.accordion-heading').length > 0) { + // parsing went ok + cy.get('.accordion-heading') + .each(($heading, index, $headings) => { + if (index < $headings.length - 1) { + cy.wrap($heading).click(); + } + }) + .then($headings => { + for (let i = 0; i < $headings.length - 1; i++) { + cy.wrap($headings.eq(i)) + .next() + .next() + .getBySel('section-details') + .then($sectionDetails => { + if ($sectionDetails.find('.log-text').length > 0) { + cy.wrap($sectionDetails).find('.log-text').should('exist'); + } else { + cy.wrap($sectionDetails).find('.log-viewer').should('not.be.empty'); + } + }); + } + }); + } else { + // parsing failed + cy.get('.log-viewer').should('not.be.empty'); } }); } navigateToRunningDeployment() { cy.getBySel('deployment-row').getBySel('running').first().click(); } -} +} \ No newline at end of file diff --git a/cypress/support/actions/settings/SettingsAction.ts b/cypress/support/actions/settings/SettingsAction.ts index 30802456..4181df31 100644 --- a/cypress/support/actions/settings/SettingsAction.ts +++ b/cypress/support/actions/settings/SettingsAction.ts @@ -17,8 +17,7 @@ export default class SettingAction { } deleteSshKey(name: string) { - settings.getDeleteBtn().click(); - + settings.getDeleteBtn().should('be.visible').click({ force: true, multiple: true }); cy.contains(name).should('not.exist'); } }