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.polls;
022:
023: import com.liferay.portalweb.portal.BaseTestCase;
024:
025: /**
026: * <a href="ViewQuestionGraphsTest.java.html"><b><i>View Source</i></b></a>
027: *
028: * @author Brian Wing Shun Chan
029: *
030: */
031: public class ViewQuestionGraphsTest extends BaseTestCase {
032: public void testViewQuestionGraphs() throws Exception {
033: selenium.click("link=Test Poll Question");
034: selenium.waitForPageToLoad("30000");
035: selenium.click("link=Area");
036: selenium.waitForPopUp("viewChart", "30000");
037: selenium.selectWindow("viewChartWindow");
038: selenium.close();
039: selenium.selectWindow("null");
040:
041: for (int second = 0;; second++) {
042: if (second >= 60) {
043: fail("timeout");
044: }
045:
046: try {
047: if (selenium.isElementPresent("link=Horizontal Bar")) {
048: break;
049: }
050: } catch (Exception e) {
051: }
052:
053: Thread.sleep(1000);
054: }
055:
056: selenium.click("link=Horizontal Bar");
057: selenium.waitForPopUp("viewChart", "30000");
058: selenium.selectWindow("viewChartWindow");
059: selenium.close();
060: selenium.selectWindow("null");
061:
062: for (int second = 0;; second++) {
063: if (second >= 60) {
064: fail("timeout");
065: }
066:
067: try {
068: if (selenium.isElementPresent("link=Line")) {
069: break;
070: }
071: } catch (Exception e) {
072: }
073:
074: Thread.sleep(1000);
075: }
076:
077: selenium.click("link=Line");
078: selenium.waitForPopUp("viewChart", "30000");
079: selenium.selectWindow("viewChartWindow");
080: selenium.close();
081: selenium.selectWindow("null");
082:
083: for (int second = 0;; second++) {
084: if (second >= 60) {
085: fail("timeout");
086: }
087:
088: try {
089: if (selenium.isElementPresent("link=Pie")) {
090: break;
091: }
092: } catch (Exception e) {
093: }
094:
095: Thread.sleep(1000);
096: }
097:
098: selenium.click("link=Pie");
099: selenium.waitForPopUp("viewChart", "30000");
100: selenium.selectWindow("viewChartWindow");
101: selenium.close();
102: selenium.selectWindow("null");
103:
104: for (int second = 0;; second++) {
105: if (second >= 60) {
106: fail("timeout");
107: }
108:
109: try {
110: if (selenium.isElementPresent("link=Vertical Bar")) {
111: break;
112: }
113: } catch (Exception e) {
114: }
115:
116: Thread.sleep(1000);
117: }
118:
119: selenium.click("link=Vertical Bar");
120: selenium.waitForPopUp("viewChart", "30000");
121: selenium.selectWindow("viewChartWindow");
122: selenium.close();
123: selenium.selectWindow("null");
124: selenium.click("link=Return to Full Page");
125: selenium.waitForPageToLoad("30000");
126: }
127: }
|