gpt4 book ai didi

testing - Click() 不工作,虽然没有任何错误,但元素没有打开 - ( Cypress 自动化)

转载 作者:行者123 更新时间:2023-11-28 21:17:52 31 4
gpt4 key购买 nike

最后一个 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

最佳答案

它发生在两种情况下:

  • 您的页面中没有该项目,或者听写不同。 (请注意 cypress 对 .containt 区分大小写)或者您的项目可能不可见。
  • 你有不止一件这样的元素。例如,您的页面中有 2 个 close。它使野心点击女巫一号。尝试通过添加更多细节来阐明这一点。

关于testing - Click() 不工作,虽然没有任何错误,但元素没有打开 - ( Cypress 自动化),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55177173/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com