0
e2eテストを実行しているAngular 5、CLI v1.5を使用してください。私は別のターミナルウィンドウでサービスを実行しました。テストを実行すると、ブラウザが開き、ログインしてから実行が開始されますが、約10秒後にはいつもエラーfailed to connect, please retry
が返されます。分度器のエラー:接続に失敗しました。再試行してください。
私たちはAngularではない偽のSTSログインページを持っているので、Angularを無効にしてから再度有効にしました。これはすべて動作し、ログインしてクリックしますが、10秒後にエラーになります。
app.e2e-spec.ts
:
import { AppPage } from "./page-objects/app.po";
import { OrderPage } from "./page-objects/order.po";
describe("tslint App",() => {
let homePage: AppPage;
let orderPage: OrderPage;
beforeEach(() => {
homePage = new AppPage();
orderPage = new OrderPage();
});
it("should navigate around orders",() => {
homePage.disableAngular();
homePage.navigateToSTS();
homePage.selectUser();
homePage.clickSignIn();
homePage.enableAngular();
expect(homePage.getParagraphText()).toEqual("First LAST");
homePage.clickOrder();
expect(orderPage.selectHeader()).toEqual("Orders");
orderDashboardPage.clickCreateOrder();
[.... etc]
});
});
protractor.conf.js
:
// Protractor configuration file, see link for more information
// https://github.com/angular/protractor/blob/master/lib/config.ts
const { SpecReporter } = require("jasmine-spec-reporter");
exports.config = {
allScriptsTimeout: 21000,
specs: ["./js/e2e/**/*.e2e-spec.ts"],
capabilities: {
browserName: "chrome"
},
useAllAngular2AppRoots: true,
directConnect: true,
baseUrl: "http://localhost/",
framework: "jasmine",
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 30000,
print: function() {}
},
onPrepare() {
require("ts-node").register({
project: "./js/e2e/tsconfig.e2e.json"
});
jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } }));
},
debug: true,
nodeDebug: true,
troubleshoot: true,
};
ターミナル出力:
C:\Code\>ng e2e -s false
(node:15364) [DEP0022] DeprecationWarning: os.tmpDir() is deprecated. Use os.tmpdir() instead.
[11:28:37] I/update - chromedriver: file exists C:\Code\node_modules\protractor\node_modules\webdriver-manager\selenium\chromedriver_2.33.zip
[11:28:37] I/update - chromedriver: unzipping chromedriver_2.33.zip
[11:28:37] I/update - chromedriver: chromedriver_2.33.exe up to date
[11:28:37] D/launcher - Running with --troubleshoot
[11:28:37] D/launcher - Protractor version: 5.2.0
[11:28:37] D/launcher - Your base url for tests is http://localhost/
Debugger listening on ws://127.0.0.1:9229/13448c66-b08b-448f-8838-0b1ff17c53c5
For help see https://nodejs.org/en/docs/inspector
[11:28:37] I/launcher - Running 1 instances of WebDriver
(node:18304) [DEP0068] DeprecationWarning: `node debug` is deprecated. Please use `node inspect` instead.
connecting to localhost:5858 ...[11:28:38] I/direct - Using ChromeDriver directly...
DevTools listening on ws://127.0.0.1:12608/devtools/browser/3763eefb-c5ae-4f7d-82bd-c99d98aee99c
.[11:28:39] D/runner - WebDriver session successfully started with capabilities Capabilities {
map_:
Map {
'acceptSslCerts' => true,
'applicationCacheEnabled' => false,
'browserConnectionEnabled' => false,
'browserName' => 'chrome',
'chrome' => { chromedriverVersion: '2.33.506120 (e3e53437346286c0bc2d2dc9aa4915ba81d9023f)',
userDataDir: 'C:\\Users\\CONTWE~1\\AppData\\Local\\Temp\\scoped_dir20368_5804' },
'cssSelectorsEnabled' => true,
'databaseEnabled' => false,
'handlesAlerts' => true,
'hasTouchScreen' => false,
'javascriptEnabled' => true,
'locationContextEnabled' => true,
'mobileEmulationEnabled' => false,
'nativeEvents' => true,
'networkConnectionEnabled' => false,
'pageLoadStrategy' => 'normal',
'platform' => 'Windows NT',
'rotatable' => false,
'setWindowRect' => true,
'takesHeapSnapshot' => true,
'takesScreenshot' => true,
'unexpectedAlertBehaviour' => '',
'version' => '62.0.3202.94',
'webStorageEnabled' => true } }
[11:28:39] D/runner - Running with spec files C:\Code\js\e2e\app.e2e-spec.ts
........ failed to connect, please retry
[11:28:52] E/launcher - Process exited with error code 1