1

I have one problem when I'm running lambda tests from Azure DevOps pipeline.

I've written tests in testcafe and they work locally with 100% percentage of succeeding test cases.

I've tried with different browsers locally by specifying command for example for Microsoft Edge in cmd :

npx testcafe "lambdatest:MicrosoftEdge@91.0:Windows 10" "e2e-testcafe/regression" -c 1 -q -e --browser-init-timeout 180000.

It works perfectly.

When I want to include the tasks on azure pipelines, tunnel is successfully initiated but there is some weird error regarding unhandled promise rejections.

pool:
  name: Azure Pipelines
steps:
- task: NodeTool@0
  displayName: 'Use Node 16.15.0'
  inputs:
    versionSpec: 16.15.0

- script: 'npm install'
  workingDirectory: 'test-main'
  displayName: 'Install Testcafe'

- task: Npm@1
  displayName: 'npm custom'
  inputs:
    command: custom
    workingDir: 'test-main'
    verbose: false
    customCommand: 'install node-lambda -g'

- task: Npm@1
  displayName: 'npm custom testcafe'
  inputs:
    command: custom
    workingDir: 'test-main'
    verbose: false
    customCommand: 'install testcafe -g'

- script: 'npx testcafe "lambdatest:MicrosoftEdge@91.0:Windows 10" "e2e-testcafe/regression" -c 1 -q -e --browser-init-timeout 180000'
  workingDirectory: 'test-main/src'
  displayName: 'Run Lambda Edge'
  env:
    LT_USERNAME: //my username
    LT_ACCESS_KEY: $(LT_ACCESS_KEY)
    LT_CONSOLE: true
    LT_NETWORK: true
    LT_VIDEO: true
    LT_SCREENSHOT: true

The output I'm getting is some weird kind of error with permission not being handled properly, and all tests fail 6/6, here is some response I'm getting:

Successfully auth

× Check application links

    • Error in fixture.beforeEach hook - Unhandled promise rejection:

    Error: Cannot pipe, not readable at new NodeError (node:internal/errors:372:5) at ServerResponse.pipe (node:_http_outgoing:991:22) at Object.respondOnWebSocket

(D:\a\1\s\test-main\node_modules\testcafe-hammerhead\lib\request-pipeline\websocket.js:39:9) at Array.decideOnProcessingStrategy

(D:\a\1\s\test-main\node_modules\testcafe-hammerhead\lib\request-pipeline\stages.js:75:25) at Object.run

(D:\a\1\s\test-main\node_modules\testcafe-hammerhead\lib\request-pipeline\index.js:19:34) at runMicrotasks () at processTicksAndRejections (node:internal/process/task_queues:96:5)

  Browser: Microsoft Edge 91.0.864.41 / Windows 10 (
  × Check navigation rules
    • Error in fixture.beforeEach hook - Unhandled promise rejection:

    Error: Cannot pipe, not readable at new NodeError (node:internal/errors:372:5) at ServerResponse.pipe (node:_http_outgoing:991:22) at Object.respondOnWebSocket

(D:\a\1\s\test-main\node_modules\testcafe-hammerhead\lib\request-pipeline\websocket.js:39:9) at Array.decideOnProcessingStrategy

(D:\a\1\s\test-main\node_modules\testcafe-hammerhead\lib\request-pipeline\stages.js:75:25) at Object.run

(D:\a\1\s\test-main\node_modules\testcafe-hammerhead\lib\request-pipeline\index.js:19:34) at runMicrotasks () at processTicksAndRejections (node:internal/process/task_queues:96:5)

  Browser: Microsoft Edge 91.0.864.41 / Windows 10 (

Do you know by any chance what is going on with this ? I've also tried pipeline with simple e2e tasks and they work as expected.

Any help is appreciated.

Manoj Choudhari
  • 5,277
  • 2
  • 26
  • 37
newnick988888
  • 107
  • 13

2 Answers2

1

I was facing similar issues. The testcafe lambda run was successful on local, but in Azure DevOps it was failing due to some pipe errors.

If you have any other lambda tests variables apart from LT_USERNAME and LT_ACCESS_KEY (like LT_NETWORK, LT_SNAPSHOT, etc.), then try to remove those variables.

Removing those extra environment variables helped in my case. Hope it helps you too !

I know this answer does not provide the root cause, but it should most probably fix the issue that you are facing.

Manoj Choudhari
  • 5,277
  • 2
  • 26
  • 37
0

It looks like the issue occurs in the 'http' module of Node.js. Please share an example with which it's possible to reproduce the issue so that I can check whether this assumption is correct. If you can make such an example, please create an issue in the TestCafe GitHub repository and attach your example to it.

mlosev
  • 5,130
  • 1
  • 19
  • 31
  • Hey I've uploaded sample of the project that runs e2e and lambdas. E2e works as expected and lambda when you run it locally. However the problem is from lambdas throwing error when being run on azure devs. Here is the repo -> https://github.com/testcafetest4321/testcafe321 – newnick988888 May 21 '22 at 18:19
  • I cloned this repository and ran the e2e npm command a few times. The tests are green. Could you please record a video showing how you run the tests? – mlosev May 23 '22 at 06:51
  • 1
    The problem is that LT_NETWORK is giving that issue when it's value is set to true. I don't know why exactly. – newnick988888 May 23 '22 at 16:53