Skip to content

Commit

Permalink
Fixing user agent handling bug
Browse files Browse the repository at this point in the history
  • Loading branch information
PicoCreator committed Jun 8, 2022
1 parent d96f800 commit eab3bd8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
3 changes: 3 additions & 0 deletions src/api/SpaceAndProjectApi.js
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,9 @@ class SpaceAndProjectApi {
height: height,
cli: 1
};
if( testParams.userAgent != null && testParams.userAgent.length >= 1 ) {
reqObj.userAgent = testParams.userAgent;
}
if( dataSetID != null ) {
reqObj["environmentId"] = dataSetID;
} else {
Expand Down
16 changes: 10 additions & 6 deletions src/cli-command/project/run.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ class TestRunnerSession {

// Script path and browser settings
let scriptPath = argv["script-path"];
let userAgent = argv.userAgent || null;
let browser = argv.browser || "chrome";
let width = argv.width || 1280;
let height = argv.height || 960;
Expand Down Expand Up @@ -215,6 +216,7 @@ class TestRunnerSession {
this.height = height;
this.region = region;
this.dataSet = dataSet;
this.userAgent = userAgent;
this.startTimeout = startTimeout;
this.startTimeout_sec = startTimeout_sec;
this.startTimeout_ms = startTimeout_ms;
Expand Down Expand Up @@ -259,6 +261,12 @@ class TestRunnerSession {
`> Test Dir: ${this.testCodeDir}`
)
}
// Custom UA
if( this.userAgent != null ) {
OutputHandler.standardGreen(
`> User Agent: ${this.userAgent}`
)
}
OutputHandler.standardGreen(">")
}

Expand Down Expand Up @@ -331,13 +339,9 @@ class TestRunnerSession {
region: this.region,
dataSetID: this.dataSetID,
data: this.dataObject,
secretData: this.secretObject
secretData: this.secretObject,
userAgent: this.userAgent
};

// User agent support
if( this.userAgent != null && this.userAgent != "" && this.userAgent.length > 2 ) {
startRequestParams.userAgent = this.userAgent;
}

// Start the test
let result = await SpaceAndProjectApi.startProjectTest( //
Expand Down

0 comments on commit eab3bd8

Please sign in to comment.