You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

26 lines
743 B
JavaScript

Cypress.Commands.add('register', () => {
const apiUrl = Cypress.env('apiUrl')
const username = `cy${Math.random().toString().slice(2, 11)}`
const email = `${username}@mailinator.com`
cy.request({
url: `${apiUrl}/users`,
method: 'POST',
body: {
user: {
username: username,
email: email,
password: 'Testtest1'
}
}
})
.then((response) => {
expect(response.status).to.eq(200)
cy.log('**user created**')
cy.log(`**email: ${email}**`)
cy.log('**password: Testtest1**')
})
// return email so that we can use that to log in
.then(() => email)
})