简体   繁体   中英

How to fix this e2e test?

Problem is that when you click on "Add Rule" button you get new "Search Term" and "Search textarea" fields. But protractor can't see them.

 it('On "Add new Audience Rule" page should have two rules and two 
    search Terms', () => {
    audiencePage.addRule.click().then(() => {
        expect(audiencePage.ORbutton.isPresent()).toBe(true);
        expect(audiencePage.searchTerms.count()).toEqual(2);
    });
});

Error log:

1) Audience page: On "Add new Audience Rule" page should have two rules and two search Terms
  - Expected false to be true.
  - Expected 1 to equal 2.

Screenshot before and after clicked "Add Rule" btn: 在此处输入图片说明

Does it work when you try it like this?

 beforeAll(() => { audiencePage.addRule.click(); }); it('On "Add new Audience Rule" page should have an OR button', () => { expect(audiencePage.ORbutton.isDisplayed()).toBe(true); }); it('On "Add new Audience Rule" page should have two search Terms', () => { expect(audiencePage.searchTerms.count()).toEqual(2); }); 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM