-
Notifications
You must be signed in to change notification settings - Fork 77
introducing browserstack-sdk to the sample repo #24
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
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
fba9253
simple sdk sample
mattonem 51f8061
clean up
mattonem 7184e75
running local tests correctly for ios
mattonem cb4943c
w3c upgrade
mattonem 0fafad0
typo
mattonem 6a3249e
upgrade appium and selenium versions
mattonem 88194a2
fixing selenium 4 deps
mattonem 0a69fdf
renaming packages
mattonem 17ff189
newlines
mattonem 1ccea6c
end of line
mattonem a37646b
end of lines
mattonem 19a7e1d
end of line again
mattonem 071b33a
readme and MutableCapabilities
mattonem 155510d
update readme
mattonem 0f7492b
Update android/testng-examples/browserstack.yml
mattonem 20b970f
Update ios/testng-examples/browserstack.yml
mattonem 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 |
---|---|---|
|
@@ -3,3 +3,5 @@ target/ | |
local.log | ||
.idea | ||
*.iml | ||
.DS_Store | ||
**/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
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,77 @@ | ||
# ============================= | ||
# 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 | ||
|
||
# ====================== | ||
# Organizing your tests | ||
# ====================== | ||
# Use `projectName`, `buildName`, `name` capabilities to organise your tests | ||
# `name` is the name of your test sessions and is automatically picked from your | ||
# test name and doesn't need to be set manually when using BrowserStack SDK | ||
# `buildName` is used to name your CI/CD job or the execution of your test suite. | ||
# Ensure you add a dynamic identifier, like an incremental build number from your | ||
# CI/CD or timestamp at the end of every build; otherwise tests from different | ||
# executions will be grouped together on BrowserStack | ||
buildName: browserstack-build | ||
mattonem marked this conversation as resolved.
Show resolved
Hide resolved
|
||
# Use `projectName` to set the name of your project. Example, Marketing Website | ||
projectName: TestNg Android Project | ||
# Use `framework` to set the framework of your project. Example, testng, cucumber, cucumber-testng | ||
framework: testng | ||
|
||
source: testng:sample-sdk:v1.0 | ||
|
||
app: ./WikipediaSample.apk | ||
# app: ./LocalSample.ipa #For running local tests | ||
|
||
# ======================================= | ||
# 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 | ||
osVersion: 12.0 | ||
platformName: android | ||
- deviceName: Samsung Galaxy S21 | ||
osVersion: 11.0 | ||
platformName: android | ||
- deviceName: Google Pixel 6 Pro | ||
osVersion: 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 | ||
consoleLogs: errors # <string> Remote browser's console debug levels to be printed (Default: errors) | ||
# Available options are `disable`, `errors`, `warnings`, `info`, `verbose` (Default: errors) |
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
28 changes: 28 additions & 0 deletions
28
android/testng-examples/src/test/java/com/browserstack/AppiumTest.java
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,28 @@ | ||
package com.browserstack; | ||
|
||
import java.net.URL; | ||
|
||
import org.openqa.selenium.MutableCapabilities; | ||
import org.testng.annotations.AfterMethod; | ||
import org.testng.annotations.BeforeMethod; | ||
|
||
import io.appium.java_client.AppiumDriver; | ||
import io.appium.java_client.android.AndroidDriver; | ||
import io.appium.java_client.android.options.UiAutomator2Options; | ||
|
||
|
||
public class AppiumTest { | ||
|
||
public AppiumDriver driver; | ||
|
||
@BeforeMethod(alwaysRun=true) | ||
public void setUp() throws Exception { | ||
MutableCapabilities capabilities = new UiAutomator2Options(); | ||
kamal-kaur04 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
driver = new AndroidDriver(new URL("http://127.0.0.1:4723/wd/hub"),capabilities); | ||
} | ||
|
||
@AfterMethod(alwaysRun=true) | ||
public void tearDown() throws Exception { | ||
driver.quit(); | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
android/testng-examples/src/test/java/com/browserstack/FirstTest.java
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,30 @@ | ||
package com.browserstack; | ||
|
||
import java.time.Duration; | ||
import java.util.List; | ||
|
||
import org.openqa.selenium.WebElement; | ||
import org.openqa.selenium.support.ui.ExpectedConditions; | ||
import org.openqa.selenium.support.ui.WebDriverWait; | ||
import org.testng.Assert; | ||
import org.testng.annotations.Test; | ||
|
||
import io.appium.java_client.AppiumBy; | ||
|
||
public class FirstTest extends AppiumTest { | ||
|
||
@Test | ||
public void test() throws Exception { | ||
WebElement searchElement = (WebElement) new WebDriverWait(driver, Duration.ofSeconds(30)).until( | ||
ExpectedConditions.elementToBeClickable(AppiumBy.accessibilityId("Search Wikipedia"))); | ||
|
||
searchElement.click(); | ||
WebElement insertTextElement = (WebElement) new WebDriverWait(driver, Duration.ofSeconds(30)).until( | ||
ExpectedConditions.elementToBeClickable(AppiumBy.id("org.wikipedia.alpha:id/search_src_text"))); | ||
insertTextElement.sendKeys("BrowserStack"); | ||
Thread.sleep(5000); | ||
|
||
List<WebElement> allProductsName = driver.findElements(AppiumBy.className("android.widget.TextView")); | ||
Assert.assertTrue(allProductsName.size() > 0); | ||
} | ||
} |
34 changes: 17 additions & 17 deletions
34
...rowserstack/run_local_test/LocalTest.java → ...test/java/com/browserstack/LocalTest.java
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
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.