Visit a page with Cypress

Andy Van Slaars
InstructorAndy Van Slaars

Share this video with your friends

Send Tweet

In order to test our application, Cypress will need to visit it in the browser. In this lesson we’ll see how we can visit our application with Cypress and how to configure a baseUrl for Cypress to make that even easier.

Siarhei Lunski
Siarhei Lunski
~ 2 years ago

Hi! If any of you guys have 404 issue launching browser while cypress open you can try add this lines to your cypress/plugins/index.js file in the project directory:

module.exports = (on, config) => { on('before:browser:launch', (browser = {}, args) => { if (browser.name === 'chrome') { // ^ make sure this is your browser name, you may // be using 'canary' or 'chromium' for example, so change it to match! args.push('--proxy-bypass-list=<-loopback>'); return args; } }); };

Cliff Smith
Cliff Smith
~ a year ago

cold not get this to cy.visit(). Had to blow out node_modules, npm install with latest versions: this works: "dependencies": { "axios": "^0.19.2", "concurrently": "^5.1.0", "json-server": "^0.16.1", "react": "^16.13.1", "react-dom": "^16.13.1", "react-router-dom": "^5.1.2" }, "devDependencies": { "babel-core": "^6.26.3", "babel-loader": "^8.1.0", "babel-plugin-transform-object-rest-spread": "^6.26.0", "babel-preset-env": "^1.7.0", "babel-preset-react": "^6.24.1", "css-loader": "^3.4.2", "cypress": "^4.2.0", "html-webpack-plugin": "^3.2.0", "style-loader": "^1.1.3", "webpack": "^4.42.0", "webpack-cli": "^3.3.11" } then had to edit webpack.config.js CHANGE module: { loaders: [ { test: /.js$/, loader: 'babel-loader', exclude: /node_modules/ }, { test: /.css$/, use: ['style-loader', 'css-loader'], exclude: /node_modules/ } ] }, TO module: { rules: [ { test: /.js$/, loader: 'babel-loader', exclude: /node_modules/ }, { test: /.css$/, use: ['style-loader', 'css-loader'], exclude: /node_modules/ } ] }, after this everything works...

davide
davide
~ a month ago

cy.visit() does not work for me neither. It print {} on the screen instead show the test.

it works by updating dependencies as Cliff Smith suggested