Skip to content

Commit e10bc32

Browse files
authored
Merge pull request #380 from seleniumbase/remove-email-manager
Remove email_manager. Use IMAPClient instead.
2 parents a5826f6 + 61df912 commit e10bc32

File tree

9 files changed

+6
-577
lines changed

9 files changed

+6
-577
lines changed

README.md

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ All-in-one framework for fast & simple browser automation and end-to-end testing
1010
pytest my_first_test.py --demo_mode
1111
```
1212

13-
SeleniumBase uses [pytest](https://github.com/pytest-dev/pytest) for running tests, while using [Selenium WebDriver](https://www.seleniumhq.org/) for controlling web browsers. SeleniumBase includes additional tools for automated email testing, [assisted-QA](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/master_qa/ReadMe.md), and [website tours](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/tour_examples/ReadMe.md).
13+
SeleniumBase uses [pytest](https://github.com/pytest-dev/pytest) for running tests, while using [Selenium WebDriver](https://www.seleniumhq.org/) for controlling web browsers. SeleniumBase includes additional tools for automated [visual testing](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/visual_testing/ReadMe.md), assisted-QA with [MasterQA](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/master_qa/ReadMe.md), and creating [website tours](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/tour_examples/ReadMe.md).
1414

1515
## <img src="https://cdn2.hubspot.net/hubfs/100006/images/super_square_logo_3a.png" title="SeleniumBase" height="32"> Get Started:
1616

@@ -242,7 +242,7 @@ pytest test_suite.py --browser=firefox
242242
An easy way to override seleniumbase/config/settings.py is by using a custom settings file.
243243
Here's the command-line option to add to tests: (See [examples/custom_settings.py](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/custom_settings.py))
244244
``--settings_file=custom_settings.py``
245-
(Settings include default timeout values, a two-factor auth key, DB credentials, S3 credentials, Email Testing API credentials, and other important settings used by tests.)
245+
(Settings include default timeout values, a two-factor auth key, DB credentials, S3 credentials, and other important settings used by tests.)
246246

247247
To pass additional data from the command-line to tests, add ``--data="ANY STRING"``.
248248
Now inside your tests, you can use ``self.data`` to access that.
@@ -677,24 +677,6 @@ pytest --reruns 5 --reruns-delay 1
677677

678678
Additionally, you can use the ``@retry_on_exception()`` decorator to specifically retry failing methods. (First import: ``from seleniumbase import decorators``) To learn more about SeleniumBase decorators, [click here](https://github.com/seleniumbase/SeleniumBase/tree/master/seleniumbase/common).
679679

680-
#### Email Testing / Checking Email:
681-
Let's say you have a test that sends an email, and now you want to check that the email was received:
682-
683-
```python
684-
from seleniumbase.fixtures.email_manager import EmailManager, EmailException
685-
num_email_results = 0
686-
email_subject = "This is the subject to search for (maybe include a timestamp)"
687-
email_manager = EmailManager("{YOUR SELENIUM GMAIL ACCOUNT EMAIL ADDRESS}")
688-
# The password for this would be stored in seleniumbase/config/settings.py
689-
try:
690-
html_text = email_manager.search(SUBJECT="%s" % email_subject, timeout=60)
691-
num_email_results = len(html_text)
692-
except EmailException:
693-
num_email_results = 0
694-
self.assert_true(num_email_results) # True if not zero
695-
```
696-
697-
Now you can parse through the email if you're looking for specific text or want to navigate to a link listed there.
698680

699681
### <img src="https://cdn2.hubspot.net/hubfs/100006/images/super_square_logo_3a.png" title="SeleniumBase" height="32"> Wrap-Up
700682

examples/custom_settings.py

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -67,17 +67,3 @@
6767
# Helps identify which strings/passwords have been obfuscated.
6868
OBFUSCATION_START_TOKEN = "$^*ENCRYPT="
6969
OBFUSCATION_END_TOKEN = "?&#$"
70-
71-
# Default Email Credentials
72-
# (If tests send out emails, you can scan and verify them by using IMAP)
73-
# Here's a list of imap strings for known email providers:
74-
# - Gmail: imap.gmail.com
75-
# - Outlook/Live: imap-mail.outlook.com
76-
# - Yahoo Mail: imap.mail.yahoo.com
77-
# - AT&T: imap.mail.att.net
78-
# - Comcast: imap.comcast.net
79-
# - Verizon: incoming.verizon.net
80-
EMAIL_USERNAME = "[TEST ACCOUNT GMAIL USERNAME]@gmail.com"
81-
EMAIL_PASSWORD = "[TEST ACCOUNT GMAIL PASSWORD]"
82-
EMAIL_IMAP_STRING = "imap.gmail.com"
83-
EMAIL_IMAP_PORT = 993

examples/visual_testing/ReadMe.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
[<img src="https://cdn2.hubspot.net/hubfs/100006/images/SeleniumBaseText_F.png" title="SeleniumBase" align="center" height="38">](https://github.com/seleniumbase/SeleniumBase/blob/master/README.md)
12
### Automated Visual Testing (Layout Change Detection)
23

34
Automated visual testing can help you detect when something has changed the layout of a web page. Rather than comparing screenshots, a more effective way is to detect layout differences by comparing HTML tags and properties. If a change is detected, it could mean that something broke on the webpage, or possibly something harmless like a website redesign or dynamic content.

help_docs/customizing_test_runs.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ You can interchange **pytest** with **nosetests**, but using pytest is strongly
6161
An easy way to override seleniumbase/config/settings.py is by using a custom settings file.
6262
Here's the command-line option to add to tests: (See [examples/custom_settings.py](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/custom_settings.py))
6363
``--settings_file=custom_settings.py``
64-
(Settings include default timeout values, a two-factor auth key, DB credentials, S3 credentials, Email Testing API credentials, and other important settings used by tests.)
64+
(Settings include default timeout values, a two-factor auth key, DB credentials, S3 credentials, and other important settings used by tests.)
6565

6666
#### **Running tests on [BrowserStack](https://www.browserstack.com/automate#)'s Selenium Grid, the [Sauce Labs](https://saucelabs.com/products/open-source-frameworks/selenium) Selenium Grid, the [TestingBot](https://testingbot.com/features) Selenium Grid, (or your own):**
6767

help_docs/method_summary.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[<img src="https://cdn2.hubspot.net/hubfs/100006/images/SeleniumBaseText_F.png" title="SeleniumBase" align="center" height="38">](https://github.com/seleniumbase/SeleniumBase/blob/master/README.md)
2-
## Method Summary
2+
## Method Summary Overview
33

44
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)
55

seleniumbase/config/settings.py

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -139,21 +139,3 @@
139139
# Helps identify which strings/passwords have been obfuscated.
140140
OBFUSCATION_START_TOKEN = "$^*ENCRYPT="
141141
OBFUSCATION_END_TOKEN = "?&#$"
142-
143-
144-
# #####>>>>>----- OPTIONAL SETTINGS -----<<<<<#####
145-
# ##### (For reading emails, notifying people via chat apps, etc.)
146-
147-
# Default Email Credentials
148-
# (If tests send out emails, you can scan and verify them by using IMAP)
149-
# Here's a list of imap strings for known email providers:
150-
# - Gmail: imap.gmail.com
151-
# - Outlook/Live: imap-mail.outlook.com
152-
# - Yahoo Mail: imap.mail.yahoo.com
153-
# - AT&T: imap.mail.att.net
154-
# - Comcast: imap.comcast.net
155-
# - Verizon: incoming.verizon.net
156-
EMAIL_USERNAME = "[TEST ACCOUNT GMAIL USERNAME]@gmail.com"
157-
EMAIL_PASSWORD = "[TEST ACCOUNT GMAIL PASSWORD]"
158-
EMAIL_IMAP_STRING = "imap.gmail.com"
159-
EMAIL_IMAP_PORT = 993

seleniumbase/core/settings_parser.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -144,14 +144,6 @@ def set_settings(settings_file):
144144
settings.OBFUSCATION_START_TOKEN = override_settings[key]
145145
elif key == "OBFUSCATION_END_TOKEN":
146146
settings.OBFUSCATION_END_TOKEN = override_settings[key]
147-
elif key == "EMAIL_USERNAME":
148-
settings.EMAIL_USERNAME = override_settings[key]
149-
elif key == "EMAIL_PASSWORD":
150-
settings.EMAIL_PASSWORD = override_settings[key]
151-
elif key == "EMAIL_IMAP_STRING":
152-
settings.EMAIL_IMAP_STRING = override_settings[key]
153-
elif key == "EMAIL_IMAP_PORT":
154-
settings.EMAIL_IMAP_PORT = override_settings[key]
155147
else:
156148
continue
157149

0 commit comments

Comments
 (0)