Compare commits

...

1 Commits

Author SHA1 Message Date
Andrei Dekterev 3b6666ef4a ci(cypress): add auth test in cypress 3 years ago
  1. 5
      .eslintrc
  2. 22
      cypress.config.ts
  3. 20
      cypress/e2e/auth/auth.cy.ts
  4. 5
      cypress/fixtures/example.json
  5. 5
      cypress/fixtures/profile.json
  6. 232
      cypress/fixtures/users.json
  7. 36
      cypress/support/commands.ts
  8. 20
      cypress/support/e2e.ts
  9. BIN
      cypress/videos/1-getting-started/todo.cy.js.mp4
  10. BIN
      cypress/videos/2-advanced-examples/actions.cy.js.mp4
  11. BIN
      cypress/videos/2-advanced-examples/aliasing.cy.js.mp4
  12. BIN
      cypress/videos/2-advanced-examples/assertions.cy.js.mp4
  13. BIN
      cypress/videos/2-advanced-examples/connectors.cy.js.mp4
  14. BIN
      cypress/videos/2-advanced-examples/cookies.cy.js.mp4
  15. BIN
      cypress/videos/2-advanced-examples/cypress_api.cy.js.mp4
  16. BIN
      cypress/videos/2-advanced-examples/files.cy.js.mp4
  17. BIN
      cypress/videos/2-advanced-examples/location.cy.js.mp4
  18. BIN
      cypress/videos/2-advanced-examples/misc.cy.js.mp4
  19. BIN
      cypress/videos/2-advanced-examples/navigation.cy.js.mp4
  20. BIN
      cypress/videos/2-advanced-examples/network_requests.cy.js.mp4
  21. BIN
      cypress/videos/2-advanced-examples/querying.cy.js.mp4
  22. BIN
      cypress/videos/2-advanced-examples/spies_stubs_clocks.cy.js.mp4
  23. BIN
      cypress/videos/2-advanced-examples/storage.cy.js.mp4
  24. BIN
      cypress/videos/2-advanced-examples/traversal.cy.js.mp4
  25. BIN
      cypress/videos/2-advanced-examples/utilities.cy.js.mp4
  26. BIN
      cypress/videos/2-advanced-examples/viewport.cy.js.mp4
  27. BIN
      cypress/videos/2-advanced-examples/waiting.cy.js.mp4
  28. BIN
      cypress/videos/2-advanced-examples/window.cy.js.mp4
  29. BIN
      cypress/videos/auth/auth.cy.js.mp4
  30. 40254
      package-lock.json
  31. 8
      package.json

@ -3,12 +3,13 @@
"eslint:recommended",
"plugin:react/recommended",
"airbnb",
"react-app"
"react-app",
"plugin:cypress/recommended"
],
"plugins": [
"sort-destructure-keys",
"typescript-sort-keys",
"postro4no"
"postro4no",
],
"rules": {
"@typescript-eslint/array-type": [

@ -0,0 +1,22 @@
import { defineConfig } from 'cypress'
export default defineConfig({
e2e: {
setupNodeEvents(on, config) {
console.log(config) // see everything in here!
// modify config values
config.defaultCommandTimeout = 10000
config.baseUrl = 'https://insports.tv'
// modify env var value
config.env.ENV = 'staging'
config.env.EMAIL = 'manager@um-teh.ru'
config.env.PASS = '12345678'
config.env.DOMAIN = 'insports.tv'
// IMPORTANT return the updated config object
return config
},
},
})

@ -0,0 +1,20 @@
/// <reference types="cypress" />
describe('check auth page', () => {
beforeEach(() => {
cy.visit(`https://auth.${Cypress.env('DOMAIN')}/authorize?client_id=insports-ott-web&redirect_uri=https%3A%2F%2Finsports.tv%2Fredirect&response_type=id_token%20token&scope=openid&state=9132f8d339bb4f07b6ad48d0a4b32664&nonce=fcf22b26396c4424b1c88ea23d62f6e9&response_mode=query&lang=en`)
})
it('displays email and password inputs and authorization', () => {
cy.get('input[name="email"]').clear().type(Cypress.env('EMAIL'))
cy.get('input[name="password"]').clear().type(Cypress.env('PASS'))
cy.get('form').submit()
cy.url().should('contain', `https://${Cypress.env('DOMAIN')}/?date=`)
cy.getAllLocalStorage()
.then((result) => {
expect(result[`https://${Cypress.env('DOMAIN')}`].token).to.not.be.null
}).end()
// .clearLocalStorage('token')
// .clearCookie('access_token')
})
})

@ -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"
}

@ -0,0 +1,5 @@
{
"id": 8739,
"name": "Jane",
"email": "jane@example.com"
}

@ -0,0 +1,232 @@
[
{
"id": 1,
"name": "Leanne Graham",
"username": "Bret",
"email": "Sincere@april.biz",
"address": {
"street": "Kulas Light",
"suite": "Apt. 556",
"city": "Gwenborough",
"zipcode": "92998-3874",
"geo": {
"lat": "-37.3159",
"lng": "81.1496"
}
},
"phone": "1-770-736-8031 x56442",
"website": "hildegard.org",
"company": {
"name": "Romaguera-Crona",
"catchPhrase": "Multi-layered client-server neural-net",
"bs": "harness real-time e-markets"
}
},
{
"id": 2,
"name": "Ervin Howell",
"username": "Antonette",
"email": "Shanna@melissa.tv",
"address": {
"street": "Victor Plains",
"suite": "Suite 879",
"city": "Wisokyburgh",
"zipcode": "90566-7771",
"geo": {
"lat": "-43.9509",
"lng": "-34.4618"
}
},
"phone": "010-692-6593 x09125",
"website": "anastasia.net",
"company": {
"name": "Deckow-Crist",
"catchPhrase": "Proactive didactic contingency",
"bs": "synergize scalable supply-chains"
}
},
{
"id": 3,
"name": "Clementine Bauch",
"username": "Samantha",
"email": "Nathan@yesenia.net",
"address": {
"street": "Douglas Extension",
"suite": "Suite 847",
"city": "McKenziehaven",
"zipcode": "59590-4157",
"geo": {
"lat": "-68.6102",
"lng": "-47.0653"
}
},
"phone": "1-463-123-4447",
"website": "ramiro.info",
"company": {
"name": "Romaguera-Jacobson",
"catchPhrase": "Face to face bifurcated interface",
"bs": "e-enable strategic applications"
}
},
{
"id": 4,
"name": "Patricia Lebsack",
"username": "Karianne",
"email": "Julianne.OConner@kory.org",
"address": {
"street": "Hoeger Mall",
"suite": "Apt. 692",
"city": "South Elvis",
"zipcode": "53919-4257",
"geo": {
"lat": "29.4572",
"lng": "-164.2990"
}
},
"phone": "493-170-9623 x156",
"website": "kale.biz",
"company": {
"name": "Robel-Corkery",
"catchPhrase": "Multi-tiered zero tolerance productivity",
"bs": "transition cutting-edge web services"
}
},
{
"id": 5,
"name": "Chelsey Dietrich",
"username": "Kamren",
"email": "Lucio_Hettinger@annie.ca",
"address": {
"street": "Skiles Walks",
"suite": "Suite 351",
"city": "Roscoeview",
"zipcode": "33263",
"geo": {
"lat": "-31.8129",
"lng": "62.5342"
}
},
"phone": "(254)954-1289",
"website": "demarco.info",
"company": {
"name": "Keebler LLC",
"catchPhrase": "User-centric fault-tolerant solution",
"bs": "revolutionize end-to-end systems"
}
},
{
"id": 6,
"name": "Mrs. Dennis Schulist",
"username": "Leopoldo_Corkery",
"email": "Karley_Dach@jasper.info",
"address": {
"street": "Norberto Crossing",
"suite": "Apt. 950",
"city": "South Christy",
"zipcode": "23505-1337",
"geo": {
"lat": "-71.4197",
"lng": "71.7478"
}
},
"phone": "1-477-935-8478 x6430",
"website": "ola.org",
"company": {
"name": "Considine-Lockman",
"catchPhrase": "Synchronised bottom-line interface",
"bs": "e-enable innovative applications"
}
},
{
"id": 7,
"name": "Kurtis Weissnat",
"username": "Elwyn.Skiles",
"email": "Telly.Hoeger@billy.biz",
"address": {
"street": "Rex Trail",
"suite": "Suite 280",
"city": "Howemouth",
"zipcode": "58804-1099",
"geo": {
"lat": "24.8918",
"lng": "21.8984"
}
},
"phone": "210.067.6132",
"website": "elvis.io",
"company": {
"name": "Johns Group",
"catchPhrase": "Configurable multimedia task-force",
"bs": "generate enterprise e-tailers"
}
},
{
"id": 8,
"name": "Nicholas Runolfsdottir V",
"username": "Maxime_Nienow",
"email": "Sherwood@rosamond.me",
"address": {
"street": "Ellsworth Summit",
"suite": "Suite 729",
"city": "Aliyaview",
"zipcode": "45169",
"geo": {
"lat": "-14.3990",
"lng": "-120.7677"
}
},
"phone": "586.493.6943 x140",
"website": "jacynthe.com",
"company": {
"name": "Abernathy Group",
"catchPhrase": "Implemented secondary concept",
"bs": "e-enable extensible e-tailers"
}
},
{
"id": 9,
"name": "Glenna Reichert",
"username": "Delphine",
"email": "Chaim_McDermott@dana.io",
"address": {
"street": "Dayna Park",
"suite": "Suite 449",
"city": "Bartholomebury",
"zipcode": "76495-3109",
"geo": {
"lat": "24.6463",
"lng": "-168.8889"
}
},
"phone": "(775)976-6794 x41206",
"website": "conrad.com",
"company": {
"name": "Yost and Sons",
"catchPhrase": "Switchable contextually-based project",
"bs": "aggregate real-time technologies"
}
},
{
"id": 10,
"name": "Clementina DuBuque",
"username": "Moriah.Stanton",
"email": "Rey.Padberg@karina.biz",
"address": {
"street": "Kattie Turnpike",
"suite": "Suite 198",
"city": "Lebsackbury",
"zipcode": "31428-2261",
"geo": {
"lat": "-38.2386",
"lng": "57.2232"
}
},
"phone": "024-648-3804",
"website": "ambrose.net",
"company": {
"name": "Hoeger LLC",
"catchPhrase": "Centralized empowering task-force",
"bs": "target end-to-end models"
}
}
]

@ -0,0 +1,36 @@
/// <reference types="cypress" />
// ***********************************************
// This example commands.ts 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) => { ... })
//
// declare global {
// namespace Cypress {
// interface Chainable {
// login(email: string, password: string): Chainable<void>
// drag(subject: string, options?: Partial<TypeOptions>): Chainable<Element>
// dismiss(subject: string, options?: Partial<TypeOptions>): Chainable<Element>
// visit(originalFn: CommandOriginalFn, url: string, options: Partial<VisitOptions>): Chainable<Element>
// }
// }

@ -0,0 +1,20 @@
// ***********************************************************
// This example support/e2e.ts 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')

40254
package-lock.json generated

File diff suppressed because it is too large Load Diff

@ -18,7 +18,8 @@
"lff": "REACT_APP_CLIENT=lff react-scripts start",
"india": "REACT_APP_CLIENT=india react-scripts start",
"tunis": "REACT_APP_CLIENT=tunis react-scripts start",
"insports": "REACT_APP_CLIENT=insports react-scripts start"
"insports": "REACT_APP_CLIENT=insports react-scripts start",
"cypress": "cypress open"
},
"dependencies": {
"@jonkoops/matomo-tracker-react": "^0.7.0",
@ -71,9 +72,11 @@
"@types/react-window": "^1.8.5",
"@types/styled-components": "^5.1.15",
"commitizen": "^4.2.4",
"cypress": "^12.4.1",
"eslint": "^7.0.1",
"eslint-config-airbnb": "18.2.1",
"eslint-config-react-app": "^7.0.1",
"eslint-plugin-cypress": "^2.12.1",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-jsx-a11y": "^6.4.1",
"eslint-plugin-postro4no": "^0.0.7",
@ -102,7 +105,8 @@
"husky": {
"hooks": {
"pre-commit": "lint-staged",
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS",
"pre-push": "cypress run"
}
},
"lint-staged": {

Loading…
Cancel
Save