Skip to content
Snippets Groups Projects
Commit c1d2e102 authored by hollum's avatar hollum
Browse files

boundry value testing for registration

parent b606814f
No related branches found
No related tags found
No related merge requests found
......@@ -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.")
});
});
......@@ -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')
})
*/
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