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

157
Visualizações
Cypress. Delete row in table and check it

I have little experience with Java. therefore I ask you for help. The situation is like this

  1. Find out the number of lines
  2. Delete line
  3. Check that the number of lines is one less than it was

Here is my code. I'm more than sure he's wrong. And please help me how to write correctly "number of lines - 1" in the last step. Thanks !

it('Step 5 - get the table row count', () => {
        cy.getByTestId('user-management-roles-table-container')
            .find("tr")
            .then((row) => {
                //row.length will give you the row count
                cy.log(String(row.length))
            });
    });
    it('Step 6 - Click on the 3 dots', () => {
        cy.getByTestId('button-group-buttonGroup-dropdown-button').first().click();
        cy.getByTestId('select-menu-buttonGroup-items-wrapper').should('be.visible');
    });

    it('Step 7 - Click on the "Delete" button', () => {
        cy.getByTestId('select-menu-buttonGroup-value-delete').click();

    });

    it('Step 8 - ', () => {
        cy.getByTestId('user-management-roles-table-container').find('tr').its('length').should('eq', "number of lines - 1" );
    });
  
    ```
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

You can do something like this:

let lenBefore;

it('Step 5 - get the before table row count', () => {
  cy.getByTestId('user-management-roles-table-container').find("tr").its('length').then((len) => {
    lenBefore = len;
    cy.log('Initial table Length is: ' + lenBefore);
  });
});

it('Step 6 - Click on the 3 dots', () => {
  cy.getByTestId('button-group-buttonGroup-dropdown-button').first().click();
  cy.getByTestId('select-menu-buttonGroup-items-wrapper').should('be.visible');
});

it('Step 7 - Click on the "Delete" button', () => {
  cy.getByTestId('select-menu-buttonGroup-value-delete').click();
});

it('Step 5 - get the after table row count', () => {
  cy.getByTestId('user-management-roles-table-container').find("tr").its('length').then((lenAfter) => {
    cy.log('After table Length is: ' + lenAfter);
    expect(lenBefore).to.equal(lenAfter - 1);
  });
});
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