Open mzbedat opened 7 years ago
I switched to Needle Driver:
self.driver = self.get_web_driver()
But now I'm getting:
File "C:\Python27\lib\site-packages\needle\cases.py", line 241, in compareScreenshot self.engine.assertSameFiles(output_file, baseline_file, threshold) AttributeError: 'NebulaTest' object has no attribute 'engine'
This command line:
self.engine.assertSameFiles(output_file, baseline_file, threshold)
From this link I can see that I need to download and install PerceptualDiff: http://the-creative-tester.github.io/Python-Visual-Regression-Testing/
that's require: 1) CMake (https://cmake.org/download/) 2) FreeImage (https://sourceforge.net/projects/freeimage/?source=typ_redirect)
But these aren't regular installations, the FreeImage for example is a dll... I have a feeling that am going in a wrong direction. Can you please give more insights on it
calling from my Test class:
self.setUpClass()
did the trick.
I still have one question regarding saving the base-line image.... by running: nosetests Needle.py --with-save-baseline I'm getting
c:\workspace_medalia\robotautomation\Galil-RF\RobotFramework\Libraries\VisualTesting>nosetests Needle.py --with-save-baseline E
ERROR: Failure: IOError (The baseline screenshot C:\VisualTesting\screenshots\baseline\feedback.png does not exist. You might want to re-run this test in baseline-saving mode.)
I order to come over it, I had overridden the save_base_line in my test class:
self.save_baseline = True
Isn't there an option to pass it as parameter? the --with-save-baseline was suppose to deal with it, no?!
I had a similar problem at first but I believe I figured out what I was doing wrong. You need to use the driver object that has the NeedleWebDriverMixin. You're using regular chrome when you do
self.driver = webdriver.Chrome()
To do use the one with the Needle mixin, I overrode get_web_driver.
from needle.cases import NeedleTestCase
from needle.driver import NeedleChrome
class ExampleTest(NeedleTestCase):
@classmethod
def get_web_driver(cls):
return NeedleChrome()
def test_example(self):
self.driver.get('http://example.com')
self.assertScreenshot('body', 'example-body')
That came mostly from https://needle.readthedocs.io/en/latest/#selecting-a-webdriver
Hi, I started looking into needle (instead of ApliTools) and trying to create a test but facing an issue with this command:
element.get_screenshot().save(baseline_file)
In compareScreenshot() method cases.py fileMy guess that the driver that am referring to is the selenium web driver, but the one used in cases.py is the needle driver!
My code:
from selenium import webdriver from selenium.webdriver.common.by import By from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC
from time import sleep
class NebulaTest(NeedleTestCase): def init(self): self.output_directory = "C:\screenshots" self.baseline_directory = "C:\screenshots\baseline"
self.engine_class = 'needle.engines.perceptualdiff_engine.Engine'
NebulaTest()
Thanks in advance.