Integrating Protractor to Octopus deployment (CI/CD Integration)



  • I have a batch file with below content:

    %1 %2 --params.validFile=%3 --params.invalidFile=%4
    
    <p>I am starting it through power shell script:</p>
    <pre class="lang-ps prettyprint-override"><code>    $path= "<filePath>\start.bat"
        $args= '"<filePath>\protractor" "<filepath>/conf.js" "<filepath>/invalidfile" "<filepath>/validfile"'
        Write-Host "Executing: " $path $args
        $process = Start-Process $path $args -RedirectStandardOutput stdout.txt" -RedirectStandardError "stderr.txt" -PassThru
        $process.WaitForExit()
        if ($process.ExitCode -eq 0){
          Write-Host "protractor cmdline complete"
          Exit 0
        } else {
          Write-Error "protractor cmdline failed"
          Exit 1
        }
    

    Note:

    • filepath is the absolute path
    • invalid and valid files are just parameters to the test

    Problem:

    On running this as part of octopus deployment, the logs shows the "protractor cmdline failed" printed, but the octopus step never ends. It keeps on going forever.

    Could someone help in knowing how to integrate protractor with octopus?



  • The issue was because the chromedriver was not exiting after test execution completes. This makes the octopus script to hang

    [https://github.com/angular/protractor/issues/4690][1]

    So the work around was to add directconnect to the conf.js

    exports.config = {
    
      directConnect: true,
    

    Also i fixed the powershell script as:

    $process = Start-Process -FilePath "$ProtractorPath" -ArgumentList $args -PassThru
    $process.WaitForExit()
    

    Where,

    $ProtractorPath= "<path>/protractor"
    $args= '"<path>/conf.js" --params.value="bla"'
    

    So now i am not executing protractor using batch file , but directly from powershell.



Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2