当我尝试运行量角器测试时,浏览器窗口将启动,并在几秒钟后关闭,没有任何活动。控制台显示错误
1) Mail suite Send email
- Failed: this.runnable is not a function
- Failed: this.runnable is not a function
Executed 1 of 1 spec (1 FAILED) in 0.074 sec.
[08:01:26] I/launcher - 0 instance(s) of WebDriver still running
[08:01:26] I/launcher - chrome #01 failed 1 test(s)
[08:01:26] I/launcher - overall: 1 failed spec(s)
[08:01:26] E/launcher - Process exited with error code 1
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! protractor-example@1.0.0 e2e: `protractor protractor.conf.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the protractor-example@1.0.0 e2e script.
npm ERR! This is probably not a problem with npm. There is likely additional
logging output above.
这是我的“ spec.ts”
import {LoginPage} from '../page-objects/pages/login/login.po';
import {LoginPageHelper} from '../page-objects/pages/login/login-page.helper';
import {browser, By, element, ExpectedConditions} from 'protractor';
import {beforeEach, describe, it} from 'selenium-webdriver/testing';
describe('Mail suite', () => {
let loginPageHelper: LoginPageHelper;
beforeEach(() => {
loginPageHelper = new LoginPageHelper();
});
it('Send email', async () => {
const user1 = browser.params.user1;
await loginPageHelper.goToPage();
await LoginPage.username.sendKeys(user1.username);
await element(By.id('identifierNext')).click();
await browser.wait(ExpectedConditions.visibilityOf(LoginPage.password));
await LoginPage.password.sendKeys(user1.password);
});
});
请帮助我调试此错误。 预先感谢
答案 0 :(得分:4)
啊,我终于明白了。 这是我的“ spec.js”中的这一行导致上述错误
import {beforeEach, describe, it} from 'selenium-webdriver/testing';
我每次使用前,webstorm都会发出警告。当我尝试使用webstorm的自动建议时,它要求执行“ Alt + Enter”。然后自动导入了这一行。
删除此行已解决了问题。
答案 1 :(得分:0)
中定义的内容
protractor.conf.js
功能this.runnable吗? 也许您想定义它
var runnable
代替
this.runnable