gpt4 book ai didi

javascript - Jasmine 规范超时。重置 WebDriver 控制流

转载 作者:行者123 更新时间:2023-11-30 19:28:54 24 4
gpt4 key购买 nike

我得到了

Jasmine spec timed out. Resetting the WebDriver Control Flow.

我之前也使用过 fakesyn 但得到了与上面相同的错误消息。请帮助我

这是我的规范:

describe('CW Login Page',   function() {
var username;
var password;
var login;
beforeEach(() => {
browser.waitForAngularEnabled(false);
browser.get('http://www.testing.com/');
console.log('after link await');
});

it('should find the element and send the parameters', fakeAsync(() => {
setTimeout(function() {
value=0;
console.log('Inside it function');
username = element(by.id('userIDInput'));
password= element(by.id('passwordInput'));
login= element(by.id('login'));
console.log('After await');
username.sendKeys('abc');
password.sendKeys('abc');
login.click();
console.log("After it function");
},5000);
tick(5000);
}));

`beforeEach`(() => {
console.log('\r\n ---=== TESTS FINISHED!!! ===--- \r\n');
});
});

这是我的配置:

exports.config = {
allScriptsTimeout: 50000,
getPageTimeout:40000,
framework:'jasmine2',
/*seleniumAddress: 'http://localhost:4723/wd/hub', // Ignored if directConnect is true
specs: ['loginpage.js'],*/
seleniumAddress: 'https://hub.testingbot.com/wd/hub',
specs: ['./src/loginpage_fakeasync.e2e-specs.js'],
seleniumArgs: ['--dev-server-target'], // '--dev-server-target' ],
directConnect: false, //Change this to true for your local testing
multiCapabilities: [{ // in 1 chrome run the 10 specs sequentially
browserName: 'chrome',
platform: 'Android',
version: '7.1',
platformName: 'Android',
deviceName: 'Pixel 2',
client_key: "abc",
client_secret: "xyz"
}],

jasmineNodeOpts: {
onComplete: null, //jasmine framework details
isVerbose: false,
showColors: true,
includeStackTrace: true,
defaultTimeoutInterval: 40000,
print: function() {}

我希望打开网页并使用自动化脚本登录。如果有人能找出错误,那将是一个很大的帮助

我得到了

Jasmine spec timed out. Resetting the WebDriver Control Flow.

我之前也使用过 fakesyn 但得到了与上面相同的错误消息。请帮助我

最佳答案

控制流应该让所有东西同步运行,所以不需要 fakeAsync 和 setTimeout。如果您的框架不是太大,那么您应该考虑禁用控制流并使用 async/await 处理 promise 的风格。

我怀疑这能否解决您的问题,但您可以尝试以下代码并发布结果吗。

describe('CW Login Page', function () {
var username;
var password;
var login;

beforeEach(() => {
browser.waitForAngularEnabled(false);
browser.get('http://www.testing.com/');
console.log('after link await');
});

it('should find the element and send the parameters', () => {
value = 0;
console.log('Inside it function');
username = element(by.id('userIDInput'));
password = element(by.id('passwordInput'));
login = element(by.id('login'));
console.log('After await');
username.sendKeys('abc');
password.sendKeys('abc');
login.click();
console.log("After it function");
})

afterEach(() => {
console.log('\r\n ---=== TESTS FINISHED!!! ===--- \r\n');
}
});

关于javascript - Jasmine 规范超时。重置 WebDriver 控制流,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56637273/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com