Advertisement
optybg

Untitled

Apr 8th, 2021
905
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /// <reference types="cypress" />
  2.  
  3. context("Actions", () => {
  4.   beforeEach(() => {});
  5.  
  6.   // https://on.cypress.io/interacting-with-elements
  7.  
  8.  
  9.  
  10.   let loginPage = {
  11.     textboxUserName: cy.get('#userName'),
  12.     textboxUserEmail: cy.get('#userEmail'),
  13.     textboxSubmit: cy.get('#submit'),
  14.  
  15.   }
  16.  
  17.  
  18.   it("DEMO CYPRESS", () => {
  19.     // https://on.cypress.io/type
  20.  
  21.     cy.visit("https://demoqa.com/automation-practice-form");
  22.  
  23.     cy.get("#firstName").type("Spas");
  24.     cy.get("#lastName").type("Genov");
  25.     cy.get("#userEmailNEW").type("spaz@mail.com");
  26.     cy.get("#gender-radio-1").check({ force: true });
  27.     cy.get("#userNumber").type("0888555555555");
  28.     cy.get("#dateOfBirthInput").click();
  29.     cy.get('div [aria-label="Choose Sunday, April 4th, 2021"]').click();
  30.     cy.get("#subjectsContainer").type("TEST");
  31.     cy.get("#hobbies-checkbox-1").check({ force: true });
  32.     cy.get("#hobbies-checkbox-2").check({ force: true });
  33.     cy.get("#currentAddress").type("test test test");
  34.     cy.contains("Select State").click();
  35.  
  36.     cy.get("#react-select-3-option-2").click();
  37.     cy.get("#submit").click();
  38.  
  39.     cy.get('.modal-header').should("contain", "Thanks for submitting the form")
  40.     cy.get('.modal-header').should("be.visible")
  41.  
  42.     cy.get("tbody > tr").last().find("td").first().should("contain", "State and City")
  43.  
  44.   });
  45.  
  46.   it("DEMO CYPRESS2", () => {
  47.     // https://on.cypress.io/type
  48.  
  49.     cy.visit("https://demoqa.com/automation-practice-form");
  50.  
  51.     cy.get("#firstName").type("Spas");
  52.     cy.get("#lastName").type("Genov");
  53.     cy.get("#userEmail").type("spaz@mail.com");
  54.     cy.get("#gender-radio-1").check({ force: true });
  55.  
  56.     cy.get("#gender-radio-1").should("be.checked")
  57.  
  58.    
  59.  
  60.   });
  61.  
  62.   it("Validation text box", () => {
  63.     // Page Object model
  64.  
  65.     cy.visit("https://demoqa.com/text-box");
  66.  
  67.     loginPage.textboxUserEmail.type("Spas")
  68.     loginPage.textboxUserName.type("genov")
  69.     loginPage.textboxSubmit.click()      
  70.  
  71.   });
  72. });
  73.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement