antonybudianto / angular-starter

:star: Gulp Angular Starter using TypeScript (Updated to 4.4.3)

Home Page:https://antonybudianto.github.io/angular-starter/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

E2E-testing and socket.io-client

DarkDrim opened this issue · comments

commented

Hello! There was another problem. When I connect socket.io-client application in Angular2 e2e-tests do not work: the browser is started and the hanging for 30 seconds, and then terminates. But the e2e-tests did not pass.
Unit tests are working well.

Socket.io-client I connect like this:
in System.js (map):
'socket.io-client': 'n:socket.io-client'
packages:
'socket.io-client': { defaultExtension: 'js', main: 'socket.io.js', format: 'cjs' }

In services:
import * as io from 'socket.io-client';

and use like this:
io.connect(...)

I starting gulp. Then gulp e2e.
What should be done to e2e tests have started?

Is it working without socket.io ?

commented

Yes

Maybe related to port ?

Also I need the error traces

commented

Connect:
this.socket = io.connect('http://sellers.site.com');

When you run the e2e-test no errors.
Just the browser "hangs" in 30 seconds and drop tests with the message:

gulp e2e
...
[09:41:20] Starting 'driver-update'...
[09:41:20] Starting 'clean-ts-test'...
[09:41:20] Finished 'clean-ts-test' after 15 ms
[09:41:20] Starting 'tsc-e2e'...
selenium standalone is up to date.
chromedriver is up to date.
[09:41:20] Finished 'driver-update' after 328 ms
[09:41:22] Finished 'tsc-e2e' after 2.69 s
[09:41:22] Starting 'e2e-test'...
[09:41:22] Finished 'e2e-test' after 1.35 ms
[09:41:22] Starting 'e2e'...
[09:41:22] Finished 'e2e' after 6.29 μs
[09:41:23] I/local - Starting selenium standalone server...
[09:41:23] I/launcher - Running 1 instances of WebDriver
[09:41:24] I/local - Selenium standalone server started at http://10.5.1.53:4390
4/wd/hub
Started
FF

Failures:

  1. Dashboard Home page should have title
    Message:
    Failed: Timed out waiting for Protractor to synchronize with the page after
    30 seconds. Please see https://github.com/angular/protractor/blob/master/docs/fa
    q.md
    Stack:
    Error: Failed: Timed out waiting for Protractor to synchronize with the page
    after 30 seconds. Please see https://github.com/angular/protractor/blob/master/
    docs/faq.md
    at C:\OpenServer\domains\saveren-fe-new\fe\src\sellers\node_modules\gulp
    -protractor\node_modules\protractor\node_modules\jasminewd2\index.js:101:16
    at Promise.invokeCallback_ (C:\OpenServer\domains\saveren-fe-new\fe\src
    sellers\node_modules\gulp-protractor\node_modules\protractor\node_modules\seleni
    um-webdriver\lib\promise.js:1329:14)
    at TaskQueue.execute_ (C:\OpenServer\domains\saveren-fe-new\fe\src\selle
    rs\node_modules\gulp-protractor\node_modules\protractor\node_modules\selenium-we
    bdriver\lib\promise.js:2790:14)
    at TaskQueue.executeNext_ (C:\OpenServer\domains\saveren-fe-new\fe\src\s
    ellers\node_modules\gulp-protractor\node_modules\protractor\node_modules\seleniu
    m-webdriver\lib\promise.js:2773:21)

  2. Dashboard Home page should have image
    Message:
    Failed: Cannot assign to read only property 'stack' of Timed out waiting for
    Protractor to synchronize with the page after 30 seconds. Please see https://gi
    thub.com/angular/protractor/blob/master/docs/faq.md
    While waiting for element with locator - Locator: By(css selector, img)
    Stack:
    TypeError: Cannot assign to read only property 'stack' of Timed out waiting
    for Protractor to synchronize with the page after 30 seconds. Please see https:/
    /github.com/angular/protractor/blob/master/docs/faq.md
    While waiting for element with locator - Locator: By(css selector, img)
    at C:\OpenServer\domains\saveren-fe-new\fe\src\sellers\node_modules\gulp
    -protractor\node_modules\protractor\built\element.js:377:21
    at Promise.invokeCallback_ (C:\OpenServer\domains\saveren-fe-new\fe\src
    sellers\node_modules\gulp-protractor\node_modules\protractor\node_modules\seleni
    um-webdriver\lib\promise.js:1329:14)
    at TaskQueue.execute_ (C:\OpenServer\domains\saveren-fe-new\fe\src\selle
    rs\node_modules\gulp-protractor\node_modules\protractor\node_modules\selenium-we
    bdriver\lib\promise.js:2790:14)
    at TaskQueue.executeNext_ (C:\OpenServer\domains\saveren-fe-new\fe\src\s
    ellers\node_modules\gulp-protractor\node_modules\protractor\node_modules\seleniu
    m-webdriver\lib\promise.js:2773:21)
    at C:\OpenServer\domains\saveren-fe-new\fe\src\sellers\node_modules\gulp
    -protractor\node_modules\protractor\node_modules\selenium-webdriver\lib\promise.
    js:2652:27
    at C:\OpenServer\domains\saveren-fe-new\fe\src\sellers\node_modules\gulp
    -protractor\node_modules\protractor\node_modules\selenium-webdriver\lib\promise.
    js:639:7
    at process._tickCallback (node.js:369:9)
    From: Task: Run it("should have image") in control flow
    at Object. (C:\OpenServer\domains\saveren-fe-new\fe\src\selle
    rs\node_modules\gulp-protractor\node_modules\protractor\node_modules\jasminewd2
    index.js:81:14)
    From asynchronous test:
    Error
    at Suite. (C:\openserver\domains\saveren-fe-new\fe\src\seller
    s\src\tmp\test\e2e\dashboard-home\test\e2e\dashboard-home\dashboard-home.spec.ts
    :12:5)
    at Object. (C:\openserver\domains\saveren-fe-new\fe\src\selle
    rs\src\tmp\test\e2e\dashboard-home\test\e2e\dashboard-home\dashboard-home.spec.t
    s:1:1)
    at Module._compile (module.js:409:26)
    at Object.Module._extensions..js (module.js:416:10)
    at Module.load (module.js:343:32)
    at Function.Module._load (module.js:300:12)

2 specs, 2 failures
Finished in 67.866 seconds
[09:42:34] I/local - Shutting down selenium standalone server.
[09:42:34] I/launcher - 0 instance(s) of WebDriver still running
[09:42:34] I/launcher - chrome #1 failed 2 test(s)
[09:42:34] I/launcher - overall: 2 failed spec(s)
[09:42:34] E/launcher - Process exited with error code 1
Error running E2E testing

do you use the latest starter?
can you give me some repo for reproduce?
well, I don't think this is starter issue, but more like third party issue

commented

No, this is "Angular 2 Starter RC 2".
But now I will make the transition to the latest version.

please post this to https://stackoverflow.com too because it's more appropriate to post it there than here, unless something wrong with the starter

commented

Soon I will give a link to the repository. And then will place a question on Stack

Thank you

commented

@antonybudianto https://bitbucket.org/drimsoftware/angular2-socket.io
This repo use mercurial (not git).
For download project: https://bitbucket.org/drimsoftware/angular2-socket.io/downloads
npm i
gulp & gulp e2e
What do you think about this?
Thanks for your answers!

I know that this is not as for angular 2-starter. But perhaps you can tell because of what this could be? Why e2e tests do not work with socket.io?

sorry cannot help much. looks like your repo had been modified much, no typings and all.
when I tried to run gulp, I got typings error

commented

Sorry. One moment.
Upd: I Fix typings.

Looks like it's not starter issue

commented

Likely.
Do you have reproduced the problem?

I can't because of typings missing

The best would be on stackoverflow

commented

I fix the typings.
Okay, i will write on stackoverflow