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

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

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 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