Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

169
Views
How to pass custom url in cypress

My application requires passing custom url to cy.visit for every page. For eg:

"env": {
"testenv" : "sbx",
"sbx":{
    "my":"https://abcabcabx#/",
    "foo": "https://defdefx#/"
  }

In base class, its read as :

cy.visit(Cypress.env()[Cypress.env()['testenv']][brand]);

Our application is in lower env and there is no connectivity between pages so we test each page by hitting url for that page. Example : https://abcabcabx#/about-your-detail for about your finance, url will be : https://abcabcabx#/about-your-finance

that is how i am calling url in test class :

For about your detail page - url will be :

let brands = ['my', 'foo']
aboutYourDetailPage.openUrl(brand)

How can i customise this url for each class.

Thanks in advance !!

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

you can define the base url for your tests in the 'cypress.json' configuration file { "baseUrl": "http://localhost:3000/#/" } and after in each your class use only path to specific page 'cy.visit('my')' here the example: https://docs.cypress.io/api/commands/visit#Prefixes OR get the base url from env.variables from your CLI command for tests 'const fullUrl = config.env.urlConfig' in the /plugins/index.ts and using base url for opening specific page in the files 'cy.visit(Cypress.env('my'));'

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!