Found 161 Articles for Rest Assured

How to implement tags in Cypress?

Debomita Bhattacharjee
Updated on 19-Nov-2021 10:43:30

767 Views

We can implement tags in Cypress. Cypress has tags - .only and .skip. While the .only tag is utilized to execute the it block to which it is tagged, the .skip tag is utilized to exclude the it block to which it is tagged.ExampleImplementation with .onlydescribe('Tutorialspoint', function()    //it block with tag .only    it.only('First Test', function() {       cy.log("First Test")    })    //it block with tag .only    It.only('Second Test', function() {       cy.log("Second Test")    })    it('Third Test', function() {       cy.log("Third Test")    }) })Execution ResultsThe output ... Read More

How to implement hooks in Cypress?

Debomita Bhattacharjee
Updated on 19-Nov-2021 10:40:03

424 Views

We can implement hooks in Cypress. Cypress Hooks are used to carrying out certain operations prior/post every/each test. Some of the common hooks are −before – Executes once prior execution any tests within a describe block.after – Executes once post-execution all tests within a describe block.beforeEach – Executes prior execution of the individual it blocks within a describe block.afterEach – Executes post-execution of the individual it blocks within a describe block.ExampleImplementationdescribe('Tutorialspoint', function() {    before(function() {       // executes once prior all tests in it block       cy.log("Before hook")    })    after(function() {       ... Read More

Explain the working of Cypress.

Debomita Bhattacharjee
Updated on 19-Nov-2021 10:34:27

116 Views

The below diagram explains the working of the Cypress −Automation tools like Selenium work by running outside the browser. However, Cypress has a different architecture. It runs within the browser. Cypress is based on the server - Node.js.There is a continuous interaction of Cypress with the Node.js and they work in – coordination with each other. As a result, Cypress can be utilized for testing both the front and backend of the application.Cypress is thus capable of handling the tasks performed in a real-time on the UI and simultaneously perform actions outside of the browser. The basic differences between Cypress ... Read More

How to handle frames in Puppeteer?

Debomita Bhattacharjee
Updated on 19-Nov-2021 10:31:43

2K+ Views

We can handle frames in Puppeteer. The frames in an html code are represented by the frames/iframe tag. Puppeteer can handle frames by switching from the main page to the frame. To work with elements inside a frame, first, we have to identify the frame with the help of locators. The method contentFrame is used to access the elements inside the frame.Syntaxconst f = await page.$("frame[name='frame-bottom']") const m = await f.contentFrame()Let us see the html code of an element inside a frame and obtain the text - BOTTOM inside it.The tagname highlighted in the above image is frame and the ... Read More

How to handle tabs in Puppeteer?

Debomita Bhattacharjee
Updated on 19-Nov-2021 10:25:04

189 Views

We can handle tabs in Puppeteer using the below methods −newPage() - We can open a new tab using this method available in the browser object.Syntaxconst p = await browser.newPage()close() - We can close the tab opened using this method.Syntaxawait p.close() close() - We can close all the tabs opened using this method available in the browser object.Syntaxawait browser.close()ExampleCode Implementation//adding Puppeteer library const pt = require('puppeteer') pt.launch().then(async browser => { //browser new page const p = await browser.newPage(); //set viewpoint of browser page await p.setViewport({ width: 1000, height: ... Read More

How to pass more than one header in a request in Rest Assured?

Debomita Bhattacharjee
Updated on 19-Nov-2021 10:20:01

8K+ Views

We can pass more than one header in a request in Rest Assured. A web service can accept headers as parameters while making a service call. The headers are represented in a key-value pair.There is more than one way of passing multiple headers in Rest Assured −Passing them in a key-value format using the header method.Syntax Response r = given() .baseUri("https://www.tutorialspoint.com/") .header("header1", "value1") .header("header2", "value2") .get("/about/about_careers.htm");Passing them as a Map using the headers method.Syntax Map m = new HashMap(); m.put("header1", "value1"); m.put("header2, "value2"); Response r = given() .baseUri("https://www.tutorialspoint.com/") .headers(m) .get("/about/about_careers.htm");Passing them as a List using the headers method.Syntax List h ... Read More

How to manage cookies in WebdriverIO?

Debomita Bhattacharjee
Updated on 19-Nov-2021 10:14:17

1K+ Views

We can manage cookies in WebdriverIO. A cookie helps to identify a user. It is an efficient technique to pass information from one site session to another or in between sessions of two connected websites.We can add, delete and obtain a cookie with WebdriverIO using the methods −browser.setCookies - this is used to set a single cookie or multiple cookies for the present page. To set a cookie for a page, we have to first launch and be on that page.Syntax browser.setCookies({cookie, cookie.name, cookie.value, cookie.path, cookie.domain, cookie.secure, cookie.httpOnly, cookie.expiry} )Here, a cookie is the cookie object or object array and ... Read More

How to create a teamcity report in Cypress?

Debomita Bhattacharjee
Updated on 19-Nov-2021 10:03:24

608 Views

We can create a teamcity report in Cypress. To install the package for teamcity report, run the command −   npm install cypress-teamcity-reporter --save-devTo generate a report for all specs in the integration folder of the Cypress project, run the command −   npx cypress run --reporter teamcity

How to create a Mochawesome report in Cypress?

Debomita Bhattacharjee
Updated on 19-Nov-2021 09:54:51

5K+ Views

We can create a Mochawesome report in Cypress. Cypress is bundled with Mocha, so any reports that can be generated for Mocha can also be utilized with Cypress.Mochawesome ReportThe Mochawesome report is one of the most important reports in Cypress. To install mochawesome, run the command −   npm install mochawesome --save-devTo install mocha, run the command −   npm install mocha --save-devTo merge mochawesome json reports, run the command −   npm install mochawesome-merge --save-devAll these packages after installation should get reflected on the package.json file.To merge multiple reports in a single report, run the command −   npm run combine-reportsIn the cypress.json ... Read More

How to perform data-driven testing in Cypress?

Debomita Bhattacharjee
Updated on 19-Nov-2021 09:49:45

245 Views

Cypress data-driven testing is achieved with the help of fixtures. Cypress fixtures are added to maintain and hold the test data for automation. The fixtures are kept inside the fixtures folder (example.json file) in the Cypress project. It basically helps us to get data input from external files.Cypress fixtures folder can have files in JSON or other formats and the data is maintained in "key:value" pairs. All these test data can be utilized by more than one test. All fixture data has to be declared within the before hook block.Syntaxcy.fixture(path of test data) cy.fixture(path of test data, encoding type ) ... Read More

Advertisements