Skip to content

Commit 3f3c8c8

Browse files
authored
Merge pull request #818 from seleniumbase/update-console-output-and-more
Update console output and more
2 parents c61802b + 2125114 commit 3f3c8c8

File tree

25 files changed

+415
-86
lines changed

25 files changed

+415
-86
lines changed

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,8 @@ The code above will leave your browser window open in case there's a failure. (i
359359
--headed # (Run tests with a GUI on Linux OS.)
360360
--locale=LOCALE_CODE # (Set the Language Locale Code for the web browser.)
361361
--start-page=URL # (The starting URL for the web browser when tests begin.)
362-
--archive-logs # (Archive old log files instead of deleting them.)
362+
--archive-logs # (Archive existing log files instead of deleting them.)
363+
--archive-downloads # (Archive old downloads instead of deleting them.)
363364
--time-limit=SECONDS # (Safely fail any test that exceeds the time limit.)
364365
--slow # (Slow down the automation. Faster than using Demo Mode.)
365366
--demo # (Slow down and visually see test actions as they occur.)
@@ -503,7 +504,7 @@ pytest --dashboard --rs --headless
503504
python -m http.server 1948
504505
```
505506
506-
🔵 Now you can navigate to ``http://localhost:1948/dashboard.html`` in order to view the dashboard as a web app. This requires two different terminal windows: one for running the server, and another for running the tests, which should be run from the same directory. (Use ``CTRL-C`` to stop the http server.)
507+
🔵 Now you can navigate to ``http://localhost:1948/dashboard.html`` in order to view the dashboard as a web app. This requires two different terminal windows: one for running the server, and another for running the tests, which should be run from the same directory. (Use ``CTRL+C`` to stop the http server.)
507508
508509
🔵 Here's a full example of what the SeleniumBase Dashboard may look like:
509510

docs/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
regex>=2020.11.13
2-
tqdm>=4.56.2
2+
tqdm>=4.57.0
33
livereload==2.6.3;python_version>="3.6"
44
joblib==1.0.1;python_version>="3.6"
55
Markdown==3.3.3
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
from seleniumbase import BaseCase
2+
3+
4+
class DataPage():
5+
6+
def go_to_data_url(self, sb):
7+
sb.open("data:text/html,<p>Hello!</p>")
8+
9+
10+
class MyTests(BaseCase):
11+
12+
def test_go_to_data_url(self):
13+
DataPage().go_to_data_url(self)
14+
self.assert_text("Hello!", "p")
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
from seleniumbase import BaseCase
2+
3+
4+
class LoginPage():
5+
6+
def login_to_swag_labs(self, sb, username):
7+
sb.type("#user-name", username)
8+
sb.type("#password", "secret_sauce")
9+
sb.click('input[type="submit"]')
10+
11+
12+
class MyTests(BaseCase):
13+
14+
def test_swag_labs_login(self):
15+
self.open("https://www.saucedemo.com/")
16+
LoginPage().login_to_swag_labs(self, "standard_user")
17+
self.assert_element("#inventory_container")
18+
self.assert_text("Products", "div.product_label")
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
from seleniumbase import BaseCase
2+
3+
4+
class GooglePage():
5+
6+
def go_to_google(self, sb):
7+
sb.open("https://google.com/ncr")
8+
9+
def do_search(self, sb, search_term):
10+
sb.type('input[title="Search"]', search_term + '\n')
11+
12+
def click_search_result(self, sb, content):
13+
sb.click('a[href*="%s"]' % content)
14+
15+
16+
class SeleniumBaseGitHubPage():
17+
18+
def click_seleniumbase_io_link(self, sb):
19+
sb.js_click('a[href*="seleniumbase.io"]')
20+
sb.wait_for_ready_state_complete()
21+
current_url = sb.get_current_url()
22+
if "seleniumbase.io" not in current_url:
23+
# GitHub probably opened a new window
24+
sb.switch_to_window(1)
25+
26+
27+
class SeleniumBaseIOPage():
28+
29+
def do_search_and_click(self, sb, search_term):
30+
if sb.is_element_visible('[for="__search"] svg'):
31+
sb.click('[for="__search"] svg')
32+
sb.type('form[name="search"] input', search_term)
33+
sb.click('li.md-search-result__item h1:contains(%s)' % search_term)
34+
35+
36+
class MyTests(BaseCase):
37+
38+
def test_page_objects(self):
39+
search_term = "SeleniumBase GitHub"
40+
expected_text = "seleniumbase/SeleniumBase"
41+
GooglePage().go_to_google(self)
42+
GooglePage().do_search(self, search_term)
43+
self.assert_text(expected_text, '#search')
44+
GooglePage().click_search_result(self, expected_text)
45+
SeleniumBaseGitHubPage().click_seleniumbase_io_link(self)
46+
SeleniumBaseIOPage().do_search_and_click(self, "Dashboard")
47+
self.assert_text("Dashboard", 'main h1')

examples/example_logs/ReadMe.md

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@
55
🔵 During test failures, logs and screenshots from the most recent test run will get saved to the ``latest_logs/`` folder. If ``--archive-logs`` is specified (or if ARCHIVE_EXISTING_LOGS is set to True in [settings.py](https://github.com/seleniumbase/SeleniumBase/blob/master/seleniumbase/config/settings.py)), test logs will also get archived to the ``archived_logs/`` folder. Otherwise, the log files will be cleaned out when the next test run begins (by default).
66

77
```bash
8-
pytest test_fail.py --browser=chrome
9-
10-
nosetests test_fail.py --browser=firefox
8+
pytest test_fail.py
119
```
1210

1311
<b>Examples of expected log files generated during failures:</b>
@@ -37,7 +35,7 @@ pytest --dashboard --rs --headless
3735
python -m http.server 1948
3836
```
3937

40-
🔵 Now you can navigate to ``http://localhost:1948/dashboard.html`` in order to view the dashboard as a web app. This requires two different terminal windows: one for running the server, and another for running the tests, which should be run from the same directory. (Use ``CTRL-C`` to stop the http server.)
38+
🔵 Now you can navigate to ``http://localhost:1948/dashboard.html`` in order to view the dashboard as a web app. This requires two different terminal windows: one for running the server, and another for running the tests, which should be run from the same directory. (Use ``CTRL+C`` to stop the http server.)
4139

4240
🔵 Here's a full example of what the SeleniumBase Dashboard may look like:
4341

@@ -81,10 +79,10 @@ pytest test_suite.py --junit-xml=report.xml
8179

8280
<h3><img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="32" /> Nosetest Reports:</h3>
8381

84-
The ``--report`` option gives you a fancy report after your test suite completes.
82+
The ``nosetests`` ``--report`` option gives you a fancy report after your tests complete.
8583

8684
```bash
87-
nosetests test_suite.py --report --browser=chrome
85+
nosetests test_suite.py --report
8886
```
8987

9088
<img src="https://seleniumbase.io/cdn/img/nose_report.png" alt="Example Nosetest Report" title="Example Nosetest Report" width="320" />

help_docs/customizing_test_runs.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,8 @@ SeleniumBase provides additional ``pytest`` command-line options for tests:
117117
--headed # (Run tests with a GUI on Linux OS.)
118118
--locale=LOCALE_CODE # (Set the Language Locale Code for the web browser.)
119119
--start-page=URL # (The starting URL for the web browser when tests begin.)
120-
--archive-logs # (Archive old log files instead of deleting them.)
120+
--archive-logs # (Archive existing log files instead of deleting them.)
121+
--archive-downloads # (Archive old downloads instead of deleting them.)
121122
--time-limit=SECONDS # (Safely fail any test that exceeds the time limit.)
122123
--slow # (Slow down the automation. Faster than using Demo Mode.)
123124
--demo # (Slow down and visually see test actions as they occur.)
@@ -280,7 +281,7 @@ pytest --dashboard --rs --headless
280281
python -m http.server 1948
281282
```
282283

283-
🔵 Now you can navigate to ``http://localhost:1948/dashboard.html`` in order to view the dashboard as a web app. This requires two different terminal windows: one for running the server, and another for running the tests, which should be run from the same directory. (Use ``CTRL-C`` to stop the http server.)
284+
🔵 Now you can navigate to ``http://localhost:1948/dashboard.html`` in order to view the dashboard as a web app. This requires two different terminal windows: one for running the server, and another for running the tests, which should be run from the same directory. (Use ``CTRL+C`` to stop the http server.)
284285

285286
🔵 Here's a full example of what the SeleniumBase Dashboard may look like:
286287

integrations/brython/ReadMe.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
```bash
1111
python -m http.server
1212
```
13-
You can always stop the server by using ``CTRL-C``.
13+
You can always stop the server by using ``CTRL+C``.
1414

1515
### 2. Navigate to [http://localhost:8000/](http://localhost:8000/)
1616

integrations/node_js/ReadMe.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<h2><img src="https://seleniumbase.io/img/sb_icon.png" title="SeleniumBase" width="30" /> Creating a Test Runner with NodeJS + Express</h2>
1+
<h2><img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="32" /> Creating a Test Runner with NodeJS + Express</h2>
22

33
You can create a customized web app for running SeleniumBase tests by using NodeJS and Express. (This tutorial assumes that you've already installed SeleniumBase by following the instructions from the [top-level ReadMe](https://github.com/seleniumbase/SeleniumBase/blob/master/README.md) file.)
44

@@ -29,7 +29,7 @@ npm install
2929
node server.js
3030
```
3131

32-
(You can always stop the server by using ``CTRL-C``.)
32+
(You can always stop the server by using ``CTRL+C``.)
3333

3434
#### 5. Open the SeleniumBase Test Runner web app
3535

integrations/node_js/server.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ const express = require('express');
33
const path = require('path');
44
const app = express();
55
const exec = require('child_process').exec;
6-
var server_info = '\nServer running at http://127.0.0.1:3000/ (CTRL-C to stop)';
6+
var server_info = '\nServer running at http://127.0.0.1:3000/ (CTRL+C to stop)';
77

88
function run_command(command) {
99
console.log("\n" + command);

0 commit comments

Comments
 (0)