From 98335b8cc0dbc9c6130fbb8e688e08a4469ac37d Mon Sep 17 00:00:00 2001 From: Gabriel Pedro Date: Fri, 11 Aug 2023 01:39:17 -0300 Subject: [PATCH] feat: add more tests (#229) --- cypress/e2e/3-check-public-pages.cy.js | 174 ++++++++++++++++++++++ cypress/e2e/4-check-protected-pages.cy.js | 81 ++++++++++ package.json | 3 + 3 files changed, 258 insertions(+) create mode 100644 cypress/e2e/3-check-public-pages.cy.js create mode 100644 cypress/e2e/4-check-protected-pages.cy.js diff --git a/cypress/e2e/3-check-public-pages.cy.js b/cypress/e2e/3-check-public-pages.cy.js new file mode 100644 index 00000000..577275ad --- /dev/null +++ b/cypress/e2e/3-check-public-pages.cy.js @@ -0,0 +1,174 @@ +describe('Check Public Pages', () => { + + /// news + it('Go to news page', () => { + cy.visit({ + url: Cypress.env('URL') + '/news', + method: 'GET', + }) + }) + + it('Go to news archive page', () => { + cy.visit({ + url: Cypress.env('URL') + '/news/archive', + method: 'GET', + }) + }) + + it('Go to changelog page', () => { + cy.visit({ + url: Cypress.env('URL') + '/changelog', + method: 'GET', + }) + }) + + /// account management + it('Go to account manage page', () => { + cy.visit({ + url: Cypress.env('URL') + '/account/manage', + method: 'GET', + }) + }) + + it('Go to account create page', () => { + cy.visit({ + url: Cypress.env('URL') + '/account/create', + method: 'GET', + }) + }) + + it('Go to account lost page', () => { + cy.visit({ + url: Cypress.env('URL') + '/account/lost', + method: 'GET', + }) + }) + + it('Go to rules page', () => { + cy.visit({ + url: Cypress.env('URL') + '/rules', + method: 'GET', + }) + }) + + // community + it('Go to online page', () => { + cy.visit({ + url: Cypress.env('URL') + '/online', + method: 'GET', + }) + }) + + it('Go to characters list page', () => { + cy.visit({ + url: Cypress.env('URL') + '/characters', + method: 'GET', + }) + }) + + it('Go to guilds page', () => { + cy.visit({ + url: Cypress.env('URL') + '/guilds', + method: 'GET', + }) + }) + + it('Go to highscores page', () => { + cy.visit({ + url: Cypress.env('URL') + '/highscores', + method: 'GET', + }) + }) + + it('Go to last kills page', () => { + cy.visit({ + url: Cypress.env('URL') + '/lastkills', + method: 'GET', + }) + }) + + it('Go to houses page', () => { + cy.visit({ + url: Cypress.env('URL') + '/houses', + method: 'GET', + }) + }) + + it('Go to bans page', () => { + cy.visit({ + url: Cypress.env('URL') + '/bans', + method: 'GET', + }) + }) + + it('Go to forum page', () => { + cy.visit({ + url: Cypress.env('URL') + '/forum', + method: 'GET', + }) + }) + + it('Go to team page', () => { + cy.visit({ + url: Cypress.env('URL') + '/team', + method: 'GET', + }) + }) + + // library + it('Go to creatures page', () => { + cy.visit({ + url: Cypress.env('URL') + '/creatures', + method: 'GET', + }) + }) + + it('Go to spells page', () => { + cy.visit({ + url: Cypress.env('URL') + '/spells', + method: 'GET', + }) + }) + + it('Go to server info page', () => { + cy.visit({ + url: Cypress.env('URL') + '/serverInfo', + method: 'GET', + }) + }) + + it('Go to commands page', () => { + cy.visit({ + url: Cypress.env('URL') + '/commands', + method: 'GET', + }) + }) + + it('Go to downloads page', () => { + cy.visit({ + url: Cypress.env('URL') + '/downloads', + method: 'GET', + }) + }) + + it('Go to gallery page', () => { + cy.visit({ + url: Cypress.env('URL') + '/gallery', + method: 'GET', + }) + }) + + it('Go to experience table page', () => { + cy.visit({ + url: Cypress.env('URL') + '/experienceTable', + method: 'GET', + }) + }) + + it('Go to faq page', () => { + cy.visit({ + url: Cypress.env('URL') + '/faq', + method: 'GET', + }) + }) +}) diff --git a/cypress/e2e/4-check-protected-pages.cy.js b/cypress/e2e/4-check-protected-pages.cy.js new file mode 100644 index 00000000..c3c4b4c6 --- /dev/null +++ b/cypress/e2e/4-check-protected-pages.cy.js @@ -0,0 +1,81 @@ +const REQUIRED_LOGIN_MESSAGE = 'Please enter your account name and your password.'; +const YOU_ARE_NOT_LOGGEDIN = 'You are not logged in.'; + +describe('Check Protected Pages', () => { + + // character actions + it('Go to accouht character creation page', () => { + cy.visit({ + url: Cypress.env('URL') + '/account/character/create', + method: 'GET', + }) + cy.contains(REQUIRED_LOGIN_MESSAGE) + }) + + it('Go to accouht character deletion page', () => { + cy.visit({ + url: Cypress.env('URL') + '/account/character/delete', + method: 'GET', + }) + cy.contains(REQUIRED_LOGIN_MESSAGE) + }) + + // account actions + it('Go to accouht email change page', () => { + cy.visit({ + url: Cypress.env('URL') + '/account/email', + method: 'GET', + }) + cy.contains(REQUIRED_LOGIN_MESSAGE) + }) + + it('Go to accouht password change page', () => { + cy.visit({ + url: Cypress.env('URL') + '/account/password', + method: 'GET', + }) + cy.contains(REQUIRED_LOGIN_MESSAGE) + }) + + it('Go to accouht info change page', () => { + cy.visit({ + url: Cypress.env('URL') + '/account/info', + method: 'GET', + }) + cy.contains(REQUIRED_LOGIN_MESSAGE) + }) + + it('Go to accouht logout change page', () => { + cy.visit({ + url: Cypress.env('URL') + '/account/logout', + method: 'GET', + }) + cy.contains(REQUIRED_LOGIN_MESSAGE) + }) + + // guild actions + it('Go to guild creation page', () => { + cy.visit({ + url: Cypress.env('URL') + '/?subtopic=guilds&action=create', + method: 'GET', + }) + cy.contains(YOU_ARE_NOT_LOGGEDIN) + }) + + it('Go to guilds cleanup players action page', () => { + cy.visit({ + url: Cypress.env('URL') + '/?subtopic=guilds&action=cleanup_players', + method: 'GET', + }) + cy.contains(YOU_ARE_NOT_LOGGEDIN) + }) + + it('Go to guilds cleanup guilds action page', () => { + cy.visit({ + url: Cypress.env('URL') + '/?subtopic=guilds&action=cleanup_guilds', + method: 'GET', + }) + cy.contains(YOU_ARE_NOT_LOGGEDIN) + }) + +}) diff --git a/package.json b/package.json index 0e20e9b5..25a88c5c 100644 --- a/package.json +++ b/package.json @@ -1,4 +1,7 @@ { + "scripts": { + "cypress:open": "cypress open" + }, "devDependencies": { "cypress": "^12.12.0" }