playwright icon indicating copy to clipboard operation
playwright copied to clipboard

Jenkins build is failing due to Timeout Error , when the backend service is auto deployed through a stage in the jenkins file.

Open moumita30 opened this issue 1 year ago • 3 comments

We have an apiautomation framework for a backend service written using Playwright with javascript. This framework was integrated with the Jenkins build pipeline , but the tests are failing with timeout issues when the backend service is auto deployed and hosted iin IIS server through a stage in the jenkins pipeline. Moreover, even if we increase the timeout in the config file to 60000, the message which is thrown in the console output in jenkins is showing 30secs as the timeout.

System info

  • Playwright Version:^1.31.2
  • Operating System: [ Windows 11]
  • Browser: Not applicable
  • Other info:

Source code

Jenkins File : // Global defaults def DEFAULT_BRANCH = 'develop' def RUN_DEPLOYMENT = true def RUN_PERFORMANCE_TEST = true def RUN_API_TEST = true

pipeline { agent { label 'rdv-008568.hylandqa.net' }

parameters {
  string(name: 'DEPLOY_BRANCH_NAME', defaultValue: "${DEFAULT_BRANCH}", description: 'Which Branch to run the deployment against?')
  booleanParam(name: 'IS_DEPLOY', defaultValue: "${RUN_DEPLOYMENT}", description: 'Do You want to IIS DEPLOYMENT?')
  booleanParam(name: 'IS_PERF', defaultValue: "${RUN_PERFORMANCE_TEST}", description: 'Do You want to run performance tests against?')
  booleanParam(name: 'IS_API', defaultValue: "${RUN_API_TEST}", description: 'Do You want to run API tests against?')
}
triggers {
  // cron('H H(0-7) * * 5')   // Run every Thursday between 12AM - 7:59AM UTC
   cron('30 14 * * 2')
}
options {
  timeout(time: 2, unit: 'HOURS') // Build timeout set to 2 hour
  buildDiscarder(logRotator(numToKeepStr: '10', artifactNumToKeepStr: '10'))
}

stages { stage('Download unzip Copy Artifacts') { when { expression { return params.IS_DEPLOY } } steps { powershell 'iisreset /stop' sh "curl -O https://rd.jenkins.hylandqa.net/job/IBPA%20-%20Verticals%20Commercials/job/hyland-verticals-efm-api/job/develop/lastSuccessfulBuild/artifact/artifacts/HCMISBE.zip" unzip zipFile: 'HCMISBE.zip', dir: 'archive' } }

    stage('Unzip main bundle') {
        when { expression { return params.IS_DEPLOY } }
        steps {
          script { 
               echo "Starting Unzipping main bundle ..." 
               powershell "Expand-Archive -Path '${workspace}//HCMISBE.Zip' -DestinationPath '${workspace}//HCMISBEService' -Force -Verbose"
            }   
        }
    }

    stage('Deploy to IIS') {
        when { expression { return params.IS_DEPLOY } }
        steps {
          script {
               dir("${workspace}") {
                  echo "Removing old files with new ones ... "
                  sh 'rm -rf /c/inetpub/wwwroot/hcmisbe_api' 
                  sh 'cp -r HCMISBEService /c/inetpub/wwwroot/hcmisbe_api'

                  powershell 'Remove-Item "c://inetpub//wwwroot//hcmisbe_api//appsettings.json" -Force -Recurse'

                  powershell 'Copy-Item -Path "c://backup//appsettings.json" -Destination "c://inetpub//wwwroot//hcmisbe_api//" -recurse -Force -Verbose'
                  powershell 'iisreset /start'
                  
              }
           }     
        }
	    }

    stage('Remove Artifacts') {
        when { expression { return params.IS_DEPLOY } }
        steps {
          script {
              powershell "Remove-Item '${workspace}//archive//' -Force -Recurse"
           }     
        }
	    }
  stage('run npm Installation') {
      steps {
          echo "Installing dependencies"
          bat 'npm install'
      }
    }
  
  stage('install Playwright') {
      steps {
          echo "Downloading playwright ... "
          bat 'npm init playwright@latest'
      }
   }
  /*stage('install browsers') {
      //steps {
         // echo "Installing dependencies"
         // bat 'npx playwright install'
     // } 
  // }
  //stage('run Regression tests ') {
      //steps {
         // echo "Starting E2E Regression tests ... "
         // bat 'npm run ConfigAppRegressionTestCases'
     // }
   //}
  stage('run smoke tests ') {
      steps {
          echo "Starting E2E Smoke tests ... "
          bat 'npm run ConfigAppSmokeTestCases'
      }
   }*/
   stage('run HCM-API tests') {
      steps { 
          powershell "New-Item -ItemType Directory -Force -Path '${workspace}//apireports'"
          echo "Starting HCM API tests ... "
          bat 'npm run HFW_HCM_APItests '
      }
   }
   stage('run FIN-API tests') {
      steps {
          echo "Starting FIN API tests ... "
          bat 'npm run HFW_FIN_APItests '
      }
   }

} post { always { // Publish e2e test report publishHTML (target: [ allowMissing: true, alwaysLinkToLastBuild: false, keepAll: true, reportDir: 'apireports', reportFiles: 'index.html', reportName: "API Test Report" ]) } } }

Link to the GitHub repository with the repro

or

Config file

// playwright.config.ts
// @ts-check
const { defineConfig, devices } = require('@playwright/test');


require('dotenv').config({ path: `.env.${process.env.ENVIRONMENT}` });


/**
 * Read environment variables from file.
 * https://github.com/motdotla/dotenv
 */
// require('dotenv').config();

/**
 * @see https://playwright.dev/docs/test-configuration
 */
module.exports = defineConfig({
  //testDir: 'tests',
  testMatch: /.*.js/ ,
  /* Maximum time one test can run for. */
  timeout: 5 *60* 1000,
  retries: 0,
  expect: {
    /**
     * Maximum time expect() should wait for the condition to be met.
     * For example in `await expect(locator).toHaveText();`
     */
    timeout: 5000
  },
  /* Run tests in files in parallel */
  fullyParallel: true,
  /* Fail the build on CI if you accidentally left test.only in the source code. */
  forbidOnly: !!process.env.CI,
  /* Retry on CI only */
  globalSetup: require.resolve('./global-setup'),
 
  //process.env.CI ? 2 : 0,
  /* Opt out of parallel tests on CI. */
  workers: process.env.CI ? 1 : undefined,
  /* Reporter to use. See https://playwright.dev/docs/test-reporters */
  reporter: 'html',
  /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
  use: {
    /* Maximum time each action such as `click()` can take. Defaults to 0 (no limit). */
    actionTimeout: 0,
    /* Base URL to use in actions like `await page.goto('/')`. */
    // baseURL: 'http://localhost:3000',
    browserName :'chromium',
    trace : 'on',
    headless: false,    /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
    baseURL: 'https://hylandforworkdayextend.hyland.com/hcmisbe',
    //baseURL: 'https://hylandwdpublic.hyland.com/efm-api-qa',
    //extraHTTPHeaders: {
    // "Authorization": "Bearer eyJhbGciOiJSUzI1NiIsImtpZCI6IkRDMzM5NjYzNjUwMjNBMzY3NzQ4RTM2RkVGNjFCNTJBMDdCQTk3MDEiLCJ0eXAiOiJhdCtqd3QiLCJ4NXQiOiIzRE9XWTJVQ09qWjNTT052NzJHMUtnZTZsd0UifQ.eyJuYmYiOjE2ODE4MDUxODIsImV4cCI6MTgyNTgwNTE4MiwiaXNzIjoiaHR0cHM6Ly9oeWxhbmR3ZHB1YmxpYy5oeWxhbmQuY29tL2lkZW50aXR5cHJvdmlkZXIiLCJhdWQiOlsiaHR0cHM6Ly9oeWxhbmR3ZHB1YmxpYy5oeWxhbmQuY29tL2lkZW50aXR5cHJvdmlkZXIvcmVzb3VyY2VzIiwiZWZtIiwiZ3JvdXAiXSwiY2xpZW50X2lkIjoiNDljNTg5NTMtYmRjYS00NThjLTgxNTQtOGY0NzA4YTQ2ZmYyIiwic3ViIjoiMiIsImF1dGhfdGltZSI6MTY4MTgwNTE4MiwiaWRwIjoibG9jYWwiLCJ1c2VybmFtZSI6Ik1BTkFHRVIiLCJncm91cCI6WyJoZncuZmluX2FkbWluIiwiaGZ3LmhjbV9hZG1pbiIsImhmdy5oY21fZW1wbG95ZWUiLCJoc2YuZW1wbG95ZWUiLCJoc2YuaHJfYWRtaW4iLCJNQU5BR0VSIl0sInRlbmFudCI6Ik9uQmFzZSIsInNjb3BlIjpbImVmbSIsImdyb3VwIl0sImFtciI6WyJwd2QiXX0.kPyRkh9np5OrdZIOmK_o4a1ioui67USl7PP_qAS6RCKDZerHllgtUmywiRaxVm0VupaWa-08oLtfnHLLn7PMBdx06B6DzGLKp15zRHvenXSgbuJ8tXz7XKY7-0F2-lsBxzkboet6sw4QL3WgTQpjFMkwnTYdCDGf7qG-2_P21ZQWAVR18rrkVeYA-122Ds-2hwcImRFEY09QJlRkxpuQy9xyUZ2BZmu2ZYGuH5tdmZ45PUiiLPdThOWmhQOIOmh45S1u2cRp26tnLuQHsWl3ELlCdXjAAo9YXPytVmC_OWN59WV4Ch6PMd0Aax0S_OhUNLk7TlTPbnn7nRY5dksXnA"
   //},
  },

  /* Configure projects for major browsers */
  
    
    /* Test against mobile viewports. */
    // {
    //   name: 'Mobile Chrome',
    //   use: { ...devices['Pixel 5'] },
    // },
    // {
    //   name: 'Mobile Safari',
    //   use: { ...devices['iPhone 12'] },
    // },

    /* Test against branded browsers. */
    // {
    //   name: 'Microsoft Edge',
    //   use: { channel: 'msedge' },
    // },
    // {
    //   name: 'Google Chrome',
    //   use: { channel: 'chrome' },
    // },
  

  /* Folder for test artifacts such as screenshots, videos, traces, etc. */
  // outputDir: 'test-results/',

  /* Run your local dev server before starting the tests */
  // webServer: {
  //   command: 'npm run start',
  //   port: 3000,
  // },
});


**Test file (self-contained)**

const {test, expect} = require('@playwright/test');
import exp from "constants";
import fs from "fs";
import { request } from "http";
import path from "path";

test.describe.configure({mode:'serial'});


test("GET: fetch Document Attribute Group",async({request , baseURL}) =>{

    const response = await request.get(`${baseURL}/configuration/document-attribute-groups`,{
        headers: {
            'Accept': "*/*",
            'Authorization': `Bearer ${process.env.TOKEN}`
          }
    });
     expect(response.status()).toBe(200);
     const responsebody = await response.json();
     console.log('Logging response', +responsebody);
     const getEmployeeRelatedDocuments = responsebody.data[0].id;
     request.storageState.getEmployeeRelatedDocuments = getEmployeeRelatedDocuments ; 
     console.log(getEmployeeRelatedDocuments);
}); 
test("GET: Fetch keywords for employee related Documents",async({request , baseURL}) =>{
    const response = await request.get(`${baseURL}/configuration/document-attribute-groups/${request.storageState.getEmployeeRelatedDocuments}`,{
        headers:{
            'Accept': "*/*",
            'Authorization': `Bearer ${process.env.TOKEN}`
        }
    });
    expect(response.status()).toBe(200);
    const responsebody = await response.json();
    expect (responsebody.total).toBeGreaterThan(0);

});
test("GET: Fetch dynamic columns",async({request , baseURL}) =>{
    const response = await request.get(`${baseURL}/configuration/document-attribute-groups/${request.storageState.getEmployeeRelatedDocuments}/`,{
        headers:{
            'Accept': "*/*",
            'Authorization': `Bearer ${process.env.TOKEN}`
        }
    },
    {
        params:{
            "retrieveSavedColumnsOnly" : 'false',
            "businessObjectType": 'employee',
        }
        
    });
    expect(response.status()).toBe(200); 
    const responsebody = await response.json();
    expect (responsebody.total).toBeGreaterThan(0);
});
test("POST: HFW Configuration", async ({ request, baseURL}) => {
    
    const response = await request.post(`${baseURL}/configuration`, {
        headers:{
            'Authorization': `Bearer ${process.env.TOKEN}`,
            'Content-Type': "application/json",
            'Accept': "*/*"

            
        },
      data: {
        "items": [
            {
        "recordCode": "WORKDAY",
        "configKey": "imagePreview.employee",
        "configValue": "[{\"sectionName\":\"thumbnail\",\"ImageScalingParameters\":{\"Height\":400,\"Width\":400}},{\"sectionName\":\"captureSuccessPreview\",\"ImageScalingParameters\":{\"Height\":700,\"Width\":700}}]",
        "mediaType": "application/json",
        "categoryName": "hfw"
    },
    {
        "recordCode": "ECM",
        "configKey": "dynamicColumn.employee",
        "configValue": "{\"dynamicColumns\":[{\"dataField\":\"simpleDocumentAttributes.Employee Object ID.value\",\"name\":\"Employee Object ID\",\"alias\":\"\",\"id\":\"Employee Object ID\",\"type\":\"string\"},{\"dataField\":\"simpleDocumentAttributes.Employee ID.value\",\"name\":\"Employee ID\",\"alias\":\"\",\"id\":\"Employee ID\",\"type\":\"string\"},{\"dataField\":\"simpleDocumentAttributes.First Name.value\",\"name\":\"First Name\",\"alias\":\"FName\",\"id\":\"First Name\",\"type\":\"string\"},{\"dataField\":\"simpleDocumentAttributes.Last Name.value\",\"name\":\"Last Name\",\"alias\":\"LName\",\"id\":\"Last Name\",\"type\":\"string\"},{\"dataField\":\"simpleDocumentAttributes.Hire Date.value\",\"name\":\"Hire Date\",\"alias\":\"\",\"id\":\"Hire Date\",\"type\":\"string\"},{\"dataField\":\"simpleDocumentAttributes.Manager.value\",\"name\":\"Manager\",\"alias\":\"\",\"id\":\"Manager\",\"type\":\"string\"},{\"dataField\":\"simpleDocumentAttributes.Department.value\",\"name\":\"Department\",\"alias\":\"\",\"id\":\"Department\",\"type\":\"string\"},{\"dataField\":\"simpleDocumentAttributes.Employee Top Skill.value\",\"name\":\"Employee Top Skill\",\"alias\":\"\",\"id\":\"Employee Top Skill\",\"type\":\"string\"},{\"dataField\":\"simpleDocumentAttributes.Applying Position.value\",\"name\":\"Applying Position\",\"alias\":\"\",\"id\":\"Applying Position\",\"type\":\"string\"},{\"dataField\":\"simpleDocumentAttributes.File Preview.value\",\"name\":\"File Preview\",\"alias\":\"Preview\",\"id\":\"filePreview\",\"type\":\"image\"},{\"dataField\":\"simpleDocumentAttributes.Document Link.value\",\"name\":\"Document Link\",\"alias\":\"Link\",\"id\":\"documentLink\",\"type\":\"externalLink\"}]}",
        "mediaType": "application/json",
        "categoryName": "hfw"
    },
    {
        "recordCode": "COMMON",
        "configKey": "fieldMap.employee",
        "configValue": "[{\"BuisnessObjectAttribute\":\"Employee Object ID\",\"DocumentAttribute\":{\"Name\":\"Employee Object ID\",\"Id\":\"161\"}},{\"BuisnessObjectAttribute\":\"Employee ID\",\"DocumentAttribute\":{\"Name\":\"Employee ID\",\"Id\":\"162\"}},{\"BuisnessObjectAttribute\":\"First Name\",\"DocumentAttribute\":{\"Name\":\"First Name\",\"Id\":\"163\"}},{\"BuisnessObjectAttribute\":\"Last Name\",\"DocumentAttribute\":{\"Name\":\"Last Name\",\"Id\":\"164\"}},{\"BuisnessObjectAttribute\":\"Hire Date\",\"DocumentAttribute\":{\"Name\":\"Hire Date\",\"Id\":\"165\"}},{\"BuisnessObjectAttribute\":\"Termination Date\",\"DocumentAttribute\":{\"Name\":\"Termination Date\",\"Id\":\"166\"}},{\"BuisnessObjectAttribute\":\"Department\",\"DocumentAttribute\":{\"Name\":\"Department\",\"Id\":\"167\"}},{\"BuisnessObjectAttribute\":\"Manager Name\",\"DocumentAttribute\":{\"Name\":\"Manager\",\"Id\":\"168\"}},{\"BuisnessObjectAttribute\":\"Designation\",\"DocumentAttribute\":{\"Name\":\"Description\",\"Id\":\"1\"}}]",
        "mediaType": "application/json",
        "categoryName": "hfw"
    },
    {
        "recordCode": "COMMON",
        "configKey": "docSearchQueryConfig.employee",
        "configValue": "{\"DocumentCreationDateRange\":{\"StartDate\":\"2023-04-12\",\"EndDate\":\"Today\"},\"DocumentAttributeGroupId\":\"101\",\"BusinessObjectIdMetadataId\":\"161\"}",
        "mediaType": "application/json",
        "categoryName": "hfw"
    },
    {
        "recordCode": "COMMON",
        "configKey": "domainMapping.employee",
        "configValue": "[{\"DomainName\":\"HCM\",\"DocumentTypeGroup\":{\"Name\":\"Employee Documents\",\"Id\":\"101\"}}]",
        "mediaType": "application/json",
        "categoryName": "hfw"
    },
    {
        "configKey": "boRoles.employee",
        "mediaType": "application/json",
        "recordCode": "WORKDAY",
        "configValue": "[{\"roleId\":\"hrpartner\",\"documentAccessPermitted\":true,\"roleName\":\"HRPartner\"},{\"roleId\":\"manager\",\"documentAccessPermitted\":true,\"roleName\":\"Manager\"},{\"roleId\":\"hrbp\",\"documentAccessPermitted\":true,\"roleName\":\"HRBusinessPartner\"}]",
        "categoryName": "hfw"
    }
    
        ]
    } , 
    });
    expect(response.status()).toBe(200);
    const responsebody = await response.json();
    expect(responsebody.data).toBe(true);
   
    
});
test("GET: Fetch HFW Configuration", async ({ request, baseURL}) => {

    const response = await request.get(`${baseURL}/configuration`,{
        headers: {
            'Accept': "*/*",
            'Authorization': `Bearer ${process.env.TOKEN}`
        },
    params:{
         'businessObjectType':'employee'
     }
    });
    expect(response.status()).toBe(200);
    const responsebody = await response.json();
    console.log(responsebody);
    
 })
 test("GET: Fetch the DocumentViewerURI", async({request, baseURL})=>{
     
    const response = await request.get(`${baseURL}/configuration/documentViewerUri`,{
        headers:{
            'Accept': "*/*",
            'Authorization': `Bearer ${process.env.TOKEN}`
        }
    });
    expect(response.status()).toBe(200);
    const responsebody = await response.json();
    console.log(responsebody.data);

})
test("GET: Fetch Document Type Groups", async({request, baseURL})=>{

    const response = await request.get(`${baseURL}/document-capture/document-type-groups`,{
        headers: {
            'Accept': "*/*",
            'Authorization': `Bearer ${process.env.TOKEN}`
        }
    });
    expect(response.status()).toBe(200);
    const responsebody = await response.json();
    const employeeDocuments = responsebody.data[0].id;
    console.log(employeeDocuments);
    request.storageState.employeeDocuments = employeeDocuments;
});
test("GET: Fetch Document Types for a DocumentTypeGroup", async({request,baseURL})=>{
    
    
    const response = await request.get(`${baseURL}/document-capture/document-types`,{
        headers:{
            'Accept': "*/*",
            'Authorization': `Bearer ${process.env.TOKEN}`
        },
    
        params:{
            'documentTypeGroupId': request.storageState.employeeDocuments 
        }
    });
    expect(response.status()).toBe(200);
    const responsebody = await response.json();
   const offerLetterDocTypeID = responsebody.data[2].id;
   request.storageState.offerLetterDocTypeID =offerLetterDocTypeID;
   //const newHireCheckListDocTypeID = responsebody.data[1].id;
  // request.storageState.newHireCheckListDocTypeID  = newHireCheckListDocTypeID;
})
test ("GET: Fetch Default attribute for Employee DocType:offerLetter", async({request,baseURL})=> {

    
    const response = await request.post(`${baseURL}/document-capture/document-types/${request.storageState.offerLetterDocTypeID}/default-attributes`,{
        headers: {
            'Accept': "*/*",
            'Content-Type': "application/json",
            'Authorization': `Bearer ${process.env.TOKEN}`
          },
          data: {
            
                "businessObjectType": "employee",
                "singleValuedBusinessObjectAttributes": [
                    {
                        "name": "Employee Object ID",
                        "value": "d7b4ce0ca31d41c29281e48a9bc52998",
                        "dataType": null,
                        "currency": null,
                        "dateFormat": null
                    },
                    {
                        "name": "Employee ID",
                        "value": "21187",
                        "dataType": null,
                        "currency": null,
                        "dateFormat": null
                    },
                    {
                        "name": "First Name",
                        "value": "Fernando",
                        "dataType": null,
                        "currency": null,
                        "dateFormat": null
                    },
                    {
                        "name": "Last Name",
                        "value": "Díaz",
                        "dataType": null,
                        "currency": null,
                        "dateFormat": null
                    },
                    {
                        "name": "Hire Date",
                        "value": "2000-01-01",
                        "dataType": null,
                        "currency": null,
                        "dateFormat": null
                    },
                    {
                        "name": "Termination Date",
                        "value": null,
                        "dataType": null,
                        "currency": null,
                        "dateFormat": null
                    },
                    {
                        "name": "Department",
                        "value": "Network & Telecom Department",
                        "dataType": null,
                        "currency": null,
                        "dateFormat": null
                    },
                    {
                        "name": "Manager Name",
                        "value": "Julie Bowles",
                        "dataType": null,
                        "currency": null,
                        "dateFormat": null
                    }
                ]
            }
          });
    expect(response.status()).toBe(200);
    const responsebody = await response.json();
    console.log(responsebody);

})
test("POST: capture a Employee Document with a valid FileType", async({request,baseURL})=>{

    const filelocation = path.resolve("lib/", "img1.jpg");
    const fileName = fs.createReadStream(filelocation);

    const response = await request.post(`${baseURL}/document-capture/documents`, {
        headers: {
            'Accept': "*/*",
            'Authorization': `Bearer ${process.env.TOKEN}`
          },
          multipart: {
            file: fileName,
            captureData: '{"documentType": {"id": "118"},"businessObjectAttributes": [{"Id": "161","Name": "Employee Object ID","Value": "d7b4ce0ca31d41c29281e48a9bc52998","DataType": "string","Currency": null,"DateFormat": null},{"Id": "162","Name": "Employee ID","Value": "21187","DataType": "string","Currency": null,"DateFormat": null},{"Id": "163","Name": "First Name","Value": "Fernando","DataType": "string","Currency": null,"DateFormat": null},{"Id": "164","Name": "Last Name","Value": "Díaz","DataType": "string","Currency": null,"DateFormat": null},{"Id": "165","Name": "Hire Date","Value": null,"DataType": "date","Currency": null,"DateFormat": null},{"Id": "166","Name": "Termination Date","Value": null,"DataType": "date","Currency": null,"DateFormat": null},{"Id": "167","Name": "Department","Value": "Network & Telecom department","DataType": "string","Currency": null,"DateFormat": null},{"Id": "168","Name": "Manager","Value": "Julie Bowles","DataType": "string","Currency": null,"DateFormat": null},{"Id": "171","Name": "Compensation","Value": "1000","DataType": "string","Currency": null,"DateFormat": null},{"Id": "2","Name": "File Name","Value": null,"DataType": "string","Currency": null,"DateFormat": null}]}'
                    
        }
         });
       expect(response.status()).toBe(200);
       const responsebody = await response.json();
       const capturedDocumentID = responsebody.data.documentId;
       console.log(capturedDocumentID);
       request.storageState.capturedDocumentID =capturedDocumentID;
});
test("POST: capture a Employee Document with an invalid FileType", async({request,baseURL})=>{

    const filelocation = path.resolve("lib/", "test_invalid_file.xlsx");
    const fileName = fs.createReadStream(filelocation);
    const response = await request.post(`${baseURL}/document-capture/documents`, {
        headers: {
            'Accept': "*/*",
            'Authorization': `Bearer ${process.env.TOKEN}`
            
          },
          multipart: {
            file: fileName,
            captureData: '{"documentType": {"id": "118"},"businessObjectAttributes": [{"Id": "161","Name": "Employee Object ID","Value": "d7b4ce0ca31d41c29281e48a9bc52998","DataType": "string","Currency": null,"DateFormat": null},{"Id": "162","Name": "Employee ID","Value": "21187","DataType": "string","Currency": null,"DateFormat": null},{"Id": "163","Name": "First Name","Value": "Fernando","DataType": "string","Currency": null,"DateFormat": null},{"Id": "164","Name": "Last Name","Value": "Díaz","DataType": "string","Currency": null,"DateFormat": null},{"Id": "165","Name": "Hire Date","Value": null,"DataType": "date","Currency": null,"DateFormat": null},{"Id": "166","Name": "Termination Date","Value": null,"DataType": "date","Currency": null,"DateFormat": null},{"Id": "167","Name": "Department","Value": "Network & Telecom department","DataType": "string","Currency": null,"DateFormat": null},{"Id": "168","Name": "Manager","Value": "Julie Bowles","DataType": "string","Currency": null,"DateFormat": null},{"Id": "171","Name": "Compensation","Value": "1000","DataType": "string","Currency": null,"DateFormat": null},{"Id": "2","Name": "File Name","Value": null,"DataType": "string","Currency": null,"DateFormat": null}]}'
                    
        }
        
       });
       expect(response.status()).toBe(400);
       const responsebody = await response.json();
       console.log(responsebody);
});
test("POST: capture a Employee Document with no file attached", async({request,baseURL})=>{

    const filelocation = path.resolve("lib/", "DSC7400.JPG");
    const fileName = fs.createReadStream(filelocation);
    const response = await request.post(`${baseURL}/document-capture/documents`, {
        headers: {
            'Accept': "*/*",
            'Authorization': `Bearer ${process.env.TOKEN}`
             },
             multipart: {
                file: "",
                captureData: '{"documentType": {"id": "118"},"businessObjectAttributes": [{"Id": "161","Name": "Employee Object ID","Value": "d7b4ce0ca31d41c29281e48a9bc52998","DataType": "string","Currency": null,"DateFormat": null},{"Id": "162","Name": "Employee ID","Value": "21187","DataType": "string","Currency": null,"DateFormat": null},{"Id": "163","Name": "First Name","Value": "Fernando","DataType": "string","Currency": null,"DateFormat": null},{"Id": "164","Name": "Last Name","Value": "Díaz","DataType": "string","Currency": null,"DateFormat": null},{"Id": "165","Name": "Hire Date","Value": null,"DataType": "date","Currency": null,"DateFormat": null},{"Id": "166","Name": "Termination Date","Value": null,"DataType": "date","Currency": null,"DateFormat": null},{"Id": "167","Name": "Department","Value": "Network & Telecom department","DataType": "string","Currency": null,"DateFormat": null},{"Id": "168","Name": "Manager","Value": "Julie Bowles","DataType": "string","Currency": null,"DateFormat": null},{"Id": "171","Name": "Compensation","Value": "1000","DataType": "string","Currency": null,"DateFormat": null},{"Id": "2","Name": "File Name","Value": null,"DataType": "string","Currency": null,"DateFormat": null}]}'
                        
            }
        
       });
       expect.soft(response.status()).toBe(400);
       const responsebody = await response.json();
       console.log(responsebody);
});
test ("GET: File Preview", async({request,baseURL})=> {

    const response = await request.get(`${baseURL}/documents/${request.storageState.capturedDocumentID}/file-preview`,{

        headers: {
            'Accept': "*/*",
            'Authorization': `Bearer ${process.env.TOKEN}`
        },
          params :{
            'pageNumber' : 1,
             'renditionType': 'captureSuccessPreview',
             'businessObjectType': 'employee'
        }
    });
    expect(response.status()).toBe(200);
});

test ("GET: Fetch related documents for Employee BusinessObject",async({request,baseURL})=>{

    const employeeBusinessObjectID = '3aa5550b7fe348b98d7b5741afc65534';
    const response = await request.get(`${baseURL}/business-objects/${employeeBusinessObjectID}/documents`,{
        headers: {
            'Accept': "*/*",
            'Authorization': `Bearer ${process.env.TOKEN}`
        },
         params:{
            'businessObjectType':'employee',
            'offset': 0,
            'limit': 10,
            'maxResults': 10
        }
        
    });
   expect(response.status()).toBe(200);
   
   const responsebody = await response.json();
   })
test("GET : Authorization Status",async({request,baseURL})=>{
    const response = await request.get(`${baseURL}/authorization-status`,{
        headers: {
            'Accept': "*/*",
            'Authorization': `Bearer ${process.env.TOKEN}`
        }
    });
    expect (response.status()).toBe(200);
    expect(response.ok()).toBeTruthy();
})

Can you please help to handle this timeout issue? Also I would like to kno whow we can increase the timeout from the default timeout which is 30 seconds..

moumita30 avatar May 17 '23 10:05 moumita30

@moumita30 You can learn about different timeouts in this guide.

Unfortunately, we are not Jenkins or IIS experts, so we are not able to help with the Jenkins issue. If your tests do not work on your local computer, we can take a look.

dgozman avatar May 17 '23 19:05 dgozman

@dgozman Thanks for your reply. Even if I am running the tests from my local computer, encountering the timeout issue. Timeout issue is fine, but the thing is ,even if I put timeout more than 30seconds, the tests are failing after 30 seconds only. My doubt is, whether it is considering the timeout mentioned in the config file as well individual test level..If you have a look at the configuration file , the timeout is mentioned as timeout: 5 60 1000,. Also at individual test level I have mentioned the timeout as test.setTimeout(120000);

Unable to understand what I am doing wrong here..

moumita30 avatar May 18 '23 11:05 moumita30

@moumita30 timeout in the config looks good and should work as expected. What does the error look like?

dgozman avatar May 18 '23 14:05 dgozman

Closing because we lack the information to act on this issue. If you can provide a full repro, please file a new issue by filling the "Bug Report" template, and link to this one.

dgozman avatar May 22 '23 15:05 dgozman