Skip to content

Commit eacf0cb

Browse files
committed
Refactoring and add node variables to README.md
1 parent 566c84c commit eacf0cb

File tree

4 files changed

+13
-10
lines changed

4 files changed

+13
-10
lines changed

README.md

+5
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,8 @@ In another terminal window, execute
1919
```
2020
npm test
2121
```
22+
23+
Node Variables:
24+
```
25+
URL=http://www.automationpractice.com
26+
```

pages/login_page.js

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import { browser } from "protractor";
2-
31
const by = protractor.by;
42
const until = protractor.ExpectedConditions;
53

stepdefs/hooks.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ https://github.com/cucumber/cucumber-js/blob/dfbfed94e2cee4fd6b1f91299f7b450b271
1717
*/
1818
After(async function (scenario) {
1919
const world = this;
20-
const scenarioFailed = scenario.result.status === Status.FAILED;
21-
if (scenarioFailed) {
20+
const failed = scenario.result.status === Status.FAILED;
21+
if (failed) {
2222
return browser.takeScreenshot().then(async function (base64EncodedImage) {
2323
return world.attach(Buffer.from(base64EncodedImage.toString(), 'base64'), 'image/png');
2424
});

support/report_utils.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ const date = new Date();
44
const day = date.getDate();
55
const month = date.getMonth() + 1;
66
const year = date.getFullYear();
7-
const generatedName = `test_report_${day}_${month}_${year}`;
8-
const directory = `./target/${generatedName}`;
9-
const jsonFile = `${directory}/${generatedName}.json`;
10-
const htmlFile = `${directory}/${generatedName}.html`;
7+
const reportFileName = `test_report_${day}_${month}_${year}`;
8+
const directory = `./target/${reportFileName}`;
9+
const jsonFile = `${directory}/${reportFileName}.json`;
10+
const htmlFile = `${directory}/${reportFileName}.html`;
1111

1212
const createDirectory = function () {
13-
const exists = fileSystem.existsSync(directory);
14-
if (!exists) {
13+
const directoryDoesNotExist = !fileSystem.existsSync(directory);
14+
if (directoryDoesNotExist) {
1515
fileSystem.mkdirSync(directory);
1616
fileSystem.writeFile(jsonFile);
1717
}

0 commit comments

Comments
 (0)