webdriverio-boneyard / wdio-junit-reporter

A WebdriverIO v4 plugin. Report results in junit xml format.
http://v4.webdriver.io
MIT License
11 stars 42 forks source link

Screenshots path #82

Open AndreyYevtukhov opened 6 years ago

AndreyYevtukhov commented 6 years ago

Hi guys!

I have a question about screenshots path in generated .xml report

Is there any option to insert links to screenshots files in XML / path to folder with saved screens, so QA can just click on such link in Jenkins and download / open it in browser?

christian-bromann commented 6 years ago

@AndreyYevtukhov not sure, probably yes. Feel free to propose a PR with such a feature.

jukafah commented 6 years ago

You can do this with the junit-attachments jenkins plugin here: https://wiki.jenkins.io/display/JENKINS/JUnit+Attachments+Plugin

You write out a filename to standard in or out and the plugin can publish them as direct test attachments in Jenkins rather than build artifacts. I recently forked this repo to work on that specific feature, but I wound up changing the logic for cucumber / jenkins reporting as well.

            if (testData.state === 'fail') {
                const screenshot = screenshots.find(function (item) { return item.toLowerCase().indexOf(test.title.toLowerCase()) > 0 });
                testCase.failure();
                testCase.standardError(`\n[[ATTACHMENT|${screenshot}]]\n\n${testData.error.stack}`);
            }

@christian-bromann thoughts on this? It requires a separate plugin to work correctly. At least for Jenkins, anyway.

goatsy commented 6 years ago

Can I access the junit reporter in the afterTest hook? I would just like to add some content to the "Standard Error" (for example embed a screenshot/iframe via html) but I don't know how to access the reporter.

@jukafah @AndreyYevtukhov

christian-bromann commented 6 years ago

Can I access the junit reporter in the afterTest hook?

No. Not sure how to pull this off. Reporter usually should not block the test execution in any way.