Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@lambdatest/smartui-cli",
"version": "4.1.45",
"version": "4.1.46",
"description": "A command line interface (CLI) to run SmartUI tests on LambdaTest",
"files": [
"dist/**/*"
Expand Down
1 change: 1 addition & 0 deletions src/commander/commander.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ program
.option('--baselineBranch <string>', 'Mark this build baseline')
.option('--baselineBuild <string>', 'Mark this build baseline')
.option('--githubURL <string>', 'GitHub URL including commitId')
.option('--gitURL <string>', 'Git URL including commitId')
.option('--userName <string>', 'Specify the LT username')
.option('--accessKey <string>', 'Specify the LT accesskey')
.addCommand(exec)
Expand Down
8 changes: 7 additions & 1 deletion src/lib/ctx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,12 @@ export default (options: Record<string, string>): Context => {
orientation: config.mobile.orientation || constants.MOBILE_ORIENTATION_PORTRAIT,
}
}
if (env.BASIC_AUTH_USERNAME && env.BASIC_AUTH_PASSWORD) {
basicAuthObj = {
'username': env.BASIC_AUTH_USERNAME,
'password': env.BASIC_AUTH_PASSWORD
}
}
if (config.basicAuthorization) {
basicAuthObj = config.basicAuthorization;
}
Expand Down Expand Up @@ -213,7 +219,7 @@ export default (options: Record<string, string>): Context => {
fetchResultsFileName: fetchResultsFileObj,
baselineBranch: options.baselineBranch || '',
baselineBuild: options.baselineBuild || '',
githubURL : options.githubURL || '',
githubURL : options.gitURL || options.githubURL || '',
showRenderErrors: options.showRenderErrors ? true : false,
userName: options.userName || '',
accessKey: options.accessKey || ''
Expand Down
8 changes: 6 additions & 2 deletions src/lib/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ export default (): Env => {
HTTPS_PROXY,
SMARTUI_HTTP_PROXY,
SMARTUI_HTTPS_PROXY,
GITHUB_ACTIONS,
GIT_URL,
BASIC_AUTH_USERNAME,
BASIC_AUTH_PASSWORD,
FIGMA_TOKEN,
LT_USERNAME,
LT_ACCESS_KEY,
Expand Down Expand Up @@ -39,7 +41,9 @@ export default (): Env => {
HTTPS_PROXY,
SMARTUI_HTTP_PROXY,
SMARTUI_HTTPS_PROXY,
GITHUB_ACTIONS,
GIT_URL,
BASIC_AUTH_USERNAME,
BASIC_AUTH_PASSWORD,
FIGMA_TOKEN,
LT_USERNAME,
LT_ACCESS_KEY,
Expand Down
10 changes: 8 additions & 2 deletions src/lib/git.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ export default (ctx: Context): Git => {
if (ctx.options.githubURL && ctx.options.githubURL.startsWith('https://')) {
githubURL = ctx.options.githubURL;
}
if (ctx.options.gitURL && ctx.options.gitURL.startsWith('https://')) {
githubURL = ctx.options.gitURL;
}
if (ctx.env.SMARTUI_GIT_INFO_FILEPATH) {
let gitInfo = JSON.parse(fs.readFileSync(ctx.env.SMARTUI_GIT_INFO_FILEPATH, 'utf-8'));

Expand All @@ -51,7 +54,7 @@ export default (ctx: Context): Git => {
commitId: gitInfo.commit_id.slice(0,6) || '',
commitMessage: gitInfo.commit_body || '',
commitAuthor: gitInfo.commit_author || '',
githubURL: githubURL ? githubURL : (ctx.env.GITHUB_ACTIONS) ? `${constants.GITHUB_API_HOST}/repos/${process.env.GITHUB_REPOSITORY}/statuses/${gitInfo.commit_id}` : '',
githubURL: githubURL ? githubURL : (ctx.env.GIT_URL) ? ctx.env.GIT_URL : `${constants.GITHUB_API_HOST}/repos/${process.env.GITHUB_REPOSITORY}/statuses/${gitInfo.commit_id}`,
baselineBranch: ctx.options.baselineBranch || ctx.env.BASELINE_BRANCH || ''
}
} else {
Expand All @@ -78,7 +81,7 @@ export default (ctx: Context): Git => {
commitId: res[0] || '',
commitMessage: res[2] || '',
commitAuthor: res[7] || '',
githubURL: githubURL ? githubURL : (ctx.env.GITHUB_ACTIONS) ? `${constants.GITHUB_API_HOST}/repos/${process.env.GITHUB_REPOSITORY}/statuses/${res[1]}` : '',
githubURL: githubURL ? githubURL : (ctx.env.GIT_URL) ? ctx.env.GIT_URL : `${constants.GITHUB_API_HOST}/repos/${process.env.GITHUB_REPOSITORY}/statuses/${res[1]}`,
baselineBranch: ctx.options.baselineBranch || ctx.env.BASELINE_BRANCH || ''
};
}
Expand All @@ -95,6 +98,9 @@ function setNonGitInfo(ctx: Context) {
if (ctx.options.githubURL && ctx.options.githubURL.startsWith('https://')) {
githubURL = ctx.options.githubURL;
}
if (ctx.options.gitURL && ctx.options.gitURL.startsWith('https://')) {
githubURL = ctx.options.gitURL;
}

ctx.git = {
branch: branch,
Expand Down
5 changes: 4 additions & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ export interface Context {
baselineBranch?: string,
baselineBuild?: string,
githubURL?: string,
gitURL?: string,
showRenderErrors?: boolean,
userName?: string,
accessKey?: string
Expand Down Expand Up @@ -121,7 +122,9 @@ export interface Env {
HTTPS_PROXY: string | undefined;
SMARTUI_HTTP_PROXY: string | undefined;
SMARTUI_HTTPS_PROXY: string | undefined;
GITHUB_ACTIONS: string | undefined;
GIT_URL: string | undefined;
BASIC_AUTH_USERNAME: string | undefined;
BASIC_AUTH_PASSWORD: string | undefined;
FIGMA_TOKEN: string | undefined;
LT_USERNAME : string | undefined;
LT_ACCESS_KEY : string | undefined;
Expand Down