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.announcements;
022:
023: import com.liferay.portalweb.portal.BaseTestCase;
024:
025: /**
026: * <a href="AddChineseAnnouncementsTest.java.html"><b><i>View Source</i></b></a>
027: *
028: * @author Brian Wing Shun Chan
029: *
030: */
031: public class AddChineseAnnouncementsTest extends BaseTestCase {
032: public void testAddChineseAnnouncements() throws Exception {
033: selenium.click("//img[@title='\u914d\u7f6e']");
034: selenium.waitForPageToLoad("30000");
035:
036: for (int second = 0;; second++) {
037: if (second >= 60) {
038: fail("timeout");
039: }
040:
041: try {
042: if (selenium.isElementPresent("_86_languageId")) {
043: break;
044: }
045: } catch (Exception e) {
046: }
047:
048: Thread.sleep(1000);
049: }
050:
051: Thread.sleep(3000);
052: selenium.select("_86_languageId",
053: "label=\u65e5\u672c\u8a9e (\u65e5\u672c)");
054: selenium.type("_86_content",
055: "This is a test announcement in \u6c49\u8bed !");
056:
057: for (int second = 0;; second++) {
058: if (second >= 60) {
059: fail("timeout");
060: }
061:
062: try {
063: if (selenium
064: .isElementPresent("//input[@value='\u5132\u5b58']")) {
065: break;
066: }
067: } catch (Exception e) {
068: }
069:
070: Thread.sleep(1000);
071: }
072:
073: Thread.sleep(3000);
074: selenium.click("//input[@value='\u5132\u5b58']");
075: selenium.waitForPageToLoad("30000");
076: selenium.click("link=\u6211\u7684\u5e33\u6236");
077: selenium.waitForPageToLoad("30000");
078: Thread.sleep(3000);
079: selenium.select("_2_languageId",
080: "label=\u65e5\u672c\u8a9e (\u65e5\u672c)");
081:
082: for (int second = 0;; second++) {
083: if (second >= 60) {
084: fail("timeout");
085: }
086:
087: try {
088: if (selenium
089: .isElementPresent("//input[@value='\u5132\u5b58']")) {
090: break;
091: }
092: } catch (Exception e) {
093: }
094:
095: Thread.sleep(1000);
096: }
097:
098: selenium.click("//input[@value='\u5132\u5b58']");
099: selenium.waitForPageToLoad("30000");
100: selenium.click("link=Announcements Test Page");
101: selenium.waitForPageToLoad("30000");
102: verifyTrue(selenium.isTextPresent(""));
103: }
104: }
|