gpt4 book ai didi

javascript - Protractor - 无法运行 Protractor 测试

转载 作者:数据小太阳 更新时间:2023-10-29 05:29:36 25 4
gpt4 key购买 nike

我的测试抛出以下错误。它以前运行良好。请指教。

我的配置文件:

exports.config = {
seleniumAddress: 'http://localhost:4444/wd/hub',
allScriptsTimeout: 20000,
baseUrl: 'https://mylink/#/',

// frameworks to use
frameworks: ['jasmine'],

// Capabilities to be passed to the webdriver instance.

multiCapabilities: [{
'browserName': 'chrome'
//}, {
// 'browserName': 'firefox'
//
}],

// Spec patterns are relative to the current working directory.
specs: [
'tests/HomePage.js'
],


onPrepare: function() {
browser.driver.manage().window().maximize();
require('jasmine-reporters');
jasmine.getEnv().addReporter(
new jasmine.JUnitXmlReporter('xmloutput', true. true));
},

jasmineNodeOpts: {
showColors: true
}

}

我的规范文件:

// spec.js
describe('MyTest homepage', function() {
var ptor;
require('protractor-linkuisref-locator')(protractor);

beforeEach(function() {
browser.ignoreSynchronization = true;
ptor = protractor.getInstance();
browser.rootEl = 'div';
//browser.driver.manage().window().setSize(1280, 1024);
browser.debugger();
});


it('Should enter homepage url and credentials', function() {
browser.get('/#/');
element(by.name('userName')).sendKeys('');
element(by.name('password')).sendKeys('');
element(by.xpath("//button[@class=' btn orange small wide']")).click();
});

it('Should the title contain', function() {
expect(browser.getTitle()).toEqual('');

});

it('Should click on the PowerGuide', function() {
element(by.linkUiSref('locator')).click();
ptor.sleep(100);
//expect(ptor.getCurrentUrl(locator)).toEqual('');
});

it('Should click on Month', function() {
element(by.id('month-tab')).click();
ptor.sleep(100);

});


//it('Should load the images', function() {
// element(by.css('.pure-u-1-2')).click();
//var icons = element.all(by.css('.pure-u-1-2')).click();
//icons.first().click();
//});


});

这是我遇到的错误。

        seleniumProcess.pid: 1380
14:43:45.163 INFO - Launching a standalone server
Setting system property webdriver.chrome.driver to C:\Users\sramamoorthy\AppData\Roaming\npm\node_modules\protractor\sel
enium\chromedriver.exe
14:43:45.342 INFO - Java: Oracle Corporation 25.40-b25
14:43:45.342 INFO - OS: Windows 7 6.1 amd64
14:43:45.373 INFO - v2.45.0, with Core v2.45.0. Built from revision 5017cb8
14:43:45.597 INFO - RemoteWebDriver instances should connect to: http://127.0.0.1:4444/wd/hub
14:43:45.597 INFO - Version Jetty/5.1.x
14:43:45.597 INFO - Started HttpContext[/selenium-server,/selenium-server]
14:43:45.779 INFO - Started org.openqa.jetty.jetty.servlet.ServletHandler@23223dd8
14:43:45.781 INFO - Started HttpContext[/wd,/wd]
14:43:45.781 INFO - Started HttpContext[/selenium-server/driver,/selenium-server/driver]
14:43:45.781 INFO - Started HttpContext[/,/]
14:43:45.789 INFO - Started SocketListener on 0.0.0.0:4444
14:43:45.789 INFO - Started org.openqa.jetty.jetty.Server@133314b
14:44:41.384 INFO - Executing: [new session: Capabilities [{count=1, browserName=chrome}]])
14:44:41.399 INFO - Creating a new session for Capabilities [{count=1, browserName=chrome}]
Starting ChromeDriver 2.14.313457 (3d645c400edf2e2c500566c9aa096063e707c9cf) on port 44385
Only local connections are allowed.
14:44:43.309 INFO - Done: [new session: Capabilities [{count=1, browserName=chrome}]]
14:44:43.567 INFO - Executing: [set script timeoutt: 20000])
14:44:43.584 INFO - Executing: [delete session: 64c8dac4-559f-416d-b77b-78c5184b6538])
14:44:43.590 INFO - Done: [set script timeoutt: 20000]
14:44:45.303 INFO - Done: [delete session: 64c8dac4-559f-416d-b77b-78c5184b6538]

测试错误:这是我从中调用 Conf.js 文件时遇到的错误

Using the selenium server at http://localhost:4444/wd/hub
[launcher] Running 1 instances of WebDriver
[launcher] Error: TypeError: undefined is not a function
at
at Object.exports.run (C:\Users\AppData\Roaming\npm\node_modules\protractor\lib\frameworks\jasmine.js:6
2:17)
at C:\Users\AppData\Roaming\npm\node_modules\protractor\lib\runner.js:326:35
at _fulfilled (C:\Users\sr\AppData\Roaming\npm\node_modules\protractor\node_modules\q\q.js:797:54)
at self.promiseDispatch.done (C:\Users\AppData\Roaming\npm\node_modules\protractor\node_modules\q\q.js:
826:30)
at Promise.promise.promiseDispatch (C:\Users\ppData\Roaming\npm\node_modules\protractor\node_modules\q
\q.js:759:13)
[launcher] Process exited with error code 100

最佳答案

onPrepare() 中有一个拼写错误:

onPrepare: function() {
browser.driver.manage().window().maximize();
require('jasmine-reporters');
jasmine.getEnv().addReporter(
new jasmine.JUnitXmlReporter('xmloutput', true. true));
// HERE^
},

你的意思是:

jasmine.getEnv().addReporter(
new jasmine.JUnitXmlReporter('xmloutput', true, true));

关于javascript - Protractor - 无法运行 Protractor 测试,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30201461/

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