gpt4 book ai didi

javascript - 如何避免 Protractor 出现 "jasmine.suite() required"错误信息?

转载 作者:可可西里 更新时间:2023-11-01 02:36:21 24 4
gpt4 key购买 nike

我为验证登录页面上的凭据而编写的代码是:

describe('Login',function() {
var loginURL;
var email=element(by.id("email"));
var password=element(by.id("password"));
var LoginButton=element(by.buttonText("Sign in"));
});


it('should redirect to login page',function() {
browser.get('https://pacific-meadow-5124-dev-test.herokuapp.com');
loginURL = browser.getCurrentUrl();``
expect(browser.getCurrentUrl()).toEqual(loginURL);
});

it('should warn on wrong/missing values',function(){
email.clear();
password.clear();

password.sendkeys('test');
loginButton.click();
expect(error.getText()).toMatch('missing email');

email.sendkeys('test');
loginButton.click();
expect(error.gettext()).toMatch('invalid email');

email.sendkeys('pavanpesse11@gmail.com');
password.clear();
loginButton.click();
expect(error.getText()).toMatch('missing password');
});

it('should accept a valid email address and password', function() {
email.clear();
password.clear();

email.sendKeys('pavanpesse11@gmail.com');
password.sendKeys('goalsr123');
loginButton.click();
expect(browser.getCurrentUrl()).not.toEqual(loginURL);
});

我无法执行上面的代码,收到一个错误提示 jasmine.suite() required如下图:

Message:
Error: jasmine.Suite() required
Stacktrace:
Error: jasmine.Suite() required
at new jasmine.Spec (C:\Users\GOALSR3\AppData\Roaming\npm\node_modules\protr
actor\node_modules\minijasminenode\lib\jasmine-1.3.1.js:2326:11)
at jasmine.Env.it (C:\Users\GOALSR3\AppData\Roaming\npm\node_modules\protrac
tor\node_modules\minijasminenode\lib\jasmine-1.3.`enter code here`1.js:966:14)
at jasmine.Env.(anonymous function) [as it] (C:\Users\GOALSR3\AppData\Roamin
g\npm\node_modules\protractor\node_modules\minijasminenode\lib\async-callback.js
:26:50)
at global.it (C:\Users\GOALSR3\AppData\Roaming\npm\node_modules\protractor\n
ode_modules\minijasminenode\lib\index.js:15:29)
at C:\Users\GOALSR3\AppData\Roaming\npm\node_modules\protractor\node_modules
\jasminewd\index.js:119:11
at Object.<anonymous> (C:\Users\GOALSR3\AppData\Roaming\npm\node_modules\pro
tractor\example\Log_spec.js:9:1)

Finished in 0.018 seconds
1 test, 1 assertion, 1 failure

我尝试验证登录但无法使用 Protractor 进行验证。

最佳答案

将您的it- block 放在您的describe- block 中。

关于javascript - 如何避免 Protractor 出现 "jasmine.suite() required"错误信息?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26841064/

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