Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

677
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda