Bandana Singh
Bandana Singh

Reputation: 95

Click() is not working though there's no any error but element not opening up - (Cypress automation)

last one cy.get('[data-cy=impact-area-table]').contains(impactareas.name).should('be.visible').click({force: true}); is not working though there's no any error ,it shows that it's fine and test pass but it doesnot open up the impact area ??

import { fillImpactAreaForm } from './utils';
import {contact, campaign, impactArea,impactareas} from '../support/commands.js';

describe('Fundraising test suite', function () {

    beforeEach(() => {
        cy.resetDb();
        cy.visit('/');
    });
it('should allow the user to create transactions', () => {
    cy.seedOrgAndLogin().then(() => {
        return cy.factoryCreate('PersonContacts', contact);

    }).then(() => {
        cy.factoryCreate('Campaigns', campaign);

    }).then(() => {
        cy.factoryCreate('ImpactAreas', impactArea);

    }).then(() => {
        cy.get('[data-cy="sidebar-Impact Areas"]').click({force: true});

        cy.reload(true);

        cy.get('[data-cy=create-impactarea]').click();

        cy.get('[data-cy=impact-area-form]').contains('Close').click();

        cy.get('[data-cy=create-impactarea]').click();

        fillImpactAreaForm(impactareas);
        cy. wait(2000);

        cy.get('[data-cy=impact-area-table]').contains(impactareas.name).should('be.visible').click({force: true});
       //cy.get('.content-scroll-wrapper.block-content').find('.content-scroll-body').contains(impactArea.name).click({force: true});

    });
});

});

enter image description here

Upvotes: 2

Views: 4822

Answers (1)

Ashkan
Ashkan

Reputation: 1378

It's happening in 2 situations:

  • you don't have that item in your page or the dictation is different. (mention that cypress is case sensitive for .containt) or maybe your item is not visible.
  • you have more than one of this item. for example, you have 2 close in your page. it makes ambition to click on witch one. try to make it clear by adding more detail.

Upvotes: 2

Related Questions