@Test(
      description = "Create Simple Html signature through GUI",
      groups = {"sanity"})
  public void CreateBasicHtmlSignature() throws HarnessException {

    String sigName = "signame" + ZimbraSeleniumProperties.getUniqueString();
    String sigBody = "sigbody" + ZimbraSeleniumProperties.getUniqueString();

    // click on signature from left pane
    app.zTreePreferences.zTreeItem(Action.A_LEFTCLICK, TreeItem.MailSignatures);

    // Click on New signature button
    FormSignatureNew signew =
        (FormSignatureNew) app.zPageSignature.zToolbarPressButton(Button.B_NEW);

    // select html format from drop down
    signew.zSelectFormat("html");
    // Reason:With "?dev=1&debug=0", Tinymce editor in HTML mode takes more time to load
    // commented out incompatible to webdriver reference
    // if(ClientSessionFactory.session().selenium().getEval("window.tinyMCE").equalsIgnoreCase("null")){
    SleepUtil.sleepVeryLong();
    // }
    // Fill Signature Name and body
    signew.zFillField(Field.SignatureName, sigName);
    signew.zFillField(Field.SignatureHtmlBody, sigBody);
    signew.zSubmit();

    SignatureItem signature = SignatureItem.importFromSOAP(app.zGetActiveAccount(), sigName);

    // Verify signature name and body contents
    ZAssert.assertEquals(signature.getName(), sigName, "Verify signature Name");
    ZAssert.assertStringContains(signature.dBodyHtmlText, sigBody, "Verify Html signature body");
    // ZAssert.assertEquals(signature.dBodyHtmlText,sigBody,"Verify Html signature body");

  }
Ejemplo n.º 2
0
  /**
   * Test case :Delete Text signature using Delete button and verify toast msg throguh GUI @Steps:
   * Create signature through soap Delete signature using delete button. Verify signature toast msg
   *
   * @throws HarnessException
   */
  @Test(
      description = " Delete Text signature using Delete button and verify toast msg throguh GUI ",
      groups = {"smoke"})
  public void DeleteSignaturesToastMsg() throws HarnessException {

    // Click on Mail/signature
    app.zTreePreferences.zTreeItem(Action.A_LEFTCLICK, TreeItem.MailSignatures);

    // Signature is created
    SignatureItem signature = SignatureItem.importFromSOAP(app.zGetActiveAccount(), this.sigName);
    ZAssert.assertEquals(signature.getName(), this.sigName, "verified Text Signature is created");

    FormSignatureNew signew = new FormSignatureNew(app);

    // Select signature which is to be Delete
    signew.zClick(Locators.zSignatureListView);
    signew.zClick("//td[contains(text(),'" + signature.getName() + "')]");

    // click Delete button
    app.zPageSignature.zToolbarPressButton(Button.B_DELETE);
    // click Save
    signew.zSubmit();

    // Verifying the toaster message
    Toaster toast = app.zPageMain.zGetToaster();
    String toastMsg = toast.zGetToastMessage();
    ZAssert.assertStringContains(
        toastMsg, "Preferences Saved", "Verify toast message: Preferences Saved");
  }
  @Test(
      description = "Create Simple text signature through GUI",
      groups = {"sanity"})
  public void CreateBasicTextSignature() throws HarnessException {

    String sigName = "signame" + ZimbraSeleniumProperties.getUniqueString();
    String sigBody = "sigbody" + ZimbraSeleniumProperties.getUniqueString();

    // click on signature from left pane
    app.zTreePreferences.zTreeItem(Action.A_LEFTCLICK, TreeItem.MailSignatures);

    // Click on New signature button
    FormSignatureNew signew =
        (FormSignatureNew) app.zPageSignature.zToolbarPressButton(Button.B_NEW);

    // Fill Signature Name and body
    signew.zFillField(Field.SignatureName, sigName);
    signew.zFillField(Field.SignatureBody, sigBody);
    signew.zSubmit();

    SignatureItem signature = SignatureItem.importFromSOAP(app.zGetActiveAccount(), sigName);

    // Verify signature name and body content
    ZAssert.assertEquals(signature.getName(), sigName, "Verify signature Name");
    ZAssert.assertEquals(signature.dBodyText, sigBody, "Verify Text signature body");
  }
Ejemplo n.º 4
0
  public static SignatureItem importFromSOAP(Element sig) throws HarnessException {

    if (sig == null) throw new HarnessException("Element cannot be null");

    SignatureItem item = null;

    try {

      // Make sure we only have the <tag/> part
      Element t = ZimbraAccount.SoapClient.selectNode(sig, "//acct:signature");
      if (t == null) throw new HarnessException("Element does not contain an <tag/> element");

      // Create the object
      item = new SignatureItem();

      // Set the ID
      item.setId(t.getAttribute("id", null));
      // Set tag name
      item.setName(t.getAttribute("name", null));

      Element contentBodyHtml =
          ZimbraAccount.SoapClient.selectNode(sig, "//acct:content[@type='text/html']");
      Element contentBodyText =
          ZimbraAccount.SoapClient.selectNode(sig, "//acct:content[@type='text/plain']");
      if (contentBodyHtml != null) {
        item.dBodyHtmlText = contentBodyHtml.getText().trim();
      } else if (contentBodyText != null) {
        item.dBodyText = contentBodyText.getText().trim();
      }

      return (item);

    } catch (Exception e) {
      throw new HarnessException("Could not parse GetMsgResponse: " + sig.prettyPrint(), e);
    } finally {
      if (item != null) logger.info(item.prettyPrint());
    }
  }