Merge pull request #835 from seleniumbase/improve-reuse-session-mode

Improve --reuse-session / --rs mode
This commit is contained in:
Michael Mintz 2021-03-05 19:40:11 -05:00 committed by GitHub
commit e7a1b2d0bd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 49 additions and 29 deletions

View File

@ -28,7 +28,7 @@ Tests are run with "pytest". Browsers are controlled by WebDriver.
<a href="#python_installation">🚀 Start</a> |
<a href="https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/features_list.md">🗂️ Features</a> |
<a href="https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/customizing_test_runs.md">🖥️ CLI</a> |
<a href="https://github.com/seleniumbase/SeleniumBase/blob/master/examples/ReadMe.md">👨‍🏫 Examples</a> |
<a href="https://github.com/seleniumbase/SeleniumBase/blob/master/examples/ReadMe.md">📖 Examples</a> |
<a href="https://github.com/seleniumbase/SeleniumBase/tree/master/examples/boilerplates">♻️ Boilerplates</a> |
<a href="https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/locale_codes.md">🗾 Locales</a> |
<a href="https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/js_package_manager.md">🗄️ PkgManager</a>
@ -50,9 +50,9 @@ Tests are run with "pytest". Browsers are controlled by WebDriver.
<a href="https://github.com/seleniumbase/SeleniumBase/blob/master/examples/master_qa/ReadMe.md">🛂 MasterQA</a>
</p>
Get set up in minutes. Deploy anywhere.<br />
Build Web-UI tests with a [complete API](https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/method_summary.md).<br />
Generate [test reports and dashboards](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/example_logs/ReadMe.md).<br />
Easy setup. Can run tests on any cloud.<br />
Uses [Python APIs](https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/method_summary.md) for web automation.<br />
Can generate [test reports / dashboards](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/example_logs/ReadMe.md).<br />
--------

View File

@ -8,7 +8,7 @@ jobs:
- job: 'Test'
pool:
vmImage: 'Ubuntu-18.04'
vmImage: 'Ubuntu-20.04'
strategy:
matrix:
Python2.7:
@ -37,16 +37,19 @@ jobs:
- script: python -m pip install seleniumbase
displayName: 'Verify install from PyPI'
- script: python -m pip install -r requirements.txt --upgrade
displayName: 'Install dependencies'
#- script: python -m pip install -r requirements.txt --upgrade
# displayName: 'Install dependencies'
- script: python setup.py install
- script: python -m pip install -e .
displayName: 'Install SeleniumBase'
- script: |
sudo apt install google-chrome-stable
sudo apt-get install firefox
displayName: 'Install Chrome and Firefox'
displayName: 'Install Chrome'
#- script: |
# sudo apt-get install firefox
# displayName: 'Install Firefox'
- script: |
seleniumbase
@ -54,7 +57,7 @@ jobs:
displayName: 'Check the console scripts interface'
- script: |
seleniumbase install chromedriver latest
seleniumbase install chromedriver
displayName: 'Install chromedriver'
- script: |
@ -62,11 +65,17 @@ jobs:
pytest nothing.py
displayName: 'Make sure pytest is working'
#- script: python -m pytest examples/unit_tests/verify_framework.py
# displayName: 'Run pytest verify_framework.py'
- script: python -m pytest examples/boilerplates/boilerplate_test.py --browser=chrome --headless -v -s --junit-xml=junit/test-results.xml
displayName: 'Run pytest boilerplate_test.py --browser=chrome --headless'
- script: python -m pytest examples/test_demo_site.py --browser=chrome --headless -v -s --junit-xml=junit/test-results.xml
displayName: 'Run pytest test_demo_site.py --browser=chrome --headless'
#- script: python -m pytest examples/boilerplates/boilerplate_test.py --browser=chrome --headless -v -s --junit-xml=junit/test-results.xml
# displayName: 'Run pytest boilerplate_test.py --browser=firefox --headless'
#- script: python -m pytest examples/test_demo_site.py --browser=chrome --headless -v -s --junit-xml=junit/test-results.xml
# displayName: 'Run pytest test_demo_site.py --browser=chrome --headless'
#- script: python -m pytest examples/my_first_test.py --browser=chrome --headless -v -s --junit-xml=junit/test-results.xml
# displayName: 'Run pytest my_first_test.py --browser=chrome --headless'

View File

@ -1,5 +1,5 @@
regex>=2020.11.13
tqdm>=4.58.0
tqdm>=4.59.0
livereload==2.6.3;python_version>="3.6"
joblib==1.0.1;python_version>="3.6"
Markdown==3.3.4

View File

@ -18,6 +18,7 @@ class GooglePage():
class SeleniumBaseGitHubPage():
def click_seleniumbase_io_link(self, sb):
sb.wait_for_ready_state_complete()
sb.js_click('a[href*="seleniumbase.io"]')
sb.wait_for_ready_state_complete()
current_url = sb.get_current_url()

View File

@ -1,6 +1,7 @@
<h3><img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="32" /> Logging, Dashboards, and Reports:</h3>
(Log files in [SeleniumBase/examples/example_logs](https://github.com/seleniumbase/SeleniumBase/tree/master/examples/example_logs) were generated when [test_fail.py](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/test_fail.py) ran and failed.)
[<img src="http://img.youtube.com/vi/XpuJCjJhJwQ/0.jpg" title="SeleniumBase Features" width="285">](https://www.youtube.com/watch?v=XpuJCjJhJwQ)
<p>(<b><a href="https://www.youtube.com/watch?v=XpuJCjJhJwQ">SB Dashboard Tutorial on YouTube</a></b>)</p>
🔵 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).
@ -8,6 +9,8 @@
pytest test_fail.py
```
(Log files in [SeleniumBase/examples/example_logs](https://github.com/seleniumbase/SeleniumBase/tree/master/examples/example_logs) were generated when [test_fail.py](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/test_fail.py) ran and failed.)
<b>Examples of expected log files generated during failures:</b>
<ul>
<li><a href="https://github.com/seleniumbase/SeleniumBase/blob/master/examples/example_logs/basic_test_info.txt">basic_test_info.txt</a></li>

View File

@ -8,12 +8,12 @@ class MaClasseDeTest(CasDeBase):
self.ouvrir("https://fr.wikipedia.org/wiki/")
self.vérifier_texte("Wikipédia") # noqa
self.vérifier_élément('[alt="Wikipédia"]')
self.taper("#searchInput", "Crème brûlée")
self.cliquer("#searchButton")
self.js_taper("#searchform input", "Crème brûlée")
self.cliquer("#searchform button")
self.vérifier_texte("Crème brûlée", "#firstHeading")
self.vérifier_élément('img[alt*="Crème brûlée"]')
self.taper("#searchInput", "Jardin des Tuileries")
self.cliquer("#searchButton")
self.taper("#searchform input", "Jardin des Tuileries")
self.cliquer("#searchform button")
self.vérifier_texte("Jardin des Tuileries", "#firstHeading")
self.vérifier_élément('img[alt*="Jardin des Tuileries"]')
self.retour()

View File

@ -7,7 +7,7 @@
<a href="https://seleniumbase.io/help_docs/customizing_test_runs/">🖥️ CLI</a> |
<a href="https://seleniumbase.io/help_docs/features_list/">🗂️ Features</a>
<br />
<a href="https://seleniumbase.io/examples/ReadMe/">👨‍🏫 Examples</a> |
<a href="https://seleniumbase.io/examples/ReadMe/">📖 Examples</a> |
<a href="https://seleniumbase.io/help_docs/mobile_testing/">📱 Mobile</a>
<br />
<a href="https://seleniumbase.io/help_docs/syntax_formats/">🔡 Syntax Formats</a> |

View File

@ -1,7 +1,7 @@
[<img src="https://seleniumbase.io/cdn/img/super_logo_sb.png" title="SeleniumBase" width="285">](https://github.com/seleniumbase/SeleniumBase/blob/master/README.md)
[<img src="http://img.youtube.com/vi/Sjzq9kU5kOw/0.jpg" title="SeleniumBase Features" width="285">](https://www.youtube.com/watch?v=Sjzq9kU5kOw)
<p>(<b><a href="https://www.youtube.com/watch?v=Sjzq9kU5kOw">Watch the tutorial on YouTube</a></b>)</p>
<p>(<b><a href="https://www.youtube.com/watch?v=Sjzq9kU5kOw">Watch the SB tutorial on YouTube!</a></b>)</p>
<a id="feature_list"></a>
<h2><img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="32" /> ⛲ Features: 🗂️</h2>
@ -37,4 +37,5 @@
* Can load and make assertions on PDF files from websites or the local file system.
* Includes useful [Python decorators and password obfuscation methods](https://github.com/seleniumbase/SeleniumBase/blob/master/seleniumbase/common/ReadMe.md).
[<img src="https://seleniumbase.io/cdn/img/super_logo_3.png" title="SeleniumBase" width="285">](https://github.com/seleniumbase/SeleniumBase/blob/master/README.md)
[<img src="http://img.youtube.com/vi/yEQeAU_mrg0/0.jpg" title="SeleniumBase Features" width="285">](https://www.youtube.com/watch?v=yEQeAU_mrg0)
<p>(<b><a href="https://www.youtube.com/watch?v=yEQeAU_mrg0">See a quick overview on YouTube!</a></b>)</p>

View File

@ -2,9 +2,12 @@
<h2><img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="32" /> Method Summary (API Reference)</h2>
Here's a summary of SeleniumBase method definitions, which are defined in [base_case.py](https://github.com/seleniumbase/SeleniumBase/blob/master/seleniumbase/fixtures/base_case.py)
[<img src="http://img.youtube.com/vi/_yNJlHnp2JA/0.jpg" title="SeleniumBase Features" width="285">](https://www.youtube.com/watch?v=_yNJlHnp2JA)
<p>(<b><a href="https://www.youtube.com/watch?v=_yNJlHnp2JA">Common API Methods on YouTube</a></b>)</p>
For backwards compatibility, older versions of method names have remained to keep older scripts working. *(Ex: wait_for_element_visible was later shortened to wait_for_element and then to find_element. Also, add_text and send_keys are the same, etc.)*
Here's a list of SeleniumBase method definitions, which are defined in [base_case.py](https://github.com/seleniumbase/SeleniumBase/blob/master/seleniumbase/fixtures/base_case.py)
For backwards compatibility, older versions of method names have remained to keep older scripts working. *(E.g: wait_for_element_visible was shortened to wait_for_element and then to find_element.)*
```python
self.open(url)

View File

@ -3,7 +3,7 @@ pip>=21.0.1;python_version>="3.6"
packaging>=20.9
setuptools>=44.1.1;python_version<"3.5"
setuptools>=50.3.2;python_version>="3.5" and python_version<"3.6"
setuptools>=54.0.0;python_version>="3.6"
setuptools>=54.1.0;python_version>="3.6"
setuptools-scm>=5.0.2
wheel>=0.36.2
attrs>=20.3.0

View File

@ -1,2 +1,2 @@
# seleniumbase package
__version__ = "1.56.7"
__version__ = "1.56.8"

View File

@ -7017,7 +7017,10 @@ class BaseCase(unittest.TestCase):
def __quit_all_drivers(self):
if self._reuse_session and sb_config.shared_driver:
if len(self._drivers_list) > 0:
sb_config.shared_driver = self._drivers_list[0]
if self._drivers_list[0] != sb_config.shared_driver:
if sb_config.shared_driver in self._drivers_list:
self._drivers_list.remove(sb_config.shared_driver)
self._drivers_list.insert(0, sb_config.shared_driver)
self._default_driver = self._drivers_list[0]
self.switch_to_default_driver()
if len(self._drivers_list) > 1:

View File

@ -49,7 +49,7 @@ if sys.argv[-1] == 'publish':
print("\n*** Installing twine: *** (Required for PyPI uploads)\n")
os.system("python -m pip install --upgrade 'twine>=1.15.0'")
print("\n*** Installing tqdm: *** (Required for PyPI uploads)\n")
os.system("python -m pip install --upgrade 'tqdm>=4.58.0'")
os.system("python -m pip install --upgrade 'tqdm>=4.59.0'")
print("\n*** Publishing The Release to PyPI: ***\n")
os.system('python -m twine upload dist/*') # Requires ~/.pypirc Keys
print("\n*** The Release was PUBLISHED SUCCESSFULLY to PyPI! :) ***\n")
@ -107,7 +107,7 @@ setup(
'packaging>=20.9',
'setuptools>=44.1.1;python_version<"3.5"',
'setuptools>=50.3.2;python_version>="3.5" and python_version<"3.6"',
'setuptools>=54.0.0;python_version>="3.6"',
'setuptools>=54.1.0;python_version>="3.6"',
'setuptools-scm>=5.0.2',
'wheel>=0.36.2',
'attrs>=20.3.0',