Package org.jboss.arquillian.graphene.spi.configuration

Examples of org.jboss.arquillian.graphene.spi.configuration.GrapheneConfiguration


    @Test
    public void testConfigurationViaDescriptor() {
        getManager().bind(SuiteScoped.class, ArquillianDescriptor.class, descriptor);
        fire(new BeforeClass(Object.class));
        assertEventFired(GrapheneConfigured.class);
        GrapheneConfiguration configuration = getManager().resolve(GrapheneConfiguration.class);
        assertNotNull("Configuration instance has to be available.", configuration);
        configuration.validate();
        assertEquals("'waitGuiInterval' should be 5", 5, configuration.getWaitGuiInterval());
        assertEquals("'waitAjaxInterval' should be 25", 25, configuration.getWaitAjaxInterval());
        assertEquals("'waitModelInterval' should be 125", 125, configuration.getWaitModelInterval());
        fire(new AfterClass(Object.class));
        assertEventFired(GrapheneUnconfigured.class);
    }
View Full Code Here


        // given
        TestingDriverStub executor = spy(new TestingDriverStub());
        when(executor.executeScript("return true;")).thenReturn(true);

        // when
        TestingInterface instance = JSInterfaceFactory.create(GrapheneContext.setContextFor(new GrapheneConfiguration(), executor, Default.class), TestingInterface.class);
        instance.namedMethod();

        // then
        verify(executor, times(1)).executeScript(invocation("TestingInterface", "anotherMethodName"));
    }
View Full Code Here

        // given
        TestingDriverStub executor = spy(new TestingDriverStub());
        when(executor.executeScript("return true;")).thenReturn(true);

        // when
        TestingInterfaceWithBase instance = JSInterfaceFactory.create(GrapheneContext.setContextFor(new GrapheneConfiguration(), executor, Default.class), TestingInterfaceWithBase.class);
        instance.method();

        // then
        verify(executor, times(1)).executeScript(invocation("base", "method"));
    }
View Full Code Here

            }
        };

        when(interceptor1.intercept(Mockito.any(InvocationContext.class))).thenAnswer(invoke);
        when(interceptor2.intercept(Mockito.any(InvocationContext.class))).thenAnswer(invoke);
        context = GrapheneContext.setContextFor(new GrapheneConfiguration(), driver, Default.class);
    }
View Full Code Here

    @Before
    public void prepareTest() {
        // given
        MockitoAnnotations.initMocks(this);
        instance = JSInterfaceFactory.create(GrapheneContext.setContextFor(new GrapheneConfiguration(), executor, Default.class), TestingInterface.class);
        when(executor.executeScript("return true;")).thenReturn(true);
    }
View Full Code Here

    @Before
    public void prepareTest() {
        // given
        MockitoAnnotations.initMocks(this);
        instance = JSInterfaceFactory.create(GrapheneContext.setContextFor(new GrapheneConfiguration(), executor, Default.class), TestingInterface.class);

        when(executor.executeScript(Mockito.anyString())).then(new Answer<Object>() {
            @Override
            public Object answer(InvocationOnMock invocation) throws Throwable {
                return answer;
View Full Code Here

        // given
        TestingDriverStub executor = spy(new TestingDriverStub());
        when(executor.executeScript("return true;")).thenReturn(true);

        // when
        TestingInterface instance = JSInterfaceFactory.create(GrapheneContext.setContextFor(new GrapheneConfiguration(), executor, Default.class), TestingInterface.class);
        instance.method();

        // then
        verify(executor, times(1)).executeScript(invocation("TestingInterface", "method"));
    }
View Full Code Here

        TestPage page = new TestPage();
        getGrapheneEnricher().enrich(page);

        assertTrue(page.element instanceof WrapsElement);

        GrapheneContext.setContextFor(new GrapheneConfiguration(), driver, Default.class);
        when(driver.findElement(Mockito.any(By.class))).thenReturn(element);
        WebElement wrappedElement = ((WrapsElement) page.element).getWrappedElement();
        GrapheneContext.removeContextFor(Default.class);

        assertEquals(element, wrappedElement);
View Full Code Here

    public void prepareServiceLoader() throws NoSuchFieldException, IllegalArgumentException, IllegalAccessException {
        grapheneEnricher = new GrapheneEnricher();
        Instance<GrapheneConfiguration> configuration = new Instance() {
            @Override
            public Object get() {
                return new GrapheneConfiguration();
            }

        };
        webElementEnricher = new WebElementEnricher(configuration);
        pageObjectEnricher = new PageObjectEnricher();
        pageFragmentEnricher = new PageFragmentEnricher(configuration);
        when(serviceLoaderInstance.get()).thenReturn(serviceLoader);
        when(serviceLoader.all(TestEnricher.class)).thenReturn(Arrays.asList(grapheneEnricher));
        when(serviceLoader.all(SearchContextTestEnricher.class)).thenReturn(Arrays.asList(webElementEnricher, pageObjectEnricher, pageFragmentEnricher));
        for (Object o: Arrays.asList(grapheneEnricher, webElementEnricher, pageObjectEnricher, pageFragmentEnricher)) {
            Field serviceLoaderField;
            if (o instanceof SearchContextTestEnricher) {
                serviceLoaderField = AbstractSearchContextEnricher.class.getDeclaredField("serviceLoader");
            } else {
                serviceLoaderField = o.getClass().getDeclaredField("serviceLoader");
            }
            if (!serviceLoaderField.isAccessible()) {
                serviceLoaderField.setAccessible(true);
            }
            serviceLoaderField.set(o, serviceLoaderInstance);
        }

        GrapheneContext.setContextFor(new GrapheneConfiguration(), browser, Default.class);
        GrapheneRuntime.pushInstance(new DefaultGrapheneRuntime());
    }
View Full Code Here

            @Override
            public void contextClick(Coordinates where) {
                throw new UnsupportedOperationException("Not supported yet.");
            }
        });
        GrapheneContext.setContextFor(new GrapheneConfiguration(), driver, Default.class);
        GrapheneRuntime.pushInstance(new DefaultGrapheneRuntime());
    }
View Full Code Here

TOP

Related Classes of org.jboss.arquillian.graphene.spi.configuration.GrapheneConfiguration

Copyright © 2018 www.massapicom. 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.