jeudi 4 mars 2021

Cypress, JavaScript Varible is still equal 0 after increase it in .each method

Hi I've got cypress test like this, and I don't know why after .each method zeroCounter variable is still 0. I checked logs and in if block zeroCounter is equal 7 at the end of .each method. Could you help me with that?

it('TEST', () => {
    var zeroCounter = 0;
    cy.addDimensionByPropertyPanel('date');
    cy.exAddMeasureByPropertyPanel('data_with_nulls');
    cy.get('[tid="qv-object-VLC]').should('be.visible');
    cy.exShowValues();
    cy.exSelectDataAndGaps("Show as connections");
    cy.get('.vizlib-line-values')
        .each(($value) => {
            expect($value.text()).to.not.equal('-');
            if ($value.text() === "0.00") {
                zeroCounter++
                cy.log(zeroCounter);
            }
        })
    expect(zeroCounter).to.equal(7);
    cy.qsTakeScreenshot('Show null data as zero');
});

Aucun commentaire:

Enregistrer un commentaire