Skip to content

Commit e9badea

Browse files
authored
Merge pull request #15 from rahulmishra-lt/master
updated: test
2 parents 5b22f08 + 7975faa commit e9badea

File tree

1 file changed

+27
-17
lines changed

1 file changed

+27
-17
lines changed

lambdatest.py

Lines changed: 27 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
import unittest
32
import os
43
from selenium import webdriver
@@ -9,11 +8,11 @@
98
access_key = os.getenv("LT_ACCESS_KEY") # Replace the access key
109

1110

12-
#paste your capibility options below
11+
# paste your capibility options below
1312

1413
options = ChromeOptions()
15-
options.browser_version = "114.0"
16-
options.platform_name = "macOS High Sierra"
14+
options.browser_version = "latest"
15+
options.platform_name = "win10"
1716
lt_options = {}
1817
lt_options["username"] = username
1918
lt_options["accessKey"] = access_key
@@ -26,40 +25,49 @@
2625
lt_options["name"] = "basic_unit_selinium"
2726
lt_options["w3c"] = True
2827
lt_options["plugin"] = "python-python"
29-
options.set_capability('LT:Options', lt_options)
28+
options.set_capability("LT:Options", lt_options)
29+
3030

31+
# Steps to run Smart UI project (https://beta-smartui.lambdatest.com/)
32+
# Step - 1 : Change the hub URL to @beta-smartui-hub.lambdatest.com/wd/hub
33+
# Step - 2 : Add "smartUI.project": "<Project Name>" as a capability above
34+
# Step - 3 : Run "driver.execute_script("smartui.takeScreenshot")" command wherever you need to take a screenshot
35+
# Note: for additional capabilities navigate to https://www.lambdatest.com/support/docs/test-settings-options/
3136

32-
# Steps to run Smart UI project (https://beta-smartui.lambdatest.com/)
33-
# Step - 1 : Change the hub URL to @beta-smartui-hub.lambdatest.com/wd/hub
34-
# Step - 2 : Add "smartUI.project": "<Project Name>" as a capability above
35-
# Step - 3 : Run "driver.execute_script("smartui.takeScreenshot")" command wherever you need to take a screenshot
36-
# Note: for additional capabilities navigate to https://www.lambdatest.com/support/docs/test-settings-options/
3737

3838
class FirstSampleTest(unittest.TestCase):
39+
driver = None
40+
3941
def setUp(self):
40-
driver = webdriver.Remote(command_executor="http://{}:{}@hub.lambdatest.com/wd/hub".format(username, access_key),options=options)
42+
self.driver = webdriver.Remote(
43+
command_executor="http://{}:{}@hub.lambdatest.com/wd/hub".format(
44+
username, access_key
45+
),
46+
options=options,
47+
)
4148

4249
# """ You can write the test cases here """
4350
def test_demo_site(self):
44-
4551
# try:
4652
driver = self.driver
4753
driver.implicitly_wait(10)
4854
driver.set_page_load_timeout(30)
4955
driver.set_window_size(1920, 1080)
5056

5157
# Url
52-
print('Loading URL')
53-
driver.get("https://stage-lambda-devops-use-only.lambdatestinternal.com/To-do-app/index.html")
58+
print("Loading URL")
59+
driver.get(
60+
"https://stage-lambda-devops-use-only.lambdatestinternal.com/To-do-app/index.html"
61+
)
5462

5563
# Let's click on a element
5664
driver.find_element(By.NAME, "li1").click()
5765
location = driver.find_element(By.NAME, "li2")
5866
location.click()
5967
print("Clicked on the second element")
6068

61-
#Take Smart UI screenshot
62-
#driver.execute_script("smartui.takeScreenshot")
69+
# Take Smart UI screenshot
70+
# driver.execute_script("smartui.takeScreenshot")
6371

6472
# Let's add a checkbox
6573
driver.find_element(By.ID, "sampletodotext").send_keys("LambdaTest")
@@ -82,9 +90,11 @@ def test_demo_site(self):
8290
print("Tests are run successfully!")
8391
else:
8492
driver.execute_script("lambda-status=failed")
85-
# tearDown runs after each test case
93+
94+
# tearDown runs after each test case
8695
def tearDown(self):
8796
self.driver.quit()
8897

98+
8999
if __name__ == "__main__":
90100
unittest.main()

0 commit comments

Comments
 (0)