0
我有一个关于如何在circleCi中使用量角器的小问题。此代码在我的本地主机中正常工作,并且如果我在Firefox中运行它。也有一个小猜测(不是100%肯定),但是当我使用getCurrentUrl等返回承诺的方法时,circleCi上的chrome也失败。这是在出现故障i接收:量角器在localhost上工作,但在CircleCi中失败
我的配置是:
- 节点版本:6.9.1
- 量角器版本:5.1
- 角版本:4
- 浏览器:chrome
- Operating Syste m和版本的Ubuntu 16.4
**我的测试samble **
import { browser, Config, element, by } from 'protractor';
import { assert } from 'chai';
describe('simple test', function() {
beforeEach(function() {
browser.ignoreSynchronization = true;
});
it('should login', function() {
browser.get('http://localhost:8080/#/signin');
const email = element(by.name('email'));
const password = element(by.name('password'));
const button = element(by.css('[type="submit"]'));
email.sendKeys('[email protected]');
password.sendKeys('12345678');
button.click();
browser.sleep(1500);
const logout = element(by.className('ll-navbar-icon fa fa-power-off'));
expect(browser.getCurrentUrl()).toMatch('/dashboard');
browser.isElementPresent(logout);
});
});
我量角器配置文件:
import { environment } from './environment';
import { browser, Config } from 'protractor';
import { SpecReporter } from 'jasmine-spec-reporter';
export let config: Config = {
directConnect: true,
allScriptsTimeout: 11000,
seleniumAddress: 'http://localhost:4444/wd/hub',
baseUrl: environment.baseUrl,
capabilities: environment.capabilities,
framework: environment.framework,
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 30000,
print: function() {}
},
specs: [
'../../build/app.spec.js'
],
// This utility function helps prepare our scripts with required actions like browser maximize
onPrepare:() => {
jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } }));
browser.driver.manage().window().maximize();
}
};