/portal-web/test/com/liferay/portalweb/portlet/webcontentdisplay/webcontent/localizewcwebcontenttemplatewcd/AddStructureLocalizedTest.java
Java | 118 lines | 87 code | 15 blank | 16 comment | 9 complexity | 1f1468a375082a67afa2c043958175fd MD5 | raw file
- /**
- * Copyright (c) 2000-2011 Liferay, Inc. All rights reserved.
- *
- * This library is free software; you can redistribute it and/or modify it under
- * the terms of the GNU Lesser General Public License as published by the Free
- * Software Foundation; either version 2.1 of the License, or (at your option)
- * any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
- * details.
- */
- package com.liferay.portalweb.portlet.webcontentdisplay.webcontent.localizewcwebcontenttemplatewcd;
- import com.liferay.portalweb.portal.BaseTestCase;
- import com.liferay.portalweb.portal.util.RuntimeVariables;
- /**
- * @author Brian Wing Shun Chan
- */
- public class AddStructureLocalizedTest extends BaseTestCase {
- public void testAddStructureLocalized() throws Exception {
- selenium.open("/web/guest/home/");
- for (int second = 0;; second++) {
- if (second >= 90) {
- fail("timeout");
- }
- try {
- if (selenium.isElementPresent("link=Control Panel")) {
- break;
- }
- }
- catch (Exception e) {
- }
- Thread.sleep(1000);
- }
- selenium.clickAt("link=Control Panel",
- RuntimeVariables.replace("Control Panel"));
- selenium.waitForPageToLoad("30000");
- selenium.clickAt("link=Web Content",
- RuntimeVariables.replace("Web Content"));
- selenium.waitForPageToLoad("30000");
- selenium.clickAt("link=Structures",
- RuntimeVariables.replace("Structures"));
- selenium.waitForPageToLoad("30000");
- selenium.clickAt("//input[@value='Add Structure']",
- RuntimeVariables.replace("Add Structure"));
- selenium.waitForPageToLoad("30000");
- selenium.type("//input[@id='_15_name_en_US']",
- RuntimeVariables.replace("Web Content Localized Structure Name"));
- selenium.type("//textarea[@id='_15_description_en_US']",
- RuntimeVariables.replace(
- "Web Content Localized Structure Description"));
- selenium.clickAt("//input[@id='_15_editorButton']",
- RuntimeVariables.replace("Launch Editor"));
- for (int second = 0;; second++) {
- if (second >= 90) {
- fail("timeout");
- }
- try {
- if (selenium.isVisible("//textarea[@id='_15_xsdContent']")) {
- break;
- }
- }
- catch (Exception e) {
- }
- Thread.sleep(1000);
- }
- Thread.sleep(5000);
- selenium.type("//textarea[@id='_15_xsdContent']",
- RuntimeVariables.replace(
- "<root>\n\n<dynamic-element name='page-name' type='text'></dynamic-element> \n\n<dynamic-element name='page-description' type='text'></dynamic-element>\n\n</root>"));
- selenium.click("//input[@value='Update']");
- for (int second = 0;; second++) {
- if (second >= 90) {
- fail("timeout");
- }
- try {
- if (selenium.isVisible("//input[@id='_15_structure_el0_name']")) {
- break;
- }
- }
- catch (Exception e) {
- }
- Thread.sleep(1000);
- }
- assertEquals("page-name",
- selenium.getValue("//input[@id='_15_structure_el0_name']"));
- assertEquals("page-description",
- selenium.getValue("//input[@id='_15_structure_el1_name']"));
- selenium.clickAt("//input[@value='Save']",
- RuntimeVariables.replace("Save"));
- selenium.waitForPageToLoad("30000");
- assertEquals(RuntimeVariables.replace(
- "Your request completed successfully."),
- selenium.getText("//div[@class='portlet-msg-success']"));
- assertEquals(RuntimeVariables.replace(
- "Web Content Localized Structure Name"),
- selenium.getText("//td[3]/a"));
- assertEquals(RuntimeVariables.replace(
- "Web Content Localized Structure Description"),
- selenium.getText("//td[4]/a"));
- }
- }