forked from SeleniumHQ/selenium
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding support to submit cleaned diagnostic information to a gist and…
… stop hiding errors so that we can fix them faster
- Loading branch information
1 parent
8e072aa
commit c9e9245
Showing
6 changed files
with
173 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
var diagInfo = window.arguments[0]; | ||
|
||
function init() { | ||
_loadDiagInfo(); | ||
} | ||
|
||
function submitInfo() { | ||
if (!document.getElementById('consent').checked) { | ||
alert("The diagnostic information will be submitted only if you provide your consent through the check box"); | ||
return false; | ||
} | ||
return true; | ||
} | ||
|
||
function cancelSubmit() { | ||
diagInfo.data = ""; | ||
return true; | ||
} | ||
|
||
function _loadDiagInfo() { | ||
document.getElementById('diag').value = diagInfo.data; | ||
} | ||
|
||
function mask() { | ||
var maskText = document.getElementById('mask'); | ||
diagInfo.data = diagInfo.data.replace(maskText.value, '*****', 'g'); | ||
maskText.value = ""; | ||
_loadDiagInfo(); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<?xml-stylesheet href="chrome://global/skin" type="text/css"?> | ||
<!-- | ||
Copyright 2014 Samit Badle | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
--> | ||
<!DOCTYPE dialog [ | ||
<!ENTITY % browserDTD SYSTEM "chrome://browser/locale/browser.dtd"> | ||
%browserDTD; | ||
]> | ||
<dialog buttons="accept,cancel" | ||
id="selenium-ide-diag-info" | ||
title="Diagnostic Information" | ||
width="520" | ||
height="600" | ||
onload="init()" | ||
ondialogaccept="return submitInfo();" | ||
ondialogcancel="return cancelSubmit();" | ||
buttonlabelaccept="Submit" | ||
defaultButton="" | ||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> | ||
|
||
<script type="application/x-javascript" src="chrome://selenium-ide/content/browser/mozilla/prompt-service.js"/> | ||
<script type="application/x-javascript" src="chrome://selenium-ide/content/health/diag-info.js"/> | ||
<vbox flex="1"> | ||
<groupbox flex="1"> | ||
<caption label="Diagnostic Information"/> | ||
<textbox id="diag" flex="1" multiline="true" readonly="true"/> | ||
</groupbox> | ||
<description> | ||
Sometimes the diagnostic information can contain sensitive information like passwords contained in error messages. Please check and replace all sensitive information by replacing it with ***** using the text box below. | ||
</description> | ||
<hbox align="center"> | ||
<textbox id="mask" multiline="false" flex="1"/> | ||
<button id="mask-button" label="Replace" tooltiptext="Mask sensitive information" oncommand="mask()"/> | ||
</hbox> | ||
<separator class="groove-thin"/> | ||
<description> | ||
The information will be sent to a public server. | ||
</description> | ||
<hbox align="center"> | ||
<checkbox id="consent" label="I consent that this information can be made available publicly"/> | ||
</hbox> | ||
</vbox> | ||
</dialog> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
/* | ||
* Copyright 2015 Samit Badle | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
/** | ||
* Creating public gists on GitHub | ||
*/ | ||
function GitHub() { | ||
} | ||
|
||
/** | ||
* Create a gist with the given description, content and optionally a filename and returns a deferred that gives the url of the created gist | ||
* | ||
* @param description description of the gist | ||
* @param content content of the gist | ||
* @param [filename] optional filename for the content | ||
* @returns {Deferred} deferred which on success provides the gist url | ||
*/ | ||
GitHub.createGist = function(description, content, filename) { | ||
var files = {}; | ||
files[filename || 'file'] = content; | ||
return this.createGistWithFiles(description, files); | ||
}; | ||
|
||
/** | ||
* Create a gist with the given description and a set of files and returns a deferred that gives the url of the created gist | ||
* | ||
* @param description description of the gist | ||
* @param {object.<string,string>} files an object with each key is the filename and value is the content | ||
* @returns {Deferred} deferred which on success provides the gist url | ||
*/ | ||
GitHub.createGistWithFiles = function(description, files) { | ||
var gistFiles = {}; | ||
for (var file in files) { | ||
gistFiles[file] = { | ||
content: files[file] | ||
}; | ||
} | ||
var data = { | ||
description: description, | ||
public: true, | ||
files: gistFiles | ||
}; | ||
return new Deferred(function(deferred) { | ||
HTTP.post('https://api.github.com/gists', data, {}, function(response, success, status) { | ||
if (status == 201 && response) { | ||
var result = JSON.parse(response); | ||
if (result.html_url) { | ||
deferred.resolve(result.html_url); | ||
return; | ||
} | ||
} | ||
deferred.reject(response, success, status); | ||
}); | ||
}); | ||
}; |