Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Screenshots from Browser Library in combination with argumentfiles are not linked correctly in the report files #609

Open
OkuRobot opened this issue Dec 10, 2024 · 2 comments

Comments

@OkuRobot
Copy link

Found in pabot Version 4.0.5

Given the following Testcase file testcases.robot

*** Settings ***
Library     Browser

*** Variables ***
${ARGUMENT}     Default_Value

*** Test Cases ***
Testcase With Screenshot
    Log    Test executed with arguments ${ARGUMENT}
    Open Browser    url=https://pabot.org/
    Take Screenshot    filename=pabot_${ARGUMENT}

and an argumentfile first.args with the following content
--variable ARGUMENT:First

Than start the testrun with the following command
pabot --argumentfile1 first.args --artifactsinsubfolders -d results testcases.robot

This will result in the following result folder structure
image

Opening the report file the screenshot is not linked correctly

image

@stlxiii
Copy link

stlxiii commented Dec 17, 2024

As a work around, I did this

  • Recursively move all png files under pabot_results to the standard browser/screenshot folder after testing
  • Cease using Browser.Take Screenshot as it generates duplicates, instead make your own. something like this:
${timestamp}   Get Current Date  result_format=epoch  
${timestamp}   Evaluate          str(int($timestamp))
${random_str}  Evaluate          ''.join(random.choices(string.ascii_lowercase + string.digits, k=15))

Browser.Take Screenshot  
...    filename=screen-${timestamp}-${random_str}

@rasjani
Copy link

rasjani commented Dec 18, 2024

Started to use pabot on new project last week and i noticed the same thing. Maybe running rebot on final output.xml to regenerate the html files would help - browser does this on their tasks.py at least ? Dunno, didnt bother. I run

for image in (BASE / "browser" / "screenshot").glob("*.png"):
    new_name = re.sub(r"\d+-","", str(image))
    image.rename(new_name)

at the end of my runner and things good

Also, there was this bug MarketSquare/robotframework-browser#669 and all i got out from that was "you are using the feature incorrectly" but i didnt get "what feature"

PS. Im not using argument file and here's how i call pabot

        python -mpabot.pabot \
        --processes 6 \
        --artifacts json,har,html,webm,png  \
        --artifactsinsubfolders \
        --nostatusrc \
        --outputdir reports/ \
        --exclude noci \
        --loglevel DEBUG \
        -v ENV:${{ inputs.TEST_ENV }} \
        -v IGNORE_HTTPS_ERRORS:True \
        --include ${{ inputs.TEST_ENV }} \
        tests/
        python tools/ghareports.py  reports/output.xml
        python tools/fix_screenshot_links.py  reports/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants