If I run my tests on protractor
on my machine the report is properly generated and screenshots saved. My objective now is to do automated testing where I'm gonna use docker
.
My docker-compose.yml
looks like this
version: '2'
services:
app:
image: app
ports:
- 9000:9000
selenium:
image: selenium/standalone-chrome
ports:
- 4444:4444
volumes:
- /dev/shm:/dev/shm
protractor:
volumes:
- ./tmp:/assets/tmp
image: test
command: "dockerize -wait http://selenium:4444 -wait http://app:9000 -timeout 60m protractor /assets/conf.js"
The problem with this is that the report and screenshots are not being saved to the volume. If instead of using the docker
image for protractor I use the local one it works correctly with the app and selenium images.
For testing purposes I've added the folder manually on my volume (local) and can see that the folder is being removed, so I'm assuming the linkage is correct.
My conf.js
as the method onPrepare
to add the reporter which look like
onPrepare: function() {
jasmine.getEnv().addReporter(new HtmlReporter({
baseDirectory: '/assets/tmp/screenshots'
}));
}
}
The reporter used is protractor-html-screenshot-reporter.
My question is where could the problem be, path on the report, permissions, etc and what could be a fix or alternative approach
Thanks in advance
After some debugging found that jasmine
versions were different (local and docker image) and wasn't triggering the method to create the screenshots.
The versions were different because of when protractor
was installed using npm install -g protractor
(2.5.1
vs 4.0.13
).
Creating the image using protractor
version 2.5.1
fixed the issue.