Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

675
Vistas
cy.visit() must be called with a url or an options object containing a url as its 1st argument - Cypress.env('StudentPortal')

I'm trying to use Environment Variables via plugin method (https://docs.cypress.io/api/plugins/configuration-api#Switch-between-multiple-configuration-files), this has worked previously but recently has stopped working for me, any pointers would be great.

plugin/index.js

const fs = require('fs-extra')
const path = require('path')

function getConfigurationByFile(file) {
  const pathToConfigFile = path.resolve('cypress', 'config', `${file}.json`)

  return fs.readJson(pathToConfigFile)
}


module.exports = (on, config) => {

  const file = config.env.configFile || 'build'

  return getConfigurationByFile(file)

}

ConfigFile > build.json

{
    "env": {
        "StudentPortal": "https://www.google.co.uk"
    }
}

Usage

cy.visit(Cypress.env('StudentPortal'));

As I said, this used to work and would visit the URL within the configFile, now I just get the following error:

CypressError cy.visit() must be called with a url or an options object containing a url as its 1st argumentLearn more cypress/support/commands.js:17:8

15 | Cypress.Commands.add('StudentPortalLogin', (email, password) => { 16 |

17 | cy.visit(Cypress.env('StudentPortal'));

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

It appears the baseURL may be missing. cy.visit() is looking for something in reference to the baseURL. I don't see one defined in the build.json file, that might fix the error to add a baseURL, "https://www.google.co.uk", then put authentication parameters inside the env{} part, per the example in your link.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda