Exemplo n.º 1
0
  @Test
  public void testChannelGroupReceive() throws Exception {
    final Channel<String> channel1 = newChannel();
    final Channel<String> channel2 = newChannel();
    final Channel<String> channel3 = newChannel();

    final ReceivePortGroup<String> group =
        new ReceivePortGroup<String>(channel1, channel2, channel3);

    Fiber fib =
        new Fiber(
                "fiber",
                fjPool,
                new SuspendableRunnable() {
                  @Override
                  public void run() throws SuspendExecution, InterruptedException {
                    String m1 = group.receive();
                    String m2 = channel2.receive();

                    assertThat(m1, equalTo("hello"));
                    assertThat(m2, equalTo("world!"));
                  }
                })
            .start();

    Thread.sleep(100);
    channel3.send("hello");
    Thread.sleep(100);
    if (policy != OverflowPolicy.BLOCK) {
      channel1.send("goodbye"); // TransferChannel will block here
      Thread.sleep(100);
    }
    channel2.send("world!");
    fib.join();
  }
Exemplo n.º 2
0
  //  Delete CSR
  @Test
  public void Test5() throws Exception {
    driver.get(baseUrl + "/#/host/magehostmanager.magemojo.com/configuration/ssl");
    driver.findElement(By.xpath("//a[contains(text(),'www.Testing5.com')]")).click();
    assertEquals(
        "Download CSR www.Testing5.com", driver.findElement(By.xpath("//legend[4]")).getText());
    driver.findElement(By.xpath("(//button[@type='button'])[8]")).click();
    assertEquals(
        "Confirmation Window",
        driver.findElement(By.cssSelector("h3.modal-title.ng-binding")).getText());
    assertTrue(isElementPresent(By.xpath("//div[3]/button[2]")));
    driver.findElement(By.xpath("//div[3]/button")).click();

    for (int second = 0; ; second++) {
      if (second >= 60) fail("timeout");
      try {
        if ("Successfully deleted the CSR."
            .equals(driver.findElement(By.xpath("//div[@id='toast-container']/div")).getText()))
          break;
      } catch (Exception e) {
      }
      Thread.sleep(1000);
    }

    for (int second = 0; ; second++) {
      if (second >= 60) fail("timeout");
      try {
        if (!isElementPresent(By.xpath("//a[contains(text(),'www.Testing5.com')]"))) break;
      } catch (Exception e) {
      }
      Thread.sleep(1000);
    }
  }
Exemplo n.º 3
0
  // Test Case 6: Password Empty - Error
  private void profileSetUpPasswordEmpty() throws InterruptedException {

    profilePage1();
    driver.findElement(By.id("nickName")).click();
    driver.findElement(By.id("nickName")).clear();
    driver.findElement(By.id("nickName")).sendKeys("Neel");

    new Select(driver.findElement(By.id("DOBMonth"))).selectByVisibleText("January");
    driver.findElement(By.cssSelector("option[value=\"01\"]")).click();
    new Select(driver.findElement(By.id("DOBDay"))).selectByVisibleText("04");
    driver.findElement(By.cssSelector("#DOBDay > option[value=\"02\"]")).click();
    new Select(driver.findElement(By.id("DOBYear"))).selectByVisibleText("1994");
    driver.findElement(By.cssSelector("option[value=\"1994\"]")).click();

    driver.findElement(By.id("email")).click();
    driver.findElement(By.id("email")).clear();
    driver.findElement(By.id("email")).sendKeys("*****@*****.**");

    driver.findElement(By.id("emailConfirmation")).click();
    driver.findElement(By.id("emailConfirmation")).clear();
    driver.findElement(By.id("emailConfirmation")).sendKeys("*****@*****.**");

    driver.findElement(By.id("password")).click();
    driver.findElement(By.id("password")).clear();

    Thread.sleep(3000);

    driver.findElement(By.cssSelector("input.submitButton.green")).click();
    Thread.sleep(3000);
    System.out.println("ERROR: Password Missing");
  }
Exemplo n.º 4
0
  @Test
  public void testTopic() throws Exception {
    final Channel<String> channel1 = newChannel();
    final Channel<String> channel2 = newChannel();
    final Channel<String> channel3 = newChannel();

    final Topic<String> topic = new Topic<String>();

    topic.subscribe(channel1);
    topic.subscribe(channel2);
    topic.subscribe(channel3);

    Fiber f1 =
        new Fiber(
                fjPool,
                new SuspendableRunnable() {
                  @Override
                  public void run() throws SuspendExecution, InterruptedException {
                    assertThat(channel1.receive(), equalTo("hello"));
                    assertThat(channel1.receive(), equalTo("world!"));
                  }
                })
            .start();

    Fiber f2 =
        new Fiber(
                fjPool,
                new SuspendableRunnable() {
                  @Override
                  public void run() throws SuspendExecution, InterruptedException {
                    assertThat(channel2.receive(), equalTo("hello"));
                    assertThat(channel2.receive(), equalTo("world!"));
                  }
                })
            .start();

    Fiber f3 =
        new Fiber(
                fjPool,
                new SuspendableRunnable() {
                  @Override
                  public void run() throws SuspendExecution, InterruptedException {
                    assertThat(channel3.receive(), equalTo("hello"));
                    assertThat(channel3.receive(), equalTo("world!"));
                  }
                })
            .start();

    Thread.sleep(100);
    topic.send("hello");
    Thread.sleep(100);
    topic.send("world!");

    f1.join();
    f2.join();
    f3.join();
  }
 // *** l'utilisation des données "......"
 // ** et des données de longeurs de "nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn"
 // pour le champ nom
 // * l'impossibilité de modifier l'id d'un motif de remplacemnt une fois enregistré
 @Test
 public void testSSV8VALDEBTA008cIntegrationTests() throws Exception {
   driver.get(baseUrl + "/selectsystem-view-tomcat-oracle/login.xhtml");
   Thread.sleep(1000);
   findElement(By.id("j_username")).clear();
   findElement(By.id("j_username")).sendKeys("usercenter");
   Thread.sleep(1000);
   findElement(By.id("j_password")).clear();
   findElement(By.id("j_password")).sendKeys("pwd8888");
   findElement(By.cssSelector("#login > img[alt=\"Frensh\"]")).click();
   optionalClick(By.xpath("//span/a"));
   findElement(By.id("form:table:1:sdksds")).click();
   findElement(By.xpath("(//img[@alt='English'])[4]")).click();
   findElement(By.xpath("(//a[contains(text(),'Card Replacement Motif')])[2]")).click();
   new Select(findElement(By.id("globalCardReplacementMotifForm:bank")))
       .selectByVisibleText("banque test 3");
   Thread.sleep(1000);
   findElement(By.xpath("//table[@id='globalCardReplacementMotifForm:AZ']/tbody/tr/td/a[3]/img"))
       .click();
   Thread.sleep(1000);
   findElement(By.id("globalCardReplacementMotifForm:inputIdeee")).clear();
   findElement(By.id("globalCardReplacementMotifForm:inputIdeee")).sendKeys("..........");
   Thread.sleep(1000);
   findElement(By.id("globalCardReplacementMotifForm:inputLabeeee")).clear();
   findElement(By.id("globalCardReplacementMotifForm:inputLabeeee")).sendKeys("ReasRp_031");
   findElement(By.cssSelector("img[alt=\"save2\"]")).click();
   findElement(By.id("globalCardReplacementMotifForm:fdfdfffffipppipppiiegggeooo")).click();
   findElement(By.xpath("//table[@id='globalCardReplacementMotifForm:AZ']/tbody/tr/td/a[3]/img"))
       .click();
   Thread.sleep(1000);
   findElement(By.id("globalCardReplacementMotifForm:inputIdeee")).clear();
   findElement(By.id("globalCardReplacementMotifForm:inputIdeee")).sendKeys("ReasRp_031");
   Thread.sleep(1000);
   findElement(By.id("globalCardReplacementMotifForm:inputLabeeee")).clear();
   findElement(By.id("globalCardReplacementMotifForm:inputLabeeee"))
       .sendKeys("nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn");
   findElement(By.cssSelector("img[alt=\"save2\"]")).click();
   findElement(By.id("globalCardReplacementMotifForm:fdfdfffffipppipppiiegggeooo")).click();
   findElement(By.xpath("//table[@id='globalCardReplacementMotifForm:AZ']/tbody/tr/td/a[3]/img"))
       .click();
   Thread.sleep(1000);
   findElement(By.id("globalCardReplacementMotifForm:inputIdeee")).clear();
   findElement(By.id("globalCardReplacementMotifForm:inputIdeee")).sendKeys("ReasRp_033");
   Thread.sleep(1000);
   findElement(By.id("globalCardReplacementMotifForm:inputLabeeee")).clear();
   findElement(By.id("globalCardReplacementMotifForm:inputLabeeee")).sendKeys("ReasRp_033");
   findElement(By.cssSelector("img[alt=\"save2\"]")).click();
   findElement(By.id("globalCardReplacementMotifForm:fdfdfffffipppipppiiegggeooo")).click();
   findElement(
           By.id(
               "globalCardReplacementMotifForm:searchCardDesignFeesResultsId:0:scxqsjhvcqjshcvhqsceee"))
       .click();
   findElement(By.cssSelector("img[alt=\"save2\"]")).click();
   findElement(By.id("globalCardReplacementMotifForm:fdfdfffffipppipppiiegggeooo")).click();
   findElement(By.xpath("(//img[@alt='English'])[2]")).click();
 }
Exemplo n.º 6
0
  @Test
  public void testOtsi() throws Exception {
    driver.get(baseUrl + "/");
    driver.findElement(By.linkText("Kandidaadid")).click();
    // Warning: waitForTextPresent may require manual changes
    for (int second = 0; ; second++) {
      if (second >= 60) fail("timeout");
      try {
        if (driver
            .findElement(By.cssSelector("BODY"))
            .getText()
            .matches("^[\\s\\S]*Vana Kala[\\s\\S]*$")) break;
      } catch (Exception e) {
      }
      Thread.sleep(1000);
    }

    driver.findElement(By.id("nimi")).clear();
    driver.findElement(By.id("nimi")).sendKeys("Magdalena");
    try {
      assertEquals("Magdalena", driver.findElement(By.id("nimi")).getAttribute("value"));
    } catch (Error e) {
      verificationErrors.append(e.toString());
    }
    driver.findElement(By.id("sButton")).click();
    // Warning: waitForTextPresent may require manual changes
    for (int second = 0; ; second++) {
      if (second >= 60) fail("timeout");
      try {
        if (driver
            .findElement(By.cssSelector("BODY"))
            .getText()
            .matches("^[\\s\\S]*Magdalena Malejeva[\\s\\S]*$")) break;
      } catch (Exception e) {
      }
      Thread.sleep(1000);
    }

    // Warning: verifyTextNotPresent may require manual changes
    try {
      assertFalse(
          driver
              .findElement(By.cssSelector("BODY"))
              .getText()
              .matches("^[\\s\\S]*Vana Kala[\\s\\S]*$"));
    } catch (Error e) {
      verificationErrors.append(e.toString());
    }
  }
  @Test
  public void testSendMessage() throws Exception {
    String url = getAppBaseURL() + "send_message";
    URL obj = new URL(url);
    HttpsURLConnection con = (HttpsURLConnection) obj.openConnection();
    String body = "message=" + URLEncoder.encode(MESSAGE, "UTF-8");

    con.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
    con.setRequestMethod("POST");

    con.setDoOutput(true);
    DataOutputStream wr = new DataOutputStream(con.getOutputStream());
    wr.writeBytes(body);
    wr.flush();
    wr.close();

    int responseCode = con.getResponseCode();

    // It ensures that the app successfully received the message.
    assertEquals(204, responseCode);

    // Try fetching the /fetch_messages endpoint and see if the
    // response contains the message.
    boolean found = false;
    for (int i = 0; i < MAX_RETRY; i++) {
      Thread.sleep(SLEEP_TIME);
      String resp = fetchMessages();
      if (resp.contains(MESSAGE)) {
        found = true;
        break;
      }
    }
    assertTrue(found);
  }
Exemplo n.º 8
0
  public static void send(Socket sa, String data) throws IOException {
    byte[] content = data.getBytes();

    byte[] length = String.format("%04d", content.length).getBytes();

    byte[] buf = new byte[1024];
    int reslen;
    int rc;
    //  Bounce the message back.
    InputStream in = sa.getInputStream();
    OutputStream out = sa.getOutputStream();

    out.write(length);
    out.write(content);

    System.out.println("sent " + data.length() + " " + data);
    int to_read = 4; // 4 + greeting_size
    int read = 0;
    while (to_read > 0) {
      rc = in.read(buf, read, to_read);
      read += rc;
      to_read -= rc;
      System.out.println("read " + rc + " total_read " + read + " to_read " + to_read);
    }
    System.out.println(String.format("%02x %02x %02x %02x", buf[0], buf[1], buf[2], buf[3]));
    try {
      Thread.sleep(1000);
    } catch (InterruptedException e) {
      e.printStackTrace();
    }
    reslen = Integer.valueOf(new String(buf, 0, 4));

    in.read(buf, 0, reslen);
    System.out.println("recv " + reslen + " " + new String(buf, 0, reslen));
  }
Exemplo n.º 9
0
  @Ignore
  @Test
  public void whenReceiveNotCalledFromOwnerThenThrowException4() throws Exception {
    assumeTrue(Debug.isAssertionsEnabled());
    final Channel<String> ch = newChannel();

    Thread thread =
        new Thread(
            new Runnable() {
              @Override
              public void run() {
                try {
                  ch.receive();
                } catch (InterruptedException ex) {
                  throw new AssertionError(ex);
                } catch (SuspendExecution e) {
                  throw new AssertionError(e);
                }
              }
            });
    thread.start();

    Thread.sleep(100);
    ch.send("a message");

    boolean thrown = false;
    try {
      ch.receive();
    } catch (Throwable e) {
      thrown = true;
    }
    assertTrue(thrown);

    thread.join();
  }
Exemplo n.º 10
0
  @Ignore
  @Test
  public void whenReceiveNotCalledFromOwnerThenThrowException2() throws Exception {
    assumeTrue(Debug.isAssertionsEnabled());
    final Channel<String> ch = newChannel();

    Fiber fib =
        new Fiber(
                "fiber",
                fjPool,
                new SuspendableRunnable() {
                  @Override
                  public void run() throws SuspendExecution, InterruptedException {
                    String m = ch.receive();

                    assertThat(m, equalTo("a message"));
                  }
                })
            .start();

    Thread.sleep(50);
    ch.send("a message");

    boolean thrown = false;
    try {
      ch.receive();
    } catch (Throwable e) {
      thrown = true;
    }
    assertTrue(thrown);

    fib.join();
  }
Exemplo n.º 11
0
  @Test
  public void testChannelCloseWithSleep() throws Exception {
    final Channel<Integer> ch = newChannel();

    Fiber fib =
        new Fiber(
                "fiber",
                fjPool,
                new SuspendableRunnable() {
                  @Override
                  public void run() throws SuspendExecution, InterruptedException {
                    for (int i = 1; i <= 5; i++) {
                      Integer m = ch.receive();

                      assertThat(m, equalTo(i));
                    }

                    Integer m = ch.receive();

                    assertThat(m, nullValue());
                    assertTrue(ch.isClosed());
                  }
                })
            .start();

    Thread.sleep(50);
    ch.send(1);
    ch.send(2);
    ch.send(3);
    ch.send(4);
    ch.send(5);

    Thread.sleep(50);
    ch.close();

    ch.send(6);
    ch.send(7);

    fib.join();
  }
 // *** Supression des risques de banques
 @Test
 public void testSSV8VALDEBTA997IntegrationTests() throws Exception {
   driver.get(baseUrl + "/selectsystem-view-tomcat-oracle/login.xhtml");
   Thread.sleep(1000);
   findElement(By.id("j_username")).clear();
   findElement(By.id("j_username")).sendKeys("usercenter");
   Thread.sleep(1000);
   findElement(By.id("j_password")).clear();
   findElement(By.id("j_password")).sendKeys("pwd8888");
   findElement(By.cssSelector("#login > img[alt=\"Frensh\"]")).click();
   optionalClick(By.xpath("//span/a"));
   findElement(By.id("form:table:0:sdksds")).click();
   findElement(By.xpath("(//img[@alt='English'])[11]")).click();
   findElement(By.linkText("Managing Risk")).click();
   new Select(findElement(By.id("globalIssuerRiskBankManagementForm:titletttrrrr")))
       .selectByVisibleText("banque test 1");
   Thread.sleep(1000);
   findElement(By.id("globalIssuerRiskBankManagementForm:hs5414")).click();
   findElement(By.xpath("//td[3]/span/a/img")).click();
   findElement(By.xpath("//td/div[3]/a")).click();
   findElement(By.xpath("//tr[2]/td[3]/center/table/tbody/tr/td[3]/span/a/img")).click();
   findElement(By.xpath("//td/div[3]/a")).click();
   findElement(By.xpath("//tr[3]/td[3]/center/table/tbody/tr/td[3]/span/a/img")).click();
   findElement(By.xpath("//td/div[3]/a")).click();
   findElement(By.id("globalIssuerRiskBankManagementForm:hs5414")).click();
   new Select(findElement(By.id("globalIssuerRiskBankManagementForm:titletttrrrr")))
       .selectByVisibleText("banque test 2");
   Thread.sleep(1000);
   findElement(By.id("globalIssuerRiskBankManagementForm:hs5414")).click();
   findElement(By.xpath("//td[3]/span/a/img")).click();
   findElement(By.xpath("//td/div[2]/a")).click();
   findElement(By.xpath("//tr[2]/td[3]/center/table/tbody/tr/td[3]/span/a/img")).click();
   findElement(By.xpath("//td/div[2]/a")).click();
   findElement(By.xpath("//tr[3]/td[3]/center/table/tbody/tr/td[3]/span/a/img")).click();
   findElement(By.xpath("//td/div[2]/a")).click();
   findElement(By.id("globalIssuerRiskBankManagementForm:hs5414")).click();
   new Select(findElement(By.id("globalIssuerRiskBankManagementForm:titletttrrrr")))
       .selectByVisibleText("banque test 3");
   Thread.sleep(1000);
   findElement(By.id("globalIssuerRiskBankManagementForm:hs5414")).click();
   findElement(By.xpath("//td[3]/span/a/img")).click();
   findElement(By.xpath("//td/div[3]/a")).click();
   findElement(By.xpath("//tr[2]/td[3]/center/table/tbody/tr/td[3]/span/a/img")).click();
   findElement(By.xpath("//td/div[3]/a")).click();
   findElement(By.xpath("//tr[3]/td[3]/center/table/tbody/tr/td[3]/span/a/img")).click();
   findElement(By.xpath("//td/div[3]/a")).click();
   findElement(By.id("globalIssuerRiskBankManagementForm:hs5414")).click();
   new Select(findElement(By.id("globalIssuerRiskBankManagementForm:titletttrrrr")))
       .selectByVisibleText("banque test 2");
   Thread.sleep(1000);
   findElement(By.id("globalIssuerRiskBankManagementForm:hs5414")).click();
   findElement(By.xpath("//td[3]/span/a/img")).click();
   findElement(By.xpath("//td/div[3]/a")).click();
   findElement(By.xpath("//tr[2]/td[3]/center/table/tbody/tr/td[3]/span/a/img")).click();
   findElement(By.xpath("//td/div[3]/a")).click();
   findElement(By.xpath("//tr[3]/td[3]/center/table/tbody/tr/td[3]/span/a/img")).click();
   findElement(By.xpath("//td/div[3]/a")).click();
   findElement(By.id("globalIssuerRiskBankManagementForm:hs5414")).click();
   findElement(By.xpath("(//img[@alt='English'])[2]")).click();
 }
Exemplo n.º 13
0
  @Test
  public void customExecutorIsPropagated() throws InterruptedException {
    AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
    ctx.register(CustomExecutorAsyncConfig.class);
    ctx.refresh();

    AsyncBean asyncBean = ctx.getBean(AsyncBean.class);
    asyncBean.work();
    Thread.sleep(500);
    assertThat(asyncBean.getThreadOfExecution().getName(), startsWith("Custom-"));

    TestableAsyncUncaughtExceptionHandler exceptionHandler =
        (TestableAsyncUncaughtExceptionHandler) ctx.getBean("exceptionHandler");
    assertFalse("handler should not have been called yet", exceptionHandler.isCalled());

    asyncBean.fail();
    Thread.sleep(500);
    Method m = ReflectionUtils.findMethod(AsyncBean.class, "fail");
    exceptionHandler.assertCalledWith(m, UnsupportedOperationException.class);

    ctx.close();
  }
 @Test
 public void set_A$String$int$Object_Expire() throws Exception {
   MemcachedSessionStore store = new MemcachedSessionStore(getMemcached());
   // given
   String key = "MemcachedSessionStoreTest#set_A$String$int$Object_" + System.currentTimeMillis();
   int expire = 2;
   String value = "aaa";
   // when
   store.set(key, expire, value);
   Thread.sleep(3000L);
   String actual = store.get(key);
   // then
   assertThat(actual, is(nullValue()));
 }
 private void waitForLocations(int locations) throws IOException, InterruptedException {
   for (int tries = 0; tries < RETRIES; )
     try {
       LocatedBlock locatedBlock = getLocatedBlock();
       assertThat(locatedBlock.getLocations().length, is(locations));
       break;
     } catch (AssertionError e) {
       if (++tries < RETRIES) {
         Thread.sleep(1000);
       } else {
         throw e;
       }
     }
 }
Exemplo n.º 16
0
  @Test
  public void testChannelGroupReceiveWithTimeout() throws Exception {
    final Channel<String> channel1 = newChannel();
    final Channel<String> channel2 = newChannel();
    final Channel<String> channel3 = newChannel();

    final ReceivePortGroup<String> group =
        new ReceivePortGroup<String>(channel1, channel2, channel3);

    Fiber fib =
        new Fiber(
                "fiber",
                fjPool,
                new SuspendableRunnable() {
                  @Override
                  public void run() throws SuspendExecution, InterruptedException {
                    String m1 = group.receive();
                    String m2 = channel2.receive();
                    String m3 = group.receive(10, TimeUnit.MILLISECONDS);
                    String m4 = group.receive(200, TimeUnit.MILLISECONDS);

                    assertThat(m1, equalTo("hello"));
                    assertThat(m2, equalTo("world!"));
                    assertThat(m3, nullValue());
                    assertThat(m4, equalTo("foo"));
                  }
                })
            .start();

    Thread.sleep(100);
    channel3.send("hello");
    Thread.sleep(100);
    channel2.send("world!");
    Thread.sleep(100);
    channel1.send("foo");
    fib.join();
  }
  @Test
  public void runUploadThenDownload() throws Exception {
    final String trackingId = newName();

    IndyFoloContentClientModule module = client.module(IndyFoloContentClientModule.class);

    // upload
    module.store(trackingId, hosted, STORE, path, new ByteArrayInputStream(bytes));

    // download
    module.get(trackingId, hosted, STORE, path);

    Thread.sleep(2000); // wait for event being fired

    sealAndCheck(trackingId);
  }
Exemplo n.º 18
0
  @Test
  public void testWeather() throws Exception {
    driver.get(baseUrl + "/");
    driver.findElement(By.linkText("Edmonton")).click();
    for (int second = 0; ; second++) {
      if (second >= 60) fail("timeout");
      try {
        if (isElementPresent(By.id("cityjump"))) break;
      } catch (Exception e) {
      }
      Thread.sleep(1000);
    }

    // Warning: verifyTextPresent may require manual changes
    try {
      assertTrue(
          driver
              .findElement(By.cssSelector("BODY"))
              .getText()
              .matches("^[\\s\\S]*Current Conditions[\\s\\S]*$"));
    } catch (Error e) {
      verificationErrors.append(e.toString());
    }
    // Warning: verifyTextPresent may require manual changes
    try {
      assertTrue(
          driver
              .findElement(By.cssSelector("BODY"))
              .getText()
              .matches("^[\\s\\S]*Forecast[\\s\\S]*$"));
    } catch (Error e) {
      verificationErrors.append(e.toString());
    }
    // Warning: verifyTextPresent may require manual changes
    try {
      assertTrue(
          driver
              .findElement(By.cssSelector("BODY"))
              .getText()
              .matches("^[\\s\\S]*Edmonton City Centre Airport[\\s\\S]*$"));
    } catch (Error e) {
      verificationErrors.append(e.toString());
    }
  }
Exemplo n.º 19
0
  @Test
  public void testPrimitiveChannelClose() throws Exception {
    assumeThat(mailboxSize, not(equalTo(0)));

    final IntChannel ch = Channels.newIntChannel(mailboxSize, policy);

    Fiber fib =
        new Fiber(
                "fiber",
                fjPool,
                new SuspendableRunnable() {
                  @Override
                  public void run() throws SuspendExecution, InterruptedException {
                    for (int i = 1; i <= 5; i++) {
                      int m = ch.receiveInt();

                      assertThat(m, is(i));
                    }

                    try {
                      int m = ch.receiveInt();
                      fail("m = " + m);
                    } catch (QueueChannel.EOFException e) {
                    }

                    assertTrue(ch.isClosed());
                  }
                })
            .start();

    Thread.sleep(50);
    ch.send(1);
    ch.send(2);
    ch.send(3);
    ch.send(4);
    ch.send(5);

    ch.close();

    ch.send(6);
    ch.send(7);

    fib.join();
  }
Exemplo n.º 20
0
 @Test
 public void testContactAdd() throws Exception {
   driver.get(LoginHelper.baseUrl + "/Account/Login?ReturnUrl=%2f");
   LoginHelper.login(driver);
   try {
     Thread.sleep(2000);
   } catch (InterruptedException x) {
   }
   driver.findElement(By.id("tileContactModule")).click();
   driver.findElement(By.linkText("Добавить новый")).click();
   driver.findElement(By.id("FirstName")).click();
   driver.findElement(By.id("FirstName")).clear();
   driver.findElement(By.id("FirstName")).sendKeys("AutoName");
   driver.findElement(By.id("LastName")).click();
   driver.findElement(By.id("LastName")).clear();
   driver.findElement(By.id("LastName")).sendKeys("Auto2Name");
   new Select(driver.findElement(By.id("SpecialityId"))).selectByVisibleText("Chirurg");
   driver.findElement(By.id("bntSave")).click();
 }
Exemplo n.º 21
0
  // Test Case 1: Postal Code Missing - Error
  private void newProfilePostalCodeEmpty() throws InterruptedException {

    driver.manage().window().maximize();
    driver.findElement(By.cssSelector("li")).click();
    new Select(driver.findElement(By.id("profileGender"))).selectByVisibleText("Woman");
    driver.findElement(By.cssSelector("option[value=\"3\"]")).click();
    new Select(driver.findElement(By.id("profileLookingGender"))).selectByVisibleText("Man");
    driver.findElement(By.cssSelector("#profileLookingGender > option[value=\"2\"]")).click();
    driver.findElement(By.id("profileLookingMinAge")).click();
    new Select(driver.findElement(By.id("profileLookingMinAge"))).selectByVisibleText("20");
    driver.findElement(By.cssSelector("option[value=\"20\"]")).click();
    new Select(driver.findElement(By.id("profileLookingMaxAge"))).selectByVisibleText("36");
    driver.findElement(By.cssSelector("#profileLookingMaxAge > option[value=\"36\"]")).click();
    driver.findElement(By.cssSelector("#country > option[value=\"39\"]")).click();
    driver.findElement(By.id("submit")).click();

    System.out.println("ERROR: Postal Code is Empty");
    Thread.sleep(5000);
  }
Exemplo n.º 22
0
  // Profile creation - step 1
  private void profilePage1() throws InterruptedException {

    driver.manage().window().maximize();
    driver.findElement(By.cssSelector("li")).click();
    new Select(driver.findElement(By.id("profileGender"))).selectByVisibleText("Woman");
    driver.findElement(By.cssSelector("option[value=\"3\"]")).click();
    new Select(driver.findElement(By.id("profileLookingGender"))).selectByVisibleText("Man");
    driver.findElement(By.cssSelector("#profileLookingGender > option[value=\"2\"]")).click();
    driver.findElement(By.id("profileLookingMinAge")).click();
    new Select(driver.findElement(By.id("profileLookingMinAge"))).selectByVisibleText("20");
    driver.findElement(By.cssSelector("option[value=\"20\"]")).click();
    new Select(driver.findElement(By.id("profileLookingMaxAge"))).selectByVisibleText("36");
    driver.findElement(By.cssSelector("#profileLookingMaxAge > option[value=\"36\"]")).click();
    driver.findElement(By.cssSelector("#country > option[value=\"39\"]")).click();
    driver.findElement(By.id(("postalCode"))).click();
    driver.findElement(By.id(("postalCode"))).clear();
    driver.findElement(By.id(("postalCode"))).sendKeys("H3S1H4");
    driver.findElement(By.id("submit")).click();
    Thread.sleep(5000);
  }
Exemplo n.º 23
0
  @Test
  public void test1create() throws InterruptedException {
    long now = System.currentTimeMillis();

    Thread.sleep(20);

    String token = store.newToken("*****@*****.**", "domain.com");

    assertThat(token, is(notNullValue()));
    assertThat(token.length(), is(not(0)));
    assertThat(store.getSessions().size(), is(1));

    Session s = store.getSessions().get(0);

    assertThat(s.getId(), is(notNullValue()));
    assertThat(s.getDomain(), is("domain.com"));
    assertThat(s.getToken(), is(token));
    assertThat(s.getUser(), is("*****@*****.**"));
    assertThat(s.getSessionStart(), is(greaterThan(now)));
    assertThat(s.getSessionExpiration(), is(greaterThan(s.getSessionStart())));
  }
Exemplo n.º 24
0
  @Test
  public void sendMessageFromThreadToFiber() throws Exception {
    final Channel<String> ch = newChannel();

    Fiber fib =
        new Fiber(
                "fiber",
                fjPool,
                new SuspendableRunnable() {
                  @Override
                  public void run() throws SuspendExecution, InterruptedException {
                    String m = ch.receive();

                    assertThat(m, equalTo("a message"));
                  }
                })
            .start();

    Thread.sleep(50);
    ch.send("a message");

    fib.join();
  }
Exemplo n.º 25
0
  @Test
  public void whenChannelClosedThenBlockedSendsComplete() throws Exception {
    assumeThat(policy, is(OverflowPolicy.BLOCK));
    final Channel<Integer> ch = newChannel();

    final SuspendableRunnable r =
        new SuspendableRunnable() {
          @Override
          public void run() throws SuspendExecution, InterruptedException {
            for (int i = 1; i <= 100; i++) {
              ch.send(i);
            }
          }
        };
    Fiber fib1 = new Fiber("fiber", fjPool, r).start();
    Fiber fib2 = new Fiber("fiber", fjPool, r).start();

    Thread.sleep(500);

    ch.close();
    fib1.join();
    fib2.join();
  }
Exemplo n.º 26
0
  private void viewEditProfile() throws InterruptedException {

    driver.findElement(By.linkText("My Profile")).click();
    driver.findElement(By.linkText("View Profile")).click();
    // driver.findElement(By.id("photoBlockClose")).click();
    driver.findElement(By.linkText("My Profile")).click();
    driver.findElement(By.linkText("Edit my profile")).click();

    new Select(driver.findElement(By.id("ethnicity"))).selectByVisibleText("Mixed Race");
    new Select(driver.findElement(By.id("height"))).selectByVisibleText("4ft. 10in.");
    Thread.sleep(4000);
    driver.findElement(By.id("submit_basic_information")).click();
    Thread.sleep(4000);

    driver.findElement(By.id("aboutMyself")).click();
    driver.findElement(By.id("aboutMyself")).clear();
    driver
        .findElement(By.id("aboutMyself"))
        .sendKeys("this is 5145502181, email [email protected], web: www.abc.com");
    Thread.sleep(4000);
    driver.findElement(By.id("submit_about_myself")).click();
    Thread.sleep(4000);

    driver.findElement(By.id("lookingFor")).click();
    driver.findElement(By.id("lookingFor")).clear();
    driver
        .findElement(By.id("lookingFor"))
        .sendKeys("my url is www.kala.com, 4389439088, email id is [email protected]");
    Thread.sleep(4000);
    driver.findElement(By.id("submit_who_im_looking_for")).click();
    Thread.sleep(4000);

    driver.findElement(By.linkText("My Profile")).click();
    driver.findElement(By.linkText("View Profile")).click();
    Thread.sleep(3000);

    verifyChanges();
  }
  @Test
  public void testMap2() throws Exception {
    driver.get(baseUrl + "/ModSolarPlatform/login.jsp;jsessionid=F33B6C551CBA0A359E87354993539EFA");
    driver.findElement(By.id("username")).clear();
    driver.findElement(By.id("username")).sendKeys("christianqa");
    driver.findElement(By.id("password")).clear();

    driver.findElement(By.id("password")).sendKeys("qa");
    driver.findElement(By.name("submit")).click();
    driver.findElement(By.cssSelector("div.newLeadList")).click();
    driver.findElement(By.id("tabResidential")).click();
    driver.findElement(By.id("firstNameResidential")).clear();
    driver.findElement(By.id("firstNameResidential")).sendKeys("christian");
    driver.findElement(By.id("lastNameResidential")).clear();
    driver.findElement(By.id("lastNameResidential")).sendKeys("Mabila");
    driver.findElement(By.id("addressResidential")).clear();
    driver.findElement(By.id("addressResidential")).sendKeys("600 Clipper rd");
    driver.findElement(By.id("cityResidential")).clear();
    driver.findElement(By.id("cityResidential")).sendKeys("Belmont");
    new Select(driver.findElement(By.id("stateResidential"))).selectByVisibleText("California");
    // driver.findElement(By.id("zipCodeResidential")).clear();
    // driver.findElement(By.id("zipCodeResidential")).sendKeys("90042");
    driver.findElement(By.cssSelector("#zipCodeResidential")).clear();
    driver.findElement(By.cssSelector("#zipCodeResidential")).sendKeys("90042");
    Thread.sleep(1500);
    driver.findElement(By.id("emailResidential")).clear();
    driver.findElement(By.id("emailResidential")).sendKeys("*****@*****.**");
    driver.findElement(By.id("utilityTaxRateInputAddressResidential")).clear();
    driver.findElement(By.id("utilityTaxRateInputAddressResidential")).sendKeys("1.2");
    driver.findElement(By.id("averageMonthlyBillResidential")).clear();
    driver.findElement(By.id("averageMonthlyBillResidential")).sendKeys("225");
    driver.findElement(By.id("nextBtn")).click();
    Thread.sleep(1000);

    WebElement mainCanvas = driver.findElement(By.xpath(".//*[@id='mapCanvas']/div/div[1]/div[2]"));

    Actions mouseAction = new Actions(driver);

    mouseAction.moveToElement(mainCanvas);

    mouseAction.contextClick(mainCanvas);

    mouseAction.moveByOffset(5, 25);

    mouseAction.sendKeys(Keys.ARROW_DOWN);

    mouseAction.sendKeys(Keys.RETURN);
    // mouseAction.keyDown(Keys.ARROW_DOWN);
    // mouseAction.moveToElement(subMenu);

    mouseAction.click();

    mouseAction.perform();

    WebElement mainCanvas2 =
        driver.findElement(
            By.xpath("html/body/div[1]/div/div[2]/div[5]/div[2]/div[2]/div/div[1]/div[2]"));

    Actions mouseAction2 = new Actions(driver);

    mouseAction2.moveToElement(mainCanvas2);

    mouseAction2.contextClick(mainCanvas2);

    mouseAction2.moveByOffset(70, 50);

    mouseAction2.sendKeys(Keys.ARROW_DOWN);

    mouseAction2.sendKeys(Keys.RETURN);
    // mouseAction.keyDown(Keys.ARROW_DOWN);
    // mouseAction.moveToElement(subMenu);

    mouseAction2.click();

    mouseAction2.perform();

    WebElement mainCanvas3 =
        driver.findElement(
            By.xpath("html/body/div[1]/div/div[2]/div[5]/div[2]/div[2]/div/div[1]/div[2]"));

    Actions mouseAction3 = new Actions(driver);

    mouseAction3.moveToElement(mainCanvas3);

    mouseAction3.contextClick(mainCanvas3);

    mouseAction3.moveToElement(mainCanvas2, 500, 220);

    mouseAction3.sendKeys(Keys.ARROW_DOWN);

    mouseAction3.sendKeys(Keys.RETURN);
    // mouseAction.keyDown(Keys.ARROW_DOWN);
    // mouseAction.moveToElement(subMenu);

    mouseAction3.click();

    mouseAction3.perform();

    // Clicking inside the Triangle

    WebElement e =
        driver.findElement(
            By.xpath("html/body/div[1]/div/div[2]/div[5]/div[2]/div[2]/div/div[1]/div[2]"));

    new Actions(driver).moveToElement(e, 0, 0).moveByOffset(520, 255).click().build().perform();
    driver.findElement(By.cssSelector("div.pgNext.right > input.btn")).click();
    driver.findElement(By.xpath("//div[@id='accordion']")).click();
    driver.findElement(By.id("regionsPaneTitle")).click();

    // Clicking inside the Triangle 1

    WebElement eI =
        driver.findElement(
            By.xpath("html/body/div[1]/div/div[2]/div[5]/div[2]/div[2]/div/div[1]/div[2]"));

    new Actions(driver).moveToElement(eI, 0, 0).moveByOffset(520, 255).click().build().perform();

    Thread.sleep(1000);

    // Clicking inside the Triangle 1

    WebElement eS =
        driver.findElement(
            By.xpath("html/body/div[1]/div/div[2]/div[5]/div[2]/div[2]/div/div[1]/div[2]"));

    new Actions(driver).moveToElement(eS, 0, 0).moveByOffset(520, 255).click().build().perform();
    Thread.sleep(1000);
    driver.findElement(By.id("accordion")).click();
    driver.findElement(By.id("mountTypeRegion1")).click();
    new Select(driver.findElement(By.id("mountTypeRegion1"))).selectByVisibleText("Flat Roof");
    driver.findElement(By.cssSelector("#mountTypeRegion1 > option[value=\"1\"]")).click();
    driver.findElement(By.id("mountTypeRegion1")).click();
    new Select(driver.findElement(By.id("mountTypeRegion1"))).selectByVisibleText("Ground Mount");
    driver.findElement(By.cssSelector("#mountTypeRegion1 > option[value=\"2\"]")).click();
    driver.findElement(By.id("mountTypeRegion1")).click();
    new Select(driver.findElement(By.id("mountTypeRegion1"))).selectByVisibleText("Flat Roof");
    driver.findElement(By.cssSelector("#mountTypeRegion1 > option[value=\"1\"]")).click();
    driver.findElement(By.id("mountTypeRegion1")).click();
    driver.findElement(By.id("mountTypeRegion1")).click();
    new Select(driver.findElement(By.id("mountTypeRegion1"))).selectByVisibleText("Sloped Roof");
    driver.findElement(By.cssSelector("#mountTypeRegion1 > option[value=\"0\"]")).click();
    ////
    // driver.findElement(By.xpath("/html/body/div[3]/div[1]/div/div[2]/div[4]/form/div[2]/div/div[3]/div[1]/div[2]/div/input")).click();
    driver
        .findElement(
            By.xpath(
                "/html/body/div[3]/div[1]/div/div[2]/div[4]/form/div[2]/div/div[3]/div[1]/div[2]/div/input"))
        .clear();
    driver
        .findElement(
            By.xpath(
                "/html/body/div[3]/div[1]/div/div[2]/div[4]/form/div[2]/div/div[3]/div[1]/div[2]/div/input"))
        .sendKeys("52");
    driver
        .findElement(
            By.xpath(
                "/html/body/div[3]/div[1]/div/div[2]/div[4]/form/div[2]/div/div[3]/div[1]/div[2]/div/input"))
        .click();
    driver
        .findElement(
            By.xpath(
                "/html/body/div[3]/div[1]/div/div[2]/div[4]/form/div[2]/div/div[3]/div[1]/div[2]/div/input"))
        .clear();
    driver
        .findElement(
            By.xpath(
                "/html/body/div[3]/div[1]/div/div[2]/div[4]/form/div[2]/div/div[3]/div[1]/div[2]/div/input"))
        .sendKeys("18");
    driver
        .findElement(
            By.xpath(
                "/html/body/div[3]/div[1]/div/div[2]/div[4]/form/div[2]/div/div[3]/div[1]/div[2]/div/input"))
        .click();
    driver
        .findElement(
            By.xpath(
                "/html/body/div[3]/div[1]/div/div[2]/div[4]/form/div[2]/div/div[3]/div[1]/div[2]/div/input"))
        .clear();
    driver
        .findElement(
            By.xpath(
                "/html/body/div[3]/div[1]/div/div[2]/div[4]/form/div[2]/div/div[3]/div[1]/div[2]/div/input"))
        .sendKeys("45");
    driver.findElement(By.id("mountTypeRegion1")).click();
    new Select(driver.findElement(By.id("mountTypeRegion1"))).selectByVisibleText("Flat Roof");
    driver.findElement(By.cssSelector("#mountTypeRegion1 > option[value=\"1\"]")).click();
    driver.findElement(By.id("mountTypeRegion1")).click();
    new Select(driver.findElement(By.id("mountTypeRegion1"))).selectByVisibleText("Sloped Roof");
    driver.findElement(By.cssSelector("#mountTypeRegion1 > option[value=\"0\"]")).click();
    driver.findElement(By.id("mountTypeRegion1")).click();

    new Select(driver.findElement(By.id("mountTypeRegion1"))).selectByVisibleText("Flat Roof");
    driver.findElement(By.cssSelector("#mountTypeRegion1 > option[value=\"1\"]")).click();
    driver.findElement(By.id("mountTypeRegion1")).click();
    new Select(driver.findElement(By.id("mountTypeRegion1"))).selectByVisibleText("Ground Mount");
    driver.findElement(By.cssSelector("#mountTypeRegion1 > option[value=\"2\"]")).click();
    driver.findElement(By.cssSelector("label.overTxtLabel")).click();
    driver.findElement(By.id("proposalName")).sendKeys("AUTOMATION TEST");
    driver.findElement(By.id("regionsPaneTitle")).click();
    driver.findElement(By.id("regionsPaneTitle")).click();
    Thread.sleep(500);
    /// driver.findElement(By.id("squareUpButton2")).click();
    driver.findElement(By.xpath("//input[@id='snapAzimuthButton1']")).click();
    driver.findElement(By.xpath("//input[@id='applySetbacksButton1']")).click();
    /// assertEquals("Setbacks cannot be less than zero.", closeAlertAndGetItsText());
    //// driver.findElement(By.id("delPolygonButton2")).click();
    Thread.sleep(1000);
    /// driver.findElement(By.id("squareUpButton3")).click();
    /// driver.findElement(By.id("squareUpButton3")).click();
    driver.findElement(By.id("accordion")).click();
    driver.findElement(By.cssSelector("div[title=\"Pan up\"]")).click();
    driver.findElement(By.cssSelector("div[title=\"Pan right\"]")).click();
    driver.findElement(By.cssSelector("div[title=\"Pan down\"]")).click();
    driver.findElement(By.cssSelector("div[title=\"Pan left\"]")).click();
    driver.findElement(By.cssSelector("div[title=\"Zoom out\"] > img")).click();
    driver.findElement(By.cssSelector("div[title=\"Zoom in\"] > img")).click();
    driver.findElement(By.id("accordion")).click();
    /////
    /////
    ////
    /// no need driver.findElement(By.xpath("//div[@id='solutionCategory']/ul/li[2]/h3")).click();
    /// no need driver.findElement(By.cssSelector("span.arrow")).click();
    driver.findElement(By.xpath("//input[@value='Next']")).click();
    driver.findElement(By.id("accordion")).click();
    driver.findElement(By.id("accordionTitleText")).click();
    driver.findElement(By.id("accordion")).click();
    driver.findElement(By.id("nextButton")).click();
    driver.findElement(By.id("accordion")).click();
    driver.findElement(By.id("contentUsagePaneTitle")).click();
    driver.findElement(By.id("accordion")).click();
    Thread.sleep(1000);
    // click on Inverters
    driver.findElement(By.xpath("//h3[text()= 'Inverters']")).click();

    // Click on Arrow

    driver.findElement(By.xpath("//span[@class = 'arrow']")).click();

    Thread.sleep(1000);
    // Default Invert select
    driver.findElement(By.xpath("html/body/ul/li[2]/span")).click();

    // Click on Arrow
    driver.findElement(By.xpath("//span[@class = 'arrow']")).click();

    Thread.sleep(2000);

    // Click on Next button
    driver.findElement(By.xpath("//input[@value='Next']")).click();
    Thread.sleep(2000);
    ////// errror--- driver.findElement(By.id("supplyLeadDetailsBtn1")).click();
    driver.findElement(By.id("accordion")).click();
    ///// driver.findElement(By.id("accordion")).click();
    ////// driver.findElement(By.id("accordion")).click();
    Thread.sleep(1500);

    ///// driver.findElement(By.id("backBtn")).click();
    //// driver.findElement(By.cssSelector("label > input[type=\"button\"]")).click();
    // Click on Next button

    driver.findElement(By.xpath("//input[@id='nextButton']")).click();

    /// PREVIEW PAGE STARTS HERE
    Thread.sleep(2000);

    driver.findElement(By.id("accordion")).click();
    Thread.sleep(250);
    driver.findElement(By.cssSelector("#buyForCashCheckbox")).click();
    Thread.sleep(250);
    driver.findElement(By.cssSelector("#nextButton")).click();
    Thread.sleep(1000);

    // ERROR: Caught exception [unknown command []]
  }
Exemplo n.º 28
0
  @Test
  public void testVip7day() throws Exception {

    driver
        .manage()
        .timeouts()
        .implicitlyWait(30, TimeUnit.SECONDS); // неявное ожидание при каждом поиске элементов
    driver.get("http://mylove.ru");

    driver.findElement(By.id("mprofile_link")).click();
    driver.findElement(By.cssSelector("#isvip")).click();

    if (isElementPresent(By.xpath("//*[@id='settings']"))) {
      driver.findElement(By.xpath("//*[@id='settings']//a[contains(@class,'techbutton')]")).click();
    }
    Pattern pat = Pattern.compile("[-]?[0-9]+(.[0-9]+)?");
    // String Str1= driver.findElement(By.cssSelector("div.vipend > i")).getText();
    String Str1 =
        driver
            .findElement(
                By.cssSelector("#body > div.window.pay_window > div > div.paymay > div.vipend > i"))
            .getText();

    Matcher matcher1 = pat.matcher(Str1);
    while (matcher1.find()) Str1 = matcher1.group(); // что-то происходит

    Str1 = Str1.replaceAll(" ", "");
    Integer i1 = Integer.valueOf(Str1);
    // driver.findElement(By.xpath("//*[@id=\"vip_settings\"]/div[2]/a[1]")).click(); тоже верно

    driver.findElement(By.cssSelector("#vip_settings  div.pcols > a")).click();

    Thread.sleep(
        1000); /// без ожидания не успевает измениться выбранное значение дней, потом заменить на
               // явное ожидание с условием
    driver
        .findElement(By.cssSelector("div.pay_variant.pay_bill.pay_variant_cash > a"))
        .click(); // Платим со счета

    WebDriverWait wait = new WebDriverWait(driver, 20);
    wait.until(
        ExpectedConditions.stalenessOf(
            driver.findElement(
                By.cssSelector(
                    "#isvip")))); // подождем когда какой то DOM исчезнет(( чтобы посмотреть сколько
                                  // теперь дней до окончания випа, долго работает

    driver.findElement(By.cssSelector("#isvip")).click();
    driver.findElement(By.xpath("//*[@id='settings']//a[contains(@class,'techbutton')]")).click();
    String Str2 = driver.findElement(By.cssSelector("div.vipend > i")).getText();

    Matcher matcher2 = pat.matcher(Str2);

    while (matcher2.find()) Str2 = matcher2.group();
    Str2 = Str2.replaceAll(" ", ""); // если дней больше 1000 то строка с пробелами
    Integer i2 = Integer.valueOf(Str2);
    i1 = i1 + 7;

    // Проверим что количество дней випа увеличилось на 7
    assertEquals(i2, i1);
  };
Exemplo n.º 29
0
  // Test Case 8: Validating the view and edit profile - Changing fields in mini-profile to see the
  // changes displayed
  private void profileEditViewSetUp() throws InterruptedException {
    profilePage1();
    String emailShuffled = shuffleEmail(email);
    driver.findElement(By.id("nickName")).click();
    driver.findElement(By.id("nickName")).clear();
    driver.findElement(By.id("nickName")).sendKeys("Neel");

    new Select(driver.findElement(By.id("DOBMonth"))).selectByVisibleText("January");
    driver.findElement(By.cssSelector("option[value=\"01\"]")).click();
    new Select(driver.findElement(By.id("DOBDay"))).selectByVisibleText("04");
    driver.findElement(By.cssSelector("#DOBDay > option[value=\"02\"]")).click();
    new Select(driver.findElement(By.id("DOBYear"))).selectByVisibleText("1994");
    driver.findElement(By.cssSelector("option[value=\"1994\"]")).click();

    driver.findElement(By.id("email")).click();
    driver.findElement(By.id("email")).clear();
    driver.findElement(By.id("email")).sendKeys(emailShuffled + "@def.com");

    driver.findElement(By.id("emailConfirmation")).click();
    driver.findElement(By.id("emailConfirmation")).clear();
    driver.findElement(By.id("emailConfirmation")).sendKeys(emailShuffled + "@def.com");

    driver.findElement(By.id("password")).click();
    driver.findElement(By.id("password")).clear();
    driver.findElement(By.id("password")).sendKeys("target");

    Thread.sleep(3000);

    driver.findElement(By.cssSelector("input.submitButton.green")).click();

    driver.findElement(By.id("headline")).click();
    driver.findElement(By.id("headline")).clear();
    driver.findElement(By.id("headline")).sendKeys("I am fine!!!");

    driver.findElement(By.id("country")).click();
    new Select(driver.findElement(By.id("country"))).selectByVisibleText("Canada");
    driver.findElement(By.cssSelector("option[value=\"39\"]")).click();

    driver.findElement(By.id("postalCode")).click();
    driver.findElement(By.id("postalCode")).clear();
    driver.findElement(By.id("postalCode")).sendKeys("H3S1H4");

    new Select(driver.findElement(By.id("education"))).selectByVisibleText("Graduate degree");
    driver.findElement(By.cssSelector("#education > option[value=\"7\"]")).click();

    new Select(driver.findElement(By.id("occupation"))).selectByVisibleText("Artist");
    driver.findElement(By.cssSelector("#occupation > option[value=\"15\"]")).click();

    new Select(driver.findElement(By.id("relationship"))).selectByVisibleText("Single");
    driver.findElement(By.cssSelector("#relationship > option[value=\"3\"]")).click();

    // driver.findElement(By.id("income")).click();
    new Select(driver.findElement(By.id("income"))).selectByVisibleText("$25,000-$50,000");
    driver.findElement(By.cssSelector("#income > option[value=\"4\"]")).click();

    // driver.findElement(By.id("religion")).click();
    new Select(driver.findElement(By.id("religion"))).selectByVisibleText("Other");
    driver.findElement(By.cssSelector("#religion > option[value=\"3\"]")).click();

    // driver.findElement(By.id("fbCloseButton")).click();
    new Select(driver.findElement(By.id("height"))).selectByVisibleText("5ft. 6in.");
    driver.findElement(By.cssSelector("#height > option[value=\"166\"]")).click();

    // driver.findElement(By.id("ethnicity")).click();
    new Select(driver.findElement(By.id("ethnicity"))).selectByVisibleText("Asian");
    driver.findElement(By.cssSelector("#ethnicity > option[value=\"5\"]")).click();

    // driver.findElement(By.id("bodyType")).click();
    new Select(driver.findElement(By.id("bodyType"))).selectByVisibleText("Average");
    driver.findElement(By.cssSelector("#bodyType > option[value=\"5\"]")).click();

    // driver.findElement(By.id("eyeColor")).click();
    new Select(driver.findElement(By.id("eyeColor"))).selectByVisibleText("Black");
    driver.findElement(By.cssSelector("#eyeColor > option[value=\"8\"]")).click();

    // driver.findElement(By.id("hairColor")).click();
    new Select(driver.findElement(By.id("hairColor"))).selectByVisibleText("Black");
    driver.findElement(By.cssSelector("#hairColor > option[value=\"7\"]")).click();

    // driver.findElement(By.id("smoking")).click();
    new Select(driver.findElement(By.id("smoking"))).selectByVisibleText("Often");
    driver.findElement(By.cssSelector("#smoking > option[value=\"5\"]")).click();

    // driver.findElement(By.id("alcohol")).click();
    new Select(driver.findElement(By.id("alcohol"))).selectByVisibleText("Occasionally");
    driver.findElement(By.cssSelector("#alcohol > option[value=\"4\"]")).click();

    driver.findElement(By.cssSelector("input.submitButton.green")).click();
    Thread.sleep(3000);
    driver.findElement(By.linkText("I promise to upload a photo later")).click();
    Thread.sleep(3000);
    driver.findElement(By.linkText("close")).click();
    viewEditProfile();
  }