Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
D
drupal
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Custom Issue Tracker
Custom Issue Tracker
Labels
Merge Requests
221
Merge Requests
221
Requirements
Requirements
List
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Analytics
Analytics
Code Review
Insights
Issue
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
project
drupal
Commits
ea55e39c
Commit
ea55e39c
authored
Mar 20, 2018
by
catch
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue
#2948276
by alexpott: Improve debugability of JavascriptTestBase tests
parent
a71163c4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
2 deletions
+17
-2
core/tests/Drupal/Tests/BrowserTestBase.php
core/tests/Drupal/Tests/BrowserTestBase.php
+17
-2
No files found.
core/tests/Drupal/Tests/BrowserTestBase.php
View file @
ea55e39c
...
...
@@ -1054,7 +1054,20 @@ protected function drupalUserIsLoggedIn(AccountInterface $account) {
* The CSS selector identifying the element to click.
*/
protected
function
click
(
$css_selector
)
{
$starting_url
=
$this
->
getSession
()
->
getCurrentUrl
();
$this
->
getSession
()
->
getDriver
()
->
click
(
$this
->
cssSelectToXpath
(
$css_selector
));
// Log only for JavascriptTestBase tests because for Goutte we log with
// ::getResponseLogHandler.
if
(
$this
->
htmlOutputEnabled
&&
!
(
$this
->
getSession
()
->
getDriver
()
instanceof
GoutteDriver
))
{
$out
=
$this
->
getSession
()
->
getPage
()
->
getContent
();
$html_output
=
'Clicked element with CSS selector: '
.
$css_selector
.
'<hr />Starting URL: '
.
$starting_url
.
'<hr />Ending URL: '
.
$this
->
getSession
()
->
getCurrentUrl
();
$html_output
.
=
'<hr />'
.
$out
;
$html_output
.
=
$this
->
getHtmlOutputHeaders
();
$this
->
htmlOutput
(
$html_output
);
}
}
/**
...
...
@@ -1080,8 +1093,9 @@ public function __sleep() {
*
* The link to the HTML output message will be printed by the results printer.
*
* @param string $message
* The HTML output message to be stored.
* @param string|null $message
* (optional) The HTML output message to be stored. If not supplied the
* current page content is used.
*
* @see \Drupal\Tests\Listeners\VerbosePrinter::printResult()
*/
...
...
@@ -1089,6 +1103,7 @@ protected function htmlOutput($message) {
if
(
!
$this
->
htmlOutputEnabled
)
{
return
;
}
$message
=
$message
?:
$this
->
getSession
()
->
getPage
()
->
getContent
();
$message
=
'<hr />ID #'
.
$this
->
htmlOutputCounter
.
' (<a href="'
.
$this
->
htmlOutputClassName
.
'-'
.
(
$this
->
htmlOutputCounter
-
1
)
.
'-'
.
$this
->
htmlOutputTestId
.
'.html">Previous</a> | <a href="'
.
$this
->
htmlOutputClassName
.
'-'
.
(
$this
->
htmlOutputCounter
+
1
)
.
'-'
.
$this
->
htmlOutputTestId
.
'.html">Next</a>)<hr />'
.
$message
;
$html_output_filename
=
$this
->
htmlOutputClassName
.
'-'
.
$this
->
htmlOutputCounter
.
'-'
.
$this
->
htmlOutputTestId
.
'.html'
;
file_put_contents
(
$this
->
htmlOutputDirectory
.
'/'
.
$html_output_filename
,
$message
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment