Skip to content

Commit e955a1b

Browse files
committed
Refactoring
1 parent 6f9086f commit e955a1b

File tree

4 files changed

+207
-192
lines changed

4 files changed

+207
-192
lines changed

seleniumbase/core/js_snippets.py

Lines changed: 0 additions & 176 deletions
This file was deleted.

seleniumbase/core/s3_manager.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,34 @@
11
"""
2-
Manager for dealing with uploading/managing files on Amazon S3
2+
Methods for uploading/managing files on Amazon S3.
33
"""
4-
from boto.s3.connection import S3Connection
5-
from boto.s3.key import Key
64
from seleniumbase.config import settings
75

86
already_uploaded_files = []
97

108

119
class S3LoggingBucket(object):
1210
"""
13-
A class to upload log files from tests to Amazon S3.
11+
A class for uploading log files from tests to Amazon S3.
1412
Those files can then be shared easily.
1513
"""
16-
1714
def __init__(
1815
self,
1916
log_bucket=settings.S3_LOG_BUCKET,
2017
bucket_url=settings.S3_BUCKET_URL,
2118
selenium_access_key=settings.S3_SELENIUM_ACCESS_KEY,
2219
selenium_secret_key=settings.S3_SELENIUM_SECRET_KEY,
2320
):
21+
from boto.s3.connection import S3Connection
2422

2523
self.conn = S3Connection(selenium_access_key, selenium_secret_key)
2624
self.bucket = self.conn.get_bucket(log_bucket)
2725
self.bucket_url = bucket_url
2826

29-
def get_key(self, _name):
27+
def get_key(self, file_name):
3028
""" Create a new Key instance with the given name. """
31-
return Key(bucket=self.bucket, name=_name)
29+
from boto.s3.key import Key
30+
31+
return Key(bucket=self.bucket, name=file_name)
3232

3333
def get_bucket(self):
3434
""" Return the bucket being used. """
@@ -37,7 +37,7 @@ def get_bucket(self):
3737
def upload_file(self, file_name, file_path):
3838
"""Upload a given file from the file_path to the bucket
3939
with the new name/path file_name."""
40-
upload_key = Key(bucket=self.bucket, name=file_name)
40+
upload_key = self.get_key(file_name)
4141
content_type = "text/plain"
4242
if file_name.endswith(".html"):
4343
content_type = "text/html"

seleniumbase/fixtures/base_case.py

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2228,7 +2228,7 @@ def switch_to_frame(self, frame, timeout=None):
22282228

22292229
def switch_to_default_content(self):
22302230
"""Brings driver control outside the current iframe.
2231-
(If driver control is inside an iframe, the driver control
2231+
(If the driver control is inside an iframe, the driver control
22322232
will be set to one level above the current frame. If the driver
22332233
control is not currently in an iframe, nothing will happen.)"""
22342234
self.__check_scope()
@@ -5224,8 +5224,9 @@ def wait_for_element_not_present(
52245224
"""Same as self.wait_for_element_absent()
52255225
Waits for an element to no longer appear in the HTML of a page.
52265226
A hidden element still counts as appearing in the page HTML.
5227-
If an element with "hidden" status is acceptable,
5228-
use wait_for_element_not_visible() instead."""
5227+
If waiting for elements to be hidden instead of nonexistent,
5228+
use wait_for_element_not_visible() instead.
5229+
"""
52295230
self.__check_scope()
52305231
if not timeout:
52315232
timeout = settings.LARGE_TIMEOUT
@@ -5241,6 +5242,10 @@ def assert_element_not_present(
52415242
):
52425243
"""Same as self.assert_element_absent()
52435244
Will raise an exception if the element stays present.
5245+
A hidden element counts as a present element, which fails this assert.
5246+
If you want to assert that elements are hidden instead of nonexistent,
5247+
use assert_element_not_visible() instead.
5248+
(Note that hidden elements are still present in the HTML of the page.)
52445249
Returns True if successful. Default timeout = SMALL_TIMEOUT."""
52455250
self.__check_scope()
52465251
if not timeout:
@@ -8121,9 +8126,10 @@ def wait_for_element_absent(
81218126
self, selector, by=By.CSS_SELECTOR, timeout=None
81228127
):
81238128
"""Waits for an element to no longer appear in the HTML of a page.
8124-
A hidden element still counts as appearing in the page HTML.
8125-
If an element with "hidden" status is acceptable,
8126-
use wait_for_element_not_visible() instead."""
8129+
A hidden element counts as a present element, which fails this assert.
8130+
If waiting for elements to be hidden instead of nonexistent,
8131+
use wait_for_element_not_visible() instead.
8132+
"""
81278133
self.__check_scope()
81288134
if not timeout:
81298135
timeout = settings.LARGE_TIMEOUT
@@ -8137,8 +8143,12 @@ def wait_for_element_absent(
81378143
def assert_element_absent(
81388144
self, selector, by=By.CSS_SELECTOR, timeout=None
81398145
):
8140-
"""Similar to wait_for_element_absent() - returns nothing.
8146+
"""Similar to wait_for_element_absent()
81418147
As above, will raise an exception if the element stays present.
8148+
A hidden element counts as a present element, which fails this assert.
8149+
If you want to assert that elements are hidden instead of nonexistent,
8150+
use assert_element_not_visible() instead.
8151+
(Note that hidden elements are still present in the HTML of the page.)
81428152
Returns True if successful. Default timeout = SMALL_TIMEOUT."""
81438153
self.__check_scope()
81448154
if not timeout:
@@ -8169,7 +8179,7 @@ def wait_for_element_not_visible(
81698179
def assert_element_not_visible(
81708180
self, selector, by=By.CSS_SELECTOR, timeout=None
81718181
):
8172-
"""Similar to wait_for_element_not_visible() - returns nothing.
8182+
"""Similar to wait_for_element_not_visible()
81738183
As above, will raise an exception if the element stays visible.
81748184
Returns True if successful. Default timeout = SMALL_TIMEOUT."""
81758185
self.__check_scope()

0 commit comments

Comments
 (0)