代码之家  ›  专栏  ›  技术社区  ›  James Delaney

如何解决这个E2E测试?

  •  0
  • James Delaney  · 技术社区  · 6 年前

    问题是,当你点击“添加规则”按钮时,你会得到新的“搜索词”和“搜索文本区域”字段。 但量角器看不见。

     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);
        });
    });
    

    错误日志:

    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.
    

    点击“添加规则”BTN前后截图: enter image description here

    1 回复  |  直到 6 年前
        1
  •  1
  •   BuruY    6 年前

    当你这样试的时候有用吗?

    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);
    });