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

111
Views
How to "CTRL + Click" in cypress, pages are linked but ctrl + click does not take me to the correct page

I have two files, a spec file and a page object file. I have imported the page object file inside the spec file. My issue is that when i try to CTRL + click on a reference inside the spec file, it does not take me to the page object file.

The test runs ok but i would like this functionality to be active. What am i missing?

Spec file:


const constants = require("../support/constants")
const positionPage = require("../support/page_objects/positionPage")


describe('Create New Position', () => {

    it('Log In', () => {
        cy.visit(Cypress.env('staging'))
        cy.logIn(Cypress.env('username'), Cypress.env('password'))
    })

    it('Expand menu', () => {
        positionPage.expandMenuButton.click()
    })

    it('Open Position menu', () =>{
        positionPage.createNewPosition('Manager')
    })

})

Page object file:

/// <reference types = "cypress" />

class PositionPage {

    get expandMenuButton () {
        return cy.get('.dash-menu-header > .mobile-menu-button')
    }

    createNewPosition (positionName) {
        cy.get('#topSearchAdd > .dropdown-toggle-mousedown').click();
        cy.get('[ng-if="currentUser.userPermissions.addPosition"] > a').click()
        cy.get('.noBottomMargin > .inputTipWrap > div > .ng-pristine').type(positionName)
    }

}

export default new PositionPage()

Thanks a lot!

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

0

The require() syntax seems to be stopping it.

Switching to import

import positionPage from "../support/page_objects/positionPage"

ctrl-click here in the spec

positionPage.expandMenuButton.click()

takes you to here in positionPage

export default new PositionPage()
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!