0
  • Jenkins 2.386
  • Pipeline plugin 590.v6a_d052e5a_a_b_5
  • Robot Framework plugin 3.3.0
  • Python3.9.2
  • robotframework 6.0.2
  • robotframework-assertion-engine 1.0.0
  • robotframework-browser 15.1.0
  • robotframework-pythonlibcore 4.0.0

Screenshots are not nested in log

Robot Publisher copies results to specific build

Using "otherFiles" option copies PNG images and Browser Library directories structure

Clicking the icon of missing image in Robot log redirects to screenshot properly.

I work on Jenkins master node - I don't use slaves.

Here is my Jenkinsfile:

pipeline {
    agent any
    stages {
        stage('Test') {
            steps {
                catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
                    sh 'robot -d results Scripts/My_Test_Suite.robot'
                }
            }
        }
        stage('Results') {
            steps {
                step([
                    $class: 'RobotPublisher',
                    outputPath: 'results',
                    outputFileName: '*.xml',
                    otherFiles: '**/*.png',
                ])
            }
        }
    }
}

Update:

Before I faced described problem I configured CSP just like here: https://stackoverflow.com/a/37524992/6639428. That means I used following configuration and according to https://content-security-policy.com/img-src/ it should work, but it doesn't...

System.setProperty("hudson.model.DirectoryBrowserSupport.CSP","sandbox allow-scripts; default-src 'none'; img-src 'self' data: ; style-src 'self' 'unsafe-inline' data: ; script-src 'self' 'unsafe-inline' 'unsafe-eval' ;")
Jalo
  • 1
  • 1
  • I have faint recollection having similar issues *with* jenkins and the root cause was CSRF blocking inline images and nothing to do with robot .. https://www.jenkins.io/doc/book/security/csrf-protection/ – rasjani Feb 06 '23 at 16:41
  • I've tried with CSRF and CSP configuration but nothing helps. I made a workaround using RFW Browser Library EMBED screenshots. That's enough for now, but the logs are much larger in size, so I guess I'll have to troubleshoot this anyway. – Jalo Feb 10 '23 at 15:14

1 Answers1

0

you need to use --artifacts png --artifactsinsubfolders this copies the screenshot for particular tests.

  • Thanks for answer but I'm not sure about this solution. I didn't try it yet because it's an option from pabot, which I don't use, but this line `otherFiles: '**/*.png',` in RobotPublisher successfully copies png files from subfolders (check the linked screens in description). – Jalo Apr 26 '23 at 14:08
  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Apr 28 '23 at 17:55