-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Registration and login tests * Cypress tests * Fix * Fix port * Update default.json * Delete canvasjs.min.js * Delete canvasjs.react.js * Update default.json * Update EditRestauranOwnerProfiletTesting.js
- Loading branch information
MatLazic
authored
Jan 17, 2020
1 parent
b2273e3
commit 412afd5
Showing
15 changed files
with
1,440 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,4 +4,5 @@ | |
"AWS_ACCESS_KEY_ID": "", | ||
"AWS_SECRET_ACCESS_KEY": "", | ||
"sequelize_Database": "" | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"name": "Using fixtures to represent data", | ||
"email": "[email protected]", | ||
"body": "Fixtures are a great way to mock data for responses to routes" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
describe('TestSiteConnection', function() { | ||
it('Check if site is running', function() { | ||
cy.visit('localhost:80') | ||
}) | ||
}) | ||
|
||
describe('TestLoginFailedWhenWrongPassword', function() { | ||
it('Test if logging with wrong password fails', function() { | ||
cy.visit('localhost:80') | ||
|
||
cy.contains('Are you a consultant').click() | ||
cy.get('.normal').first().click() | ||
|
||
cy.get('input').first().type('TestConsultant') | ||
cy.get('input').last().type('12345678') | ||
cy.get('.normal').last().click() | ||
|
||
cy.contains('Invalid username or password') | ||
}) | ||
}) | ||
|
||
describe('LoginFailedWhenMissingPassword', function() { | ||
it('Test if logging with missing password fails', function() { | ||
cy.visit('localhost:80') | ||
|
||
cy.contains('Are you a consultant').click() | ||
cy.get('.normal').first().click() | ||
|
||
cy.get('input').first().type('TestConsultant') | ||
cy.get('.normal').last().click() | ||
|
||
cy.url().should('not.include', '/.+') | ||
}) | ||
}) | ||
|
||
describe('TestLoginFailedWhenUsernameDoesNotExits', function() { | ||
it('Test if logging with non existing username fails', function() { | ||
cy.visit('localhost:80') | ||
|
||
cy.contains('Are you a consultant').click() | ||
cy.get('.normal').first().click() | ||
|
||
cy.get('input').first().type('ABCDEFGHIJKL') | ||
cy.get('input').last().type('123456') | ||
cy.get('.normal').last().click() | ||
|
||
cy.contains('Invalid username or password') | ||
}) | ||
}) | ||
|
||
describe('LoginFailedWhenMissingUsername', function() { | ||
it('Test if logging with missing username fails', function() { | ||
cy.visit('localhost:80') | ||
|
||
cy.contains('Are you a consultant').click() | ||
cy.get('.normal').first().click() | ||
|
||
cy.get('input').last().type('123456') | ||
cy.get('.normal').last().click() | ||
|
||
cy.url().should('not.include', '/.+') }) | ||
}) | ||
|
||
|
||
describe('TestLogin', function() { | ||
it('Test if logging with password fails', function() { | ||
cy.visit('localhost:80') | ||
|
||
cy.contains('Are you a consultant').click() | ||
cy.get('.normal').first().click() | ||
|
||
cy.get('input').first().type('TestConsultant') | ||
cy.get('input').last().type('123456') | ||
cy.get('.normal').last().click() | ||
|
||
cy.url().should('include', '/Consultant') | ||
}) | ||
|
||
}) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
describe('TestSiteConnection', function() { | ||
it('Check if site is running', function() { | ||
cy.visit('localhost:80') | ||
}) | ||
}) | ||
|
||
describe('TestRegisteringAlreadyExistingEmail', function() { | ||
it('Test if user will be registered if providing already existing email', function() { | ||
cy.visit('localhost:80') | ||
|
||
cy.contains('Are you a consultant').click() | ||
cy.get('.normal').last().click() | ||
|
||
cy.get('input').first().type('[email protected]') | ||
cy.get('input').eq(1).type('TestConsultant2') | ||
cy.get('input').eq(2).type('Test') | ||
cy.get('input').eq(3).type('Consultant') | ||
cy.get('input').eq(4).type('OurCompanyRocks') | ||
cy.get('input').eq(5).type('123456') | ||
cy.get('input').last().type('123456') | ||
|
||
cy.get('.normal').last().click() | ||
|
||
cy.contains('Email already taken') | ||
|
||
|
||
}) | ||
}) | ||
|
||
describe('TestRegisteringAlreadyExistingUsername', function() { | ||
it('Test if user will be registered if providing already existing username', function() { | ||
cy.visit('localhost:80') | ||
|
||
cy.contains('Are you a consultant').click() | ||
cy.contains('Sign up').click() | ||
|
||
cy.get('input').first().type('[email protected]') | ||
cy.get('input').eq(1).type('TestConsultant') | ||
cy.get('input').eq(2).type('Test') | ||
cy.get('input').eq(3).type('Consultant') | ||
cy.get('input').eq(4).type('OurCompanyRocks') | ||
cy.get('input').eq(5).type('123456') | ||
cy.get('input').last().type('123456') | ||
|
||
cy.get('.normal').last().click() | ||
|
||
cy.contains('Username already taken') | ||
|
||
}) | ||
}) | ||
|
||
|
||
describe('TestProvidingDifferentPasswords', function() { | ||
it('Test if user will be registered if providing differing passwords', function() { | ||
cy.visit('localhost:80') | ||
|
||
cy.contains('Are you a consultant').click() | ||
cy.contains('Sign up').click() | ||
|
||
cy.get('input').first().type('[email protected]') | ||
cy.get('input').eq(1).type('TestUser2') | ||
cy.get('input').eq(2).type('Test') | ||
cy.get('input').eq(3).type('User') | ||
cy.get('input').eq(4).type('OurCompanyRocks') | ||
cy.get('input').eq(5).type('123456') | ||
cy.get('input').last().type('654321') | ||
|
||
cy.get('.normal').last().click() | ||
|
||
cy.contains('Password confirmation has to be identical to the password.') | ||
|
||
}) | ||
}) | ||
|
||
|
||
describe('TestDataInWrongFormat', function() { | ||
it('Test if user will be registered if some data is in wrong format or missing', function() { | ||
cy.visit('localhost:80') | ||
|
||
cy.contains('Are you consultant').click() | ||
cy.contains('Sign up').click() | ||
|
||
cy.get('input').first().type('test.user2test.com') | ||
cy.get('input').eq(1).type('Test') | ||
cy.get('input').eq(2).type('Test') | ||
cy.get('input').eq(5).type('1234') | ||
cy.get('input').last().type('1234') | ||
|
||
cy.get('.normal').last().click() | ||
|
||
cy.url().should('not.include', '/.+') | ||
|
||
}) | ||
}) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
describe('TestSiteConnection', function() { | ||
it('Check if site is running', function() { | ||
cy.visit('localhost:80') | ||
}) | ||
}) | ||
|
||
describe('TestRegisteringAlreadyExistingEmail', function() { | ||
it('Test if user will be registered if providing already existing email', function() { | ||
cy.visit('localhost:80') | ||
|
||
cy.contains('Sign up').click() | ||
cy.contains('Customer').click() | ||
|
||
cy.get('input').first().type('[email protected]') | ||
cy.get('input').eq(1).type('TestUser2') | ||
cy.get('input').eq(2).type('123456') | ||
cy.get('input').last().type('123456') | ||
|
||
cy.get('.normal').last().click() | ||
|
||
cy.get('input').first().type('Test Restaurant') | ||
|
||
cy.contains('Email already taken') | ||
|
||
|
||
}) | ||
}) | ||
|
||
describe('TestRegisteringAlreadyExistingUsername', function() { | ||
it('Test if user will be registered if providing already existing username', function() { | ||
cy.visit('localhost:80') | ||
|
||
cy.contains('Sign up').click() | ||
cy.contains('Customer').click() | ||
|
||
cy.get('input').first().type('[email protected]') | ||
cy.get('input').eq(1).type('TestCustomer') | ||
cy.get('input').eq(2).type('123456') | ||
cy.get('input').last().type('123456') | ||
|
||
cy.get('.normal').last().click() | ||
|
||
cy.contains('Username already taken') | ||
|
||
}) | ||
}) | ||
|
||
|
||
describe('TestProvidingDifferentPasswords', function() { | ||
it('Test if user will be registered if providing differing passwords', function() { | ||
cy.visit('localhost:80') | ||
|
||
cy.contains('Sign up').click() | ||
cy.contains('Customer').click() | ||
|
||
cy.get('input').first().type('[email protected]') | ||
cy.get('input').eq(1).type('TestCustomer2') | ||
cy.get('input').eq(2).type('123456') | ||
cy.get('input').last().type('654321') | ||
|
||
cy.get('.normal').last().click() | ||
|
||
cy.contains('Password confirmation has to be identical to the password.') | ||
|
||
}) | ||
}) | ||
|
||
|
||
describe('TestDataInWrongFormat', function() { | ||
it('Test if user will be registered if some data is in wrong format or missing', function() { | ||
cy.visit('localhost:80') | ||
|
||
cy.contains('Sign up').click() | ||
cy.contains('Customer').click() | ||
|
||
cy.get('input').first().type('test.user2test.com') | ||
cy.get('input').eq(2).type('1234') | ||
cy.get('input').last().type('1234') | ||
|
||
cy.get('.normal').last().click() | ||
|
||
cy.url().should('not.include', '/.+') | ||
|
||
}) | ||
}) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
describe('TestLogin', function() { | ||
it('Test if logging with password fails', function() { | ||
cy.visit('localhost:80') | ||
|
||
cy.contains('Log in').click() | ||
|
||
cy.get('input').first().type('TestUser') | ||
cy.get('input').last().type('123456') | ||
cy.get('.normal').last().click() | ||
|
||
cy.wait(2000) | ||
cy.visit('localhost:80/Profile') | ||
|
||
}) | ||
|
||
}) | ||
|
||
describe('TestChangingMail', function() { | ||
it('Test if changing mail will really change it', function() { | ||
|
||
cy.get('input').first().clear() | ||
cy.get('input').first().type('[email protected]') | ||
cy.get('.normal').last().click() | ||
|
||
cy.contains('Log in').click() | ||
|
||
cy.get('input').first().type('TestUser') | ||
cy.get('input').last().type('123456') | ||
cy.get('.normal').last().click() | ||
|
||
cy.wait(2000) | ||
cy.visit('localhost:80/Profile') | ||
|
||
|
||
cy.get('input').first().invoke('val').should('include', '[email protected]') | ||
|
||
cy.get('input').first().clear() | ||
cy.get('input').first().type('[email protected]') | ||
cy.get('.normal').last().click() | ||
|
||
}) | ||
|
||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
describe('TestLogin', function() { | ||
it('Test if logging with password fails', function() { | ||
cy.visit('localhost:80') | ||
|
||
cy.contains('Log in').click() | ||
|
||
cy.get('input').first().type('TestUser') | ||
cy.get('input').last().type('123456') | ||
cy.get('.normal').last().click() | ||
|
||
}) | ||
|
||
}) | ||
|
||
describe('TestEditRestaurantFail', function() { | ||
it('Test if editing restaurant will fail with no acceptable data', function() { | ||
|
||
cy.contains('Edit information').click() | ||
|
||
cy.get('input').eq(2).clear() | ||
cy.get('input').eq(2).type('ABCDEF 4321') | ||
cy.get('.normal').last().click() | ||
|
||
cy.contains('Location data cannot be calculated') | ||
|
||
cy.type({esc}) | ||
}) | ||
}) | ||
|
||
|
||
describe('TestEditRestaurant', function() { | ||
it('Test if editing restaurant work', function() { | ||
|
||
|
||
cy.contains('Edit information').click() | ||
cy.get('input').eq(2).clear() | ||
cy.get('input').eq(2).type('Slavonska 10') | ||
cy.get('.normal').last().click() | ||
|
||
cy.contains('Slavonska 10') | ||
|
||
cy.wait(3000) | ||
cy.contains('Edit information').click() | ||
|
||
cy.get('input').eq(2).clear() | ||
cy.get('input').eq(2).type('Unska 4') | ||
cy.get('.normal').last().click() | ||
}) | ||
}) |
Oops, something went wrong.