-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from SEPM-2022/feature/e2e-tests
Feature/e2e tests
- Loading branch information
Showing
14 changed files
with
1,572 additions
and
40 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
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 @@ | ||
{ | ||
"baseUrl": "http://host.docker.internal", | ||
"pluginsFile": false, | ||
"supportFile": false | ||
} |
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('Test dynamic pages', () => { | ||
const randomNumber = Math.floor(Math.random() * 1000); | ||
const name = 'cypress_name' + randomNumber; | ||
const password = 'cypress_password' + randomNumber; | ||
const username = 'cypress_username' + randomNumber; | ||
const email = 'email' + randomNumber + '@cypress.com'; | ||
|
||
it('when clicking on create an account, then should open respective page', () => { | ||
cy.visit(Cypress.config().baseUrl) | ||
|
||
cy.get('#signup').click() | ||
|
||
cy.url().should('include', '/signup') | ||
cy.contains('Create your profile') | ||
}) | ||
|
||
it('when filling out registration form, should create account', () => { | ||
cy.visit(Cypress.config().baseUrl + '/signup') | ||
|
||
|
||
cy.get('#form-name') | ||
.type(name) | ||
.should('have.value', name) | ||
|
||
cy.get('#form-password') | ||
.type(password) | ||
.should('have.value', password) | ||
|
||
cy.get('#form-username') | ||
.type(username) | ||
.should('have.value', username) | ||
|
||
cy.get('#form-email') | ||
.type(email) | ||
.should('have.value', email) | ||
|
||
cy.get('[type="radio"]').check('girl') | ||
cy.get('#next-step').click(); | ||
cy.get('#form-daisy').click() | ||
|
||
cy.contains('Congrats! Your acount has been successfully created!') | ||
}) | ||
|
||
it('when filling out correct login details, should be directed to dashboard', () => { | ||
cy.visit(Cypress.config().baseUrl) | ||
|
||
cy.get('#Username') | ||
.type(username) | ||
.should('have.value', username) | ||
|
||
cy.get('#password') | ||
.type(password) | ||
.should('have.value', password) | ||
|
||
cy.get('#form-login').submit() | ||
|
||
cy.url().should('include', '/login') | ||
cy.contains('User Dashboard') | ||
}) | ||
|
||
it('when filling out false login details, should stay on same page', () => { | ||
cy.visit(Cypress.config().baseUrl) | ||
|
||
const notExistUsername = 'notExistUsername' | ||
const notExistPassword = 'notExistPassword' | ||
|
||
cy.get('#Username') | ||
.type(notExistUsername) | ||
.should('have.value', notExistUsername) | ||
|
||
cy.get('#password') | ||
.type(notExistPassword) | ||
.should('have.value', notExistPassword) | ||
|
||
cy.get('#form-login').submit() | ||
|
||
cy.url().should('include', '/login') | ||
cy.contains('Not Registered?') | ||
}) | ||
}) |
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,60 @@ | ||
describe('Test static pages', () => { | ||
it('when clicking on About link, then should open respective page', () => { | ||
cy.visit(Cypress.config().baseUrl) | ||
|
||
cy.get('#header-about').click() | ||
|
||
cy.url().should('include', '/about') | ||
cy.contains('How to play Clever Birds Game?') | ||
}) | ||
|
||
it('when clicking on Talk to Tweety link, then should open respective page', () => { | ||
cy.visit(Cypress.config().baseUrl) | ||
|
||
cy.get('#header-tweety').click() | ||
|
||
cy.url().should('include', '/tweety') | ||
cy.get('#tweety-img').should('have.attr', 'src', '/static/img/tweety-wait.gif') | ||
}) | ||
|
||
it('when clicking on privacy policy document link, then should open respective page', () => { | ||
cy.visit(Cypress.config().baseUrl) | ||
|
||
cy.get('#footer-privacy-policy').click() | ||
|
||
cy.url().should('include', '/privacy') | ||
cy.contains('Privacy Policy') | ||
}) | ||
|
||
it('should have correct github url', () => { | ||
cy.visit(Cypress.config().baseUrl) | ||
|
||
cy.get('#footer-github-repo').should('have.attr', 'href', 'https://github.com/SEPM-2022/CleverBirds') | ||
}) | ||
|
||
it('when clicking on play now link, then should open game page', () => { | ||
cy.visit(Cypress.config().baseUrl) | ||
|
||
cy.get('#header-game').click() | ||
|
||
cy.url().should('include', '/playgame') | ||
cy.get('iframe').should('have.attr', 'src', 'http://localhost:8080?bird=birdy') | ||
}) | ||
|
||
it('when clicking on chat icon, then should open chatbot', () => { | ||
cy.visit(Cypress.config().baseUrl) | ||
|
||
cy.get('df-messenger').find('#widgetIcon', { includeShadowDom: true }).click(); | ||
|
||
cy.get('df-messenger').find('.df-messenger-wrapper', { includeShadowDom: true }).should('have.class', 'expanded') | ||
}) | ||
|
||
it('when chatbot is open and clicking on close button, then should close chatbot', () => { | ||
cy.visit(Cypress.config().baseUrl) | ||
|
||
cy.get('df-messenger').find('#widgetIcon', { includeShadowDom: true }).click(); | ||
cy.get('df-messenger').find('#widgetIcon', { includeShadowDom: true }).click(); | ||
|
||
cy.get('df-messenger').find('.df-messenger-wrapper', { includeShadowDom: true }).should('not.have.class', 'expanded') | ||
}) | ||
}) |
Oops, something went wrong.