虽然没有任何错误但元素没有打开,但Click()不起作用 - (赛普拉斯自动化)

问题描述 投票:0回答:1

最后一个cy.get('[data-cy = impact-area-table]')。contains(impactareas.name).should('be.visible')。click({force:true});虽然没有任何错误,但它没有工作,它表明它很好并且测试通过但是它没有打开影响区域?

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

testing automation automated-tests click cypress
1个回答
0
投票

它发生在两种情况:

  • 您的页面中没有该项目,或者听写不同。 (提到柏树对.containt区分大小写)或者您的项目可能不可见。
  • 你有这个项目不止一个。例如,您的页面中有2个close。它有志于点击巫婆之一。尝试通过添加更多细节来明确。
© www.soinside.com 2019 - 2024. All rights reserved.