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

215
Vistas
How to exclude certain element from checks

Hey guys i have a table that consist of some rows and columns where one of the columns can be empty so i want to exclude it somehow.

Currently i am checking like this which looks like there is to much not needed writings

  cy.get('tr td.cdk-cell.amount.cdk-column-Amount').each(($column) => {
    expect($column).to.not.be.empty
 })

 cy.get('tr td.cdk-cell.cryptocurrency.cdk-column-BTC').each(($column) => {
  expect($column).to.not.be.empty
})
cy.get('tr td.cdk-cell.status.cdk-column-Status').each(($column) => {
  expect($column).to.not.be.empty
})

I cannot do the following since one of the columns always empty

cy.get('tbody[role="rowgroup"] tr td').each(($ele) => {
  expect($ele.text().trim().length).to.be.at.least(1)
})

So my question is how to ignore 1 column and check if all others have value present

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Break down the selectors a bit, use .each() over the rows because it's per-row test (I presume that is correct?).

Inside the row, get the isEmpty result of all the columns you are interested in.

Them combine the isEmpty variables into one result you can test.

cy.get('tbody[role="rowgroup"] tr').each(($tr, rowIndex) => {

  const amountCol = $tr.find('td.cdk-cell.amount.cdk-column-Amount');
  const cryptoCol = $tr.find('td.cdk-cell.cryptocurrency.cdk-column-BTC');
  const statusCol = $tr.find('td.cdk-cell.status.cdk-column-Status');

  const amountIsEmpty = amountCol.is(':empty')   // result is true/false
  const cryptoIsEmpty = cryptoCol.is(':empty')
  const statusIsEmpty = statusCol.is(':empty')

  const allAreEmpty = amountIsEmpty && cryptoIsEmpty && statusIsEmpty;
  if (allAreEmpty) {
    throw new Error(`Row ${rowIndex} has all three columns empty`)
  }
  // or
  expect(allAreEmpty).to.eq(false);
})
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