[JBoss JIRA] (ARQGRA-492) Integrate RushEye with Graphene for automated visual validation
by vinoth selvaraj (JIRA)
vinoth selvaraj created ARQGRA-492:
--------------------------------------
Summary: Integrate RushEye with Graphene for automated visual validation
Key: ARQGRA-492
URL: https://issues.jboss.org/browse/ARQGRA-492
Project: Arquillian Graphene
Issue Type: Feature Request
Reporter: vinoth selvaraj
I have provided a sample use case of a Page Object.
Graphene along with RushEye can compare the whole page or or just specific element (we can get the coordinates of an element - get the corresponding image from the whole image)
{code:java}
@RushEye(pattern="/resources/login.png")
public class LoginPage{
@FindBy
private WebElement username;
@FindBy
private WebElement password;
@FindBy
private WebElement someDynamicContentElement;
@ArquillianResource
private ImageComparator imageComparator;
@RushEye(pattern="/resources/login/someElementWhichShouldMatchImge.png")
@FindBy
private WebElement someElementWhichShouldMatchImge;
//takes the screenshot of the current page on the fly
//compares with baseline & returns the status
//it can even highlight the difference in case of mismatch
public boolean isPageAsExpected(){
return imageComparator.compare();
}
//we might want to exclude some elements
//it might have dynamic content like current date/time etc
public boolean isPageAsExpectedAfterExcludingElements(){
return imageComparator.mask(someDynamicContentElement)
.mask(someOtherElement1)
.mask(someOtherElement2)
.compare();
}
//in some case we might not want to do whole page compare
//ex: it might have tons of adds
//So we might want to just compare one or more elements - not whole page
public boolean isSomeElementAsExpected(){
//take current coordinates of the element and get the image
//compare with baseline
return imageComparator.element(someElementWhichShouldMatchImge) //or list of elements
.compare();
}
}
{code}
--
This message was sent by Atlassian JIRA
(v6.4.11#64026)
8 years, 2 months
[JBoss JIRA] (ARQ-2034) Test enrichment and JUnit @Rule do not harmonize
by Björn Kautler (JIRA)
[ https://issues.jboss.org/browse/ARQ-2034?page=com.atlassian.jira.plugin.s... ]
Björn Kautler commented on ARQ-2034:
------------------------------------
This would solve the second point, or is an alternate solution for the first point?
As the branch you point to seems to case about Rules enrichment, I guess it cares about the first point (enriching rules in the container).
My question was about the second point (enriching the test method before the rules methods are evaluated), so that you can use fields that get enriched by Arquillian in rule-producing methods to forward injected stuff to rules you don't have under your control and thus cannot be made to receive the inject directly.
> Test enrichment and JUnit @Rule do not harmonize
> ------------------------------------------------
>
> Key: ARQ-2034
> URL: https://issues.jboss.org/browse/ARQ-2034
> Project: Arquillian
> Issue Type: Bug
> Components: Base Implementation
> Affects Versions: 1.1.11.Final
> Environment: junit 4.11
> arquillian-junit-container 1.1.11.Final
> wildfly-arquillian-container-remote 8.1.0.Final
> Reporter: Björn Kautler
> Assignee: Matous Jobanek
>
> We are starting with Arquillian tests on a remote WildFly instance.
> I tried to write a JUnit {{@Rule}}, that can be used to make a login call for all test methods automatically, but I was not yet able to make it work, as I need an injected {{@Ejb}} instance for this.
> I tried to add {{@EJB private InterfaceLoginManagement interfaceLoginManagement;}} to the {{TestRule}} implementation, but it stays {{null}}. I've read at ARQ-1954 that this should probably work, but unfortunately it is not, at least not with the remote container runner. {{org.jboss.arquillian.junit.extension.JUnitCoreExtension}} that should register {{org.jboss.arquillian.junit.extension.UpdateTestResultBeforeAfter}} and {{org.jboss.arquillian.junit.RulesEnricher}} is not even loaded on the container side. Maybe the {{META-INF/services/}} file is missing?
> Then I tried to simply give the injected instance to the rule from the test class like
> {code}
> @EJB private InterfaceLoginManagement interfaceLoginManagement;
> @Rule private LoginRule loginRule = new LoginRule(interfaceLoginManagement);
> {code}
> or even
> {code}
> @EJB private InterfaceLoginManagement interfaceLoginManagement;
> @Rule public LoginRule getLoginRule() {
> return new LoginRule(() -> {
> return interfaceLoginManagement;
> });
> }
> {code}
> with the {{LoginRule}} receiving a {{Supplier<InterfaceLoginManagement>}} and call it as late as possible, i. e. in the rules {{apply()}} method. But even this is still too early as the EJB is still {{null}} and the test enrichers are only run between the {{@Rule}} applying and {{@Before}} methods.
> So I'd like to suggest two things:
> # Fix the implementation of ARQ-1954 if it should work on container side which I assume it should
> # Make the test enrichments earlier in the lifecycle, i. e. before the {{@Rule}} s are being applied, or rather even before the {{@Rule}} methods are called, so that you at least can use the injected instances in the {{@Rule}} annotated methods to forward them to a rule. This is necessary even if top 1 is taken care of, because you might want to use a 3rd Party rule the code of which you cannot change.
--
This message was sent by Atlassian JIRA
(v6.4.11#64026)
8 years, 2 months
[JBoss JIRA] (ARQ-2034) Test enrichment and JUnit @Rule do not harmonize
by Björn Kautler (JIRA)
[ https://issues.jboss.org/browse/ARQ-2034?page=com.atlassian.jira.plugin.s... ]
Björn Kautler edited comment on ARQ-2034 at 10/5/16 11:23 AM:
--------------------------------------------------------------
[~mjobanek] Are you sure? As far as I remember what I have looked at in Arquillian code you copied some code from the {{BlockJUnit4ClassRunner}}, having own instances of {{withBefore}}, {{withAfter}} and so on, but calling the {{BlockJUnit4ClassRunner}} s {{withRules}} method via reflection. In the {{withRules}} you should also have a test available already I think, as that probably is the code that sets the instance fields that are annotated with {{@Rule}} to the actual rule instances. So I guess you have to change that you not hook into {{withBefore}} but already into {{withRules}} to do the enriching before the rules.
was (Author: vampire):
[~mjobanek] Are you sure? As far as I remember what I have looked at in Arquillian code you copied some code from the {{BlockJUnit4ClassRunner}}, having own instances of {{withBefore}}, {{withAfter}} and so on, but calling the {{BlockJUnit4ClassRunner}}s {{withRules}} method via reflection. In the {{withRules}} you should also have a test available already I think, as that probably is the code that sets the instance fields that are annotated with {{@Rule}} to the actual rule instances. So I guess you have to change that you not hook into {{withBefore}} but already into {{withRules}} to do the enriching before the rules.
> Test enrichment and JUnit @Rule do not harmonize
> ------------------------------------------------
>
> Key: ARQ-2034
> URL: https://issues.jboss.org/browse/ARQ-2034
> Project: Arquillian
> Issue Type: Bug
> Components: Base Implementation
> Affects Versions: 1.1.11.Final
> Environment: junit 4.11
> arquillian-junit-container 1.1.11.Final
> wildfly-arquillian-container-remote 8.1.0.Final
> Reporter: Björn Kautler
> Assignee: Matous Jobanek
>
> We are starting with Arquillian tests on a remote WildFly instance.
> I tried to write a JUnit {{@Rule}}, that can be used to make a login call for all test methods automatically, but I was not yet able to make it work, as I need an injected {{@Ejb}} instance for this.
> I tried to add {{@EJB private InterfaceLoginManagement interfaceLoginManagement;}} to the {{TestRule}} implementation, but it stays {{null}}. I've read at ARQ-1954 that this should probably work, but unfortunately it is not, at least not with the remote container runner. {{org.jboss.arquillian.junit.extension.JUnitCoreExtension}} that should register {{org.jboss.arquillian.junit.extension.UpdateTestResultBeforeAfter}} and {{org.jboss.arquillian.junit.RulesEnricher}} is not even loaded on the container side. Maybe the {{META-INF/services/}} file is missing?
> Then I tried to simply give the injected instance to the rule from the test class like
> {code}
> @EJB private InterfaceLoginManagement interfaceLoginManagement;
> @Rule private LoginRule loginRule = new LoginRule(interfaceLoginManagement);
> {code}
> or even
> {code}
> @EJB private InterfaceLoginManagement interfaceLoginManagement;
> @Rule public LoginRule getLoginRule() {
> return new LoginRule(() -> {
> return interfaceLoginManagement;
> });
> }
> {code}
> with the {{LoginRule}} receiving a {{Supplier<InterfaceLoginManagement>}} and call it as late as possible, i. e. in the rules {{apply()}} method. But even this is still too early as the EJB is still {{null}} and the test enrichers are only run between the {{@Rule}} applying and {{@Before}} methods.
> So I'd like to suggest two things:
> # Fix the implementation of ARQ-1954 if it should work on container side which I assume it should
> # Make the test enrichments earlier in the lifecycle, i. e. before the {{@Rule}} s are being applied, or rather even before the {{@Rule}} methods are called, so that you at least can use the injected instances in the {{@Rule}} annotated methods to forward them to a rule. This is necessary even if top 1 is taken care of, because you might want to use a 3rd Party rule the code of which you cannot change.
--
This message was sent by Atlassian JIRA
(v6.4.11#64026)
8 years, 2 months
[JBoss JIRA] (ARQ-2034) Test enrichment and JUnit @Rule do not harmonize
by Matous Jobanek (JIRA)
[ https://issues.jboss.org/browse/ARQ-2034?page=com.atlassian.jira.plugin.s... ]
Matous Jobanek commented on ARQ-2034:
-------------------------------------
Hi,
yeah, there is a way to do it - crating a new event. Here is my proposal:
https://github.com/MatousJobanek/arquillian-core/tree/ARQ-2034_new_event
> Test enrichment and JUnit @Rule do not harmonize
> ------------------------------------------------
>
> Key: ARQ-2034
> URL: https://issues.jboss.org/browse/ARQ-2034
> Project: Arquillian
> Issue Type: Bug
> Components: Base Implementation
> Affects Versions: 1.1.11.Final
> Environment: junit 4.11
> arquillian-junit-container 1.1.11.Final
> wildfly-arquillian-container-remote 8.1.0.Final
> Reporter: Björn Kautler
> Assignee: Matous Jobanek
>
> We are starting with Arquillian tests on a remote WildFly instance.
> I tried to write a JUnit {{@Rule}}, that can be used to make a login call for all test methods automatically, but I was not yet able to make it work, as I need an injected {{@Ejb}} instance for this.
> I tried to add {{@EJB private InterfaceLoginManagement interfaceLoginManagement;}} to the {{TestRule}} implementation, but it stays {{null}}. I've read at ARQ-1954 that this should probably work, but unfortunately it is not, at least not with the remote container runner. {{org.jboss.arquillian.junit.extension.JUnitCoreExtension}} that should register {{org.jboss.arquillian.junit.extension.UpdateTestResultBeforeAfter}} and {{org.jboss.arquillian.junit.RulesEnricher}} is not even loaded on the container side. Maybe the {{META-INF/services/}} file is missing?
> Then I tried to simply give the injected instance to the rule from the test class like
> {code}
> @EJB private InterfaceLoginManagement interfaceLoginManagement;
> @Rule private LoginRule loginRule = new LoginRule(interfaceLoginManagement);
> {code}
> or even
> {code}
> @EJB private InterfaceLoginManagement interfaceLoginManagement;
> @Rule public LoginRule getLoginRule() {
> return new LoginRule(() -> {
> return interfaceLoginManagement;
> });
> }
> {code}
> with the {{LoginRule}} receiving a {{Supplier<InterfaceLoginManagement>}} and call it as late as possible, i. e. in the rules {{apply()}} method. But even this is still too early as the EJB is still {{null}} and the test enrichers are only run between the {{@Rule}} applying and {{@Before}} methods.
> So I'd like to suggest two things:
> # Fix the implementation of ARQ-1954 if it should work on container side which I assume it should
> # Make the test enrichments earlier in the lifecycle, i. e. before the {{@Rule}} s are being applied, or rather even before the {{@Rule}} methods are called, so that you at least can use the injected instances in the {{@Rule}} annotated methods to forward them to a rule. This is necessary even if top 1 is taken care of, because you might want to use a 3rd Party rule the code of which you cannot change.
--
This message was sent by Atlassian JIRA
(v6.4.11#64026)
8 years, 2 months