Examples of GrapheneContext


Examples of org.jboss.arquillian.graphene.context.GrapheneContext

    /**
     * Wraps the {@link WebDriver} instance provided by {@link Drone} in a proxy and sets the driver into context
     */
    @Override
    public WebDriver enhance(WebDriver driver, Class<? extends Annotation> qualifier) {
        GrapheneContext grapheneContext = GrapheneContext.setContextFor(configuration.get(), driver, qualifier);
        Class<?>[] interfaces = GrapheneProxyUtil.getInterfaces(driver.getClass());
        return grapheneContext.getWebDriver(interfaces);
    }
View Full Code Here

Examples of org.jboss.arquillian.graphene.context.GrapheneContext

     * @param <T> type of the returned object
     */
    private abstract static class DirectProvider extends SeleniumResourceProvider {
        @Override
        public Object lookup(ArquillianResource resource, Annotation... qualifiers) {
            GrapheneContext context = GrapheneContext.getContextFor(ReflectionHelper.getQualifier(qualifiers));
            try {
                return context.getWebDriver(Class.forName(getReturnType()));
            } catch (ClassNotFoundException ex) {
                //the external users:
                //  - does not have any chance to build a test with classes which are not added on classpath
                //the intern usage of Providers:
                //  - the class path may contain a different version of Selenium
View Full Code Here

Examples of org.jboss.arquillian.graphene.context.GrapheneContext

        protected <BASE> BASE base(final Annotation[] annotations) {
            final GrapheneProxy.FutureTarget futureTarget = new GrapheneProxy.FutureTarget() {
                @Override
                public Object getTarget() {
                    GrapheneContext context = GrapheneContext.getContextFor(ReflectionHelper.getQualifier(annotations));
                    return context.getWebDriver(mediatorType);
                }
            };

            GrapheneProxyHandler mediatorHandler = new GrapheneProxyHandler(futureTarget) {
                @Override
View Full Code Here

Examples of org.jboss.arquillian.graphene.context.GrapheneContext

    @Override
    public void enrich(final SearchContext searchContext, Object target) {
        try {
            List<Field> fields = FindByUtilities.getListOfFieldsAnnotatedWithFindBys(target);
            for (Field field : fields) {
                GrapheneContext grapheneContext = searchContext == null ? null : ((GrapheneProxyInstance) searchContext).getContext();
                final SearchContext localSearchContext;
                if (grapheneContext == null) {
                    grapheneContext = GrapheneContext.getContextFor(ReflectionHelper.getQualifier(field.getAnnotations()));
                    localSearchContext = grapheneContext.getWebDriver(SearchContext.class);
                } else {
                    localSearchContext = searchContext;
                }
                //by should never by null, by default it is ByIdOrName using field name
                By by = FindByUtilities.getCorrectBy(field, configuration.get().getDefaultElementLocatingStrategy());
View Full Code Here

Examples of org.jboss.arquillian.graphene.context.GrapheneContext

    @Override
    public void enrich(final SearchContext searchContext, Object target) {
        Collection<Field> fields = ReflectionHelper.getFieldsWithAnnotation(target.getClass(), JavaScript.class);
        for (Field field : fields) {
            GrapheneContext grapheneContext = searchContext == null ? null : ((GrapheneProxyInstance) searchContext).getContext();
            if (grapheneContext == null) {
                grapheneContext = GrapheneContext.getContextFor(ReflectionHelper.getQualifier(field.getAnnotations()));
            }
            if (!field.isAccessible()) {
                field.setAccessible(true);
View Full Code Here

Examples of org.jboss.arquillian.graphene.context.GrapheneContext

    @Override
    public void enrich(final SearchContext searchContext, Object target) {
        List<Field> fields = FindByUtilities.getListOfFieldsAnnotatedWithFindBys(target);
        for (Field field : fields) {
            GrapheneContext grapheneContext = searchContext == null ? null : ((GrapheneProxyInstance) searchContext)
                .getContext();
            final SearchContext localSearchContext;
            if (grapheneContext == null) {
                grapheneContext = GrapheneContext.getContextFor(ReflectionHelper.getQualifier(field.getAnnotations()));
                localSearchContext = grapheneContext.getWebDriver(SearchContext.class);
            } else {
                localSearchContext = searchContext;
            }
            // Page fragment
            if (isPageFragmentClass(field.getType(), target)) {
View Full Code Here

Examples of org.jboss.arquillian.graphene.context.GrapheneContext

            return ReflectionHelper.hasConstructor(clazz, outerClass);
        }
    }

    protected final <T> List<T> createPageFragmentList(final Class<T> clazz, final SearchContext searchContext, final By rootBy) {
        GrapheneContext grapheneContext = ((GrapheneProxyInstance) searchContext).getContext();
        List<T> result = GrapheneProxy.getProxyForFutureTarget(grapheneContext, new FutureTarget() {
            @Override
            public Object getTarget() {
                List<WebElement> elements = searchContext.findElements(rootBy);
                List<T> fragments = new ArrayList<T>();
View Full Code Here

Examples of org.jboss.arquillian.graphene.context.GrapheneContext

        return result;
    }

    public static <T> T createPageFragment(Class<T> clazz, final WebElement root) {
        try {
            GrapheneContext grapheneContext = ((GrapheneProxyInstance) root).getContext();
            T pageFragment = null;

            if (Modifier.isFinal(clazz.getModifiers())) {
                throw new PageFragmentInitializationException("Page Fragment must not be final class. It is, your "
                    + clazz + ", declared in: " + clazz);
View Full Code Here

Examples of org.jboss.arquillian.graphene.context.GrapheneContext

        }, clazz, WebElement.class);
    }

    protected final void setupPageFragmentList(SearchContext searchContext, Object target, Field field)
        throws ClassNotFoundException {
        GrapheneContext grapheneContext = ((GrapheneProxyInstance) searchContext).getContext();
        // the by retrieved in this way is never null, by default it is ByIdOrName using field name
        By rootBy = FindByUtilities.getCorrectBy(field, configuration.get().getDefaultElementLocatingStrategy());
        List<?> pageFragments = createPageFragmentList(getListType(field), searchContext, rootBy);
        setValue(field, target, pageFragments);
    }
View Full Code Here

Examples of org.jboss.arquillian.graphene.context.GrapheneContext

        List<?> pageFragments = createPageFragmentList(getListType(field), searchContext, rootBy);
        setValue(field, target, pageFragments);
    }

    protected final void setupPageFragment(SearchContext searchContext, Object target, Field field) {
        GrapheneContext grapheneContext = ((GrapheneProxyInstance) searchContext).getContext();
        // the by retrieved in this way is never null, by default it is ByIdOrName using field name
        By rootBy = FindByUtilities.getCorrectBy(field, configuration.get().getDefaultElementLocatingStrategy());
        WebElement root = WebElementUtils.findElementLazily(rootBy, searchContext);
        Object pageFragment = createPageFragment(field.getType(), root);
        setValue(field, target, pageFragment);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.