diff --git a/frontend/cypress/integration/register.spec.js b/frontend/cypress/integration/register.spec.js index 28d738b852e64ef06f54be71de79f0f5ba085f15..0a5392cb98015bc399f662ce4215c0110215cee7 100644 --- a/frontend/cypress/integration/register.spec.js +++ b/frontend/cypress/integration/register.spec.js @@ -6,39 +6,52 @@ var baseUrl = "localhost:9090" /** * The only validation done in the frontend is thorugh email */ +const ThreeHundredChars = "tdt4242 tdt4242 tdt4242 tdt4242 tdt4242 tdt4242 tdt4242 tdt4242 tdt4242 tdt4242 tdt4242 tdt4242 tdt4242 tdt4242 tdt4242 tdt4242 tdt4242 tdt4242 tdt4242 "; + describe('boundary tests registration page', () => { beforeEach(() => { cy.visit(`${baseUrl}/register.html`) }); - it('alert should be visible if email is invalid', () => { + it('Test lower limit', () => { cy.get('#btn-create-account').click() - cy.get('li').contains('username').children('ul').children('li').contains('This field may not be blank.') + cy.get('.alert').should('be.visible'); + cy.get('.alert').get('li').contains('username').children('ul').children('li').contains('This field may not be blank.') cy.get('li').contains('password').children('ul').children('li').contains('This field may not be blank.') cy.get('li').contains('password1').children('ul').children('li').contains('This field may not be blank.') }); - it('alert should be visible if email is invalid', () => { - const username = randomUsername(); - cy.get('[name="username"]') - .type(username); - - cy.get('[name="password"]') - .type('testpassword'); - - cy.get('[name="password1"]') - .type('testpassword'); + it('Test upper limit', () => { - cy.get('[name="email"]') - .type("invalidEmail@"); + cy.get('input[name="username"]').type(ThreeHundredChars) + cy.get('input[name="email"]').type(ThreeHundredChars) + cy.get('input[name="password"]').type(ThreeHundredChars) + cy.get('input[name="password1"]').type(ThreeHundredChars) + cy.get('input[name="phone_number"]').type(ThreeHundredChars) + cy.get('input[name="country"]').type(ThreeHundredChars) + cy.get('input[name="city"]').type(ThreeHundredChars) + cy.get('input[name="street_address"]').type(ThreeHundredChars) + // cy.get('input[name="main_gym"]').type(ThreeHundredChars) + // cy.get('input[name="favourite_exercise"]').type(ThreeHundredChars) - cy.get('#btn-create-account') - .click(); + cy.get('#btn-create-account').click() cy.get('.alert').should('be.visible'); + cy.get('li').contains('Enter a valid username. This value may contain only letters, numbers, and @/./+/-/_ characters.') + cy.get('li').contains('Ensure this field has no more than 150 characters.') + cy.get('li').contains('Enter a valid email address.') + cy.get('li').contains('phone_number').children('ul').children('li').contains("Ensure this field has no more than 50 characters.") + cy.get('li').contains('country').children('ul').children('li').contains("Ensure this field has no more than 50 characters.") + cy.get('li').contains('city').children('ul').children('li').contains("Ensure this field has no more than 50 characters.") + cy.get('li').contains('street_address').children('ul').children('li').contains("Ensure this field has no more than 50 characters.") + // cy.get('li').contains('main_gym').children('ul').children('li').contains("Ensure this field has no more than 50 characters.") + // cy.get('li').contains('favourite_exercise').children('ul').children('li').contains("Ensure this field has no more than 50 characters.") + }); + + }); diff --git a/frontend/cypress/support/index.js b/frontend/cypress/support/index.js index d63cbb61f5aefa07a13fc97a9819d486aa39d044..9fdf2e81916dda980e0ee0bcb8b9fe6a88f6763f 100644 --- a/frontend/cypress/support/index.js +++ b/frontend/cypress/support/index.js @@ -16,6 +16,7 @@ // Import commands.js using ES2015 syntax: import './commands' +/* var coachUser = { username: null, @@ -115,3 +116,5 @@ beforeEach(() => { cy.wrap(athleteUser).as('athleteUser') cy.wrap(login).as('login') }) + + */