我有一个Angular应用程序,需要与Google进行身份验证,授予一些范围等,我正在尝试为其设置自动e2e测试.我的量角器一般对我来说很好,但是当我们进入google auth页面,登录并重定向时,量角器失败,因为“等待结果时卸载文档”.
有没有一个工具或技术,我可以用来验证一个开发谷歌帐户beforeEach测试?
如果我可以让框架保持一秒钟,而老式的webdriver驱动登录,只有真正激活角度的东西,在我到达目标页面之后,这将是完美的!
关键是使用browser.driver.get而不是browser.get,并在使用角度特定命令之前使用browser.driver.sleep(someMilliseconds)来使最终目的地的角加载.
这是我的工作量角器规范,首先授权给Google,然后计数中继器中的项目:
it('allows the user to add new slides',function () { browser.driver.get('http://localhost:3000/editor/?state=%7B"action":"create"%7D'); // at this point my server redirects to google's auth page,so let's log in var emailInput = browser.driver.findElement(by.id('Email')); emailInput.sendKeys('user@googleappsdomain.com'); var passwordInput = browser.driver.findElement(by.id('Passwd')); passwordInput.sendKeys('pa$sWo2d'); //you should not commit this to VCS var signInButton = browser.driver.findElement(by.id('signIn')); signInButton.click(); // we're about to authorize some permissions,but the button isn't enabled for a second browser.driver.sleep(1500); var submitApproveAccess = browser.driver.findElement(by.id('submit_approve_access')); submitApproveAccess.click(); // this nap is necessary to let angular load. browser.driver.sleep(10000); // at this point the protractor functions have something to hook into and // will work as normal! element(by.id('new-slide-dropdown-trigger')).click(); element(by.id('new-text-slide-trigger')).click(); var slideList = element.all(by.repeater('slide in deck.getSlides()')); slideList.then(function(slideElements) { expect(slideElements.length).toEqual(1); }); });