Cypress test to check change user password and login with the new (#2159)

password.

Co-authored-by: Dmitry Kruchinin <dmitryx.kruchinin@intel.com>
main
Dmitry Kruchinin 5 years ago committed by GitHub
parent 7e7b650a6b
commit 4dc25e20c9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -0,0 +1,51 @@
/*
* Copyright (C) 2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*/
/// <reference types="cypress" />
context('Register user, change password, login with new password', () => {
const caseId = '2'
const firstName = 'First name'
const lastName = 'Last name'
const userName = 'Username'
const emailAddr = `${userName}@local.local`
const password = 'UfdU21!dds'
const newPassword = 'dKl3j49sd@jjk'
before(() => {
cy.visit('auth/register')
cy.url().should('include', '/auth/register')
})
describe(`Testing "Case ${caseId}"`, () => {
it('Register user, change password', () => {
cy.userRegistration(firstName, lastName, userName, emailAddr, password)
cy.url().should('include', '/tasks')
cy.get('.cvat-right-header')
.find('.cvat-header-menu-dropdown')
.should('have.text', userName)
.trigger('mouseover')
cy.get('.anticon-edit')
.click()
cy.get('.ant-modal-body').within(() => {
cy.get('#oldPassword').type(password)
cy.get('#newPassword1').type(newPassword)
cy.get('#newPassword2').type(newPassword)
cy.get('.change-password-form-button').click()
})
cy.contains('New password has been saved.')
.should('exist')
})
it('Logout', () => {
cy.logout(userName)
cy.url().should('include', '/auth/login')
})
it('Login with the new password', () => {
cy.login(userName, newPassword)
cy.url().should('include', '/tasks')
})
})
})

@ -25,6 +25,16 @@ Cypress.Commands.add('logout', (username=Cypress.env('user')) => {
.click()
})
Cypress.Commands.add('userRegistration', (firstName, lastName, userName, emailAddr, password) => {
cy.get('#firstName').type(firstName)
cy.get('#lastName').type(lastName)
cy.get('#username').type(userName)
cy.get('#email').type(emailAddr)
cy.get('#password1').type(password)
cy.get('#password2').type(password)
cy.get('.register-form-button').click()
})
Cypress.Commands.add('createAnnotationTask', (taksName='New annotation task',
labelName='Some label',
attrName='Some attr name',

Loading…
Cancel
Save