Coder Social home page Coder Social logo

ocular's People

Contributors

uselvvi avatar vinsguru avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ocular's Issues

Maven missing artifact

Hello,

After add your library in my pom.xml, maven report n missing artifacts:

Missing artifact com.beust:jcommander:jar:1.64
Missing artifact com.google.code.findbugs:jsr305:jar:1.3.9
Missing artifact com.google.code.gson:gson:jar:2.8.0
Missing artifact com.google.errorprone:error_prone_annotations:jar:2.0.18
Missing artifact com.google.guava:guava:jar:23.0
Missing artifact com.google.j2objc:j2objc-annotations:jar:1.1
Missing artifact com.sun.msv.datatype.xsd:xsdlib:jar:2009.1
Missing artifact com.testautomationguru.ocular:ocular:jar:1.0.0.Alpha
Missing artifact commons-codec:commons-codec:jar:1.10
Missing artifact commons-io:commons-io:jar:1.4
Missing artifact commons-lang:commons-lang:jar:2.4
Missing artifact commons-logging:commons-logging:jar:1.2
Missing artifact dom4j:dom4j:jar:1.6.1
Missing artifact isorelax:isorelax:jar:20030108
Missing artifact javassist:javassist:jar:3.8.0.GA
Missing artifact javax.xml.stream:stax-api:jar:1.0-2
Missing artifact net.bytebuddy:byte-buddy:jar:1.7.5
Missing artifact net.java.dev.jna:jna-platform:jar:4.1.0
Missing artifact net.java.dev.jna:jna:jar:4.1.0
Missing artifact net.java.dev.msv:msv-core:jar:2009.1
Missing artifact net.java.dev.msv:msv-testharness:jar:2009.1
Missing artifact net.sf:jargs:jar:1.0
Missing artifact org.apache.ant:ant-launcher:jar:1.7.1
Missing artifact org.apache.ant:ant:jar:1.7.1
Missing artifact org.apache.commons:commons-exec:jar:1.3
Missing artifact org.apache.httpcomponents:httpclient:jar:4.5.3
Missing artifact org.apache.httpcomponents:httpcore:jar:4.4.6
Missing artifact org.arquillian.rusheye:rusheye-api:jar:1.0.0
Missing artifact org.arquillian.rusheye:rusheye-impl:jar:1.0.0
Missing artifact org.codehaus.mojo:animal-sniffer-annotations:jar:1.14
Missing artifact org.codehaus.woodstox:stax2-api:jar:3.0.3
Missing artifact org.codehaus.woodstox:woodstox-core-lgpl:jar:4.0.9
Missing artifact org.seleniumhq.selenium:selenium-api:jar:3.6.0
Missing artifact org.seleniumhq.selenium:selenium-chrome-driver:jar:3.6.0
Missing artifact org.seleniumhq.selenium:selenium-edge-driver:jar:3.6.0
Missing artifact org.seleniumhq.selenium:selenium-firefox-driver:jar:3.6.0
Missing artifact org.seleniumhq.selenium:selenium-ie-driver:jar:3.6.0
Missing artifact org.seleniumhq.selenium:selenium-java:jar:3.6.0
Missing artifact org.seleniumhq.selenium:selenium-opera-driver:jar:3.6.0
Missing artifact org.seleniumhq.selenium:selenium-remote-driver:jar:3.6.0
Missing artifact org.seleniumhq.selenium:selenium-safari-driver:jar:3.6.0
Missing artifact org.seleniumhq.selenium:selenium-support:jar:3.6.0
Missing artifact org.testng:testng:jar:6.11
Missing artifact org.yaml:snakeyaml:jar:1.17
Missing artifact relaxngDatatype:relaxngDatatype:jar:20020414
Missing artifact xerces:xercesImpl:jar:2.9.1
Missing artifact xml-apis:xml-apis:jar:1.0.b2
Missing artifact xml-resolver:xml-resolver:jar:1.2
No versions available for org.seleniumhq.selenium:selenium-support:jar:[3.3.1,4.0.0) within specified range

Exist some problem with version of this libraries?

Error: java: cannot access org.arquillian.rusheye.suite.ComparisonResult

I am getting : Error: java: cannot access org.arquillian.rusheye.suite.ComparisonResult

on "return result.isEqualsImages();" in the following code.

private boolean verifyChart(String fileName, WebElement element) {

    Path path = Paths.get(fileName);

    OcularResult result = Ocular.snapshot()
            .from(path)
            .sample()
            .using(driver)
            .element(element)
            .compare();

    return result.isEqualsImages();

}

I am using Intellij. I have imported the lib by drag drop the ocular-1.0.0.Alpha.jar file into lib folder and then did "Add as library". I have written a sample test and page object by following your README as is.

Am I missing something ?

Getting null pointer exception

My Page class

public class WynPageClass {

	private WebDriver driver;
	private Map<String, String> map;
	
	@FindBy(xpath="//img[@alt='Anita Baker & Jardin Dinner Pairing']")
	private WebElement element;
	
	public WynPageClass(WebDriver driver){
		this.driver=driver;
		map = new HashMap<String, String>();
		map.put("snap1", "snap1.jpg");
	}
	
	
	public boolean match(){
		return this.verifyChart(map.get("snap1"), element);
	}
	
	private boolean verifyChart(String fileName, WebElement element) {
        Path path = Paths.get(fileName);
        OcularResult result = Ocular.snapshot()
                                    .from(path)
                                    .sample()
                                    .using(driver)
                                    .element(element)
                                    .compare();

        return result.isEqualsImages();
    }
}

TestNG based test class

public class OcularVisual {

	public WebDriver driver;
	private WynPageClass page;

	@BeforeSuite
	public void bs(){
		System.setProperty("webdriver.chrome.driver", "E:\\Softwares\\chromedriver.exe");
		driver = new ChromeDriver();
		Ocular.config()
		.snapshotPath(Paths.get("E:\\workspace\\NewTech\\src\\test\\resources/snap"))
		.resultPath(Paths.get("E:\\workspace\\NewTech\\src\\test\\resources\\result"));

	}
	
	

	@Test
	public void testA(){
		driver.get("https://intg.wynntesting.com/dining");
		page = new WynPageClass(driver);
		Assert.assertTrue(page.match());
	}


	@AfterSuite
	public void as(){
		driver.quit();
	}

	public boolean verifyImage(String fileName, WebElement element){
		Path path = Paths.get(fileName);
		OcularResult result = Ocular.snapshot()
				.from(path)
				.sample()
				.using(driver)
				.element(element)
				.compare();

		return result.isEqualsImages();
	}

Exception
java.lang.NullPointerException
at com.testautomationguru.ocular.comparator.ImageUtil.getElementSnapshot(ImageUtil.java:39)
at com.testautomationguru.ocular.sample.SampleBuilderImpl.element(SampleBuilderImpl.java:46)

@vinsguru Can you pls help

Ocular Exception when tests run on Grid

The tests are working fine if I run locally. Is there any workaround to get these working on Selenium Grid?

com.testautomationguru.ocular.exception.OcularException: Unable to get page snapshot
	at com.testautomationguru.ocular.comparator.ImageUtil.getPageSnapshot(ImageUtil.java:33)
	at com.testautomationguru.ocular.comparator.ImageUtil.getElementSnapshot(ImageUtil.java:42)
	at com.testautomationguru.ocular.sample.SampleBuilderImpl.element(SampleBuilderImpl.java:46)
	at com.insight.automation.steps.reports.speedByClass.SpeedLineChartSnap.compare(SpeedLineChartSnap.java:31)
	at com.insight.automation.steps.reports.speedByClass.SpeedByClassLineChartSteps.iCanSeeTheLineChartInTheSpeedByClassReportIsMatchingTheSnapshot(SpeedByClassLineChartSteps.java:32)
	at ✽.I can see the line chart in the speed by class report is matching the snapshot(C:/Users/Tester/.jenkins/workspace/FT - Grid/src/test/resources/features/modernUI/reports/speedByClass/LineChartSpeedByClass_4710.feature:14)
Caused by: java.lang.IllegalArgumentException: input == null!
	at java.desktop/javax.imageio.ImageIO.read(ImageIO.java:1305)
	at com.testautomationguru.ocular.comparator.ImageUtil.getPageSnapshot(ImageUtil.java:31)
	at com.testautomationguru.ocular.comparator.ImageUtil.getElementSnapshot(ImageUtil.java:42)
	at com.testautomationguru.ocular.sample.SampleBuilderImpl.element(SampleBuilderImpl.java:46)
	at com.insight.automation.steps.reports.speedByClass.SpeedLineChartSnap.compare(SpeedLineChartSnap.java:31)
	at com.insight.automation.steps.reports.speedByClass.SpeedByClassLineChartSteps.iCanSeeTheLineChartInTheSpeedByClassReportIsMatchingTheSnapshot(SpeedByClassLineChartSteps.java:32)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at cucumber.runtime.Utils$1.call(Utils.java:31)
	at cucumber.runtime.Timeout.timeout(Timeout.java:16)
	at cucumber.runtime.Utils.invoke(Utils.java:25)
	at cucumber.runtime.java.JavaStepDefinition.execute(JavaStepDefinition.java:37)
	at cucumber.runtime.StepDefinitionMatch.runStep(StepDefinitionMatch.java:40)
	at cucumber.api.TestStep.executeStep(TestStep.java:102)
	at cucumber.api.TestStep.run(TestStep.java:83)
	at cucumber.api.TestCase.run(TestCase.java:58)
	at cucumber.runner.Runner.runPickle(Runner.java:80)
	at cucumber.runtime.junit.PickleRunners$NoStepDescriptions.run(PickleRunners.java:140)
	at cucumber.runtime.junit.FeatureRunner.runChild(FeatureRunner.java:68)
	at cucumber.runtime.junit.FeatureRunner.runChild(FeatureRunner.java:23)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
	at cucumber.runtime.junit.FeatureRunner.run(FeatureRunner.java:73)
	at cucumber.api.junit.Cucumber.runChild(Cucumber.java:118)
	at cucumber.api.junit.Cucumber.runChild(Cucumber.java:56)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
	at cucumber.api.junit.Cucumber$1.evaluate(Cucumber.java:127)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
	at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:365)
	at org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Provider.java:273)
	at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:238)
	at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:159)
	at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:379)
	at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:340)
	at org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:125)
	at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:413)

ocular not taking correct screenshot

i want to validate logo of the site https://intg.wynntesting.com

a

public class OcularSpecific {

private WebDriver driver;

@BeforeTest
public void ocularConfigSetup() {
	Ocular.config().reset();
	Ocular.config().snapshotPath(Paths.get(System.getProperty("user.dir"), "src/test/resources/end2end/Specific"))
	.resultPath(Paths.get(".", "target")).saveSnapshot(true);
	WebDriverManager.chromedriver().setup();
	driver = new ChromeDriver();
}

@Test
public void specificTest() throws InterruptedException {
	driver.get("https://intg.wynntesting.com/");
	driver.manage().window().maximize();
	Thread.sleep(5000);
	WebElement element=driver.findElement(By.xpath("//img[contains(@src,'wynn-animated')]"));
	
	OcularResult result=Ocular.snapshot()
    .from(Paths.get("/Users/admin/Documents/_Work/Sephora/code/ocular-master/src/test/resources/end2end/Specific/a.png"))
.sample()
    .using(driver)
    .element(element)
.compare();
	
	System.out.println(result.getSimilarity());
}


@AfterTest
public void quitDriver() {
	driver.quit();
}

}

Now for this element - Ocular is taking screenshot of a different element.

Taking a screenshot of a large page

Hello - how would I configure Ocular to take a screenshot of a page that has a lot of content and would normally require me to scroll down? Currently it only takes a screenshot of whatever is visible in the browser.

@Snap( ) - this does not accept a method with return type string

@vinsguru

@snap( ) - this does not accept a method with return type string in page object class

My requirement is to run tests on multiple platforms with almost similar UI but different projects hence different URL
It also isn't accepting a constant which fetches value from a method and throws error - Attribute value must be a constant.

Can you help ?

License

The post located here says that this project is free and open-source, but according to Github's Licensing Help Page it is not open source if an open source license is not declared. I would love to put this project to good use, but cannot unless it has an open source license.

See https://choosealicense.com/

If you would like, I can put together a pull request that adds the MIT license to this project.

Can Ocular work on Selenium grid ?

Can we run the test using Ocular on selenium grid ? I tried to run it and it doesnt give me any error or anything. But it doesnt take a screen shot. No Snap nor Result.

RasterFormatException when using IE

Hello,

Just started using this library last week and have run into a slight problem with Internet explore. Before it can take the snapshot, it throws the following error:

Started InternetExplorerDriver server (32-bit)
3.6.0.0
Listening on port 23841
Only local connections are allowed
Oct 02, 2017 7:44:59 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: W3C

Scenario: Item can be added to shopping cart # C:/Users/mitesh.patel/Documents/repo/src/test/resources/features/add_item_to_shopping_cart.feature:11 Given I have searched for 'cotton' # ShoppingCartStepDefs.givenIHaveSearchedFor(String) java.awt.image.RasterFormatException: (x + width) is outside of Raster at sun.awt.image.ByteInterleavedRaster.createWritableChild(ByteInterleavedRaster.java:1245) at java.awt.image.BufferedImage.getSubimage(BufferedImage.java:1202) at com.testautomationguru.ocular.comparator.ImageUtil.getElementSnapshot(ImageUtil.java:42) at com.testautomationguru.ocular.sample.SampleBuilderImpl.element(SampleBuilderImpl.java:46) at example.ui.pages.HomePage.comparePage(HomePage.java:34) at example.ui.steplibs.CustomerSteps.checkHomepageLookAndFeel(CustomerSteps.java:24) at example.ui.steplibs.CustomerSteps$$EnhancerByCGLIB$$b1957b7d.CGLIB$checkHomepageLookAndFeel$6(<generated>) at example.ui.steplibs.CustomerSteps$$EnhancerByCGLIB$$b1957b7d$$FastClassByCGLIB$$948f9cde.invoke(<generated>) at net.sf.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228) at net.thucydides.core.steps.StepInterceptor.invokeMethod(StepInterceptor.java:395) at net.thucydides.core.steps.StepInterceptor.executeTestStepMethod(StepInterceptor.java:380) at net.thucydides.core.steps.StepInterceptor.runTestStep(StepInterceptor.java:355) at net.thucydides.core.steps.StepInterceptor.testStepResult(StepInterceptor.java:132) at net.thucydides.core.steps.StepInterceptor.intercept(StepInterceptor.java:61) at example.ui.steplibs.CustomerSteps$$EnhancerByCGLIB$$b1957b7d.checkHomepageLookAndFeel(<generated>) at example.ui.stepdefs.ShoppingCartStepDefs.givenIHaveSearchedFor(ShoppingCartStepDefs.java:37)

I don;t see this issue with Chrome. Any thoughts what could be causing it?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.