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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
/local.log
env
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ pip3 install -r requirements.txt
* Run sample test:
- To run the sample test across platforms defined in the `browserstack.yml` file, run:
```
browserstack-sdk ./scripts/test.py
browserstack-sdk ./tests/test.py
```
* Run tests on locally hosted website:
- To run the local test across platforms defined in the `browserstack.yml` file, run:
```
browserstack-sdk ./scripts/local-test.py
browserstack-sdk ./tests/local-test.py
```
10 changes: 3 additions & 7 deletions tests/local-test.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import json
from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
from selenium.webdriver.chrome.options import Options as ChromeOptions

options = ChromeOptions()
Expand All @@ -15,11 +12,10 @@
options=options)

try:
driver.get('http://bs-local.com:45691/check')
body_text = WebDriverWait(driver, 10).until(
EC.visibility_of_element_located((By.CSS_SELECTOR, 'body'))).text
driver.get('http://bs-local.com:45454')
page_title = driver.title
# check if local connected successfully
if body_text == 'Up and running':
if 'BrowserStack Local' in page_title:
# mark test as passed if Local website is accessible
driver.execute_script(
'browserstack_executor: {"action": "setSessionStatus", "arguments": {"status":"passed", "reason": "Local Test ran successfully"}}')
Expand Down