-
Notifications
You must be signed in to change notification settings - Fork 36
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 #775 from aablatov/tests/Cypress-03
tests/cypress-03. Verification of authorization and loading of the save
- Loading branch information
Showing
11 changed files
with
4,216 additions
and
25 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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
name: "PROD Check save Game" | ||
|
||
on: | ||
pull_request: | ||
push: | ||
workflow_call: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
smoke_job: | ||
name: Cypress PROD Check save Game | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: cypress run | ||
uses: cypress-io/github-action@v5 | ||
with: | ||
working-directory: tests/tests_cypress/smoke_prod | ||
start: npm run start |
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 |
---|---|---|
@@ -1,18 +1,32 @@ | ||
{ | ||
"extends": ["html-validate:recommended"], | ||
"extends": [ | ||
"html-validate:recommended" | ||
], | ||
"rules": { | ||
"require-sri": "warn", | ||
"script-type": "warn", | ||
"wcag/h30": "warn", | ||
"wcag/h37": "warn", | ||
"heading-level": "warn", | ||
"element-permitted-content": "warn", | ||
"input-missing-label": "warn", | ||
"no-deprecated-attr": "warn", | ||
"attribute-allowed-values": "warn", | ||
"element-name": "warn" | ||
"element-required-attributes": [ | ||
"warn", | ||
{ | ||
"exclude": [ | ||
"html lang" | ||
] | ||
} | ||
], | ||
"require-sri": "warn", | ||
"script-type": "warn", | ||
"wcag/h30": "warn", | ||
"wcag/h37": "warn", | ||
"heading-level": "warn", | ||
"element-permitted-content": "warn", | ||
"input-missing-label": "warn", | ||
"no-deprecated-attr": "warn", | ||
"attribute-allowed-values": "warn", | ||
"element-name": "warn", | ||
"attribute-boolean-style": "warn", | ||
"no-inline-style": "warn", | ||
"valid-id": "warn", | ||
"void-style": "warn" | ||
}, | ||
"elements": [ | ||
"html5" | ||
"html5" | ||
] | ||
} |
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,9 @@ | ||
|
||
export default ({ | ||
e2e: { | ||
baseUrl: 'https://1255.areso.pro/', | ||
setupNodeEvents(on, config) { | ||
// implement node event listeners here | ||
}, | ||
}, | ||
}); |
67 changes: 67 additions & 0 deletions
67
tests/tests_cypress/smoke_prod/cypress/e2e/checkSaveGame.cy.js
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,67 @@ | ||
describe('Verification of authorization and loading of the save', () => { | ||
|
||
it('Verification of authorization and loading of the save', () => { | ||
cy.visit('/'); | ||
|
||
Cypress.on('uncaught:exception', (err, runnable) => { | ||
return false; | ||
}); | ||
|
||
//close windows canvas | ||
cy.window().then((win) => { | ||
win.eval('document.getElementById("myDCanvas").classList.remove("active-modal")'); | ||
}); | ||
|
||
cy.get('#tabSettings').click(); | ||
cy.get('#selectLng').select('English'); | ||
cy.get('#btnLogin').click(); | ||
cy.get('#login').type('tester16'); | ||
cy.get('#password').type('tester16'); | ||
cy.get('#btnRegLogin').click(); | ||
cy.get('#log').contains('login successfull'); | ||
cy.get('#buttonLoadFromCloud', { timeout: 9000 }).click(); | ||
|
||
// Check | ||
cy.get('#autosaveImg').should('have.attr', 'src', 'resources/button_green.png'); | ||
cy.get('#panelGoldValue').should("have.text", 24180); | ||
cy.get('#panelPopValue').should("have.text", 648); | ||
cy.get('#gems').should("have.text", 10); | ||
cy.get('#spnServerStatusValue').should("have.text", "Up"); | ||
|
||
cy.window().its('game.year').should('equal', 1308); | ||
cy.window().its('game.season').should('equal', 3); | ||
cy.window().its('game.food').should('equal', 20); | ||
cy.window().its('game.treasuryGuard').should('equal', 20); | ||
cy.window().its('game.happiness').should('equal', 80); | ||
cy.window().its('game.fire').should('equal', 0); | ||
cy.window().its('game.fireSteps').should('equal', 0); | ||
cy.window().its('game.fireGuard').should('equal', 0); | ||
cy.window().its('game.hero').should('equal', 0); | ||
|
||
// checking available buildings | ||
cy.get('#btnOpenTabBuilding').click(); | ||
|
||
cy.get('#homes').should('have.text', 'Build Homelvl 17131072 gold'); | ||
// bugs | ||
// cy.get('#defence').should('have.class', 'Build Walllvl 3125000 gold'); | ||
cy.get('#treasury').should('have.text', 'Build Treasurylvl 1381920000000000000 gold'); | ||
cy.get('#buttonBldGallows').should('have.text', 'Build Gallowslvl 150 gold'); | ||
cy.get('#buttonBldFountain').should('have.text', 'Build Fountainlvl 3125000 gold'); | ||
cy.get('#buttonBldStash').should('have.text', 'Build Stashlvl 3125000 gold'); | ||
cy.get('#buttonBldStable').should('have.text', 'Build Stablelvl 3125000 gold'); | ||
cy.get('#buttonBldArchery').should('have.text', 'Build Archery rangelvl 3125000 gold'); | ||
cy.get('#buttonBldInn').should('have.text', 'Build Innlvl 4160000 gold'); | ||
cy.get('#buttonBuildUniversity').should('have.text', 'Build university200 gold'); | ||
|
||
cy.get('#chat_btn').click(); | ||
cy.get('#log_btn').click(); | ||
|
||
cy.get('#log').within(() => { | ||
cy.contains('Hello player in this incremental game!'); | ||
cy.contains('Your task is simple - manage the city as mayor of the city!'); | ||
cy.contains('Citizen will pay taxes each season (30 secs) and population will grow each season'); | ||
cy.contains('login successfull'); | ||
cy.contains('game loaded successfully'); | ||
}); | ||
}); | ||
}) |
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": "hello@cypress.io", | ||
"body": "Fixtures are a great way to mock data for responses to routes" | ||
} |
25 changes: 25 additions & 0 deletions
25
tests/tests_cypress/smoke_prod/cypress/support/commands.js
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,25 @@ | ||
// *********************************************** | ||
// This example commands.js shows you how to | ||
// create various custom commands and overwrite | ||
// existing commands. | ||
// | ||
// For more comprehensive examples of custom | ||
// commands please read more here: | ||
// https://on.cypress.io/custom-commands | ||
// *********************************************** | ||
// | ||
// | ||
// -- This is a parent command -- | ||
// Cypress.Commands.add('login', (email, password) => { ... }) | ||
// | ||
// | ||
// -- This is a child command -- | ||
// Cypress.Commands.add('drag', { prevSubject: 'element'}, (subject, options) => { ... }) | ||
// | ||
// | ||
// -- This is a dual command -- | ||
// Cypress.Commands.add('dismiss', { prevSubject: 'optional'}, (subject, options) => { ... }) | ||
// | ||
// | ||
// -- This will overwrite an existing command -- | ||
// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... }) |
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,20 @@ | ||
// *********************************************************** | ||
// This example support/e2e.js is processed and | ||
// loaded automatically before your test files. | ||
// | ||
// This is a great place to put global configuration and | ||
// behavior that modifies Cypress. | ||
// | ||
// You can change the location of this file or turn off | ||
// automatically serving support files with the | ||
// 'supportFile' configuration option. | ||
// | ||
// You can read more here: | ||
// https://on.cypress.io/configuration | ||
// *********************************************************** | ||
|
||
// Import commands.js using ES2015 syntax: | ||
import './commands' | ||
|
||
// Alternatively you can use CommonJS syntax: | ||
// require('./commands') |
Oops, something went wrong.