Skip to content

Let Users pass dynamic path to read main and test apks#68

Merged
deepwired merged 9 commits into
browserstack:masterfrom
richaArora08:master
Jan 12, 2023
Merged

Let Users pass dynamic path to read main and test apks#68
deepwired merged 9 commits into
browserstack:masterfrom
richaArora08:master

Conversation

@richaArora08
Copy link
Copy Markdown
Contributor

@richaArora08 richaArora08 commented Jan 2, 2023

https://browserstack.atlassian.net/browse/AASI-2063
This change will let user pass paths to their main and test apks.
Example command:-
./gradlew executeDebugTestsOnBrowserstack -PmainAPKPath=/Users/richa/Documents/gradle_richa/test/mainApk -PtestAPKPath=/Users/richa/Documents/gradle_richa/test/testApk
Latest APKs present in the given folder will be picked for execution.

Comment thread test.rb
});
}

Files.find(Paths.get(dir), Constants.APP_SEARCH_MAX_DEPTH, (filePath, fileAttr) -> isValidFile(filePath, fileAttr))
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if both paths are provided no need to execute below loop on files

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok.

Files.find(Paths.get(dir), Constants.APP_SEARCH_MAX_DEPTH, (filePath, fileAttr) -> isValidFile(filePath, fileAttr))
.forEach(f -> {

if (f.toString().endsWith("-androidTest.apk")) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

might as well combine these if statements !isAPKFileCreated[1] && f.toString().endsWith("-androidTest.apk")

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Comment thread test.rb
@richaArora08 richaArora08 requested a review from deepwired January 3, 2023 15:54
deepwired
deepwired previously approved these changes Jan 4, 2023
Copy link
Copy Markdown
Collaborator

@deepwired deepwired left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Comment thread test.rb
stdout = run_command(gradle_command)
responses = stdout.lines.select{ |line| line.match(/DebugApp apk: null|TestApp apk: null/)}
if responses.count != 2
puts "✘ #{gradle_command} failed with error: #{responses}".red
Copy link
Copy Markdown
Collaborator

@deepwired deepwired Jan 5, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if we are expecting this unit test to fail, can we change the color indication to green here, and red for the else condition?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resolved.

deepwired
deepwired previously approved these changes Jan 5, 2023
Comment thread test.rb Outdated
def run_test_with_ipa
puts "Running tests with ipa files"
mainAPKPath = $current_path + "/test/mainApk/ipa"
testAPKPAth = $current_path + "/test/mainApk/ipa"
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will pick the same app, can we point it to any other path with apk test

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes pushed.

Copy link
Copy Markdown
Collaborator

@deepwired deepwired left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@deepwired deepwired merged commit 5f1cd97 into browserstack:master Jan 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants