/** Three processes start computing sequentially */ @Test public void consequentTest() { DA_Suzuki_Kasami_RMI process1 = setup.getProcesses().get(0); TestThread thread1 = new TestThread(process1); DA_Suzuki_Kasami_RMI process2 = setup.getProcesses().get(1); TestThread thread2 = new TestThread(process2); DA_Suzuki_Kasami_RMI process3 = setup.getProcesses().get(2); TestThread thread3 = new TestThread(process3); try { process1.reset(); process2.reset(); process3.reset(); new Thread(thread1).start(); Token token = Token.instantiate(3); if (token != null) { TokenMessage tm = new TokenMessage("", 0, token); process1.receiveToken(tm); } Thread.sleep(3000); new Thread(thread2).start(); Thread.sleep(3000); new Thread(thread3).start(); Thread.sleep(5000); Assert.assertTrue(process1.isComputationFinished()); Assert.assertTrue(process2.isComputationFinished()); Assert.assertTrue(process3.isComputationFinished()); } catch (Exception e) { e.printStackTrace(); Assert.fail(); } }
@Test public void testHoverLivingMenuLoadsMenu() { Home home = new Home(setup.getDriver()); home.getHomePage(); if (!home.isLoggedIn()) { home.login("*****@*****.**", "6314134223"); } setup.getDriver().manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS); HeaderRegion header = home.header(); HeaderMenu menu = header.hoverMenu("living"); assertEquals("living", menu.getMenuName()); assertEquals(true, menu.isDropdownMenuVisible()); }
@Test public void testClickLivingMenuLoadsPageLiving() { Home home = new Home(setup.getDriver()); home.getHomePage(); if (!home.isLoggedIn()) { home.login("*****@*****.**", "6314134223"); } setup.getDriver().manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS); home.header().clickMenu("living"); System.out.println(setup.getDriver().getCurrentUrl()); System.out.println(setup.getDriver().getTitle()); assertEquals("https://www.sneakpeeq.com/v/LIVING", setup.getDriver().getCurrentUrl()); }
/** Runs the setup strategy Prepares all the data in db (cleans db/inserts new data if needed) */ @Before public void setUpTestData() throws Exception { LGR.trace("Setting up the data"); if (testSetupStrategy == null) { throw new IllegalStateException( "TestSetup strategy was not set properly.Did you forget to call setTestSetup()?"); } testSetupStrategy.setup(); LGR.trace("All Set!"); }
@After public void tearDown() throws Exception { setup.getDriver().quit(); }
@Before public void init() { setup = new TestSetup(); setup.init(); }