-
Notifications
You must be signed in to change notification settings - Fork 2
Initial commit #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
karanshah-browserstack
merged 6 commits into
main
from
SDKAD-153-cucumber-java-sample-repo
Nov 5, 2024
Merged
Changes from 3 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
4ec6fa5
Initial commit
karanshah-browserstack ee69fd4
Update Readme
karanshah-browserstack 48aa9bb
Add workflow file
karanshah-browserstack 919d85d
Fix local test and default android
karanshah-browserstack 7829d14
Remove allure and fix new lines
karanshah-browserstack a38bcf7
Trigger Build
karanshah-browserstack File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,106 @@ | ||
| # This job is to test different maven profiles in sdk branch again Pull Request raised | ||
| # This workflow targets Java with Maven execution | ||
|
|
||
| name: Java SDK Test workflow for Maven on workflow_dispatch | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| inputs: | ||
| commit_sha: | ||
| description: 'The full commit id to build' | ||
| required: true | ||
|
|
||
| jobs: | ||
| comment-run: | ||
| runs-on: ${{ matrix.os }} | ||
| strategy: | ||
| fail-fast: false | ||
| max-parallel: 3 | ||
| matrix: | ||
| java: [ '8', '11', '17' ] | ||
| os: [ 'macos-latest', 'windows-latest', 'ubuntu-latest' ] | ||
| name: Cucumber Appium Repo ${{ matrix.Java }} - ${{ matrix.os }} Sample | ||
| env: | ||
| BROWSERSTACK_USERNAME: ${{ secrets.BROWSERSTACK_USERNAME }} | ||
| BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }} | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v3 | ||
| with: | ||
| ref: ${{ github.event.inputs.commit_sha }} | ||
| - uses: actions/github-script@98814c53be79b1d30f795b907e553d8679345975 | ||
| id: status-check-in-progress | ||
| env: | ||
| job_name: Cucumber Appium Repo ${{ matrix.Java }} - ${{ matrix.os }} Sample | ||
| commit_sha: ${{ github.event.inputs.commit_sha }} | ||
| with: | ||
| github-token: ${{ github.token }} | ||
| script: | | ||
| const result = await github.rest.checks.create({ | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| name: process.env.job_name, | ||
| head_sha: process.env.commit_sha, | ||
| status: 'in_progress' | ||
| }).catch((err) => ({status: err.status, response: err.response})); | ||
| console.log(`The status-check response : ${result.status} Response : ${JSON.stringify(result.response)}`) | ||
| if (result.status !== 201) { | ||
| console.log('Failed to create check run') | ||
| } | ||
| - name: Set up Java | ||
| uses: actions/setup-java@v3 | ||
| with: | ||
| distribution: 'temurin' | ||
| java-version: ${{ matrix.java }} | ||
| - name: Run android mvn test | ||
| run: | | ||
| cd android | ||
| mvn compile | ||
| mvn test | ||
| - name: Run android mvn profile sample-local-test | ||
| run: | | ||
| cd android | ||
| mvn compile | ||
| mvn test -P sample-local-test | ||
| - name: Run android mvn profile sample-test | ||
| run: | | ||
| cd android | ||
| mvn compile | ||
| mvn test -P sample-test | ||
| - name: Run ios mvn test | ||
| run: | | ||
| cd ios | ||
| mvn compile | ||
| mvn test | ||
| - name: Run ios mvn profile sample-local-test | ||
| run: | | ||
| cd ios | ||
| mvn compile | ||
| mvn test -P sample-local-test | ||
| - name: Run ios mvn profile sample-test | ||
| run: | | ||
| cd ios | ||
| mvn compile | ||
| mvn test -P sample-test | ||
| - if: always() | ||
| uses: actions/github-script@98814c53be79b1d30f795b907e553d8679345975 | ||
| id: status-check-completed | ||
| env: | ||
| conclusion: ${{ job.status }} | ||
| job_name: Cucumber Appium Repo ${{ matrix.Java }} - ${{ matrix.os }} Sample | ||
| commit_sha: ${{ github.event.inputs.commit_sha }} | ||
| with: | ||
| github-token: ${{ github.token }} | ||
| script: | | ||
| const result = await github.rest.checks.create({ | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| name: process.env.job_name, | ||
| head_sha: process.env.commit_sha, | ||
| status: 'completed', | ||
| conclusion: process.env.conclusion | ||
| }).catch((err) => ({status: err.status, response: err.response})); | ||
| console.log(`The status-check response : ${result.status} Response : ${JSON.stringify(result.response)}`) | ||
| if (result.status !== 201) { | ||
| console.log('Failed to create check run') | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| *.png | ||
| target/ | ||
| local.log | ||
| .idea | ||
| *.iml | ||
| .DS_Store | ||
| **/logs/* | ||
| reports/ | ||
| logs/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,69 @@ | ||
| # cucumber-java-appium-app-browserstack | ||
| This repository demonstrates how to run Appium tests in Cucumber Java on BrowserStack App Automate. | ||
|
|
||
| This repository demonstrates how to run Appium tests in Cucumber Testng on BrowserStack App Automate using BrowserStack SDK. | ||
|
|
||
|  | ||
|
|
||
| ## Setup | ||
|
|
||
| ### Requirements | ||
|
|
||
| 1. Java 8+ | ||
|
|
||
| - If Java is not installed, follow these instructions: | ||
| - For Windows, download latest java version from [here](https://java.com/en/download/) and run the installer executable | ||
| - For Mac and Linux, run `java -version` to see what java version is pre-installed. If you want a different version download from [here](https://java.com/en/download/) | ||
|
|
||
| 2. Maven | ||
| - If Maven is not downloaded, download it from [here](https://maven.apache.org/download.cgi) | ||
| - For installation, follow the instructions [here](https://maven.apache.org/install.html) | ||
|
|
||
| ### Install the dependencies | ||
|
|
||
| To install the dependencies for Android tests, run : | ||
| ```sh | ||
| cd android/ | ||
| mvn clean | ||
| ``` | ||
|
|
||
| Or, | ||
|
|
||
| To install the dependencies for iOS tests, run : | ||
|
|
||
| ```sh | ||
| cd ios/ | ||
| mvn clean | ||
| ``` | ||
|
|
||
| ## Getting Started | ||
|
|
||
| Getting Started with Appium tests in Cucumber TestNg on BrowserStack couldn't be easier! | ||
|
|
||
| ### **Run Sample test :** | ||
|
|
||
| - Switch to one of the following directories: [Android examples](android) or [iOS examples](ios) | ||
| - Run the following maven command `mvn test -P sample-test` | ||
|
|
||
| ### **Use Local testing for apps that access resources hosted in development or testing environments :** | ||
|
|
||
| - Simply configure the `browserstackLocal` parameter in the `browserstack.yml` file accordingly in [Android examples](android) or [iOS examples](ios). | ||
| ``` | ||
| browserstackLocal: true | ||
| ``` | ||
| - You can use the `LocalSample` app provided in both folder [Android examples](android) or [iOS examples](ios) to run your test. Change the app parameter in the `browserstack.yml` file and run the tests with the following command: `mvn test -P sample-local-test` | ||
|
|
||
|
|
||
| **Note**: If you are facing any issues, refer [Getting Help section](#Getting-Help) | ||
|
|
||
| ## Integration with other Java frameworks | ||
|
|
||
| For other Java frameworks samples, refer to following repositories : | ||
|
|
||
| - [JUnit](https://github.com/browserstack/junit-appium-app-browserstack) | ||
| - [Java](https://github.com/browserstack/java-appium-app-browserstack) | ||
karanshah-browserstack marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| Note: For other test frameworks supported by App-Automate refer our [Developer documentation](https://www.browserstack.com/docs/) | ||
|
|
||
| ## Getting Help | ||
|
|
||
| If you are running into any issues or have any queries, please check [Browserstack Support page](https://www.browserstack.com/support/app-automate) or [get in touch with us](https://www.browserstack.com/contact?ref=help). | ||
Binary file not shown.
Binary file not shown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,76 @@ | ||
| # ============================= | ||
| # Set BrowserStack Credentials | ||
| # ============================= | ||
| # Add your BrowserStack userName and acccessKey here or set BROWSERSTACK_USERNAME and | ||
| # BROWSERSTACK_ACCESS_KEY as env variables | ||
| userName: BROWSERSTACK_USERNAME | ||
| accessKey: BROWSERSTACK_ACCESS_KEY | ||
|
|
||
| # ====================== | ||
| # BrowserStack Reporting | ||
| # ====================== | ||
| # The following capabilities are used to set up reporting on BrowserStack: | ||
| # Set 'projectName' to the name of your project. Example, Marketing Website | ||
| projectName: BrowserStack Samples | ||
| # Set `buildName` as the name of the job / testsuite being run | ||
| buildName: browserstack build | ||
| # `buildIdentifier` is a unique id to differentiate every execution that gets appended to | ||
| # buildName. Choose your buildIdentifier format from the available expressions: | ||
| # ${BUILD_NUMBER} (Default): Generates an incremental counter with every execution | ||
| # ${DATE_TIME}: Generates a Timestamp with every execution. Eg. 05-Nov-19:30 | ||
| # Read more about buildIdentifiers here -> https://www.browserstack.com/docs/automate/selenium/organize-tests | ||
| buildIdentifier: '#${BUILD_NUMBER}' # Supports strings along with either/both ${expression} | ||
| # Set `framework` of your test suite. Example, `testng`, `cucumber`, `cucumber-testng` | ||
| # This property is needed to send test context to BrowserStack (test name, status) | ||
| framework: cucumber-testng | ||
|
|
||
| source: cucumber-java:appium-sample-main:v1.0 | ||
|
|
||
| # app: ./WikipediaSample.apk | ||
| app: ./LocalSample.apk #For running local tests | ||
karanshah-browserstack marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| # ======================================= | ||
| # Platforms (Browsers / Devices to test) | ||
| # ======================================= | ||
| # Platforms object contains all the browser / device combinations you want to test on. | ||
| # Entire list available here -> (https://www.browserstack.com/list-of-browsers-and-platforms/automate) | ||
| platforms: | ||
| - deviceName: Samsung Galaxy S22 Ultra | ||
| platformVersion: 12.0 | ||
| platformName: android | ||
| - deviceName: Samsung Galaxy S21 | ||
| platformVersion: 11.0 | ||
| platformName: android | ||
| - deviceName: Google Pixel 6 Pro | ||
| platformVersion: 12.0 | ||
| platformName: android | ||
|
|
||
| # ======================= | ||
| # Parallels per Platform | ||
| # ======================= | ||
| # The number of parallel threads to be used for each platform set. | ||
| # BrowserStack's SDK runner will select the best strategy based on the configured value | ||
| # | ||
| # Example 1 - If you have configured 3 platforms and set `parallelsPerPlatform` as 2, a total of 6 (2 * 3) parallel threads will be used on BrowserStack | ||
| # | ||
| # Example 2 - If you have configured 1 platform and set `parallelsPerPlatform` as 5, a total of 5 (1 * 5) parallel threads will be used on BrowserStack | ||
| parallelsPerPlatform: 1 | ||
|
|
||
| # ========================================== | ||
| # BrowserStack Local | ||
| # (For localhost, staging/private websites) | ||
| # ========================================== | ||
| # Set browserStackLocal to true if your website under test is not accessible publicly over the internet | ||
| # Learn more about how BrowserStack Local works here -> https://www.browserstack.com/docs/automate/selenium/local-testing-introduction | ||
| browserstackLocal: true # <boolean> (Default false) | ||
| #browserStackLocalOptions: | ||
| #Options to be passed to BrowserStack local in-case of advanced configurations | ||
| # localIdentifier: # <string> (Default: null) Needed if you need to run multiple instances of local. | ||
| # forceLocal: true # <boolean> (Default: false) Set to true if you need to resolve all your traffic via BrowserStack Local tunnel. | ||
| # Entire list of arguments available here -> https://www.browserstack.com/docs/automate/selenium/manage-incoming-connections | ||
|
|
||
| # =================== | ||
| # Debugging features | ||
| # =================== | ||
| debug: false # <boolean> # Set to true if you need screenshots for every selenium command ran | ||
| networkLogs: false # <boolean> Set to true to enable HAR logs capturing | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.