Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test is hung in the middle #96

Open
minsooshin opened this issue Nov 23, 2016 · 2 comments
Open

Test is hung in the middle #96

minsooshin opened this issue Nov 23, 2016 · 2 comments

Comments

@minsooshin
Copy link

Environment

node: v4.5.0
npm: 2.15.9
testee: 0.2.5
phantomjs: 2.1.1

// adder.js
import Component from 'can/component/';
import Map from 'can/map/';
import 'can/map/define/';
import './adder.less!';
import template from './adder.stache!';

export const ViewModel = Map.extend({
  a: 0,
  b: 0,
  define: {
    result: {
      get() {
        return this.attr('a') + this.attr('b');
      }
    }
  }
});

export default Component.extend({
  tag: 'adder',
  viewModel: ViewModel,
  template
});
import QUnit from 'steal-qunit';
import can from 'can';
import stache from 'can/view/stache/';
import F from 'funcunit';
import $ from 'jquery';
import './adder';

// ViewModel unit tests
QUnit.module('apoc/components/adder');

QUnit.test('Has added number', function() {
  const mock = {
    a: 2,
    b: 3
  };
  const template = stache('<adder {a}="a" {b}="b" />');

  $('#qunit-fixture').html(template(mock));
  this.$component = F('#qunit-fixture').find('adder');
  this.vm = can.viewModel(this.$component);
  console.log(this.vm);

  equal(this.vm.attr('result'), 5);
});

log from DEBUG:testee command with phantom browser

testee:main running test for [ 'test/test.html' ] [ 'phantom' ] {} +0ms
  testee:main bootstrapping Testee +10ms
  testee:main starting Testee server { port: 3996,
  root: '/Users/mshin/Workspace/spirent/apoc',
  reporter: 'Dot',
  adapter: '/testee/',
  timeout: 120,
  delay: 1000,
  tunnel: { type: 'local', port: 3996 },
  launch: { type: 'local' } } +1ms
  testee:server initializing Feathers API +2ms
  testee:hosting intializing static file server /Users/mshin/Workspace/spirent/apoc +15ms
  testee:main testee server started and listening +22ms
  testee:main hooking up services to Mocha reporter +0ms
  testee:reporter setting up Mocha command line reporter +0ms
  testee:reporter start +1ms

    testee:main starting up localhost tunnel { type: 'local', port: 3996 } +0ms
  testee:main localhost tunnel started on http://localhost:3996 +1ms
  testee:main using browser launcher local { type: 'local' } +0ms
  testee:main browser launcher initialized +0ms
  testee:main setting up test runner +0ms
  testee:main server bootstrapped, running tests. +1ms
  testee:runner running tests for [ 'test/test.html' ] [ 'phantom' ] +0ms
  testee:runner initializing sequential test runs for browser phantom +0ms
  testee:runner running individual test http://localhost:3996/test/test.html?__token=5k2emi { browser: 'phantom' } +2ms
  testee:runner browser instance started { browser: 'phantom' } +28ms
  testee:runner tracking test run http://localhost:3996/test/test.html?__token=5k2emi { browser: 'phantom' } +0ms
  testee:html-injector injecting scripts into file /test/test.html?__token=5k2emi +504ms
  testee:runner CONSOLE: [object Object]
 http://localhost:3996/test/test.html?__token=5k2emi { browser: 'phantom' } +1s

log from DEBUG:testee command with firefox browser

testee:main running test for [ 'test/test.html' ] [ 'firefox' ] { browsers: 'firefox' } +0ms
  testee:main bootstrapping Testee +20ms
  testee:main starting Testee server { browsers: 'firefox',
  port: 3996,
  root: '/Users/mshin/Workspace/spirent/apoc',
  reporter: 'Dot',
  adapter: '/testee/',
  timeout: 120,
  delay: 1000,
  tunnel: { type: 'local', port: 3996 },
  launch: { type: 'local' } } +1ms
  testee:server initializing Feathers API +1ms
  testee:hosting intializing static file server /Users/mshin/Workspace/spirent/apoc +12ms
  testee:main testee server started and listening +16ms
  testee:main hooking up services to Mocha reporter +0ms
  testee:reporter setting up Mocha command line reporter +1ms
  testee:reporter start +0ms

    testee:main starting up localhost tunnel { type: 'local', port: 3996 } +0ms
  testee:main localhost tunnel started on http://localhost:3996 +1ms
  testee:main using browser launcher local { type: 'local' } +0ms
  testee:main browser launcher initialized +1ms
  testee:main setting up test runner +0ms
  testee:main server bootstrapped, running tests. +0ms
  testee:runner running tests for [ 'test/test.html' ] [ 'firefox' ] +0ms
  testee:runner initializing sequential test runs for browser firefox +0ms
  testee:runner running individual test http://localhost:3996/test/test.html?__token=b7g71d { browser: 'firefox' } +2ms
  testee:runner browser instance started { browser: 'firefox' } +49ms
  testee:runner tracking test run http://localhost:3996/test/test.html?__token=b7g71d { browser: 'firefox' } +0ms
  testee:html-injector injecting scripts into file /test/test.html?__token=b7g71d +1s
  testee:html-injector injecting scripts into file /favicon.ico +292ms
  testee:reporter starting run { status: 'running',
  file: 'http://localhost:3996/test/test.html?__token=b7g71d',
  id: 'a26d215ef30a56394074b87a43a3ec1b',
  environment: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:50.0) Gecko/20100101 Firefox/50.0',
  runner: 'QUnit',
  time: 1479931070826 } +1s
  testee:runner checking if browser timeout can be reset http://localhost:3996/test/test.html?__token=b7g71d true +9ms
  testee:reporter starting suite { status: 'running',
  file: 'http://localhost:3996/test/test.html?__token=b7g71d',
  title: 'apoc tests',
  root: true,
  id: 'd33df44d4c08ad6bdb371ab2c737337c',
  parent: 'a26d215ef30a56394074b87a43a3ec1b' } +63ms
  testee:reporter starting suite { status: 'running',
  file: 'http://localhost:3996/test/test.html?__token=b7g71d',
  title: 'apoc/components/adder',
  parent: 'd33df44d4c08ad6bdb371ab2c737337c',
  id: '2ba96d5c24f28e2b2fc70b5ffde4a211' } +8ms
  testee:reporter starting suite { status: 'running',
  file: 'http://localhost:3996/test/test.html?__token=b7g71d',
  title: 'Has added number',
  parent: '2ba96d5c24f28e2b2fc70b5ffde4a211',
  id: '7ffcd5828adb259f18031510347868d2' } +2ms
  testee:reporter starting test { file: 'http://localhost:3996/test/test.html?__token=b7g71d',
  id: '1d48565b36709004587aca01a5185894',
  title: 'okay',
  parent: '7ffcd5828adb259f18031510347868d2' } +2ms
  testee:reporter updating test { file: 'http://localhost:3996/test/test.html?__token=b7g71d',
  id: '1d48565b36709004587aca01a5185894',
  title: 'okay',
  parent: '7ffcd5828adb259f18031510347868d2',
  status: 'passed' } +2ms

  ․  testee:reporter updating suite { status: 'finished',
  file: 'http://localhost:3996/test/test.html?__token=b7g71d',
  title: 'Has added number',
  parent: '2ba96d5c24f28e2b2fc70b5ffde4a211',
  id: '7ffcd5828adb259f18031510347868d2' } +11ms
  testee:reporter updating suite { status: 'finished',
  file: 'http://localhost:3996/test/test.html?__token=b7g71d',
  title: 'apoc/components/adder',
  parent: 'd33df44d4c08ad6bdb371ab2c737337c',
  id: '2ba96d5c24f28e2b2fc70b5ffde4a211',
  failed: 0,
  total: 1 } +11ms
  testee:reporter updating suite { status: 'finished',
  file: 'http://localhost:3996/test/test.html?__token=b7g71d',
  title: 'apoc tests',
  root: true,
  id: 'd33df44d4c08ad6bdb371ab2c737337c',
  parent: 'a26d215ef30a56394074b87a43a3ec1b' } +6ms
  testee:reporter updating run { status: 'finished',
  file: 'http://localhost:3996/test/test.html?__token=b7g71d',
  id: 'a26d215ef30a56394074b87a43a3ec1b',
  environment: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:50.0) Gecko/20100101 Firefox/50.0',
  runner: 'QUnit',
  time: 1479931070826,
  failed: 0,
  passed: 1,
  total: 1,
  runtime: 118 } +4ms
  testee:runner checking if run http://localhost:3996/test/test.html?__token=b7g71d is finished true +1ms
  testee:runner stopping browser instance { browser: 'firefox' } +1ms
  testee:main shutting down reporter +705ms
  testee:reporter end +0ms
  testee:reporter reportErrors 0 +0ms


  1 passing (4s)

  testee:main closing server +3ms
@minsooshin
Copy link
Author

Another hanging case is missing parent property from tests object

// component
import Component from 'can/component/';
import Map from 'can/map/';
import './breadcrumb.less!';
import template from './breadcrumb.stache!';

export const ViewModel = Map.extend({
  isVisible: false,
  paths: []
});

export default Component.extend({
  tag: 'sc-breadcrumb',
  viewModel: ViewModel,
  template
});
// stache
<div {{^isVisible}} class="sc-hidden"{{/isVisible}}>
  {{#if isVisible}}
    {{#each paths}}
      {{#if @index}}
        <span class="sc-icon-caret-right"></span>
      {{/if}}
      {{#if isLink}}
        <a href="{{link}}">{{name}}</a>
      {{else}}
        <p>{{name}}</p>
      {{/if}}
    {{/each}}
  {{/if}}
</div>
// test
import QUnit from 'steal-qunit';
import can from 'can';
import $ from 'jquery';
import F from 'funcunit';
import './breadcrumb';

// ViewModel unit tests
QUnit.module('apoc/components/breadcrumb');

QUnit.test('Breadcrumb', function() {
  // given
  const mock = {
    isVisible: true,
    paths: [
      {
        isLink: true,
        link: '#depth-1',
        name: 'Depth 1'
      },
      {
        isLink: true,
        link: '#depth-1/depth-2',
        name: 'Depth 2'
      },
      {
        isLink: false,
        link: '#depth-1/depth-2/depth-3',
        name: 'Depth 3'
      }
    ]
  };

  // when
  const template = can.stache('<sc-breadcrumb {is-visible}="isVisible" {paths}="paths" />');

  $('#qunit-fixture').html(template(mock));
  this.$component = F('#qunit-fixture').find('sc-breadcrumb');
  this.vm = can.viewModel(this.$component);

  // then
  F('sc-breadcrumb').find('.sc-icon-caret-right')
    .css('color', 'rgb(153, 153, 153)', 'show have gray colored arrow')
    .size(this.vm.paths.length - 1, 'should have 1 less number of depth arrow');
  F('sc-breadcrumb').find('a')
    .size(this.vm.paths.length - 1, 'should have 1 less number of depth link');
});

log from DEBUG:testee command with phantom browser

testee:main running test for [ 'test/test.html' ] [ 'phantom' ] {} +0ms
  testee:main bootstrapping Testee +12ms
  testee:main starting Testee server { port: 3996,
  root: '/Users/mshin/Workspace/spirent/apoc',
  reporter: 'Dot',
  adapter: '/testee/',
  timeout: 120,
  delay: 1000,
  tunnel: { type: 'local', port: 3996 },
  launch: { type: 'local' } } +1ms
  testee:server initializing Feathers API +1ms
  testee:hosting intializing static file server /Users/mshin/Workspace/spirent/apoc +17ms
  testee:main testee server started and listening +28ms
  testee:main hooking up services to Mocha reporter +0ms
  testee:reporter setting up Mocha command line reporter +0ms
  testee:reporter start +1ms

    testee:main starting up localhost tunnel { type: 'local', port: 3996 } +0ms
  testee:main localhost tunnel started on http://localhost:3996 +1ms
  testee:main using browser launcher local { type: 'local' } +0ms
  testee:main browser launcher initialized +1ms
  testee:main setting up test runner +0ms
  testee:main server bootstrapped, running tests. +0ms
  testee:runner running tests for [ 'test/test.html' ] [ 'phantom' ] +0ms
  testee:runner initializing sequential test runs for browser phantom +1ms
  testee:runner running individual test http://localhost:3996/test/test.html?__token=fllnja { browser: 'phantom' } +2ms
  testee:runner browser instance started { browser: 'phantom' } +21ms
  testee:runner tracking test run http://localhost:3996/test/test.html?__token=fllnja { browser: 'phantom' } +0ms
  testee:html-injector injecting scripts into file /test/test.html?__token=fllnja +541ms
  testee:runner CONSOLE: WARN: Use %index in place of @index.
 http://localhost:3996/test/test.html?__token=fllnja { browser: 'phantom' } +1s
  testee:runner CONSOLE: WARN: Use %index in place of @index.
 http://localhost:3996/test/test.html?__token=fllnja { browser: 'phantom' } +2ms
  testee:runner CONSOLE: WARN: Use %index in place of @index.
 http://localhost:3996/test/test.html?__token=fllnja { browser: 'phantom' } +1ms
  testee:reporter starting test { file: 'http://localhost:3996/test/test.html?__token=fllnja',
  id: '761cc02b747823cec8292d9df17272bd',
  title: 'show have gray colored arrow' } +106ms
  testee:reporter updating test { file: 'http://localhost:3996/test/test.html?__token=fllnja',
  id: '761cc02b747823cec8292d9df17272bd',
  title: 'show have gray colored arrow',
  status: 'passed' } +3ms
  testee:reporter starting test { file: 'http://localhost:3996/test/test.html?__token=fllnja',
  id: '03a208679c0b6389c32a8700cce59364',
  title: 'should have 1 less number of depth arrow' } +9ms
  testee:reporter updating test { file: 'http://localhost:3996/test/test.html?__token=fllnja',
  id: '03a208679c0b6389c32a8700cce59364',
  title: 'should have 1 less number of depth arrow',
  status: 'passed' } +4ms
  testee:reporter starting test { file: 'http://localhost:3996/test/test.html?__token=fllnja',
  id: 'ca9ac5ab2e5d7c5155f60a3513bc4834',
  title: 'should have 1 less number of depth link' } +17ms
  testee:reporter updating test { file: 'http://localhost:3996/test/test.html?__token=fllnja',
  id: 'ca9ac5ab2e5d7c5155f60a3513bc4834',
  title: 'should have 1 less number of depth link',
  status: 'passed' } +9ms
  testee:runner test http://localhost:3996/test/test.html?__token=fllnja timed out +2m
  testee:runner stopping browser instance { browser: 'phantom' } +1ms
  testee:reporter adding error to reporter { [Error: Browser timed out within 120 seconds]
  message: 'Browser timed out within 120 seconds',
  stack: 'Error: Browser timed out within 120 seconds\n    at testTimedOut [as _onTimeout] (/Users/mshin/Workspace/spirent/apoc/node_modules/testee/lib/runner.js:43:42)\n    at Timer.listOnTimeout (timers.js:92:15)',
  title: 'http://localhost:3996/test/test.html?__token=fllnja on {"browser":"phantom"}' } +5ms
  testee:main shutting down reporter +1ms
  testee:reporter end +0ms
  testee:reporter reportErrors 1 +0ms
  testee:reporter starting run { id: 'c88c0b68-39f2-4c7d-a5ab-a623d2700837',
  title: 'General error' } +0ms
  testee:reporter reporting error { [Error: Browser timed out within 120 seconds]
  message: 'Browser timed out within 120 seconds',
  stack: 'Error: Browser timed out within 120 seconds\n    at testTimedOut [as _onTimeout] (/Users/mshin/Workspace/spirent/apoc/node_modules/testee/lib/runner.js:43:42)\n    at Timer.listOnTimeout (timers.js:92:15)',
  title: 'http://localhost:3996/test/test.html?__token=fllnja on {"browser":"phantom"}' } +1ms
  testee:reporter starting test { id: '05927667-edd5-493e-bbdc-267d47aa96f3',
  parent: 'c88c0b68-39f2-4c7d-a5ab-a623d2700837',
  status: 'failed',
  err:
   { [Error: Browser timed out within 120 seconds]
     message: 'Browser timed out within 120 seconds',
     stack: 'Error: Browser timed out within 120 seconds\n    at testTimedOut [as _onTimeout] (/Users/mshin/Workspace/spirent/apoc/node_modules/testee/lib/runner.js:43:42)\n    at Timer.listOnTimeout (timers.js:92:15)',
     title: 'http://localhost:3996/test/test.html?__token=fllnja on {"browser":"phantom"}' },
  title: 'http://localhost:3996/test/test.html?__token=fllnja on {"browser":"phantom"}' } +0ms
  testee:reporter updating test { id: '05927667-edd5-493e-bbdc-267d47aa96f3',
  parent: 'c88c0b68-39f2-4c7d-a5ab-a623d2700837',
  status: 'failed',
  err:
   { [Error: Browser timed out within 120 seconds]
     message: 'Browser timed out within 120 seconds',
     stack: 'Error: Browser timed out within 120 seconds\n    at testTimedOut [as _onTimeout] (/Users/mshin/Workspace/spirent/apoc/node_modules/testee/lib/runner.js:43:42)\n    at Timer.listOnTimeout (timers.js:92:15)',
     title: 'http://localhost:3996/test/test.html?__token=fllnja on {"browser":"phantom"}' },
  title: 'http://localhost:3996/test/test.html?__token=fllnja on {"browser":"phantom"}' } +0ms

  ․  testee:reporter updating run { status: 'finished',
  id: 'c88c0b68-39f2-4c7d-a5ab-a623d2700837',
  title: 'General error' } +1ms


  0 passing (2m)
  1 failing

  1) General error http://localhost:3996/test/test.html?__token=fllnja on {"browser":"phantom"}:
     Error: Browser timed out within 120 seconds
      at testTimedOut [as _onTimeout] (/Users/mshin/Workspace/spirent/apoc/node_modules/testee/lib/runner.js:43:42)
      at Timer.listOnTimeout (timers.js:92:15)



  testee:main closing server +2ms

If take a look at the debugging object when the test starts

testee:reporter starting test { file: 'http://localhost:3996/test/test.html?__token=fllnja',
  id: '761cc02b747823cec8292d9df17272bd',
  title: 'show have gray colored arrow' } +106ms

There is no parent property...

@minsooshin
Copy link
Author

Update

chrome

testee:html-injector injecting scripts into file /test/test.html?__token=d5r1bn +475ms
  testee:reporter startRun ---------------------------------------------------- +1s
  testee:reporter { status: 'running', file: 'http://localhost:3996/test/test.html?__token=d5r1bn', id: '6a473ffcf2036a579b013a9746505665', environment: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.98 Safari/537.36', runner: 'QUnit', time: 1479942101214 } +1ms

phantom

testee:html-injector injecting scripts into file /test/test.html?__token=lr1i20 +472ms
  testee:reporter starting test { file: 'http://localhost:3996/test/test.html?__token=lr1i20',
  id: 'eba2407b07bf1a93b29a31630d919ea5',
  title: 'show have gray colored arrow' } +1s

Even it doesn't trigger startRun and startSuite from lib/reporter/index.js

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant