예제 #1
0
  /** CaseId: 68859 Change container when edit layout for user's page */
  @Test
  public void test04_ChangeContainerWhenEditLayoutUserPage() {
    String pageName = "gateinsniff04";
    String title = "Row1";

    navTool.goToDashboard();
    pageE.createNewPageEmptyLayout(pageName);
    navTool.goToEditPageEditor();

    info("Add container");
    pageE.addNewContainer("Rows Layout", "oneRow");
    waitForAndGetElement(ELEMENT_DROP_TARGET_HAS_LAYOUT);
    click(ELEMENT_SWITCH_VIEW_MODE);
    waitForAndGetElement(ELEMENT_DROP_TARGET_HAS_LAYOUT);
    click(ELEMENT_SWITCH_VIEW_MODE);

    info("Edit container");
    mouseOver(ELEMENT_DROP_TARGET_HAS_LAYOUT, true);
    click(ELEMENT_EDIT_CONTAINER_ICON);
    type(ELEMENT_CONTAINER_TITLE, title, true);
    but.save();
    mouseOver(ELEMENT_DROP_TARGET_HAS_LAYOUT, true);
    waitForAndGetElement("//*[@class='UIRowContainer']//span[text()='" + title + "']");

    info("Delete container");
    pageE.removeContainer(ELEMENT_DROP_TARGET_HAS_LAYOUT, ELEMENT_DELETE_CONTAINER_ICON);
    waitForElementNotPresent(ELEMENT_DROP_TARGET_HAS_LAYOUT);
    click(ELEMENT_PAGE_FINISH_BUTTON);
    waitForElementNotPresent(ELEMENT_PAGE_FINISH_BUTTON, 60000);

    deleteTabOnDashboard(pageName);
  }
  /**
   * CaseId: 70593 + 70594 + 70592 + 70595 Add container when edit layout for portal's page edit
   * container when edit layout for portal's page move container when edit layout for portal's page
   * delete container when edit layout for portal's page
   */
  @Test
  public void test07_MoveContainerWhenEditLayout_PortalPage() {
    String pageName = "Sniffportalnavigation07";
    String title = "Container1";
    String newContainerPos = "//*[@class='UIRowContainer']/div[2]";

    pageE.createNewPageEmptyLayout(pageName);
    navTool.goToEditPageEditor();

    info("Add container");
    pageE.addNewContainer("Rows Layout", "oneRow");
    waitForAndGetElement(ELEMENT_DROP_TARGET_HAS_LAYOUT);

    info("Edit title of container");
    mouseOver(ELEMENT_DROP_TARGET_HAS_LAYOUT, true);
    click(ELEMENT_EDIT_CONTAINER_ICON);
    type(ELEMENT_CONTAINER_TITLE, title, true);
    type(ELEMENT_WIDTH_TEXTBOX, "150px", true);
    type(ELEMENT_HEIGHT_TEXTBOX, "150px", true);
    but.save();
    mouseOver(ELEMENT_DROP_TARGET_HAS_LAYOUT, true);
    if (this.plfVersion.contains("4.0"))
      waitForAndGetElement(ELEMENT_NAME_CONTAINER.replace("${nameContainer}", title));
    else waitForAndGetElement(ELEMENT_NAME_CONTAINER_PLF41.replace("${nameContainer}", title));
    WebElement element = waitForAndGetElement(ELEMENT_EDITING_CONTAINER);
    String valueStyle = element.getAttribute("style");
    assert valueStyle.equals("width: 150px; height: 150px;")
        : "Failed to edit the value of container: " + title;

    info("Move container");
    pageE.addNewContainer("Rows Layout", "oneRow");
    waitForAndGetElement(
        ELEMENT_LIST_CONTAINER.replace("${number}", "1").replace("${nameContainer}", "Container"),
        DEFAULT_TIMEOUT,
        1,
        2);
    waitForAndGetElement(
        ELEMENT_LIST_CONTAINER.replace("${number}", "2").replace("${nameContainer}", title),
        DEFAULT_TIMEOUT,
        1,
        2);
    mouseOver(ELEMENT_NAME_CURRENT_CONTAINER.replace("${nameContainer}", "Container"), true);
    if (this.plfVersion.contains("4.0"))
      dragAndDropToObject(
          ELEMENT_DRAG_CURRENT_CONTAINER.replace("${nameContainer}", "Container"),
          ELEMENT_PORTLET_LAYOUT_DECORATOR);
    else
      dragAndDropToObject(
          ELEMENT_DRAG_CURRENT_CONTAINER_PLF41.replace("${nameContainer}", "Container"),
          newContainerPos);
    waitForAndGetElement(
        ELEMENT_LIST_CONTAINER.replace("${number}", "1").replace("${nameContainer}", title),
        DEFAULT_TIMEOUT,
        1,
        2);
    waitForAndGetElement(
        ELEMENT_LIST_CONTAINER.replace("${number}", "1").replace("${nameContainer}", "Container"),
        DEFAULT_TIMEOUT,
        1,
        2);
    click(ELEMENT_ABORTEDIT_BUTTON);
    click(pageE.ELEMENT_CONFIRM_YES_BUTTON);
    waitForElementNotPresent(pageE.ELEMENT_VIEW_PAGE_PROPERTIES);

    info("Delete container");
    navTool.goToEditPageEditor();
    pageE.addNewContainer("Rows Layout", "oneRow");
    pageE.removeContainer(
        ELEMENT_NAME_CURRENT_CONTAINER.replace("${nameContainer}", "Container"),
        ELEMENT_DELETE_CONTAINER_ICON);
    pageE.finishEditLayout();
    waitForElementNotPresent(pageE.ELEMENT_VIEW_PAGE_PROPERTIES);

    info("Delete page");
    pageMag.deletePageAtManagePageAndPortalNavigation(pageName, true, "intranet", false, null);
  }