/portal-web/test/com/liferay/portalweb/portlet/helloworld/portlet/addportlethwduplicate/AddPortletHWDuplicateTest.java
https://github.com/azzazzel/liferay-portal · Java · 91 lines · 60 code · 15 blank · 16 comment · 9 complexity · e1fa6a665c80a2a3a806903845f5a0d2 MD5 · raw file
- /**
- * Copyright (c) 2000-2012 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.helloworld.portlet.addportlethwduplicate;
- import com.liferay.portalweb.portal.BaseTestCase;
- import com.liferay.portalweb.portal.util.RuntimeVariables;
- /**
- * @author Brian Wing Shun Chan
- */
- public class AddPortletHWDuplicateTest extends BaseTestCase {
- public void testAddPortletHWDuplicate() throws Exception {
- selenium.open("/web/guest/home/");
- loadRequiredJavaScriptModules();
- for (int second = 0;; second++) {
- if (second >= 90) {
- fail("timeout");
- }
- try {
- if (selenium.isVisible("link=Hello World Test Page")) {
- break;
- }
- }
- catch (Exception e) {
- }
- Thread.sleep(1000);
- }
- selenium.clickAt("link=Hello World Test Page",
- RuntimeVariables.replace("Hello World Test Page"));
- selenium.waitForPageToLoad("30000");
- loadRequiredJavaScriptModules();
- assertEquals(RuntimeVariables.replace("More\u2026"),
- selenium.getText("//a[@id='_145_addApplication']"));
- selenium.clickAt("//a[@id='_145_addApplication']",
- RuntimeVariables.replace("More\u2026"));
- for (int second = 0;; second++) {
- if (second >= 90) {
- fail("timeout");
- }
- try {
- if (selenium.isVisible(
- "//input[@id='layout_configuration_content']")) {
- break;
- }
- }
- catch (Exception e) {
- }
- Thread.sleep(1000);
- }
- selenium.typeKeys("//input[@id='layout_configuration_content']",
- RuntimeVariables.replace("h"));
- for (int second = 0;; second++) {
- if (second >= 90) {
- fail("timeout");
- }
- try {
- if (selenium.isVisible("//div[@title='Hello World']")) {
- break;
- }
- }
- catch (Exception e) {
- }
- Thread.sleep(1000);
- }
- assertFalse(selenium.isVisible("//div[@title='Hello World']/p/a"));
- }
- }