Skip to content

Commit

Permalink
remove encoding and decoding of name and test status
Browse files Browse the repository at this point in the history
  • Loading branch information
Dileep17 committed Feb 2, 2023
1 parent b3b09e0 commit 91f2b77
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "appium-reporter-plugin",
"version": "1.0.0-beta.9",
"version": "1.0.0-beta.10",
"description": "Appium 2.0 plugin for generating html report with screenshots server side.",
"main": "./lib/index.js",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion src/reportTemplate/bundle.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/reportTemplate/template.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@
<body>
<div id="root"></div>
</body>
</html>
</html>
4 changes: 2 additions & 2 deletions src/reporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ async function setTestInfo(sessionID, testName, testStatus, error = undefined) {
if (!testStatusValues.includes(testStatus.toUpperCase()))
throw new Error(`Test status ${testStatus} is not valid state.`);

info['testName'] = Buffer.from(testName, 'utf8').toString('base64');
info['testStatus'] = Buffer.from(testStatus.toUpperCase(), 'utf8').toString('base64');
info['testName'] = testName;
info['testStatus'] = testStatus.toUpperCase();
if (error) info['error'] = Buffer.from(error, 'utf8').toString('base64');
info['deviceInfo'] = file.get(`testInfo.${sessionID}.deviceInfo`);
file.set(`testInfo.${sessionID}`, info);
Expand Down
6 changes: 3 additions & 3 deletions src/web/components/Navbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export const Navbar = (props) => {
filterCondition = 'FAILED';
}
data.sessions.map((sessionId, key) => {
if (window.atob(data['testInfo'][sessionId]['testStatus']) === filterCondition) {
if (data['testInfo'][sessionId]['testStatus'] === filterCondition) {
newFilteredSessions.push(sessionId);
}
});
Expand Down Expand Up @@ -92,8 +92,8 @@ export const Navbar = (props) => {
</h6>
<ul className="sidebar-links" id="testLinks">
{filteredSessions.map((sessionId, key) => {
const testName = window.atob(data['testInfo'][sessionId]['testName']);
const testStatus = window.atob(data['testInfo'][sessionId]['testStatus']);
const testName = data['testInfo'][sessionId]['testName'];
const testStatus = data['testInfo'][sessionId]['testStatus'];
return (
<div key={key}>
<SessionTab testName={testName} testStatus={testStatus} sessionId={sessionId} />
Expand Down
4 changes: 2 additions & 2 deletions src/web/components/OverallExecutionSummary.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ export const OverAllExecutionSummary = (props) => {
let resultElements = [];
for (const key in results) {
let result = results[key];
const name = window.atob(result.testName);
const status = window.atob(result.testStatus);
const name = result.testName;
const status = result.testStatus;
if (status === 'PASSED') {
passCount = passCount + 1;
} else {
Expand Down
6 changes: 3 additions & 3 deletions src/web/components/TestStatus.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ export const TestStatus = (props) => {
const sessionId = props.sessionId;
const data = props.data;
const testInfo = data.testInfo[sessionId];
const testName = window.atob(testInfo.testName);
const testStatus = window.atob(testInfo.testStatus);
const testName = testInfo.testName;
const testStatus = testInfo.testStatus;

return (
<div className="test-summary-page">
Expand All @@ -21,7 +21,7 @@ export const TestStatus = (props) => {
<h4 className="summary-text-heading"> Error </h4>
<h5 className="summary-text"> {window.atob(testInfo.error)} </h5>
</div>
)}
)}
<h4 className="summary-text-heading">Platform</h4>
<h5 className="summary-text">{testInfo.deviceInfo.platformName}</h5>
<h4 className="summary-text-heading">OS Version</h4>
Expand Down
2 changes: 1 addition & 1 deletion test/unit/repoter.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ describe('Record data in JSON file', function () {
const fileContents = file.get();
expect(fileContents).to.deep.equal({
sessions: ['test'],
testInfo: { test: { testName: 'U2FtcGxlIHRlc3QgbmFtZQ==', testStatus: 'UEFTU0VE' } },
testInfo: { test: { testName: 'Sample test name', testStatus: 'PASSED' } },
});
});

Expand Down

0 comments on commit 91f2b77

Please sign in to comment.