Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 3a26477

Browse files
fixes
1 parent b657c73 commit 3a26477

File tree

3 files changed

+35
-15
lines changed

3 files changed

+35
-15
lines changed

‎README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Python-UnitTest-Selenium
22
![LambdaTest Logo](https://www.lambdatest.com/static/images/logo.svg)
3-
---
3+
---
44

55
### Environment Setup
66

@@ -40,7 +40,7 @@
4040
- Run following command
4141
* Execution
4242
```
43-
$ python lambdatest_test.py
43+
$ python lambdatest_test.py or nosetests test_sample.py
4444
```
4545
4646
##### Routing traffic through your local machine

‎lambdatest_test.py

Lines changed: 28 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,37 @@
1-
import unittest, time, re
2-
import base_test
3-
from selenium.webdriver.common.keys import Keys
4-
5-
class LambdaTest(base_test.BaseTest):
1+
import os
2+
import unittest
3+
import sys
4+
from selenium import webdriver
5+
6+
username = os.environ.get("LT_USERNAME")
7+
access_key = os.environ.get("LT_ACCESS_KEY")
8+
9+
class FirstSampleTest(unittest.TestCase):
10+
11+
# setUp runs before each test case
12+
def setUp(self):
13+
desired_caps = {
14+
"build": 'unittest sample build',
15+
"name": 'Py-unittest',
16+
"platform": 'Windows 10',
17+
"browserName": 'firefox',
18+
"version": '73'
19+
}
20+
self.driver = webdriver.Remote(
21+
command_executor="http://{}:{}@hub.lambdatest.com:80/wd/hub".format(username, access_key),
22+
desired_capabilities= desired_caps)
23+
24+
25+
# tearDown runs after each test case
26+
def tearDown(self):
27+
self.driver.quit()
628

729
def test_unit_user_should_able_to_add_item(self):
830
# try:
931
driver = self.driver
1032

1133
# Url
12-
driver.get(self.base_url)
34+
driver.get("https://lambdatest.github.io/sample-todo-app/")
1335

1436
# Click on check box
1537
check_box_one = driver.find_element_by_name("li1")
@@ -30,11 +52,6 @@ def test_unit_user_should_able_to_add_item(self):
3052
# Verified added item
3153
added_item = driver.find_element_by_xpath("//span[@class='done-false']").text
3254
print (added_item)
33-
self.assertEqual ("Yey, Let's add it to list", added_item )
34-
if added_item in ":
35-
return True
36-
else:
37-
return False
3855

3956
if __name__ == "__main__":
4057
unittest.main()

‎requirements.txt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
1-
selenium
2-
ConfigParser
1+
ConfigParser
2+
selenium>2.5
3+
pytest
4+
nose
5+
pytest-xdist

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /