Posts

api testing - GET, POST. PUT, DELETE requests

/// <reference types = "Cypress"/> //*api testing*// describe("api testing", () => {    //1) GET request    it("GET", () => {     cy.request({       method: "GET",       url: "https://reqres.in/api/users?page=2",     }).then((res) => {       cy.log(res);       cy.log(res.body.data);       expect(res.body.data[0]).to.have.property("id");       expect(res.body.data[0]).to.have.keys(         "id",         "avatar",         "email",         "first_name",         "last_name"       );       //assert every element at a time using forEach method:       let arry = res.body.data;       arry.forEach((el) => {         expect(el).to.have.keys(          ...

cypress login tests

/// <reference types = "Cypress"/> //1) orange hrm login test //A) correct username & password describe("orange hrm login test",function(){     it("with correct username & password", function(){         cy.visit("https://opensource-demo.orangehrmlive.com/web/index.php/auth/login")         cy.get('[name="username"]').type('Admin')         cy.get('[name="password"]').type('admin123')         cy.get('[type="submit"]').click()         cy.get('[class="oxd-text oxd-text--h6 oxd-topbar-header-breadcrumb-module"]')         .should('contain','Dashboard')     }) })

cypress testcases

//1) google search using dropdown suggestion selection     it("google search using dropdown suggestion selection",function(){         cy.visit("https://www.google.co.in")         cy.get('[name="q"]').type('pune n')         cy.get('ul>div>[jsname="bw4e9b"]').contains('news').click()         cy.get('[class="QXROIe"]').should('have.text', 'Top stories')     }) //2) amazon search using dropdown suggestion selection       it("amazon search using dropdown suggestion selection",function(){         cy.visit("https://www.amazon.in/")         cy.get('[id="twotabsearchtextbox"]').type('nokia')         cy.wait(1000)         cy.get('[class="autocomplete-results-container"]').contains('keypad mobile phone').click() //3) webdriveruniversity contact us form     it("webdriveruniversity contact us...

JS Cypress testing interview questions Apexon

1. Cypress folder structure - See details > 2. Cypress advantages & disadvantages - See details > 3. What is npm and npx? - See details >   4. What is diff. between pom & page factory - See details > (no.4 is selenium question) 5. What are interfaces? 6. Which reporting is used? What is the command to generate report? 7. Can we make interface private or protected? 8. How can we run only one method? 9. Give one example in which you have used oops concept 10. How to verify title of the page? 11. How to check element is visible or not? 12. How to do pagination? 13. What are agile methodologies? 14. What are scrum ceremony? 15. How many days is your sprint? 16. How you give feedback in retrospective meeting? 17. What is there in sprint planning? 18. What is defect leakage? 19. What is diff. between smoke and sanity? 20. How can I automate OTP based login? 21. HTTP Codes 22. What are webservices? 23. OOPS concepts 24. How to extract data from excel sheet?

JS: Operations with object

//* Operations with Object *// let info = {     firstName: 'Virat',     lastName: 'Kohli' } //1) retrieve property & value from boject //dot notation console.log(info.firstName) console.log(info.lastName) //bracket notation console.log(info['firstName']) console.log(info['lastName']) //2) add property to object //dot notation info.age = 32 console.log(info) //bracket notation info['city'] = 'Delhi' console.log(info) //3) update property of object //dot notation info.firstName = 'Vrendra' console.log(info) //bracket notation info['lastName'] = 'Sehwag' console.log(info) //4) delete property of object //dot notation delete info.city console.log(info) //bracket notation delete info['age'] console.log(info) //Example 2 with dot notation info2 = {     CarName: 'Scorpio',     Color: 'White' } // retrive console.log(info2.CarName) console.log(info2.Color) // add info2.Model = 2020 console.log(i...

JS: String property & methods

//* String property & methods *// //A) String property 1) length : returns the length of string //B) String methods 1)   slice() 2)   replace() 3)   toUpperCase() 4)   toLowerCase() 5)   concat() : joins two different strings 6)   trim() : removes whitespace from both sides of a string 7)   trimStart() : removes whitespace only from the start of a string 8)   trimEnd() : removes whitespace only from the end of a string 9)   charAt() : method returns the character at a specified index (position) in a string 10) startsWith() : Checks whether a string begins with specified characters 11) endsWith() : Checks whether a string ends with specified characters 12) includes() : Returns if a string contains a specified value 13) indexOf() : Returns the index (position) of the first occurrence of a value in a string 14) repeat() : returns a new string with a number o...

JS: Operations with Array: retrieve, add, update, delete

//* Operations with Array *// 16-sep-2022 //1) retrieve elements from array //                              0            1             2 let vegetables = ['tomato', 'potato', 'spinach'] console.log(vegetables) console.log(vegetables[0]) console.log(vegetables.at(0)) console.log(vegetables.at(2)) //2) add element to array let f1 = vegetables.push('brinjal') // adds element at end console.log(f1) // returns new length of array console.log(vegetables) // returns updated array // updated array --> ['tomato', 'potato', 'spinach', 'brinjal] let f2 = vegetables.unshift('cabbage') // adds element at start console.log(f2) // returns new length of array console.log(vegetables) // returns updated array // updated array --> ['cabbage', tomato', 'potato', 'spinach', 'brinjal] //3) update element of array //              ...