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

Full or relative path for baseline image directory #88

Closed
MininAS opened this issue Apr 6, 2021 · 11 comments
Closed

Full or relative path for baseline image directory #88

MininAS opened this issue Apr 6, 2021 · 11 comments

Comments

@MininAS
Copy link
Contributor

MininAS commented Apr 6, 2021

Describe the bug
What can we set like path for baseline image directory? Should it be full or relative path?
With full path a test finishes correctly.

*** Settings ***
Documentation     Documentation

Library           SeleniumLibrary
Library           RobotEyes

Suite Setup       Suite Setup
Suite Teardown    Close All Browsers
Force tags        google_logo

*** Variables ***
${IMAGES_DIR}     ${OUTPUT_DIR}${/}visual_images_original

*** Test cases ***
Google Logo Should Not Be Changed
    Open Eyes      SeleniumLibrary    tolerance=5
    Wait Until Element Is Visible     css:.k1zIA.rSk4se
    Capture Element                   css:.k1zIA.rSk4se    name=image
    Compare Images
    [Teardown]    No Operation

*** Keywords ***
Suite Setup
    Open Browser    https://www.google.com/    chrome

Console output =>
image

But if we pointed relative path

*** Variables ***
${IMAGES_DIR}     visual_images_original

Console output =>
image

It is not blocker for testing localy, but it seems it affects to visual report at Jenkins automation server.
We need to publish visual report results to artifactory and report contains broken link to base line image.
An actual and diff links are correct.
I assume that this is related that we set the baseline image directory path like full.

@jessezach
Copy link
Owner

@MininAS Relative Baseline path is supported. From the error log it looks like the failure occurs where it expects the output directory to exist. A condition above the assert statement checks for the existence of baseline folder. Seems like that's working fine.
Is your baseline folder within the output folder? And are you passing absolute path to the output directory?

@MininAS
Copy link
Contributor Author

MininAS commented Apr 6, 2021

Yep, baseline folder ${OUTPUT_DIR}${/}visual_images_original is in output folder.
As far as the OUTPUT_DIR framework variable contains result output folder.

@MininAS
Copy link
Contributor Author

MininAS commented Apr 6, 2021

And are you passing absolute path to the output directory?
Yep. In this case OUTPUT_DIR = d:\robot-test-asset

@jessezach
Copy link
Owner

@MininAS Is this a separate location from where your tests are running?

@MininAS
Copy link
Contributor Author

MininAS commented Apr 6, 2021

the same

report_generation.py =>

import os
import xml.etree.ElementTree as ET
from time import sleep

from .constants import IMAGE_EXTENSIONS

def generate_report(baseline_folder, results_folder, actual_folder=None):
    sleep(1)
    img_path = os.path.join(results_folder, 'visual_images')
    report_path = os.path.join(results_folder, 'output.xml')
    relative_baseline_folder_path = relative_path(baseline_folder, results_folder.replace(os.getcwd(), ''))
    relative_actual_folder_path = relative_path(actual_folder, results_folder.replace(os.getcwd(), '')) if actual_folder else ''
baseline_folder = "visual_images_original"
results_folder = "D:\robot-test-asset"

so =>
results_folder.replace(os.getcwd(), '') returns an empty because os.getcwd() = "D:\robot-test-asset"
then relative_path method gets the empty the second attribute and go to exception

@jessezach
Copy link
Owner

@MininAS Understood. The code is breaking when results are stored in the root itself. I'll fix this

@MininAS
Copy link
Contributor Author

MininAS commented Apr 6, 2021

Thank you!!! I'm looking forward to it. :)

@jessezach
Copy link
Owner

Hi @MininAS, I have pushed a fix in v1.5.7. Can you please upgrade and check if your issue gets resolved?

@MininAS
Copy link
Contributor Author

MininAS commented Apr 7, 2021

Big thanks!!! Works good locally and in automation Jenkins too.

@Wutsarawuthiveground
Copy link

Hello @MininAS

      Could you please share the command to start your test?

so I had facing issue error >> 'please provide image baseline directory'

My command is >> robot -d regression -v image_dir:out1 .\robot-test..

@MininAS
Copy link
Contributor Author

MininAS commented Nov 9, 2021

Hi! Your varible name is image_dir and should be images_dir.

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