001: /**
002: * Copyright (c) 2000-2008 Liferay, Inc. All rights reserved.
003: *
004: * Permission is hereby granted, free of charge, to any person obtaining a copy
005: * of this software and associated documentation files (the "Software"), to deal
006: * in the Software without restriction, including without limitation the rights
007: * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
008: * copies of the Software, and to permit persons to whom the Software is
009: * furnished to do so, subject to the following conditions:
010: *
011: * The above copyright notice and this permission notice shall be included in
012: * all copies or substantial portions of the Software.
013: *
014: * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
015: * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
016: * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
017: * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
018: * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
019: * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
020: * SOFTWARE.
021: */package com.liferay.portalweb.portlet.blogs;
022:
023: import com.liferay.portalweb.portal.BaseTestCase;
024:
025: /**
026: * <a href="AddEntryTest.java.html"><b><i>View Source</i></b></a>
027: *
028: * @author Brian Wing Shun Chan
029: *
030: */
031: public class AddEntryTest extends BaseTestCase {
032: public void testAddEntry() throws Exception {
033: selenium.click("//input[@value='Add Blog Entry']");
034:
035: for (int second = 0;; second++) {
036: if (second >= 60) {
037: fail("timeout");
038: }
039:
040: try {
041: if (selenium.isElementPresent("_33_title")) {
042: break;
043: }
044: } catch (Exception e) {
045: }
046:
047: Thread.sleep(1000);
048: }
049:
050: selenium.typeKeys("_33_title", "Test Entry");
051:
052: for (int second = 0;; second++) {
053: if (second >= 60) {
054: fail("timeout");
055: }
056:
057: try {
058: if (selenium.isElementPresent("_33_editor")) {
059: break;
060: }
061: } catch (Exception e) {
062: }
063:
064: Thread.sleep(1000);
065: }
066:
067: for (int second = 0;; second++) {
068: if (second >= 60) {
069: fail("timeout");
070: }
071:
072: try {
073: if (selenium.isElementPresent("FCKeditor1___Frame")) {
074: break;
075: }
076: } catch (Exception e) {
077: }
078:
079: Thread.sleep(1000);
080: }
081:
082: for (int second = 0;; second++) {
083: if (second >= 60) {
084: fail("timeout");
085: }
086:
087: try {
088: if (selenium.isElementPresent("//textarea")) {
089: break;
090: }
091: } catch (Exception e) {
092: }
093:
094: Thread.sleep(1000);
095: }
096:
097: selenium.selectFrame("//iframe[@id=\"_33_editor\"]");
098: selenium.selectFrame("//iframe[@id=\"FCKeditor1___Frame\"]");
099: selenium.selectFrame("//iframe");
100: selenium.typeKeys("//body", "This is a test entry!");
101: selenium.selectFrame("relative=top");
102: selenium.click("//input[@value='Save']");
103: selenium.waitForPageToLoad("30000");
104:
105: for (int second = 0;; second++) {
106: if (second >= 60) {
107: fail("timeout");
108: }
109:
110: try {
111: if (selenium.isElementPresent("link=0 Comments")) {
112: break;
113: }
114: } catch (Exception e) {
115: }
116:
117: Thread.sleep(1000);
118: }
119: }
120: }
|