circleCiで分度器を使用する方法については少し質問があります。このコードは、私のlocalhostでうまく動作し、もしfirefoxで実行しても動作します。小さな推測(100%ではない)もありますが、たとえばgetCurrentUrlのような約束を返すメソッドを使用すると、circleCiのchromeも失敗します。これは、私はエラーが表示されます。分度器は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();
}
};