Update the docs

This commit is contained in:
Michael Mintz 2022-02-03 22:16:49 -05:00
parent 5b816bfb53
commit b420059e74
5 changed files with 69 additions and 16 deletions

View File

@ -72,7 +72,15 @@ pytest test_suite.py --dashboard --html=report.html
<img src="https://seleniumbase.io/cdn/img/dash_report.jpg" alt="Dashboard Pytest HTML Report" title="Dashboard Pytest HTML Report" width="520" />
If viewing pytest html reports in [Jenkins](https://www.jenkins.io/), you may need to [configure Jenkins settings](https://stackoverflow.com/a/46197356) for the html to render correctly. This is due to [Jenkins CSP changes](https://www.jenkins.io/doc/book/system-administration/security/configuring-content-security-policy/).
--------
If viewing ``pytest-html`` reports in [Jenkins](https://www.jenkins.io/), you may need to [configure Jenkins settings](https://stackoverflow.com/a/46197356) for the HTML to render correctly. This is due to [Jenkins CSP changes](https://www.jenkins.io/doc/book/system-administration/security/configuring-content-security-policy/). That setting can be changed from ``Manage Jenkins`` > ``Script Console`` by running:
```
System.setProperty("hudson.model.DirectoryBrowserSupport.CSP", "")
```
--------
You can also use ``--junit-xml=report.xml`` to get an xml report instead. Jenkins can use this file to display better reporting for your tests.

View File

@ -4,15 +4,21 @@
![](https://seleniumbase.io/cdn/gif/masterqa6.gif "MasterQA")
Here's example code from [basic_masterqa_test_0.py](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/master_qa/basic_masterqa_test_0.py):
Here's code from [basic_masterqa_test_0.py](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/master_qa/basic_masterqa_test_0.py):
```python
self.open("https://xkcd.com/1700/")
self.verify("Do you see a webcomic?")
self.highlight_click('link=Blag')
self.verify('Do you see a blog archive?')
self.highlight_update_text("input#s", "Dragons\n")
self.verify('Do you see "dragons" in the search results?')
from seleniumbase import MasterQA
class MasterQATests(MasterQA):
def test_masterqa(self):
self.open("https://xkcd.com/1700/")
self.verify("Do you see a webcomic?")
self.open("https://seleniumbase.io/demo_page")
self.highlight('table')
self.verify("Do you see elements in a table?")
self.open("https://seleniumbase.io/devices/")
self.highlight("div.mockup-wrapper")
self.verify("Do you see 4 computer devices?")
```
After each automation checkpoint, a pop-up window will ask the user questions for each verification command.

View File

@ -109,7 +109,7 @@ class MyTourClass(BaseCase):
self.add_tour_step("Type in your query here.", 'input[title="Search"]')
self.play_tour()
self.highlight_update_text('input[title="Search"]', "Google")
self.highlight_type('input[title="Search"]', "Google")
self.wait_for_element('[role="listbox"]') # Wait for autocomplete
self.create_tour(theme="light")

View File

@ -0,0 +1,33 @@
<h2><img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="32" /> Useful <code>grep</code> commands</h2>
There are several useful **grep** commands for helping you find and/or replace text in multiple files. Examples:
#### List all files containing ``self.get_new_driver(``, ignoring ".pyc" files, from the current directory:
``grep -rl "self.get_new_driver(" * --exclude=\*.pyc``
OR
``grep -rl * -e "self.get_new_driver(" --exclude=\*.pyc``
--------
#### Replace all occurrences of "foo_abc" with "bar_xyz" on Linux, from the current directory:
``sed -i 's/foo_abc/bar_xyz/g' *``
#### Replace all occurrences of "foo_abc" with "bar_xyz" on macOS (file-backup required), from the current directory:
``sed -i '.bak' 's/foo_abc/bar_xyz/g' *``
--------
#### Find all chromedriver processes (this combines ``ps`` with ``grep``):
``ps -ef |grep chromedriver``
--------
#### References:
* https://stackoverflow.com/questions/16956810/how-do-i-find-all-files-containing-specific-text-on-linux
* https://stackoverflow.com/questions/11392478/how-to-replace-a-string-in-multiple-files-in-linux-command-line/20721292#20721292

View File

@ -4,15 +4,21 @@
![](https://seleniumbase.io/cdn/gif/masterqa6.gif "MasterQA")
Here's example code from [basic_masterqa_test_0.py](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/master_qa/basic_masterqa_test_0.py):
Here's code from [basic_masterqa_test_0.py](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/master_qa/basic_masterqa_test_0.py):
```python
self.open("https://xkcd.com/1700/")
self.verify("Do you see a webcomic?")
self.highlight_click('link=Blag')
self.verify('Do you see a blog archive?')
self.highlight_update_text("input#s", "Dragons\n")
self.verify('Do you see "dragons" in the search results?')
from seleniumbase import MasterQA
class MasterQATests(MasterQA):
def test_masterqa(self):
self.open("https://xkcd.com/1700/")
self.verify("Do you see a webcomic?")
self.open("https://seleniumbase.io/demo_page")
self.highlight('table')
self.verify("Do you see elements in a table?")
self.open("https://seleniumbase.io/devices/")
self.highlight("div.mockup-wrapper")
self.verify("Do you see 4 computer devices?")
```
After each automation checkpoint, a pop-up window will ask the user questions for each verification command.