UNCLASSIFIED - NO CUI

Skip to content
Snippets Groups Projects
Commit ab76d865 authored by Jimmy Bourque's avatar Jimmy Bourque
Browse files

Commented out the new code and put back to old code until script is updated

parent 5f9dda22
No related branches found
No related tags found
1 merge request!245Cypress updates
Pipeline #2799697 failed
......@@ -13,18 +13,28 @@ describe('Gitlab Signup', () => {
cy.get('input[id="new_user_last_name"]').type(Cypress.env('gitlab_last_name'))
//Listen for API call to validate username does not exist
cy.intercept('GET', '**/exists').as('userExistsCall')
//cy.intercept('GET', '**/exists').as('userExistsCall')
cy.get('input[id="new_user_username"]').type(Cypress.env('gitlab_username'))
cy.wait('@userExistsCall').then(({ response }) => {
expect(response.body).to.deep.equal({ exists: false });
})
//cy.wait('@userExistsCall').then(({ response }) => {
// expect(response.body).to.deep.equal({ exists: false });
//})
cy.get('input[id="new_user_email"]').type(Cypress.env('gitlab_email'))
cy.get('input[id="new_user_password"]').type(Cypress.env('gitlab_password'))
cy.get('button[data-testid="new-user-register-button"]').click()
cy.wait(3000) // wait 3 seconds for username check to complete
// add user if not already created
cy.get('.validation-error').then(($userexist) => {
if ($userexist.hasClass('hide')) {
cy.get('input[id="new_user_password"]').type(Cypress.env('gitlab_password'))
cy.get('button[data-testid="new-user-register-button"]').click()
}
})
//cy.get('input[id="new_user_password"]').type(Cypress.env('gitlab_password'))
//cy.get('button[data-testid="new-user-register-button"]').click()
//Validate redirect back to sign in and no errors occurred
cy.url().should('include', '/users/sign_in')
//cy.url().should('include', '/users/sign_in')
})
})
......@@ -36,13 +46,21 @@ describe('Gitlab Login as Root and Approve User', () => {
// approve new user
cy.visit(`${Cypress.env('url')}/admin/users?filter=blocked_pending_approval&search_query=${Cypress.env('gitlab_email')}&sort=name_asc`)
cy.get('div[data-testid="user-actions-dropdown-toggle"] > button').click()
cy.get('li[data-testid="approve"] > button').click()
cy.get('button[data-testid="approve-user-confirm-button"]').click()
//cy.get('div[data-testid="user-actions-dropdown-toggle"] > button').click()
//cy.get('li[data-testid="approve"] > button').click()
//cy.get('button[data-testid="approve-user-confirm-button"]').click()
cy.get('body').then($body => {
if ($body.find('div[data-testid="user-actions-dropdown-toggle"] > button').length > 0 ) {
cy.get('div[data-testid="user-actions-dropdown-toggle"] > button').click()
cy.get('li[data-testid="approve"] > button').click()
cy.get('button[data-testid="approve-user-confirm-button"]').click()
}
})
})
})
describe('Create Gitlab Project and Cleanup Resources Created', () => {
describe('Create Gitlab Project', () => {
it('Check if KC SSO or Non-SSO user is able to create/delete a project', () => {
// clear user data before starting test
......@@ -65,23 +83,33 @@ 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.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
cy.clearAllUserData()
//Sign in as Root
cy.visit(`${Cypress.env('url')}/users/sign_in`)
cy.performGitlabLogin('root', Cypress.env('adminpassword'))
// If project does not exist, create it
cy.get('body').then($body => {
if ($body.find('.project-row').length === 0) {
cy.createGitlabProject(Cypress.env('url'), Cypress.env('gitlab_project'))
}
})
//Browse to created user and delete
cy.visit(`${Cypress.env('url')}/admin/users/${Cypress.env('gitlab_username')}`)
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})
// Commenting out call to delete cypress created gitlab project as test script is also dependent on it
// Revisit once https://repo1.dso.mil/big-bang/product/packages/gitlab/-/issues/233 has been addressed
//cy.deleteGitlabProject(Cypress.env('url'), Cypress.env('gitlab_username'), Cypress.env('gitlab_project'))
})
// Commenting out this part of the test as script test is dependent on cypress created user
// Revisit once https://repo1.dso.mil/big-bang/product/packages/gitlab/-/issues/233 has been addressed
//it('Login as Root and Delete Test User', () => {
// // clear user data before starting test
// cy.clearAllUserData()
//
// //Sign in as Root
// cy.visit(`${Cypress.env('url')}/users/sign_in`)
// cy.performGitlabLogin('root', Cypress.env('adminpassword'))
//
// //Browse to created user and delete
// cy.visit(`${Cypress.env('url')}/admin/users/${Cypress.env('gitlab_username')}`)
// 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})
//})
})
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment