Skip to content

Commit

Permalink
[qacode] fix for issue #261 (#262)
Browse files Browse the repository at this point in the history
  • Loading branch information
netzulo committed Apr 13, 2019
1 parent 6432456 commit 06fd9c9
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 20 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,13 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Moved log messages to new class to centralize them #untracked
- Refactor for control suites after changes from #247 , #untracked
- Updated USAGE.rst documentation #untracked
+ Now get_text check for input tag #untracked
- Now get_text check for input tag #untracked

### Fixed
- Can't use dropdown methods if ControlForm strict_tags is disabled #247
- Some PageExceptions was failing at instantiation #untracked
- Now get_tag update self property
- fixed CI complexity issue for #261

### Removed
- Deleted ControlGroup + tests #256
Expand Down
32 changes: 14 additions & 18 deletions qacode/core/bots/modules/nav_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,24 +349,20 @@ def get_log(self, log_name='browser', raises=False):
list() -- list of messages typed on a log_name
"""
try:
if log_name == 'browser':
return self.driver.get_log(log_name)
if log_name == 'driver':
return self.driver.get_log(log_name)
if log_name == 'client':
return self.driver.get_log(log_name)
if log_name == 'server':
return self.driver.get_log(log_name)
except WebDriverException as err:
msg = "nav | get_log: log_name={}, err={}"
self.log.warning(msg.format(log_name, err.msg))
# Selenium said, not all drivers will be handled
# by them with all options values
if raises:
raise CoreException(
msg=("selenium log_name just can be:"
" [browser,driver,client,server]"))
return []
return {
'browser': self.driver.get_log,
'driver': self.driver.get_log,
'client': self.driver.get_log,
'server': self.driver.get_log,
}[log_name](log_name)
except (KeyError, WebDriverException) as err:
if isinstance(err, KeyError):
raise CoreException("Can't use not valid value to get log")
self.log.debug(("nav | get_log: Selenium, not all drivers will"
" be handled by them with all optionsvalues"))
self.log.warning("nav | get_log: log_name={}, err={}".format(
log_name, err.msg))
return list()

def get_screenshot_as_base64(self):
"""Gets the screenshot of the current window as a base64 encoded string
Expand Down
6 changes: 5 additions & 1 deletion tests/001_functionals/suite_004_navbase.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,10 +165,14 @@ def test_getlog_ok(self):

@pytest.mark.skipIf(SKIP_NAVS, SKIP_NAVS_MSG)
@pytest.mark.parametrize(
"log_name", ['browser', 'driver', 'client', 'server'])
"log_name", [None, 'browser', 'driver', 'client', 'server'])
def test_getlog_lognames(self, log_name):
"""Testcase: test_getlog_lognames"""
self.bot.navigation.get_url(self.page.get('url'))
if log_name is None:
with pytest.raises(CoreException):
self.bot.navigation.get_log(log_name=log_name)
return True
log_data = self.bot.navigation.get_log(log_name=log_name)
self.assert_not_none(log_data)
msg = "selenium logs, log_name={}, log_data={}".format(
Expand Down

0 comments on commit 06fd9c9

Please sign in to comment.