Skip to content

Commit

Permalink
add retries mechanism
Browse files Browse the repository at this point in the history
  • Loading branch information
razvanvancea committed Oct 14, 2020
1 parent 31da308 commit b8c008d
Show file tree
Hide file tree
Showing 12 changed files with 1,934 additions and 0 deletions.
1 change: 1 addition & 0 deletions retries-cypress/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
6 changes: 6 additions & 0 deletions retries-cypress/cypress.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"retries": {
"runMode": 1,
"openMode": 2
}
}
9 changes: 9 additions & 0 deletions retries-cypress/cypress/elements/pages/HomePage.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
export default class HomePage {
getFormsSideMenu() {
return cy.get("#forms");
}

getLoginSideMenu() {
return cy.get("#login");
}
}
17 changes: 17 additions & 0 deletions retries-cypress/cypress/elements/pages/LoginPage.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
export default class LoginPage {
getEmailField() {
return cy.get("#email");
}

getPasswordField() {
return cy.get("#password");
}

getSubmitBtn() {
return cy.get("#submitLoginBtn");
}

getResponseMessage() {
return cy.get("#message");
}
}
5 changes: 5 additions & 0 deletions retries-cypress/cypress/fixtures/example.json
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"
}
20 changes: 20 additions & 0 deletions retries-cypress/cypress/integration/examples/login.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import HomePage from "../../elements/pages/HomePage";
import LoginPage from "../../elements/pages/LoginPage";

describe("user actions suite", function () {
it("login scenario", function () {
let homePage = new HomePage();
let loginPage = new LoginPage();
cy.visit("https://qa-automation-practice.netlify.app");

homePage.getFormsSideMenu().click();
homePage.getLoginSideMenu().click();

loginPage.getEmailField().type("[email protected]");
loginPage.getPasswordField().type("admin123");
loginPage.getSubmitBtn().click();
loginPage
.getResponseMessage()
.should("have.text", "qweqweqweYou have successfully logged in!");
});
});
21 changes: 21 additions & 0 deletions retries-cypress/cypress/plugins/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/// <reference types="cypress" />
// ***********************************************************
// This example plugins/index.js can be used to load plugins
//
// You can change the location of this file or turn off loading
// the plugins file with the 'pluginsFile' configuration option.
//
// You can read more here:
// https://on.cypress.io/plugins-guide
// ***********************************************************

// This function is called when a project is opened or re-opened (e.g. due to
// the project's config changing)

/**
* @type {Cypress.PluginConfig}
*/
module.exports = (on, config) => {
// `on` is used to hook into various events Cypress emits
// `config` is the resolved Cypress config
}
25 changes: 25 additions & 0 deletions retries-cypress/cypress/support/commands.js
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) => { ... })
20 changes: 20 additions & 0 deletions retries-cypress/cypress/support/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// ***********************************************************
// This example support/index.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')
8 changes: 8 additions & 0 deletions retries-cypress/cypress/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"compilerOptions": {
"allowJs": true,
"baseUrl": "../node_modules",
"types": ["cypress"]
},
"include": ["**/*.*"]
}
Loading

0 comments on commit b8c008d

Please sign in to comment.