codeceptjs / codeceptjs/CodeceptJS

stepByStepReport error on saving screenshot with JS alert pop up

Abierto
#1,560 0 comentarios 1 reacción 0 asignados Ver en GitHub
bug plugin
Lenguaje dominante
JavaScript
Estrellas
4.2k
Forks
757
Merge medio
2 d 9 h
PR fusionados (30 d)
16

Descripción

#### What are you trying to achieve?

I am trying to use stepByStepReport plugin and record steps. This is my scenario:

```js
Scenario("answerOnNextPrompt ", (I) => {
I.amOnPage("https://a9t9.com/kantu/demo/storeeval");
I.resizeWindow(1537,824);
I.click({css:"#sometext"});
I.fillField({css: '#sometext'},"123321");
//after this click there is java script alert pop up
I.click({xpath:"//button[@onclick='myFunction1()']"});
I.seeInPopup("Hello\nHow are you?");
});
```
I know that I can't make screenshots when there is JS alert, because of that I added this configuration in codecept.conf.js

```js
...
"plugins": {
"allure": {},
"stepByStepReport": {
"enabled": true,
"deleteSuccessful": true,
"ignoreSteps":["seeInPopup*","wait*","grab*"],
"screenshotsForAllureReport": true
}
},
...
```

#### What do you get instead?

Error caused by `I.click({xpath:"//button[@onclick='myFunction1()']"});` command:

`ENOENT: no such file or directory, open 'C:\Users\evgenii.mikhailishin\Documents\ATF Web\CodeceptJS\Codecept-Allure POC\output\all__browser_chrome__1\rec ord_answerOnNextPrompt__1552385381\0004.png'
--`

> Provide console output if related. Use `--verbose` mode for more details.

```bash
> codeceptjs run-multiple all:chrome -c ./codecept/codecept.conf.js --plugins allure "--steps" "--verbose"

[1.all:chrome] CodeceptJS v2.0.7
[1.all:chrome] Using test root "C:\Users\evgenii.mikhailishin\Documents\ATF Web\CodeceptJS\Codecept-Allure POC\codecept"
[1.all:chrome] Helpers: ClickFallback, HoverClick, Protractor
[1.all:chrome] Plugins: screenshotOnFail, allure, stepByStepReport

[1.all:chrome] new commands --
[1.all:chrome] [1] Starting recording promises
[1.all:chrome] Emitted | suite.before ([object Object])
[1.all:chrome] answerOnNextPrompt
[1.all:chrome] Emitted | test.before ([object Object])
[1.all:chrome] Emitted | test.start ([object Object])
[1.all:chrome] Emitted | step.before (I am on page "https://a9t9.com/kantu/demo/storeeval")
[1.all:chrome] Emitted | step.after (I am on page "https://a9t9.com/kantu/demo/storeeval")
[1.all:chrome] Emitted | step.before (I resize window 1537, 824)
[1.all:chrome] Emitted | step.after (I resize window 1537, 824)
[1.all:chrome] Emitted | step.before (I click {"css":"#sometext"})
[1.all:chrome] Emitted | step.after (I click {"css":"#sometext"})
[1.all:chrome] Emitted | step.before (I fill field {"css":"#sometext"}, "123321")
[1.all:chrome] Emitted | step.after (I fill field {"css":"#sometext"}, "123321")
[1.all:chrome] Emitted | step.before (I click {"xpath":"//button[@onclick='myFunction1()']"})
[1.all:chrome] Emitted | step.after (I click {"xpath":"//button[@onclick='myFunction1()']"})
[1.all:chrome] Emitted | step.before (I see in popup "Hello
How are you?")
[1.all:chrome] Emitted | step.after (I see in popup "Hello
How are you?")
[1.all:chrome] Emitted | step.start (I am on page "https://a9t9.com/kantu/demo/storeeval")
[1.all:chrome] I am on page "https://a9t9.com/kantu/demo/storeeval"
[1.all:chrome] » Visited https://a9t9.com/kantu/demo/storeeval
[1.all:chrome] » Screenshot has been saved to C:\Users\evgenii.mikhailishin\Documents\ATF Web\CodeceptJS\Codecept-Allure POC\output\all__browser_chrome__1\record_answerOnNextPrompt__1552386365\0000.png
[1.all:chrome] » Adding screenshot to Allure
[1.all:chrome] Emitted | step.passed (I am on page "https://a9t9.com/kantu/demo/storeeval")
[1.all:chrome] Emitted | step.finish (I am on page "https://a9t9.com/kantu/demo/storeeval")
[1.all:chrome] Emitted | step.start (I resize window 1537, 824)
[1.all:chrome] I resize window 1537, 824
[1.all:chrome] » Screenshot has been saved to C:\Users\evgenii.mikhailishin\Documents\ATF Web\CodeceptJS\Codecept-Allure POC\output\all__browser_chrome__1\record_answerOnNextPrompt__1552386365\0001.png
[1.all:chrome] » Adding screenshot to Allure
[1.all:chrome] Emitted | step.passed (I resize window 1537, 824)
[1.all:chrome] Emitted | step.finish (I resize window 1537, 824)
[1.all:chrome] Emitted | step.start (I click {"css":"#sometext"})
[1.all:chrome] I click {"css":"#sometext"}
[1.all:chrome] » Screenshot has been saved to C:\Users\evgenii.mikhailishin\Documents\ATF Web\CodeceptJS\Codecept-Allure POC\output\all__browser_chrome__1\record_answerOnNextPrompt__1552386365\0002.png
[1.all:chrome] » Adding screenshot to Allure
[1.all:chrome] Emitted | step.passed (I click {"css":"#sometext"})
[1.all:chrome] Emitted | step.finish (I click {"css":"#sometext"})
[1.all:chrome] Emitted | step.start (I fill field {"css":"#sometext"}, "123321")
[1.all:chrome] I fill field {"css":"#sometext"}, "123321"
[1.all:chrome] » Screenshot has been saved to C:\Users\evgenii.mikhailishin\Documents\ATF Web\CodeceptJS\Codecept-Allure POC\output\all__browser_chrome__1\record_answerOnNextPrompt__1552386365\0003.png
[1.all:chrome] » Adding screenshot to Allure
[1.all:chrome] Emitted | step.passed (I fill field {"css":"#sometext"}, "123321")
[1.all:chrome] Emitted | step.finish (I fill field {"css":"#sometext"}, "123321")
[1.all:chrome] Emitted | step.start (I click {"xpath":"//button[@onclick='myFunction1()']"})
[1.all:chrome] I click {"xpath":"//button[@onclick='myFunction1()']"}
[1.all:chrome] » Screenshot has been saved to C:\Users\evgenii.mikhailishin\Documents\ATF Web\CodeceptJS\Codecept-Allure POC\output\all__browser_chrome__1\record_answerOnNextPrompt__1552386365\0004.png
[1.all:chrome] » undefined
[1.all:chrome] » Adding screenshot to Allure
[1.all:chrome] [1] Error | Error: ENOENT: no such file or directory, open 'C:\Users\evgenii.mikhailishin\Documents\ATF Web\CodeceptJS\Codecept-Allure POC\output\all__browser_chrome__1\record_answerOnNextProm...
[1.all:chrome] Emitted | step.failed (I click {"xpath":"//button[@onclick='myFunction1()']"})
[1.all:chrome] Emitted | step.finish (I click {"xpath":"//button[@onclick='myFunction1()']"})
[1.all:chrome] [1] Error | Error: ENOENT: no such file or directory, open 'C:\Users\evgenii.mikhailishin\Documents\ATF Web\CodeceptJS\Codecept-Allure POC\output\all__browser_chrome__1\record_answerOnNextProm...
[1.all:chrome] Emitted | step.failed (I see in popup "Hello
How are you?")
[1.all:chrome] Emitted | step.finish (I see in popup "Hello
How are you?")
[1.all:chrome] [1] Error | Error: ENOENT: no such file or directory, open 'C:\Users\evgenii.mikhailishin\Documents\ATF Web\CodeceptJS\Codecept-Allure POC\output\all__browser_chrome__1\record_answerOnNextProm...
[1.all:chrome] [1] Starting session
[1.all:chrome] Emitted | test.failed ([object Object])
[1.all:chrome] Emitted | test.finish ([object Object])
[1.all:chrome] [1] Stopping recording promises
[1.all:chrome] » Test failed, saving screenshot
[1.all:chrome] » Screenshot has been saved to C:\Users\evgenii.mikhailishin\Documents\ATF Web\CodeceptJS\Codecept-Allure POC\output\all__browser_chrome__1\answerOnNextPrompt_.failed.png
[1.all:chrome] × FAILED in 4777ms
[1.all:chrome]
[1.all:chrome] [2] Starting recording promises
[1.all:chrome] Emitted | test.after ([object Object])
[1.all:chrome] Emitted | suite.after ([object Object])

[1.all:chrome] -- FAILURES:

1) new commands
answerOnNextPrompt :
ENOENT: no such file or directory, open 'C:\Users\evgenii.mikhailishin\Documents\ATF Web\CodeceptJS\Codecept-Allure POC\output\all__browser_chrome__1\record_answerOnNextPrompt__1552386365\0004.png'

Scenario Steps:

- I.click({"xpath":"//button[@onclick='myFunction1()']"}) at Test.Scenario (tests\converted\new commands.js:8:6)
- I.fillField({"css":"#sometext"}, "123321") at Test.Scenario (tests\converted\new commands.js:7:6)
- I.click({"css":"#sometext"}) at Test.Scenario (tests\converted\new commands.js:6:6)
- I.resizeWindow(1537, 824) at Test.Scenario (tests\converted\new commands.js:5:6)
- I.amOnPage("https://a9t9.com/kantu/demo/storeeval") at Test.Scenario (tests\converted\new commands.js:4:6)

Error: ENOENT: no such file or directory, open 'C:\Users\evgenii.mikhailishin\Documents\ATF Web\CodeceptJS\Codecept-Allure POC\output\all__browser_chrome__1\record_answerOnNextPrompt__1552386365\0004.png'
at Object.openSync (fs.js:451:3)
at Object.readFileSync (fs.js:351:35)
at persistStep (node_modules\codeceptjs\lib\plugin\stepByStepReport.js:153:69)
at process.internalTickCallback (internal/process/next_tick.js:77:7)

[1.all:chrome] FAIL | 0 passed, 1 failed // 7s
[1.all:chrome] Emitted | global.result ([object Object])
[1.all:chrome] (*) Step-by-step preview: file://C:\Users\evgenii.mikhailishin\Documents\ATF Web\CodeceptJS\Codecept-Allure POC\output\all__browser_chrome__1/records.html
[1.all:chrome] Emitted | global.after ([object Object])
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! codecept-allure-poc@1.0.0 ccjs:allure:chrome: `codeceptjs run-multiple all:chrome -c ./codecept/codecept.conf.js --plugins allure "--steps" "--verbose"`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the codecept-allure-poc@1.0.0 ccjs:allure:chrome script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\evgenii.mikhailishin\AppData\Roaming\npm-cache\_logs\2019-03-12T10_26_12_627Z-debug.log
```

> Provide test source code if related

```js
Feature("new commands");

Scenario("answerOnNextPrompt ", (I) => {
I.amOnPage("https://a9t9.com/kantu/demo/storeeval");
I.resizeWindow(1537,824);
I.click({css:"#sometext"});
I.fillField({css: '#sometext'},"123321");
I.click({xpath:"//button[@onclick='myFunction1()']"});
I.seeInPopup("Hello\nHow are you?");
});
```

### Details
* CodeceptJS version: 2.0.7
* NodeJS Version: v11.3.0
* Operating System: Windows 10
* Protractor
* Configuration file:

```js
exports.config = {
tests: '../tests/converted/*.js',
output: '../output',
helpers: {
"ClickFallback": {
"require": "./helpers/clickfallback_helper.js"
},
"HoverClick": {
"require": "./helpers/hoverclick_helper.js"
},
Protractor: {
url: '127.0.0.1:9000',
driver: 'hosted',
browser: 'chrome',
rootElement: 'body',
angular: false,
}
},
"multiple": {
"all": {
"browsers": ["chrome", "firefox"]
},
},
include: {
I: '../steps_file.js'
},
bootstrap: null,
"plugins": {
"allure": {},
"stepByStepReport": {
"enabled": true,
"deleteSuccessful": true,
//disabled screenshot on "click" commands because of screenshot fail when JS alert pops up
"ignoreSteps":[/*"click*",*/"seeInPopup*","wait*","grab*"],
"screenshotsForAllureReport": true
}
},
mocha: {},
name: 'Codecept-Allure POC'
}
```

So as temporary solution I disabled recording "click" command in stepByStepReport plugin configuration, but it just disables ALL click commands.
What can I do with this problem?

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.