Testcafe: Testcafe 0.23.2 hanging once tests have completed

Created on 14 Nov 2018  Â·  13Comments  Â·  Source: DevExpress/testcafe

What is your Test Scenario?


I'm running testcafe from a codebuild docker image based on ubuntu. Once all tests are completed, it does not return, it just hangs indefinitely. Commandline, test file and logs are below. Testfile will run fine from a macbook locally.

Testcafe is version 0.23.2

What is the Current behavior?


Testcafe never returns once the tests have completed, successfully or otherwise

What is the Expected behavior?


Testcafe to return

What is your web application and your TestCafe test code?

Logs:

Tue, 13 Nov 2018 09:51:22 GMT testcafe:test-run:HeadlessChrome
70.0.3538 / Linux 0.0.0:driver-message  
    { 
      "cmd": "ready", 
      "status": { 
        "id": "2829.9000000006345", 
        "isCommandResult": true, 
        "executionError": null, 
        "pageError": null, 
        "resent": false, 
        "result": [ 
          0 
        ], 
        "consoleMessages": { 
          "log": [], 
          "info": [], 
          "warn": [], 
          "error": [] 
        } 
      }, 
      "disableResending": true, 
      "allowRejecting": true, 
      "sessionId": "J07WRZJDH" 
    }    Tue, 13 Nov 2018 09:51:22 GMT testcafe:test-run:HeadlessChrome 70.0.3538 / Linux 0.0.0:command  
    { 
      "type": "test-done" 
    }    Tue, 13 Nov 2018 09:51:22 GMT testcafe:test-run:HeadlessChrome 70.0.3538 / Linux
0.0.0:driver-message  
    { 
      "cmd": "ready", 
      "status": { 
        "id": "2851.400000000467", 
        "isCommandResult": true, 
        "executionError": null, 
        "pageError": null, 
        "resent": false, 
        "result": null, 
        "consoleMessages": { 
          "log": [], 
          "info": [], 
          "warn": [], 
          "error": [] 
        } 
      }, 
      "disableResending": true, 
      "allowRejecting": true, 
      "sessionId": "J07WRZJDH" 
    }     ✓ Login nogroup user 
     5 passed (31s)

Steps to Reproduce:

Run with the commandline above using a simple test file. Test file has a single fixture and 5 test cases. The tests themselves actually complete successfully and testcafe returns 'passed' at the end of the test.

import { Selector } from 'testcafe'; import { Role } from 'testcafe'; import { ClientFunction } from 'testcafe';

fixture `Login`
    .page `url goes here`;

const getPageUrl = ClientFunction(() => window.location.href);

test('Login user', async t => {     await t  ..test example code here... });

Your Environment details:

  • testcafe version:
root@3c9892b7d478:/tmp# testcafe -v
0.23.2<!-- run `testcafe -v` -->

  • node.js version:
root@3c9892b7d478:/tmp# node -v
v10.1.0<!-- run `node -v` -->

  • command-line arguments:
    export DEBUG="testcafe:test-run:* gulp test-functional"; testcafe "chrome:headless --no-sandbox" test/client/login.js
  • browser name and version:
    Google Chrome 70.0.3538.102<!-- example: IE 11, Chrome 69, Firefox 100, etc. -->
  • platform and version:
    Ubuntu 14.04.5 LTS <!-- example: "macOS 10.14, Windows, Linux Ubuntu 18.04.1, iOS 12 -->
  • other:
Auto-locked

Most helpful comment

@willscripted, the fix for the described problem is located in PR #3234.

All 13 comments

Could you please provide additional resources to help me reproduce and examine the issue:

  • [ ] Your Dockerfile or a link to your image on Docker Hub
  • [ ] The full code of your test files
  • [ ] If you can't disclose your tests or site, please try to reproduce the issue on another public site (example.com google.com, etc.) and provide a test that uses this site.

Test file - this is just a hacked version of one of my real tests but produces the exact same result. It appears irrelevant whether it succeeds or fails.

import { Selector } from 'testcafe';
import { Role } from 'testcafe';
import { ClientFunction } from 'testcafe';

fixture `Login`
    .page `http://www.google.com`;

const getPageUrl = ClientFunction(() => window.location.href);

test('test google', async t => {
    await t
        .expect(Selector('#carcontent > thead > tr').exists).notOk();
});

Dockerfile:

# Copyright 2017-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Amazon Software License (the "License"). You may not use this file except in compliance with the License.
# A copy of the License is located at
#
#    http://aws.amazon.com/asl/
#
# or in the "license" file accompanying this file.
# This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, express or implied.
# See the License for the specific language governing permissions and limitations under the License.
#

FROM ubuntu:14.04.5

ENV DOCKER_BUCKET="download.docker.com" \
    DOCKER_VERSION="17.09.0-ce" \
    DOCKER_CHANNEL="stable" \
    DOCKER_SHA256="a9e90a73c3cdfbf238f148e1ec0eaff5eb181f92f35bdd938fd7dab18e1c4647" \
    DIND_COMMIT="3b5fac462d21ca164b3778647420016315289034" \
    DOCKER_COMPOSE_VERSION="1.21.2" \
    GITVERSION_VERSION="3.6.5"

# Install git, SSH, and other utilities
RUN set -ex \
    && echo 'Acquire::CompressionTypes::Order:: "gz";' > /etc/apt/apt.conf.d/99use-gzip-compression \
    && apt-get update \
    && apt install -y apt-transport-https \
    && apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF \
    && echo "deb https://download.mono-project.com/repo/ubuntu stable-trusty main" | tee /etc/apt/sources.list.d/mono-official-stable.list \
    && apt-get update \
    && apt-get install software-properties-common -y --no-install-recommends \
    && apt-add-repository ppa:git-core/ppa \
    && apt-get update \
    && apt-get install git=1:2.* -y --no-install-recommends \
    && git version \
    && apt-get install -y --no-install-recommends openssh-client=1:6.6* \
    && mkdir ~/.ssh \
    && touch ~/.ssh/known_hosts \
    && ssh-keyscan -t rsa,dsa -H github.com >> ~/.ssh/known_hosts \
    && ssh-keyscan -t rsa,dsa -H bitbucket.org >> ~/.ssh/known_hosts \
    && chmod 600 ~/.ssh/known_hosts \
    && apt-get install -y --no-install-recommends \
       wget=1.15-* python=2.7.* python2.7-dev=2.7.* fakeroot=1.20-* ca-certificates \
       tar=1.27.* gzip=1.6-* zip=3.0-* autoconf=2.69-* automake=1:1.14.* \
       bzip2=1.0.* file=1:5.14-* g++=4:4.8.* gcc=4:4.8.* imagemagick=8:6.7.* \
       libbz2-dev=1.0.* libc6-dev=2.19-* libcurl4-openssl-dev=7.35.* libdb-dev=1:5.3.* \
       libevent-dev=2.0.* libffi-dev=3.1~* libgeoip-dev=1.6.* libglib2.0-dev=2.40.* \
       libjpeg-dev=8c-* libkrb5-dev=1.12+* liblzma-dev=5.1.* \
       libmagickcore-dev=8:6.7.* libmagickwand-dev=8:6.7.* libmysqlclient-dev=5.5.* \
       libncurses5-dev=5.9+* libpng12-dev=1.2.* libpq-dev=9.3.* libreadline-dev=6.3-* \
       libsqlite3-dev=3.8.* libssl-dev=1.0.* libtool=2.4.* libwebp-dev=0.4.* \
       libxml2-dev=2.9.* libxslt1-dev=1.1.* libyaml-dev=0.1.* make=3.81-* \
       patch=2.7.* xz-utils=5.1.* zlib1g-dev=1:1.2.* unzip=6.0-* curl=7.35.* \
       e2fsprogs=1.42.* iptables=1.4.* xfsprogs=3.1.* xz-utils=5.1.* \
       mono-devel less=458-* groff=1.22.* liberror-perl=0.17-* \
       asciidoc=8.6.* build-essential=11.* bzr=2.6.* cvs=2:1.12.* cvsps=2.1-* docbook-xml=4.5-* docbook-xsl=1.78.* dpkg-dev=1.17.* \
       libdbd-sqlite3-perl=1.40-* libdbi-perl=1.630-* libdpkg-perl=1.17.* libhttp-date-perl=6.02-* \
       libio-pty-perl=1:1.08-* libserf-1-1=1.3.* libsvn-perl=1.8.* libsvn1=1.8.* libtcl8.6=8.6.* libtimedate-perl=2.3000-* \
       libunistring0=0.9.* libxml2-utils=2.9.* libyaml-perl=0.84-* python-bzrlib=2.6.* python-configobj=4.7.* \
       sgml-base=1.26+* sgml-data=2.0.* subversion=1.8.* tcl=8.6.* tcl8.6=8.6.* xml-core=0.13+* xmlto=0.0.* xsltproc=1.1.* \
    && rm -rf /var/lib/apt/lists/* \
    && apt-get clean

# Download and set up GitVersion
RUN set -ex \
    && wget "https://github.com/GitTools/GitVersion/releases/download/v${GITVERSION_VERSION}/GitVersion_${GITVERSION_VERSION}.zip" -O /tmp/GitVersion_${GITVERSION_VERSION}.zip \
    && mkdir -p /usr/local/GitVersion_${GITVERSION_VERSION} \
    && unzip /tmp/GitVersion_${GITVERSION_VERSION}.zip -d /usr/local/GitVersion_${GITVERSION_VERSION} \
    && rm /tmp/GitVersion_${GITVERSION_VERSION}.zip \
    && echo "mono /usr/local/GitVersion_${GITVERSION_VERSION}/GitVersion.exe \$@" >> /usr/local/bin/gitversion \
    && chmod +x /usr/local/bin/gitversion

# Install Docker
RUN set -ex \
    && curl -fSL "https://${DOCKER_BUCKET}/linux/static/${DOCKER_CHANNEL}/x86_64/docker-${DOCKER_VERSION}.tgz" -o docker.tgz \
    && echo "${DOCKER_SHA256} *docker.tgz" | sha256sum -c - \
    && tar --extract --file docker.tgz --strip-components 1  --directory /usr/local/bin/ \
    && rm docker.tgz \
    && docker -v \
# set up subuid/subgid so that "--userns-remap=default" works out-of-the-box
    && addgroup dockremap \
    && useradd -g dockremap dockremap \
    && echo 'dockremap:165536:65536' >> /etc/subuid \
    && echo 'dockremap:165536:65536' >> /etc/subgid \
    && wget "https://raw.githubusercontent.com/docker/docker/${DIND_COMMIT}/hack/dind" -O /usr/local/bin/dind \
    && curl -L https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose-Linux-x86_64 > /usr/local/bin/docker-compose \
    && chmod +x /usr/local/bin/dind /usr/local/bin/docker-compose \
# Ensure docker-compose works
    && docker-compose version

# Install dependencies by all python images equivalent to buildpack-deps:jessie
# on the public repos.

RUN set -ex \
    && wget "https://bootstrap.pypa.io/2.6/get-pip.py" -O /tmp/get-pip.py \
    && python /tmp/get-pip.py \
    && pip install awscli==1.* \
    && rm -fr /var/lib/apt/lists/* /tmp/* /var/tmp/*

VOLUME /var/lib/docker

COPY dockerd-entrypoint.sh /usr/local/bin/

ENV NODE_VERSION="10.1.0"

# gpg keys listed at https://github.com/nodejs/node#release-team
RUN set -ex \
    && for key in \
      94AE36675C464D64BAFA68DD7434390BDBE9B9C5 \
      B9AE9905FFD7803F25714661B63B535A4C206CA9 \
      77984A986EBC2AA786BC0F66B01FBB92821C587A \
      56730D5401028683275BD23C23EFEFE93C4CFFFE \
      71DCFD284A79C3B38668286BC97EC7A07EDE3FC1 \
      FD3A5288F042B6850C66B31F09FE44734EB7990E \
      8FCCA13FEF1D0C2E91008E09770F7A9A5AE15600 \
      C4F0DFFF4E8C1A8236409D08E73BC641CC11F4C8 \
      DD8F2338BAE7501E3DD5AC78C273792F7D83545D \
      9554F04D7259F04124DE6B476D5A82AC7E37093B \
      93C7E9E91B49E432C2F75674B0A78B0A6C481CF6 \
      114F43EE0176B71C7BC219DD50A3051F888C628D \
      7937DFD2AB06298B2293C3187D33FF9D0246406D \
    ; do \
      gpg --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys "$key" || \
      gpg --keyserver hkp://ipv4.pool.sks-keyservers.net --recv-keys "$key" || \
      gpg --keyserver hkp://pgp.mit.edu:80 --recv-keys "$key" ; \
    done

RUN set -ex \
    && wget "https://nodejs.org/download/release/v$NODE_VERSION/node-v$NODE_VERSION-linux-x64.tar.gz" -O node-v$NODE_VERSION-linux-x64.tar.gz \
    && wget "https://nodejs.org/download/release/v$NODE_VERSION/SHASUMS256.txt.asc" -O SHASUMS256.txt.asc \
    && gpg --batch --decrypt --output SHASUMS256.txt SHASUMS256.txt.asc \
    && grep " node-v$NODE_VERSION-linux-x64.tar.gz\$" SHASUMS256.txt | sha256sum -c - \
        && tar -xzf "node-v$NODE_VERSION-linux-x64.tar.gz" -C /usr/local --strip-components=1 \
        && rm "node-v$NODE_VERSION-linux-x64.tar.gz" SHASUMS256.txt.asc SHASUMS256.txt \
        && ln -s /usr/local/bin/node /usr/local/bin/nodejs \
        && rm -fr /var/lib/apt/lists/* /tmp/* /var/tmp/*

RUN npm set unsafe-perm true
RUN npm install -g testcafe
RUN echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" > /etc/apt/sources.list.d/google-chrome.list
RUN wget https://dl.google.com/linux/linux_signing_key.pub
RUN sudo apt-key add linux_signing_key.pub
RUN apt update
RUN apt install -y google-chrome-stable

CMD [ "node" ]

buildspec.yml

version: 0.1

phases:
  build:
    commands:
      - echo begin
      - export DEBUG="testcafe:test-run:* gulp test-functional"; testcafe "chrome:headless --no-sandbox" test/client/login.google.js
      - echo finished

 ```

Log Output:

[Container] 2018/11/14 09:25:11 Waiting for agent ping
[Container] 2018/11/14 09:25:11 Waiting for DOWNLOAD_SOURCE
[Container] 2018/11/14 09:25:11 Phase is DOWNLOAD_SOURCE
[Container] 2018/11/14 09:25:11 CODEBUILD_SRC_DIR=/codebuild/output/src968547354/src
[Container] 2018/11/14 09:25:11 YAML location is /codebuild/output/src968547354/src/testcafe.yml
[Container] 2018/11/14 09:25:11 Processing environment variables
[Container] 2018/11/14 09:25:11 Moving to directory /codebuild/output/src968547354/src
[Container] 2018/11/14 09:25:11 Registering with agent
[Container] 2018/11/14 09:25:11 Phases found in YAML: 1
[Container] 2018/11/14 09:25:11 BUILD: 3 commands
[Container] 2018/11/14 09:25:11 Phase complete: DOWNLOAD_SOURCE Success: true
[Container] 2018/11/14 09:25:11 Phase context status code: Message:
[Container] 2018/11/14 09:25:12 Entering phase INSTALL
[Container] 2018/11/14 09:25:12 Phase complete: INSTALL Success: true
[Container] 2018/11/14 09:25:12 Phase context status code: Message:
[Container] 2018/11/14 09:25:12 Entering phase PRE_BUILD
[Container] 2018/11/14 09:25:12 Phase complete: PRE_BUILD Success: true
[Container] 2018/11/14 09:25:12 Phase context status code: Message:
[Container] 2018/11/14 09:25:12 Entering phase BUILD
[Container] 2018/11/14 09:25:12 Running command echo begin
begin

[Container] 2018/11/14 09:25:12 Running command export DEBUG="testcafe:test-run:* gulp test-functional"; testcafe "chrome:headless --no-sandbox" test/client/login.google.js
(node:24) ExperimentalWarning: The fs.promises API is experimental
Running tests in:

  • HeadlessChrome 70.0.3538 / Linux 0.0.0

Login
Wed, 14 Nov 2018 09:25:16 GMT testcafe:test-run:HeadlessChrome 70.0.3538 / Linux 0.0.0:command
{
"type": "assertion",
"assertionType": "notOk",
"actual": {
"_then": [],
"_taskPromise": null
},
"message": null,
"options": {
"allowUnawaitedPromise": false
}
}

Wed, 14 Nov 2018 09:25:17 GMT testcafe:test-run:HeadlessChrome 70.0.3538 / Linux 0.0.0:command
{
"type": "execute-selector",
"instantiationCallsiteName": "Selector",
"fnCode": "(function(){\n var __f$=(function(){return document.querySelectorAll(\"#carcontent > thead > tr\");});;\n return function(){\n var args = __dependencies$.boundArgs || arguments;\n var selectorFilter = window['%testCafeSelectorFilter%'];\n \n var nodes = __f$.apply(this, args);\n nodes = selectorFilter.cast(nodes);\n \n if (!nodes.length && !selectorFilter.error)\n selectorFilter.error = __dependencies$.apiInfo.apiFnID;\n\n return selectorFilter.filter(nodes, __dependencies$.filterOptions, __dependencies$.apiInfo);\n };\n})();",
"args": [
[]
],
"dependencies": [
{
"filterOptions": {
"filterVisible": {
"@t": "[[undefined]]",
"data": ""
},
"filterHidden": {
"@t": "[[undefined]]",
"data": ""
},
"counterMode": true,
"collectionMode": {
"@t": "[[undefined]]",
"data": ""
},
"index": null
},
"apiInfo": {
"apiFnChain": [
"Selector('#carcontent > thead > tr')"
],
"apiFnID": 0
},
"boundArgs": {
"@t": "[[undefined]]",
"data": ""
},
"customDOMProperties": {
"@t": "[[undefined]]",
"data": ""
},
"customMethods": {
"@t": "[[undefined]]",
"data": ""
}
}
],
"visibilityCheck": false,
"timeout": null,
"apiFnChain": [
"Selector('#carcontent > thead > tr')"
],
"index": 0
}

Wed, 14 Nov 2018 09:25:18 GMT testcafe:test-run:HeadlessChrome 70.0.3538 / Linux 0.0.0:driver-message
{
"cmd": "ready",
"status": {
"id": "1653.3999999992375",
"isCommandResult": false,
"executionError": null,
"pageError": null,
"resent": false,
"result": null,
"consoleMessages": {
"log": [],
"info": [],
"warn": [],
"error": []
}
},
"disableResending": true,
"allowRejecting": true,
"sessionId": "fguLFOxVT"
}

Wed, 14 Nov 2018 09:25:20 GMT testcafe:test-run:HeadlessChrome 70.0.3538 / Linux 0.0.0:driver-message
{
"cmd": "ready",
"status": {
"id": "3055.099999999584",
"isCommandResult": true,
"executionError": null,
"pageError": null,
"resent": false,
"result": [
0
],
"consoleMessages": {
"log": [],
"info": [],
"warn": [],
"error": []
}
},
"disableResending": true,
"allowRejecting": true,
"sessionId": "fguLFOxVT"
}

Wed, 14 Nov 2018 09:25:20 GMT testcafe:test-run:HeadlessChrome 70.0.3538 / Linux 0.0.0:command
{
"type": "test-done"
}

Wed, 14 Nov 2018 09:25:20 GMT testcafe:test-run:HeadlessChrome 70.0.3538 / Linux 0.0.0:driver-message
{
"cmd": "ready",
"status": {
"id": "3078.4999999996217",
"isCommandResult": true,
"executionError": null,
"pageError": null,
"resent": false,
"result": null,
"consoleMessages": {
"log": [],
"info": [],
"warn": [],
"error": []
}
},
"disableResending": true,
"allowRejecting": true,
"sessionId": "fguLFOxVT"
}

✓ test google

1 passed (3s)
```

Confirmed that rolling testcafe back to v0.21.1 results in expected behaviour, tests complete and testcafe now terminates successfully with no changes to any other configuration

I have a similar issue in a Jenkins/docker environment that runs testcafe in the CI gate. It also hang and downgrading to 0.21.1 helped as well.

I've built the image corresponding to the Dockerfile configuration you provided and tried to run it manually with the following command:

docker run -it --rm -v /d/gh-3114:/d/ andreybelym/test-images:gh-3114 'export DEBUG="testcafe:test-run:* gulp test-functional"; testcafe "chrome:headless --no-sandbox"
 /d/test.js'

I ran the image and it was terminated successfully. I've pushed it to Docker Hub, so could you please try to run it on your machine? You can get it by running the following command

docker pull andreybelym/test-images:gh-3114 

I see that you use AWS CodeBuild to run your builds and expect that the problem can be reproducible in the CodeBuild environment but I need additional time to set it up.

I also checked commits we introduced between the working (v0.23.1) and problematic (v0.23.2) TestCafe versions and found that we had only 2 commits that could cause the issue: 6f8db5ec and f105949a.

So I've prepared debug builds for both of these commits, and also a third build that is just a rebuilt v0.23.1 version and will serve as a control build for checking that the issue isn't caused by some automatically updated TestCafe dependency. Below is the list of links to these builds:

While I'm setting the environment to reproduce the problem, could you try to install these builds to help me determine the exact commit that caused the issue?

You can install any of these builds by specifying the following line in the dependencies section of your package.json:

"testcafe": "LINK"

or by executing the following command in your terminal:

npm i -g LINK

Replace LINK with the actual link to a build.

Also, please modify your build steps to include the output of the testcafe -v command. It will help you check that a correct TestCafe version has been installed.

Have tested as requested, thank you very much for the detailed test cases. I updated the Dockerfile and created 3 new docker images in the following way:

#RUN npm install -g [email protected]
RUN npm i -g https://github.com/AndreyBelym/testcafe/releases/download/gh-3114-1/testcafe-0.23.3-alpha.gh3114.1.tgz

Summary of results:

testcafe-0.23.3-alpha.gh3114.1.tgz - hangs as before
testcafe-0.23.3-alpha.gh3114.2.tgz - completes successfully, expected behaviour
testcafe-0.23.3-alpha.gh3114.3.tgz - completes successfully, expected behaviour

CodeBuild buildspec file below. It now includes a -v on every execution, plus echo before and after the execution of testcafe so you are able to see successful termination.

version: 0.1

phases:
  build:
    commands:
      - echo begin
      - testcafe -v
      - export DEBUG="testcafe:test-run:* gulp test-functional"; testcafe "chrome:headless --no-sandbox" test/client/login.google.js
      - echo finished

CodeBuild log from testcafe-0.23.3-alpha.gh3114.1.tgz. Needs to be manually terminated:

[Container] 2018/11/17 10:57:39 Waiting for agent ping 
[Container] 2018/11/17 10:57:39 Waiting for DOWNLOAD_SOURCE 
[Container] 2018/11/17 10:57:39 Phase is DOWNLOAD_SOURCE 
[Container] 2018/11/17 10:57:39 CODEBUILD_SRC_DIR=/codebuild/output/src340609852/src 
[Container] 2018/11/17 10:57:39 YAML location is /codebuild/output/src340609852/src/testcafe.yml 
[Container] 2018/11/17 10:57:39 Processing environment variables 
[Container] 2018/11/17 10:57:39 Moving to directory /codebuild/output/src340609852/src 
[Container] 2018/11/17 10:57:39 Registering with agent 
[Container] 2018/11/17 10:57:39 Phases found in YAML: 1 
[Container] 2018/11/17 10:57:39  BUILD: 4 commands 
[Container] 2018/11/17 10:57:39 Phase complete: DOWNLOAD_SOURCE Success: true 
[Container] 2018/11/17 10:57:39 Phase context status code:  Message:  
[Container] 2018/11/17 10:57:39 Entering phase INSTALL 
[Container] 2018/11/17 10:57:39 Phase complete: INSTALL Success: true 
[Container] 2018/11/17 10:57:39 Phase context status code:  Message:  
[Container] 2018/11/17 10:57:39 Entering phase PRE_BUILD 
[Container] 2018/11/17 10:57:39 Phase complete: PRE_BUILD Success: true 
[Container] 2018/11/17 10:57:39 Phase context status code:  Message:  
[Container] 2018/11/17 10:57:39 Entering phase BUILD 
[Container] 2018/11/17 10:57:39 Running command echo begin 
begin 

[Container] 2018/11/17 10:57:39 Running command testcafe -v 
0.23.3-alpha.gh3114.1 

[Container] 2018/11/17 10:57:40 Running command export DEBUG="testcafe:test-run:* gulp test-functional"; testcafe "chrome:headless --no-sandbox" test/client/login.google.js 
(node:36) ExperimentalWarning: The fs.promises API is experimental 
 Running tests in: 
 - HeadlessChrome 70.0.3538 / Linux 0.0.0 

 Login 
Sat, 17 Nov 2018 10:57:44 GMT testcafe:test-run:HeadlessChrome 70.0.3538 / Linux 0.0.0:command  
    { 
      "type": "assertion", 
      "assertionType": "notOk", 
      "actual": { 
        "_then": [], 
        "_taskPromise": null 
      }, 
      "message": null, 
      "options": { 
        "allowUnawaitedPromise": false 
      } 
    } 

Sat, 17 Nov 2018 10:57:45 GMT testcafe:test-run:HeadlessChrome 70.0.3538 / Linux 0.0.0:command  
    { 
      "type": "execute-selector", 
      "instantiationCallsiteName": "Selector", 
      "fnCode": "(function(){\n   var __f$=(function(){return document.querySelectorAll(\"#carcontent > thead > tr\");});;\n   return function(){\n       var args           = __dependencies$.boundArgs || arguments;\n       var selectorFilter = window['%testCafeSelectorFilter%'];\n       \n       var nodes = __f$.apply(this, args);\n       nodes     = selectorFilter.cast(nodes);\n       \n       if (!nodes.length && !selectorFilter.error)\n           selectorFilter.error = __dependencies$.apiInfo.apiFnID;\n\n       return selectorFilter.filter(nodes, __dependencies$.filterOptions, __dependencies$.apiInfo);\n   };\n})();", 
      "args": [ 
        [] 
      ], 
      "dependencies": [ 
        { 
          "filterOptions": { 
            "filterVisible": { 
              "@t": "[[undefined]]", 
              "data": "" 
            }, 
            "filterHidden": { 
              "@t": "[[undefined]]", 
              "data": "" 
            }, 
            "counterMode": true, 
            "collectionMode": { 
              "@t": "[[undefined]]", 
              "data": "" 
            }, 
            "index": null 
          }, 
          "apiInfo": { 
            "apiFnChain": [ 
              "Selector('#carcontent > thead > tr')" 
            ], 
            "apiFnID": 0 
          }, 
          "boundArgs": { 
            "@t": "[[undefined]]", 
            "data": "" 
          }, 
          "customDOMProperties": { 
            "@t": "[[undefined]]", 
            "data": "" 
          }, 
          "customMethods": { 
            "@t": "[[undefined]]", 
            "data": "" 
          } 
        } 
      ], 
      "visibilityCheck": false, 
      "timeout": null, 
      "apiFnChain": [ 
        "Selector('#carcontent > thead > tr')" 
      ], 
      "index": 0 
    } 

Sat, 17 Nov 2018 10:57:46 GMT testcafe:test-run:HeadlessChrome 70.0.3538 / Linux 0.0.0:driver-message  
    { 
      "cmd": "ready", 
      "status": { 
        "id": "1269.2999999999302", 
        "isCommandResult": false, 
        "executionError": null, 
        "pageError": null, 
        "resent": false, 
        "result": null, 
        "consoleMessages": { 
          "log": [], 
          "info": [], 
          "warn": [], 
          "error": [] 
        } 
      }, 
      "disableResending": true, 
      "allowRejecting": true, 
      "sessionId": "uMtqPSB7g" 
    } 

Sat, 17 Nov 2018 10:57:47 GMT testcafe:test-run:HeadlessChrome 70.0.3538 / Linux 0.0.0:driver-message  
    { 
      "cmd": "ready", 
      "status": { 
        "id": "2680.5999999996857", 
        "isCommandResult": true, 
        "executionError": null, 
        "pageError": null, 
        "resent": false, 
        "result": [ 
          0 
        ], 
        "consoleMessages": { 
          "log": [], 
          "info": [], 
          "warn": [], 
          "error": [] 
        } 
      }, 
      "disableResending": true, 
      "allowRejecting": true, 
      "sessionId": "uMtqPSB7g" 
    } 

Sat, 17 Nov 2018 10:57:47 GMT testcafe:test-run:HeadlessChrome 70.0.3538 / Linux 0.0.0:command  
    { 
      "type": "test-done" 
    } 

Sat, 17 Nov 2018 10:57:47 GMT testcafe:test-run:HeadlessChrome 70.0.3538 / Linux 0.0.0:driver-message  
    { 
      "cmd": "ready", 
      "status": { 
        "id": "2712.0999999997366", 
        "isCommandResult": true, 
        "executionError": null, 
        "pageError": null, 
        "resent": false, 
        "result": null, 
        "consoleMessages": { 
          "log": [], 
          "info": [], 
          "warn": [], 
          "error": [] 
        } 
      }, 
      "disableResending": true, 
      "allowRejecting": true, 
      "sessionId": "uMtqPSB7g" 
    } 

 ✓ test google 


 1 passed (3s) 

CodeBuild log from testcafe-0.23.3-alpha.gh3114.2.tgz:

[Container] 2018/11/17 11:08:00 Waiting for agent ping 
[Container] 2018/11/17 11:08:00 Waiting for DOWNLOAD_SOURCE 
[Container] 2018/11/17 11:08:00 Phase is DOWNLOAD_SOURCE 
[Container] 2018/11/17 11:08:00 CODEBUILD_SRC_DIR=/codebuild/output/src313414576/src 
[Container] 2018/11/17 11:08:00 YAML location is /codebuild/output/src313414576/src/testcafe.yml 
[Container] 2018/11/17 11:08:00 Processing environment variables 
[Container] 2018/11/17 11:08:00 Moving to directory /codebuild/output/src313414576/src 
[Container] 2018/11/17 11:08:00 Registering with agent 
[Container] 2018/11/17 11:08:00 Phases found in YAML: 1 
[Container] 2018/11/17 11:08:00  BUILD: 4 commands 
[Container] 2018/11/17 11:08:00 Phase complete: DOWNLOAD_SOURCE Success: true 
[Container] 2018/11/17 11:08:00 Phase context status code:  Message:  
[Container] 2018/11/17 11:08:00 Entering phase INSTALL 
[Container] 2018/11/17 11:08:00 Phase complete: INSTALL Success: true 
[Container] 2018/11/17 11:08:00 Phase context status code:  Message:  
[Container] 2018/11/17 11:08:00 Entering phase PRE_BUILD 
[Container] 2018/11/17 11:08:00 Phase complete: PRE_BUILD Success: true 
[Container] 2018/11/17 11:08:00 Phase context status code:  Message:  
[Container] 2018/11/17 11:08:00 Entering phase BUILD 
[Container] 2018/11/17 11:08:00 Running command echo begin 
begin 

[Container] 2018/11/17 11:08:00 Running command testcafe -v 
0.23.3-alpha.gh3114.2 

[Container] 2018/11/17 11:08:01 Running command export DEBUG="testcafe:test-run:* gulp test-functional"; testcafe "chrome:headless --no-sandbox" test/client/login.google.js 
(node:37) ExperimentalWarning: The fs.promises API is experimental 
 Running tests in: 
 - HeadlessChrome 70.0.3538 / Linux 0.0.0 

 Login 
Sat, 17 Nov 2018 11:08:06 GMT testcafe:test-run:HeadlessChrome 70.0.3538 / Linux 0.0.0:command  
    { 
      "type": "assertion", 
      "assertionType": "notOk", 
      "actual": { 
        "_then": [], 
        "_taskPromise": null 
      }, 
      "message": null, 
      "options": { 
        "allowUnawaitedPromise": false 
      } 
    } 

Sat, 17 Nov 2018 11:08:06 GMT testcafe:test-run:HeadlessChrome 70.0.3538 / Linux 0.0.0:command  
    { 
      "type": "execute-selector", 
      "instantiationCallsiteName": "Selector", 
      "fnCode": "(function(){\n   var __f$=(function(){return document.querySelectorAll(\"#carcontent > thead > tr\");});;\n   return function(){\n       var args           = __dependencies$.boundArgs || arguments;\n       var selectorFilter = window['%testCafeSelectorFilter%'];\n       \n       var nodes = __f$.apply(this, args);\n       nodes     = selectorFilter.cast(nodes);\n       \n       if (!nodes.length && !selectorFilter.error)\n           selectorFilter.error = __dependencies$.apiInfo.apiFnID;\n\n       return selectorFilter.filter(nodes, __dependencies$.filterOptions, __dependencies$.apiInfo);\n   };\n})();", 
      "args": [ 
        [] 
      ], 
      "dependencies": [ 
        { 
          "filterOptions": { 
            "filterVisible": { 
              "@t": "[[undefined]]", 
              "data": "" 
            }, 
            "filterHidden": { 
              "@t": "[[undefined]]", 
              "data": "" 
            }, 
            "counterMode": true, 
            "collectionMode": { 
              "@t": "[[undefined]]", 
              "data": "" 
            }, 
            "index": null 
          }, 
          "apiInfo": { 
            "apiFnChain": [ 
              "Selector('#carcontent > thead > tr')" 
            ], 
            "apiFnID": 0 
          }, 
          "boundArgs": { 
            "@t": "[[undefined]]", 
            "data": "" 
          }, 
          "customDOMProperties": { 
            "@t": "[[undefined]]", 
            "data": "" 
          }, 
          "customMethods": { 
            "@t": "[[undefined]]", 
            "data": "" 
          } 
        } 
      ], 
      "visibilityCheck": false, 
      "timeout": null, 
      "apiFnChain": [ 
        "Selector('#carcontent > thead > tr')" 
      ], 
      "index": 0 
    } 

Sat, 17 Nov 2018 11:08:07 GMT testcafe:test-run:HeadlessChrome 70.0.3538 / Linux 0.0.0:driver-message  
    { 
      "cmd": "ready", 
      "status": { 
        "id": "1422.9999999997744", 
        "isCommandResult": false, 
        "executionError": null, 
        "pageError": null, 
        "resent": false, 
        "result": null, 
        "consoleMessages": { 
          "log": [], 
          "info": [], 
          "warn": [], 
          "error": [] 
        } 
      }, 
      "disableResending": true, 
      "allowRejecting": true, 
      "sessionId": "5xNGYVj9f" 
    } 

Sat, 17 Nov 2018 11:08:08 GMT testcafe:test-run:HeadlessChrome 70.0.3538 / Linux 0.0.0:driver-message  
    { 
      "cmd": "ready", 
      "status": { 
        "id": "2927.599999999984", 
        "isCommandResult": true, 
        "executionError": null, 
        "pageError": null, 
        "resent": false, 
        "result": [ 
          0 
        ], 
        "consoleMessages": { 
          "log": [], 
          "info": [], 
          "warn": [], 
          "error": [] 
        } 
      }, 
      "disableResending": true, 
      "allowRejecting": true, 
      "sessionId": "5xNGYVj9f" 
    } 

Sat, 17 Nov 2018 11:08:08 GMT testcafe:test-run:HeadlessChrome 70.0.3538 / Linux 0.0.0:command  
    { 
      "type": "test-done" 
    } 

Sat, 17 Nov 2018 11:08:09 GMT testcafe:test-run:HeadlessChrome 70.0.3538 / Linux 0.0.0:driver-message  
    { 
      "cmd": "ready", 
      "status": { 
        "id": "2950.3999999997177", 
        "isCommandResult": true, 
        "executionError": null, 
        "pageError": null, 
        "resent": false, 
        "result": null, 
        "consoleMessages": { 
          "log": [], 
          "info": [], 
          "warn": [], 
          "error": [] 
        } 
      }, 
      "disableResending": true, 
      "allowRejecting": true, 
      "sessionId": "5xNGYVj9f" 
    } 

 ✓ test google 


 1 passed (3s) 

[Container] 2018/11/17 11:08:10 Running command echo finished 
finished 

[Container] 2018/11/17 11:08:10 Phase complete: BUILD Success: true 
[Container] 2018/11/17 11:08:10 Phase context status code:  Message:  
[Container] 2018/11/17 11:08:10 Entering phase POST_BUILD 
[Container] 2018/11/17 11:08:10 Phase complete: POST_BUILD Success: true 
[Container] 2018/11/17 11:08:10 Phase context status code:  Message:  

CodeBuild log from testcafe-0.23.3-alpha.gh3114.3.tgz:

[Container] 2018/11/17 12:18:38 Waiting for agent ping 
[Container] 2018/11/17 12:18:38 Waiting for DOWNLOAD_SOURCE 
[Container] 2018/11/17 12:18:38 Phase is DOWNLOAD_SOURCE 
[Container] 2018/11/17 12:18:38 CODEBUILD_SRC_DIR=/codebuild/output/src854036283/src 
[Container] 2018/11/17 12:18:38 YAML location is /codebuild/output/src854036283/src/testcafe.yml 
[Container] 2018/11/17 12:18:38 Processing environment variables 
[Container] 2018/11/17 12:18:38 Moving to directory /codebuild/output/src854036283/src 
[Container] 2018/11/17 12:18:38 Registering with agent 
[Container] 2018/11/17 12:18:38 Phases found in YAML: 1 
[Container] 2018/11/17 12:18:38  BUILD: 4 commands 
[Container] 2018/11/17 12:18:38 Phase complete: DOWNLOAD_SOURCE Success: true 
[Container] 2018/11/17 12:18:38 Phase context status code:  Message:  
[Container] 2018/11/17 12:18:38 Entering phase INSTALL 
[Container] 2018/11/17 12:18:38 Phase complete: INSTALL Success: true 
[Container] 2018/11/17 12:18:38 Phase context status code:  Message:  
[Container] 2018/11/17 12:18:38 Entering phase PRE_BUILD 
[Container] 2018/11/17 12:18:38 Phase complete: PRE_BUILD Success: true 
[Container] 2018/11/17 12:18:38 Phase context status code:  Message:  
[Container] 2018/11/17 12:18:38 Entering phase BUILD 
[Container] 2018/11/17 12:18:38 Running command echo begin 
begin 

[Container] 2018/11/17 12:18:38 Running command testcafe -v 
0.23.3-alpha.gh3114.3 

[Container] 2018/11/17 12:18:41 Running command export DEBUG="testcafe:test-run:* gulp test-functional"; testcafe "chrome:headless --no-sandbox" test/client/login.google.js 
(node:38) ExperimentalWarning: The fs.promises API is experimental 
 Running tests in: 
 - HeadlessChrome 70.0.3538 / Linux 0.0.0 

 Login 
Sat, 17 Nov 2018 12:18:45 GMT testcafe:test-run:HeadlessChrome 70.0.3538 / Linux 0.0.0:command  
    { 
      "type": "assertion", 
      "assertionType": "notOk", 
      "actual": { 
        "_then": [], 
        "_taskPromise": null 
      }, 
      "message": null, 
      "options": { 
        "allowUnawaitedPromise": false 
      } 
    } 

Sat, 17 Nov 2018 12:18:45 GMT testcafe:test-run:HeadlessChrome 70.0.3538 / Linux 0.0.0:command  
    { 
      "type": "execute-selector", 
      "instantiationCallsiteName": "Selector", 
      "fnCode": "(function(){\n   var __f$=(function(){return document.querySelectorAll(\"#carcontent > thead > tr\");});;\n   return function(){\n       var args           = __dependencies$.boundArgs || arguments;\n       var selectorFilter = window['%testCafeSelectorFilter%'];\n       \n       var nodes = __f$.apply(this, args);\n       nodes     = selectorFilter.cast(nodes);\n       \n       if (!nodes.length && !selectorFilter.error)\n           selectorFilter.error = __dependencies$.apiInfo.apiFnID;\n\n       return selectorFilter.filter(nodes, __dependencies$.filterOptions, __dependencies$.apiInfo);\n   };\n})();", 
      "args": [ 
        [] 
      ], 
      "dependencies": [ 
        { 
          "filterOptions": { 
            "filterVisible": { 
              "@t": "[[undefined]]", 
              "data": "" 
            }, 
            "filterHidden": { 
              "@t": "[[undefined]]", 
              "data": "" 
            }, 
            "counterMode": true, 
            "collectionMode": { 
              "@t": "[[undefined]]", 
              "data": "" 
            }, 
            "index": null 
          }, 
          "apiInfo": { 
            "apiFnChain": [ 
              "Selector('#carcontent > thead > tr')" 
            ], 
            "apiFnID": 0 
          }, 
          "boundArgs": { 
            "@t": "[[undefined]]", 
            "data": "" 
          }, 
          "customDOMProperties": { 
            "@t": "[[undefined]]", 
            "data": "" 
          }, 
          "customMethods": { 
            "@t": "[[undefined]]", 
            "data": "" 
          } 
        } 
      ], 
      "visibilityCheck": false, 
      "timeout": null, 
      "apiFnChain": [ 
        "Selector('#carcontent > thead > tr')" 
      ], 
      "index": 0 
    } 

Sat, 17 Nov 2018 12:18:46 GMT testcafe:test-run:HeadlessChrome 70.0.3538 / Linux 0.0.0:driver-message  
    { 
      "cmd": "ready", 
      "status": { 
        "id": "1321.0000000003674", 
        "isCommandResult": false, 
        "executionError": null, 
        "pageError": null, 
        "resent": false, 
        "result": null, 
        "consoleMessages": { 
          "log": [], 
          "info": [], 
          "warn": [], 
          "error": [] 
        } 
      }, 
      "disableResending": true, 
      "allowRejecting": true, 
      "sessionId": "VFkMpT0jt" 
    } 

Sat, 17 Nov 2018 12:18:47 GMT testcafe:test-run:HeadlessChrome 70.0.3538 / Linux 0.0.0:driver-message  
    { 
      "cmd": "ready", 
      "status": { 
        "id": "2834.2999999999847", 
        "isCommandResult": true, 
        "executionError": null, 
        "pageError": null, 
        "resent": false, 
        "result": [ 
          0 
        ], 
        "consoleMessages": { 
          "log": [], 
          "info": [], 
          "warn": [], 
          "error": [] 
        } 
      }, 
      "disableResending": true, 
      "allowRejecting": true, 
      "sessionId": "VFkMpT0jt" 
    } 

Sat, 17 Nov 2018 12:18:47 GMT testcafe:test-run:HeadlessChrome 70.0.3538 / Linux 0.0.0:command  
    { 
      "type": "test-done" 
    } 

Sat, 17 Nov 2018 12:18:47 GMT testcafe:test-run:HeadlessChrome 70.0.3538 / Linux 0.0.0:driver-message  
    { 
      "cmd": "ready", 
      "status": { 
        "id": "2856.6000000000713", 
        "isCommandResult": true, 
        "executionError": null, 
        "pageError": null, 
        "resent": false, 
        "result": null, 
        "consoleMessages": { 
          "log": [], 
          "info": [], 
          "warn": [], 
          "error": [] 
        } 
      }, 
      "disableResending": true, 
      "allowRejecting": true, 
      "sessionId": "VFkMpT0jt" 
    } 

 ✓ test google 


 1 passed (3s) 

[Container] 2018/11/17 12:18:49 Running command echo finished 
finished 

[Container] 2018/11/17 12:18:49 Phase complete: BUILD Success: true 
[Container] 2018/11/17 12:18:49 Phase context status code:  Message:  
[Container] 2018/11/17 12:18:49 Entering phase POST_BUILD 
[Container] 2018/11/17 12:18:49 Phase complete: POST_BUILD Success: true 
[Container] 2018/11/17 12:18:49 Phase context status code:  Message:  

Another point to note, 0.23.3-alpha.gh3114.1 (in fact all 3 versions) execute successfully when run locally within the docker image, with the hanging only occurring when run from the CodeBuild execution environment..

@grittershub
We prepared a build with a fix for you. Could you please check if it solves the issue? You can download it from the following link https://github.com/AndreyBelym/testcafe/releases/download/gh-3114-4/testcafe-0.23.3-alpha.gh3114.4.tgz

This appears to work perfectly. Thank you for this Alex.

@grittershub
The fix was published in [email protected].

Looks like I have the same problem with 0.23.3 when passing in an outStream to a reporter. Appears to be an order-of-operations issues here

this.outStream.end();

await new Promise(resolve => {
     this.outStream.once('finish', resolve);
     this.outStream.once('error', resolve);
});

If this.outStream.end() fires the finish event synchronously, the promise will never resolve. The once handler is not called for passed events.

The fix should be pretty straightforward; just create the promise before this.outStream.end()

const p = new Promise(resolve => {
     this.outStream.once('finish', resolve);
     this.outStream.once('error', resolve);
});

this.outStream.end();

await p;

@willscripted, the fix for the described problem is located in PR #3234.

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs or feature requests. For TestCafe API, usage and configuration inquiries, we recommend asking them on StackOverflow.

Was this page helpful?
0 / 5 - 0 ratings