How to login in Auth0 in an E2E test with Cypress?

This is not currently supported in Cypress. I built a workaround that might help, though. I set up a simple server that runs in parallel to cypress. The endpoint opens a headless instance of Puppeteer and completes the login flow, responding to the call with all the cookies: const micro = require(“micro”); const puppeteer = … Read more

How to use Puppeteer in an Angular application

How to use Angular e2e testing with Puppeteer 1) Install Puppeteer npm install –save-dev puppeteer @types/puppeteer 2) Configure Protractor to use Puppeteer Edit your protractor.conf.js and add the following inside capabilities: // … const puppeteer = require(‘puppeteer’); exports.config = { // … capabilities: { browserName: ‘chrome’, chromeOptions: { args: [‘–headless’], binary: puppeteer.executablePath(), }, }, // … Read more

Can I access parameters in my protractor configuration file?

I am not completely sure if protractor globals are set at the beforeLaunch() stage, but they are definitely available at onPrepare() step. Access the params object through the global browser object: console.log(browser.params.baseUrl); Update: Using Jasmine 2.6+, protractor 4.x, browser.params was empty, but the following worked in onPrepare() step: console.log(browser.baseUrl);

cy.url() and/or cy.location(‘href’) does not return a string

tl;dr Cypress commands are asynchronous, you have to use then to work with their yields. cy.url().then(url => { cy.get(‘.editor-toolbar-actions-save’).click(); cy.url().should(‘not.eq’, url); }); Explanation A similar question was asked on GitHub, and the official document on aliases explains this phenomenon in great detail: You cannot assign or work with the return values of any Cypress command. … Read more

Cypress test: is .contains() equivalent to should(‘contain’)?

The result on your cypress test will be the same if the element with name=planSelect does not contain dummyPlan, that is, the test will fail at this point. The difference between them is that in the first form, using contains(), you’re actually trying to select an element, and the result of cy.get(…).contains() will yield this … Read more

Should e2e tests persist data in real databases?

I’m currently working at a large well-known company on our test tools and frameworks team. So while I’m no expert, it is something that’s part of my job. I’m going to be talking specifically about web testing. Testing is somewhat different for native apps like iOS and Android and I’m not super familiar with those … Read more

Cypress: How to know if element is visible or not in using If condition?

Cypress allows jQuery to work with DOM elements so this will work for you: cy.get(“selector_for_your_button”).then($button => { if ($button.is(‘:visible’)){ //you get here only if button is visible } }) UPDATE: You need to differentiate between button existing and button being visible. The code below differentiates between 3 various scenarios (exists & visible, exists & not … Read more

What is a proper way of end-to-end (e2e) testing in Vue.js

The tool you are thinking about is Nightwatch. With this, you can do E2E testing with Vue.js. Even better, this is bundled by default when you are using vue-cli, ready to run. The command line to create a project with Nightwatch activated by default is vue init webpack myProjectName. Here are small tutorials about it. … Read more

Integrating Protractor with Yeoman via Grunt

Install protractor and grunt-protractor-runner from npm: npm install protractor grunt-protractor-runner –save-dev Create a config file for protractor (protractor.conf.js), change specs and baseUrl to your test files and test server: exports.config = { seleniumAddress: ‘http://localhost:4444/wd/hub’, specs: [‘test/e2e/*_test.js’], baseUrl: ‘http://localhost:9001’ //default test port with Yeoman } Update your Gruntfile.js, add the following after the karma task: protractor: … Read more