Angular量角器测试登录功能

时间:2018-04-20 18:38:25

标签: angular protractor e2e-testing

我想测试登录流程但是使用此代码我收到以下错误:    - 失败:找不到使用定位器的元素:By(css selector,mat-simple-snackbar)

  describe('After login', () => {
   it('should show login message', () => {
   const emailInput = element.all(by.xpath('//*[@id="mat-input-1"]'));
   const passwordInput = element.all(by.xpath('//*[@id="mat-input-2"]'));
   emailInput.sendKeys('user@domain.com');
   passwordInput.sendKeys('Passw0rd!');

  element(by.css('#mat-dialog-0 > login-form')).click().then(() => {
    browser.waitForAngular().then(() => {
      const loginMessage = element(by.tagName('mat-simple-snackbar'));
      expect(loginMessage.getText()).toEqual('Du är nu inloggad');
    });
  });
 });
});

当触发.click()时,关闭登录窗口的对话框并加载页面,但找不到小吃店?

0 个答案:

没有答案