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.documentlibrary;
022:
023: import com.liferay.portalweb.portal.BaseTestCase;
024:
025: /**
026: * <a href="AddDocumentTest.java.html"><b><i>View Source</i></b></a>
027: *
028: * @author Brian Wing Shun Chan
029: *
030: */
031: public class AddDocumentTest extends BaseTestCase {
032: public void testAddDocument() throws Exception {
033: selenium.click("link=Test Subfolder");
034: selenium.waitForPageToLoad("30000");
035: selenium.click("//input[@value='Add Document']");
036: selenium.waitForPageToLoad("30000");
037: selenium.click("link=Use the classic uploader.");
038: Thread.sleep(3000);
039:
040: for (int second = 0;; second++) {
041: if (second >= 60) {
042: fail("timeout");
043: }
044:
045: try {
046: if (selenium.isElementPresent("_20_file")) {
047: break;
048: }
049: } catch (Exception e) {
050: }
051:
052: Thread.sleep(1000);
053: }
054:
055: for (int second = 0;; second++) {
056: if (second >= 60) {
057: fail("timeout");
058: }
059:
060: try {
061: if (selenium.isElementPresent("_20_title")) {
062: break;
063: }
064: } catch (Exception e) {
065: }
066:
067: Thread.sleep(1000);
068: }
069:
070: for (int second = 0;; second++) {
071: if (second >= 60) {
072: fail("timeout");
073: }
074:
075: try {
076: if (selenium.isElementPresent("_20_description")) {
077: break;
078: }
079: } catch (Exception e) {
080: }
081:
082: Thread.sleep(1000);
083: }
084:
085: selenium
086: .type(
087: "_20_file",
088: "L:\\portal\\build\\portal-web\\test\\com\\liferay\\portalweb\\portlet\\documentlibrary\\test_document.txt");
089: selenium.type("_20_title", "Test Document");
090: selenium.type("_20_description", "This is a test document!");
091: selenium.click("//input[@value='Save']");
092: selenium.waitForPageToLoad("30000");
093:
094: for (int second = 0;; second++) {
095: if (second >= 60) {
096: fail("timeout");
097: }
098:
099: try {
100: if (selenium
101: .isElementPresent("link=Test Document.txt\nThis is a test document!")) {
102: break;
103: }
104: } catch (Exception e) {
105: }
106:
107: Thread.sleep(1000);
108: }
109: }
110: }
|