From 0fc20b64ab0e391a8a405d6e3f1093cf76af7bce Mon Sep 17 00:00:00 2001 From: Jimmy Bourque <jbourque@bridgephase.com> Date: Fri, 26 Jan 2024 13:40:07 -0600 Subject: [PATCH] Used shared command for project deletion and tweaked user deletion portion --- .../cypress/e2e/01-gitlab-health-spec.cy.js | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/chart/tests/cypress/e2e/01-gitlab-health-spec.cy.js b/chart/tests/cypress/e2e/01-gitlab-health-spec.cy.js index 11908871d..6539fa92e 100644 --- a/chart/tests/cypress/e2e/01-gitlab-health-spec.cy.js +++ b/chart/tests/cypress/e2e/01-gitlab-health-spec.cy.js @@ -68,11 +68,7 @@ describe('Create Gitlab Project and Cleanup Resources Created', () => { // Validate project can be created and then delete to clean up resources cy.createGitlabProject(Cypress.env('url'), Cypress.env('gitlab_project')) - cy.visit(`${Cypress.env('url')}/${Cypress.env('gitlab_username')}/${Cypress.env('gitlab_project')}/edit`) - cy.get('section[data-testid="advanced-settings-content"]').contains('span', 'Expand').click() - cy.get('button[data-testid="delete-button"]').click() - cy.get('input[data-testid="confirm-name-field"]').type(`${Cypress.env('gitlab_username')}/${Cypress.env('gitlab_project')}`) - cy.get('button[data-testid="confirm-delete-button"]').click() + cy.deleteGitlabProject(Cypress.env('url'), Cypress.env('gitlab_username'), Cypress.env('gitlab_project')) }) it('Login as Root and Delete Test User', () => { // clear user data before starting test @@ -87,11 +83,13 @@ describe('Create Gitlab Project and Cleanup Resources Created', () => { cy.get('div[data-testid="user-actions-2"]').find('button[data-testid="base-dropdown-toggle"]').click() cy.get('li[data-testid="delete-deleteWithContributions"]').find('button').click() cy.get('input[name="username"]').type(`${Cypress.env('gitlab_first_name')} ${Cypress.env('gitlab_last_name')}`) - cy.contains('span', 'Delete user and contributions').click({force: true}) - //Wait for user deletion to complete before validating user no longer exists - //Unfortunately, there is no API call to listen to here so it has to be an explicit wait - cy.wait(3000) + //Start listening for user list refresh prior to moving on to validation + cy.intercept('GET', '**/admin/users').as('userListCall') + cy.contains('span', 'Delete user and contributions').click({force: true}) + cy.wait('@userListCall').then((interception) => { + expect(interception.response.statusCode).to.equal(200) + }) //Validate user is gone cy.visit(`${Cypress.env('url')}/admin/users?search_query=${Cypress.env('gitlab_email')}&sort=name_asc`) -- GitLab