当我尝试运行我的量角器测试时,浏览器窗口会启动,几秒钟后它就会关闭,没有任何活动。控制台显示一个错误。
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);
});
});请帮我调试这个错误。提前感谢
发布于 2018-06-29 12:50:15
啊,我终于想出来了。是我的"spec.js“中的这一行造成了上述错误
import {beforeEach, describe, it} from 'selenium-webdriver/testing';我一使用beforeEach,网络风暴就发出了警告。当我试图使用自动建议的网络风暴,它要求做"Alt+Enter“。它会自动导入这一行。
移除这条线解决了问题。
发布于 2018-06-29 11:42:53
定义为
protractor.conf.js函数this.runnable?也许你想给它下定义
var runnable而不是
this.runnablehttps://stackoverflow.com/questions/51093658
复制相似问题