testinglambdaazure-pipelinestestcafee2e

Lambda tests not working on azure devops pipeline


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.


Solution

  • 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.