Skip to content

Commit ed9498d

Browse files
joaoncaaltat
authored andcommitted
Set log source default level to TRACE. (#1244)
Change most of the keywords loglevel to TRACE.
1 parent a5af615 commit ed9498d

18 files changed

+87
-84
lines changed

atest/README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ from the `.travis.yam`_. Generally speaking the test are automatically run
8282
by using Chrome and Firefox browsers. The project uses Python 2.7, Python 3.4,
8383
Python 3.6 and PyPy 3.5 for test execution. The project uses and latest available
8484
Selenium 3 version for test execution. Test uses Robot Framework versions
85-
2.9.2 and 3.0.2 for acceptance test execution.
85+
2.9.2 and 3.0.4 for acceptance test execution.
8686

8787
.. _browser driver: https://github.com/robotframework/SeleniumLibrary#browser-drivers
8888
.. _PATH: https://en.wikipedia.org/wiki/PATH_(variable)

atest/acceptance/big_list_of_naught_strings.robot

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ Big List Of Naughty Strings
1111
:FOR ${string} IN @{blns}
1212
\ Check Blns Error Check ${string}
1313

14-
1514
*** Keywords ***
1615
Check Blns Error Check
1716
[Arguments] ${string}

atest/acceptance/extending.robot

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ Suite Teardown ExtSeLib.Close All Browsers
44
Resource resource.robot
55
Library ExtSL.ExtSL WITH NAME ExtSeLib
66

7-
87
*** Test Cases ***
98
When Extending SeleniumLibrary Keywords With Decorated Name Can Be Used For Extending
109
${elements} = ExtSeLib.Ext Web Element //tr

atest/acceptance/keywords/click_element_modifier.robot

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ Suite Setup Go To Page "javascript/click_modifier.html"
33
Test Setup Initialize Page
44
Resource ../resource.robot
55

6-
76
*** Test Cases ***
87
Click Element Modifier CTRL
98
Click Element Button modifier=CTRL

atest/acceptance/keywords/content_assertions.robot

Lines changed: 27 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ Location Should Be
2020
... Location should have been 'non existing' but was 'http://localhost:7000/html/'.
2121
... Location Should Be non existing message=None
2222

23-
2423
Location Should Contain
2524
[Documentation] LOG 2:4 Current location contains 'html'.
2625
Location Should Contain html
@@ -36,7 +35,6 @@ Location Should Contain
3635
... Location should have contained 'not a location' but it was 'http://localhost:7000/html/'.
3736
... Location Should Contain not a location message=None
3837

39-
4038
Title Should Be
4139
[Documentation] LOG 2:4 Page title is '(root)/index.html'.
4240
Title Should Be (root)/index.html
@@ -47,26 +45,36 @@ Title Should Be
4745
... Page title was not expected
4846
... Title Should Be not a title message=Page title was not expected
4947

50-
5148
Page Should Contain
52-
[Documentation] LOG 2:7 Current page contains text 'needle'.
53-
... LOG 4.1:14 REGEXP: (?i)<html.*</html>
49+
[Documentation] The last step fails and doesn't contain the html content.
50+
... FAIL Page should have contained text 'non existing text' but did not.
51+
... LOG 2:7 Current page contains text 'needle'.
52+
... LOG 3:7 INFO Current page contains text 'This is the haystack'.
53+
... LOG 4:14 FAIL Page should have contained text 'non existing text' but did not.
5454
Page Should Contain needle
5555
Page Should Contain This is the haystack
56-
Run Keyword And Expect Error
57-
... Page should have contained text 'non existing text' but did not.
58-
... Page Should Contain non existing text
56+
Page Should Contain non existing text
5957

60-
Page Should Contain with text having internal elements
58+
Page Should Contain With Text Having Internal Elements
6159
Page Should Contain This is the haystack and somewhere on this page is a needle.
6260
Go to page "links.html"
6361
Page Should Contain Relative with text after
6462

65-
Page Should Contain With Custom Log Level
66-
[Documentation] LOG 2.1:14 DEBUG REGEXP: (?i)<html.*</html>
67-
Run Keyword And Expect Error
68-
... Page should have contained text 'non existing text' but did not.
69-
... Page Should Contain non existing text DEBUG
63+
Page Should Contain With Custom Log Level DEBUG
64+
[Documentation] Html content is shown at DEBUG level.
65+
... FAIL Page should have contained text 'non existing text' but did not.
66+
... LOG 2:14 DEBUG REGEXP: (?i)<html.*</html>
67+
... LOG 2:15 FAIL Page should have contained text 'non existing text' but did not.
68+
Page Should Contain non existing text DEBUG
69+
70+
Page Should Contain With Custom Log Level TRACE
71+
[Documentation] Html content is shown at DEBUG level.
72+
... FAIL Page should have contained text 'non existing text' but did not.
73+
... LOG 3:15 TRACE REGEXP: (?i)<html.*</html>
74+
... LOG 3:16 FAIL Page should have contained text 'non existing text' but did not.
75+
Set Log Level TRACE
76+
Page Should Contain non existing text TRACE
77+
[Teardown] Set Log Level DEBUG
7078

7179
Page Should Contain With Disabling Source Logging
7280
[Documentation] LOG 3:2 NONE
@@ -81,12 +89,12 @@ Page Should Contain With Frames
8189
Page Should Contain You're looking at right.
8290

8391
Page Should Not Contain
84-
[Documentation] LOG 2:11 Current page does not contain text 'non existing text'.
85-
... LOG 3.1:10 REGEXP: (?i)<html.*</html>
92+
[Documentation] Default log level does not have html output.
93+
... FAIL Page should not have contained text 'needle'.
94+
... LOG 2:11 Current page does not contain text 'non existing text'.
95+
... LOG 3:10 FAIL Page should not have contained text 'needle'.
8696
Page Should Not Contain non existing text
87-
Run Keyword And Expect Error
88-
... Page should not have contained text 'needle'.
89-
... Page Should Not Contain needle
97+
Page Should Not Contain needle
9098

9199
Page Should Not Contain With Custom Log Level
92100
[Documentation] LOG 2.1:10 DEBUG REGEXP: (?i)<html.*</html>

atest/acceptance/keywords/cookies.robot

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ Suite Teardown Delete All Cookies
55
Test Setup Add Cookies
66
Resource ../resource.robot
77

8-
98
*** Test Cases ***
109
Get Cookies
1110
${cookies}= Get Cookies

atest/acceptance/keywords/counting_elements.robot

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -100,14 +100,12 @@ Page Should Contain Element When Limit Is Not Number
100100
... Page Should Contain Element name: div_name limit=AA
101101

102102
Page Should Contain Element When Error With Limit And Different Loglevels
103-
[Documentation]
104-
... LOG 2.1:7 INFO REGEXP: .*links\\.html.*
105-
... LOG 3.1:7 DEBUG REGEXP: .*links\\.html.*
103+
[Documentation] Only at DEBUG loglevel is the html placed in the log.
104+
... FAIL Page should have contained "99" element(s), but it did contain "2" element(s).
105+
... LOG 2.1:7 FAIL Page should have contained "99" element(s), but it did contain "2" element(s).
106+
... LOG 3:7 DEBUG REGEXP: .*links\\.html.*
107+
... LOG 3:8 FAIL Page should have contained "99" element(s), but it did contain "2" element(s).
106108
[Setup] Go To Page "links.html"
107109
Run Keyword And Ignore Error
108110
... Page Should Contain Element name: div_name limit=99
109-
Run Keyword And Ignore Error
110-
... Page Should Contain Element
111-
... name: div_name
112-
... loglevel=debug
113-
... limit=99
111+
Page Should Contain Element name: div_name loglevel=debug limit=99

atest/acceptance/keywords/screenshot_element.robot

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ Documentation Suite description
33
Suite Setup Go To Page "links.html"
44
Resource ../resource.robot
55

6-
76
*** Test Cases ***
87
Capture Element Screenshot
98
[Setup] Remove Files ${OUTPUTDIR}/selenium-element-screenshot-1.png

atest/run.py

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -52,19 +52,19 @@
5252

5353
# Folder settings
5454
ROOT_DIR = os.path.dirname(os.path.abspath(__file__))
55-
ACCEPTANCE_TEST_DIR = os.path.join(ROOT_DIR, "acceptance")
56-
UNIT_TEST_RUNNER = os.path.join(ROOT_DIR, '..', 'utest', 'run.py')
57-
RESOURCES_DIR = os.path.join(ROOT_DIR, "resources")
58-
RESULTS_DIR = os.path.join(ROOT_DIR, "results")
59-
SRC_DIR = os.path.normpath(os.path.join(ROOT_DIR, "..", "src"))
60-
TEST_LIBS_DIR = os.path.join(RESOURCES_DIR, "testlibs")
61-
HTTP_SERVER_FILE = os.path.join(RESOURCES_DIR, "testserver", "testserver.py")
55+
ACCEPTANCE_TEST_DIR = os.path.join(ROOT_DIR, 'acceptance')
56+
UNIT_TEST_RUNNER = os.path.join(ROOT_DIR, os.pardir, 'utest', 'run.py')
57+
RESOURCES_DIR = os.path.join(ROOT_DIR, 'resources')
58+
RESULTS_DIR = os.path.join(ROOT_DIR, 'results')
59+
SRC_DIR = os.path.normpath(os.path.join(ROOT_DIR, os.pardir, 'src'))
60+
TEST_LIBS_DIR = os.path.join(RESOURCES_DIR, 'testlibs')
61+
HTTP_SERVER_FILE = os.path.join(RESOURCES_DIR, 'testserver', 'testserver.py')
6262
# Travis settings for pull request
63-
TRAVIS = os.environ.get("TRAVIS", False)
64-
TRAVIS_EVENT_TYPE = os.environ.get("TRAVIS_EVENT_TYPE", None)
65-
TRAVIS_JOB_NUMBER = os.environ.get("TRAVIS_JOB_NUMBER", "localtunnel")
66-
SAUCE_USERNAME = os.environ.get("SAUCE_USERNAME", None)
67-
SAUCE_ACCESS_KEY = os.environ.get("SAUCE_ACCESS_KEY", None)
63+
TRAVIS = os.environ.get('TRAVIS', False)
64+
TRAVIS_EVENT_TYPE = os.environ.get('TRAVIS_EVENT_TYPE', None)
65+
TRAVIS_JOB_NUMBER = os.environ.get('TRAVIS_JOB_NUMBER', 'localtunnel')
66+
SAUCE_USERNAME = os.environ.get('SAUCE_USERNAME', None)
67+
SAUCE_ACCESS_KEY = os.environ.get('SAUCE_ACCESS_KEY', None)
6868
TRAVIS_BROWSERS = ['chrome', 'firefox', 'headlesschrome']
6969

7070
ROBOT_OPTIONS = [
@@ -91,7 +91,7 @@ def unit_tests():
9191
sys.exit(failures)
9292

9393

94-
def acceptance_tests(interpreter, browser, rf_options=[],
94+
def acceptance_tests(interpreter, browser, rf_options=None,
9595
sauce_username=None, sauce_key=None):
9696
if os.path.exists(RESULTS_DIR):
9797
shutil.rmtree(RESULTS_DIR)
@@ -125,7 +125,8 @@ def execute_tests(interpreter, browser, rf_options, sauce_username, sauce_key):
125125
options = []
126126
runner = interpreter.split() + ['-m', 'robot.run']
127127
options.extend([opt.format(browser=browser) for opt in ROBOT_OPTIONS])
128-
options += rf_options
128+
if rf_options:
129+
options += rf_options
129130
if sauce_username and sauce_key:
130131
options.extend(get_sauce_conf(browser, sauce_username, sauce_key))
131132
command = runner

src/SeleniumLibrary/base/librarycomponent.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def log_source(self, loglevel='INFO'):
4444
self.ctx.log_source(loglevel)
4545

4646
def assert_page_contains(self, locator, tag=None, message=None,
47-
loglevel='INFO'):
47+
loglevel='TRACE'):
4848
if not self.find_element(locator, tag, required=False):
4949
self.log_source(loglevel)
5050
if is_noney(message):
@@ -55,7 +55,7 @@ def assert_page_contains(self, locator, tag=None, message=None,
5555
% (tag or 'element', locator))
5656

5757
def assert_page_not_contains(self, locator, tag=None, message=None,
58-
loglevel='INFO'):
58+
loglevel='TRACE'):
5959
if self.find_element(locator, tag, required=False):
6060
self.log_source(loglevel)
6161
if is_noney(message):

0 commit comments

Comments
 (0)