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

157
Vistas
How to resolve a type error in javascript/cypress

I am learning cypress and javascript and have come across this type error.

 TypeError: _testElements.default.selectionRow is not a function

I looked at some documentation with cypress and can't see a mistake I am making in the code, so was hoping someone with javascript and cypress experience may know why this error is being outputted.

Code:

First the class where it gets the element:

class testElements {

    selectionRow() {
        return cy.get('.selectionRow')
     }

    typeButton() {
        return cy.get('.typeButton')
     }
 
  
}

export default testElements

And then the code it's referring the error to is below:

import { Given, When, Then } from "cypress-cucumber-preprocessor/steps";
import testElements from '../elements/testElements';

When ("User selects a row", () => {
  testElements.selectionRow()
  .within(() => {
    testElements.typeButton().not(".disabled");
  })
})
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

You should first create a class instance to use the methods:

const testElem = new testElements();
testElem.selectionRow()

And I suggest to use uppercase name convention for class TestElements.

If you don't want to instantiating the class, you can use static methods

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