jdk/test/sanity/client/SwingSet/src/OptionPaneDemoTest.java
author hseigel
Wed, 01 Mar 2017 08:00:02 -0500
changeset 46194 5596e6f63072
parent 39006 fd8c3312d043
permissions -rw-r--r--
8172307: Remove ununsed JVM API JVM_GetModuleByPackageName() Summary: Remove get_module_by_package_name() etc., and unneeded test. Reviewed-by: sspitsyn, gtriantafill
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
36744
a00905527ec2 8153141: Develop initial set of tests for SwingSet
mrkam
parents:
diff changeset
     1
/*
a00905527ec2 8153141: Develop initial set of tests for SwingSet
mrkam
parents:
diff changeset
     2
 * Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved.
a00905527ec2 8153141: Develop initial set of tests for SwingSet
mrkam
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
a00905527ec2 8153141: Develop initial set of tests for SwingSet
mrkam
parents:
diff changeset
     4
 *
a00905527ec2 8153141: Develop initial set of tests for SwingSet
mrkam
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
a00905527ec2 8153141: Develop initial set of tests for SwingSet
mrkam
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
a00905527ec2 8153141: Develop initial set of tests for SwingSet
mrkam
parents:
diff changeset
     7
 * published by the Free Software Foundation.
a00905527ec2 8153141: Develop initial set of tests for SwingSet
mrkam
parents:
diff changeset
     8
 *
a00905527ec2 8153141: Develop initial set of tests for SwingSet
mrkam
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
a00905527ec2 8153141: Develop initial set of tests for SwingSet
mrkam
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
a00905527ec2 8153141: Develop initial set of tests for SwingSet
mrkam
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
a00905527ec2 8153141: Develop initial set of tests for SwingSet
mrkam
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
a00905527ec2 8153141: Develop initial set of tests for SwingSet
mrkam
parents:
diff changeset
    13
 * accompanied this code).
a00905527ec2 8153141: Develop initial set of tests for SwingSet
mrkam
parents:
diff changeset
    14
 *
a00905527ec2 8153141: Develop initial set of tests for SwingSet
mrkam
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
a00905527ec2 8153141: Develop initial set of tests for SwingSet
mrkam
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
a00905527ec2 8153141: Develop initial set of tests for SwingSet
mrkam
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
a00905527ec2 8153141: Develop initial set of tests for SwingSet
mrkam
parents:
diff changeset
    18
 *
a00905527ec2 8153141: Develop initial set of tests for SwingSet
mrkam
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
a00905527ec2 8153141: Develop initial set of tests for SwingSet
mrkam
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
a00905527ec2 8153141: Develop initial set of tests for SwingSet
mrkam
parents:
diff changeset
    21
 * questions.
a00905527ec2 8153141: Develop initial set of tests for SwingSet
mrkam
parents:
diff changeset
    22
 */
a00905527ec2 8153141: Develop initial set of tests for SwingSet
mrkam
parents:
diff changeset
    23
a00905527ec2 8153141: Develop initial set of tests for SwingSet
mrkam
parents:
diff changeset
    24
import com.sun.swingset3.demos.optionpane.OptionPaneDemo;
a00905527ec2 8153141: Develop initial set of tests for SwingSet
mrkam
parents:
diff changeset
    25
import static com.sun.swingset3.demos.optionpane.OptionPaneDemo.*;
39006
fd8c3312d043 8157339: Further stabilization for the SwingSet client sanity tests
prr
parents: 37677
diff changeset
    26
36744
a00905527ec2 8153141: Develop initial set of tests for SwingSet
mrkam
parents:
diff changeset
    27
import javax.swing.UIManager;
39006
fd8c3312d043 8157339: Further stabilization for the SwingSet client sanity tests
prr
parents: 37677
diff changeset
    28
fd8c3312d043 8157339: Further stabilization for the SwingSet client sanity tests
prr
parents: 37677
diff changeset
    29
import org.jtregext.GuiTestListener;
fd8c3312d043 8157339: Further stabilization for the SwingSet client sanity tests
prr
parents: 37677
diff changeset
    30
36744
a00905527ec2 8153141: Develop initial set of tests for SwingSet
mrkam
parents:
diff changeset
    31
import org.netbeans.jemmy.ClassReference;
39006
fd8c3312d043 8157339: Further stabilization for the SwingSet client sanity tests
prr
parents: 37677
diff changeset
    32
import org.netbeans.jemmy.operators.Operator.DefaultStringComparator;
36744
a00905527ec2 8153141: Develop initial set of tests for SwingSet
mrkam
parents:
diff changeset
    33
import org.netbeans.jemmy.operators.JButtonOperator;
a00905527ec2 8153141: Develop initial set of tests for SwingSet
mrkam
parents:
diff changeset
    34
import org.netbeans.jemmy.operators.JComboBoxOperator;
a00905527ec2 8153141: Develop initial set of tests for SwingSet
mrkam
parents:
diff changeset
    35
import org.netbeans.jemmy.operators.JDialogOperator;
a00905527ec2 8153141: Develop initial set of tests for SwingSet
mrkam
parents:
diff changeset
    36
import org.netbeans.jemmy.operators.JFrameOperator;
a00905527ec2 8153141: Develop initial set of tests for SwingSet
mrkam
parents:
diff changeset
    37
import org.netbeans.jemmy.operators.JLabelOperator;
a00905527ec2 8153141: Develop initial set of tests for SwingSet
mrkam
parents:
diff changeset
    38
import org.netbeans.jemmy.operators.JTextFieldOperator;
39006
fd8c3312d043 8157339: Further stabilization for the SwingSet client sanity tests
prr
parents: 37677
diff changeset
    39
37677
9774eca96b01 8154381: SwingSet tests are not auto closed in jtreg
mrkam
parents: 36744
diff changeset
    40
import org.testng.annotations.Listeners;
39006
fd8c3312d043 8157339: Further stabilization for the SwingSet client sanity tests
prr
parents: 37677
diff changeset
    41
import org.testng.annotations.Test;
fd8c3312d043 8157339: Further stabilization for the SwingSet client sanity tests
prr
parents: 37677
diff changeset
    42
import static org.testng.AssertJUnit.*;
36744
a00905527ec2 8153141: Develop initial set of tests for SwingSet
mrkam
parents:
diff changeset
    43
a00905527ec2 8153141: Develop initial set of tests for SwingSet
mrkam
parents:
diff changeset
    44
a00905527ec2 8153141: Develop initial set of tests for SwingSet
mrkam
parents:
diff changeset
    45
/*
a00905527ec2 8153141: Develop initial set of tests for SwingSet
mrkam
parents:
diff changeset
    46
 * @test
a00905527ec2 8153141: Develop initial set of tests for SwingSet
mrkam
parents:
diff changeset
    47
 * @key headful
a00905527ec2 8153141: Develop initial set of tests for SwingSet
mrkam
parents:
diff changeset
    48
 * @summary Verifies SwingSet3 OptionPaneDemo page by opening all the dialogs
a00905527ec2 8153141: Develop initial set of tests for SwingSet
mrkam
parents:
diff changeset
    49
 *          and choosing different options in them.
a00905527ec2 8153141: Develop initial set of tests for SwingSet
mrkam
parents:
diff changeset
    50
 *
a00905527ec2 8153141: Develop initial set of tests for SwingSet
mrkam
parents:
diff changeset
    51
 * @library /sanity/client/lib/jemmy/src
37677
9774eca96b01 8154381: SwingSet tests are not auto closed in jtreg
mrkam
parents: 36744
diff changeset
    52
 * @library /sanity/client/lib/Extensions/src
36744
a00905527ec2 8153141: Develop initial set of tests for SwingSet
mrkam
parents:
diff changeset
    53
 * @library /sanity/client/lib/SwingSet3/src
39006
fd8c3312d043 8157339: Further stabilization for the SwingSet client sanity tests
prr
parents: 37677
diff changeset
    54
 * @modules java.desktop
fd8c3312d043 8157339: Further stabilization for the SwingSet client sanity tests
prr
parents: 37677
diff changeset
    55
 *          java.logging
36744
a00905527ec2 8153141: Develop initial set of tests for SwingSet
mrkam
parents:
diff changeset
    56
 * @build org.jemmy2ext.JemmyExt
a00905527ec2 8153141: Develop initial set of tests for SwingSet
mrkam
parents:
diff changeset
    57
 * @build com.sun.swingset3.demos.optionpane.OptionPaneDemo
a00905527ec2 8153141: Develop initial set of tests for SwingSet
mrkam
parents:
diff changeset
    58
 * @run testng OptionPaneDemoTest
a00905527ec2 8153141: Develop initial set of tests for SwingSet
mrkam
parents:
diff changeset
    59
 */
37677
9774eca96b01 8154381: SwingSet tests are not auto closed in jtreg
mrkam
parents: 36744
diff changeset
    60
@Listeners(GuiTestListener.class)
36744
a00905527ec2 8153141: Develop initial set of tests for SwingSet
mrkam
parents:
diff changeset
    61
public class OptionPaneDemoTest {
a00905527ec2 8153141: Develop initial set of tests for SwingSet
mrkam
parents:
diff changeset
    62
a00905527ec2 8153141: Develop initial set of tests for SwingSet
mrkam
parents:
diff changeset
    63
    public static final String SOME_TEXT_TO_TYPE = "I am some text";
a00905527ec2 8153141: Develop initial set of tests for SwingSet
mrkam
parents:
diff changeset
    64
    public static final String MESSAGE = UIManager.getString("OptionPane.messageDialogTitle");
a00905527ec2 8153141: Develop initial set of tests for SwingSet
mrkam
parents:
diff changeset
    65
    public static final String OK = "OK";
a00905527ec2 8153141: Develop initial set of tests for SwingSet
mrkam
parents:
diff changeset
    66
    public static final String CANCEL = "Cancel";
a00905527ec2 8153141: Develop initial set of tests for SwingSet
mrkam
parents:
diff changeset
    67
    public static final String INPUT = UIManager.getString("OptionPane.inputDialogTitle");
a00905527ec2 8153141: Develop initial set of tests for SwingSet
mrkam
parents:
diff changeset
    68
    public static final String TEXT_TO_TYPE = "Hooray! I'm a textField";
a00905527ec2 8153141: Develop initial set of tests for SwingSet
mrkam
parents:
diff changeset
    69
    public static final String NO = "No";
a00905527ec2 8153141: Develop initial set of tests for SwingSet
mrkam
parents:
diff changeset
    70
    public static final String YES = "Yes";
37677
9774eca96b01 8154381: SwingSet tests are not auto closed in jtreg
mrkam
parents: 36744
diff changeset
    71
    public static final String SELECT_AN_OPTION = UIManager.getString("OptionPane.titleText");
36744
a00905527ec2 8153141: Develop initial set of tests for SwingSet
mrkam
parents:
diff changeset
    72
a00905527ec2 8153141: Develop initial set of tests for SwingSet
mrkam
parents:
diff changeset
    73
    @Test
a00905527ec2 8153141: Develop initial set of tests for SwingSet
mrkam
parents:
diff changeset
    74
    public void test() throws Exception {
a00905527ec2 8153141: Develop initial set of tests for SwingSet
mrkam
parents:
diff changeset
    75
37677
9774eca96b01 8154381: SwingSet tests are not auto closed in jtreg
mrkam
parents: 36744
diff changeset
    76
        new ClassReference(OptionPaneDemo.class.getCanonicalName()).startApplication();
9774eca96b01 8154381: SwingSet tests are not auto closed in jtreg
mrkam
parents: 36744
diff changeset
    77
9774eca96b01 8154381: SwingSet tests are not auto closed in jtreg
mrkam
parents: 36744
diff changeset
    78
        JFrameOperator frame = new JFrameOperator(DEMO_TITLE);
36744
a00905527ec2 8153141: Develop initial set of tests for SwingSet
mrkam
parents:
diff changeset
    79
37677
9774eca96b01 8154381: SwingSet tests are not auto closed in jtreg
mrkam
parents: 36744
diff changeset
    80
        showInputDialog(frame);
9774eca96b01 8154381: SwingSet tests are not auto closed in jtreg
mrkam
parents: 36744
diff changeset
    81
        showWarningDialog(frame);
9774eca96b01 8154381: SwingSet tests are not auto closed in jtreg
mrkam
parents: 36744
diff changeset
    82
        showMessageDialog(frame);
9774eca96b01 8154381: SwingSet tests are not auto closed in jtreg
mrkam
parents: 36744
diff changeset
    83
        showComponentDialog(frame);
9774eca96b01 8154381: SwingSet tests are not auto closed in jtreg
mrkam
parents: 36744
diff changeset
    84
        showConfirmationDialog(frame);
36744
a00905527ec2 8153141: Develop initial set of tests for SwingSet
mrkam
parents:
diff changeset
    85
    }
a00905527ec2 8153141: Develop initial set of tests for SwingSet
mrkam
parents:
diff changeset
    86
39006
fd8c3312d043 8157339: Further stabilization for the SwingSet client sanity tests
prr
parents: 37677
diff changeset
    87
    private void checkMessage(String message) {
fd8c3312d043 8157339: Further stabilization for the SwingSet client sanity tests
prr
parents: 37677
diff changeset
    88
        JDialogOperator jdo = new JDialogOperator(MESSAGE);
fd8c3312d043 8157339: Further stabilization for the SwingSet client sanity tests
prr
parents: 37677
diff changeset
    89
        new JLabelOperator(jdo, message);
fd8c3312d043 8157339: Further stabilization for the SwingSet client sanity tests
prr
parents: 37677
diff changeset
    90
        new JButtonOperator(jdo, OK).push();
fd8c3312d043 8157339: Further stabilization for the SwingSet client sanity tests
prr
parents: 37677
diff changeset
    91
        jdo.waitClosed();
fd8c3312d043 8157339: Further stabilization for the SwingSet client sanity tests
prr
parents: 37677
diff changeset
    92
    }
fd8c3312d043 8157339: Further stabilization for the SwingSet client sanity tests
prr
parents: 37677
diff changeset
    93
fd8c3312d043 8157339: Further stabilization for the SwingSet client sanity tests
prr
parents: 37677
diff changeset
    94
    private void useInputDialog(JFrameOperator jfo, String textToType, String buttonToPush) {
fd8c3312d043 8157339: Further stabilization for the SwingSet client sanity tests
prr
parents: 37677
diff changeset
    95
        new JButtonOperator(jfo, INPUT_BUTTON).pushNoBlock();
fd8c3312d043 8157339: Further stabilization for the SwingSet client sanity tests
prr
parents: 37677
diff changeset
    96
        JDialogOperator jdo = new JDialogOperator(INPUT);
fd8c3312d043 8157339: Further stabilization for the SwingSet client sanity tests
prr
parents: 37677
diff changeset
    97
        if(textToType != null) {
fd8c3312d043 8157339: Further stabilization for the SwingSet client sanity tests
prr
parents: 37677
diff changeset
    98
            JTextFieldOperator jto = new JTextFieldOperator(jdo);
fd8c3312d043 8157339: Further stabilization for the SwingSet client sanity tests
prr
parents: 37677
diff changeset
    99
            jto.typeText(textToType);
fd8c3312d043 8157339: Further stabilization for the SwingSet client sanity tests
prr
parents: 37677
diff changeset
   100
            jto.waitText(textToType);
fd8c3312d043 8157339: Further stabilization for the SwingSet client sanity tests
prr
parents: 37677
diff changeset
   101
        }
fd8c3312d043 8157339: Further stabilization for the SwingSet client sanity tests
prr
parents: 37677
diff changeset
   102
        new JButtonOperator(jdo, buttonToPush).push();
fd8c3312d043 8157339: Further stabilization for the SwingSet client sanity tests
prr
parents: 37677
diff changeset
   103
        jdo.waitClosed();
fd8c3312d043 8157339: Further stabilization for the SwingSet client sanity tests
prr
parents: 37677
diff changeset
   104
    }
fd8c3312d043 8157339: Further stabilization for the SwingSet client sanity tests
prr
parents: 37677
diff changeset
   105
36744
a00905527ec2 8153141: Develop initial set of tests for SwingSet
mrkam
parents:
diff changeset
   106
    public void showInputDialog(JFrameOperator jfo) throws Exception {
a00905527ec2 8153141: Develop initial set of tests for SwingSet
mrkam
parents:
diff changeset
   107
        // Cancel with text case
39006
fd8c3312d043 8157339: Further stabilization for the SwingSet client sanity tests
prr
parents: 37677
diff changeset
   108
        useInputDialog(jfo, SOME_TEXT_TO_TYPE, CANCEL);
fd8c3312d043 8157339: Further stabilization for the SwingSet client sanity tests
prr
parents: 37677
diff changeset
   109
        //TODO: wait for no dialog displayed
36744
a00905527ec2 8153141: Develop initial set of tests for SwingSet
mrkam
parents:
diff changeset
   110
a00905527ec2 8153141: Develop initial set of tests for SwingSet
mrkam
parents:
diff changeset
   111
        // Cancel with *NO* text case
39006
fd8c3312d043 8157339: Further stabilization for the SwingSet client sanity tests
prr
parents: 37677
diff changeset
   112
        useInputDialog(jfo, null, CANCEL);
fd8c3312d043 8157339: Further stabilization for the SwingSet client sanity tests
prr
parents: 37677
diff changeset
   113
        //TODO: wait for no dialog displayed
36744
a00905527ec2 8153141: Develop initial set of tests for SwingSet
mrkam
parents:
diff changeset
   114
a00905527ec2 8153141: Develop initial set of tests for SwingSet
mrkam
parents:
diff changeset
   115
        // Text field has *NO* input
39006
fd8c3312d043 8157339: Further stabilization for the SwingSet client sanity tests
prr
parents: 37677
diff changeset
   116
        useInputDialog(jfo, null, OK);
fd8c3312d043 8157339: Further stabilization for the SwingSet client sanity tests
prr
parents: 37677
diff changeset
   117
        //TODO: wait for no dialog displayed
36744
a00905527ec2 8153141: Develop initial set of tests for SwingSet
mrkam
parents:
diff changeset
   118
a00905527ec2 8153141: Develop initial set of tests for SwingSet
mrkam
parents:
diff changeset
   119
        // Text field has input
a00905527ec2 8153141: Develop initial set of tests for SwingSet
mrkam
parents:
diff changeset
   120
        {
a00905527ec2 8153141: Develop initial set of tests for SwingSet
mrkam
parents:
diff changeset
   121
            final String enteredText = "Rambo";
a00905527ec2 8153141: Develop initial set of tests for SwingSet
mrkam
parents:
diff changeset
   122
39006
fd8c3312d043 8157339: Further stabilization for the SwingSet client sanity tests
prr
parents: 37677
diff changeset
   123
            useInputDialog(jfo, enteredText, OK);
fd8c3312d043 8157339: Further stabilization for the SwingSet client sanity tests
prr
parents: 37677
diff changeset
   124
            checkMessage(enteredText + INPUT_RESPONSE);
36744
a00905527ec2 8153141: Develop initial set of tests for SwingSet
mrkam
parents:
diff changeset
   125
        }
a00905527ec2 8153141: Develop initial set of tests for SwingSet
mrkam
parents:
diff changeset
   126
    }
a00905527ec2 8153141: Develop initial set of tests for SwingSet
mrkam
parents:
diff changeset
   127
a00905527ec2 8153141: Develop initial set of tests for SwingSet
mrkam
parents:
diff changeset
   128
    public void showWarningDialog(JFrameOperator jfo) throws Exception {
a00905527ec2 8153141: Develop initial set of tests for SwingSet
mrkam
parents:
diff changeset
   129
        new JButtonOperator(jfo, WARNING_BUTTON).pushNoBlock();
a00905527ec2 8153141: Develop initial set of tests for SwingSet
mrkam
parents:
diff changeset
   130
a00905527ec2 8153141: Develop initial set of tests for SwingSet
mrkam
parents:
diff changeset
   131
        JDialogOperator jdo = new JDialogOperator(WARNING_TITLE);
a00905527ec2 8153141: Develop initial set of tests for SwingSet
mrkam
parents:
diff changeset
   132
a00905527ec2 8153141: Develop initial set of tests for SwingSet
mrkam
parents:
diff changeset
   133
        new JButtonOperator(jdo, OK).push();
a00905527ec2 8153141: Develop initial set of tests for SwingSet
mrkam
parents:
diff changeset
   134
39006
fd8c3312d043 8157339: Further stabilization for the SwingSet client sanity tests
prr
parents: 37677
diff changeset
   135
        jdo.waitClosed();
36744
a00905527ec2 8153141: Develop initial set of tests for SwingSet
mrkam
parents:
diff changeset
   136
    }
a00905527ec2 8153141: Develop initial set of tests for SwingSet
mrkam
parents:
diff changeset
   137
a00905527ec2 8153141: Develop initial set of tests for SwingSet
mrkam
parents:
diff changeset
   138
    public void showMessageDialog(JFrameOperator jfo) throws Exception {
a00905527ec2 8153141: Develop initial set of tests for SwingSet
mrkam
parents:
diff changeset
   139
        new JButtonOperator(jfo, MESSAGE_BUTTON).pushNoBlock();
a00905527ec2 8153141: Develop initial set of tests for SwingSet
mrkam
parents:
diff changeset
   140
a00905527ec2 8153141: Develop initial set of tests for SwingSet
mrkam
parents:
diff changeset
   141
        JDialogOperator jdo = new JDialogOperator(MESSAGE);
a00905527ec2 8153141: Develop initial set of tests for SwingSet
mrkam
parents:
diff changeset
   142
a00905527ec2 8153141: Develop initial set of tests for SwingSet
mrkam
parents:
diff changeset
   143
        new JButtonOperator(jdo, OK).push();
a00905527ec2 8153141: Develop initial set of tests for SwingSet
mrkam
parents:
diff changeset
   144
39006
fd8c3312d043 8157339: Further stabilization for the SwingSet client sanity tests
prr
parents: 37677
diff changeset
   145
        jdo.waitClosed();
fd8c3312d043 8157339: Further stabilization for the SwingSet client sanity tests
prr
parents: 37677
diff changeset
   146
    }
fd8c3312d043 8157339: Further stabilization for the SwingSet client sanity tests
prr
parents: 37677
diff changeset
   147
fd8c3312d043 8157339: Further stabilization for the SwingSet client sanity tests
prr
parents: 37677
diff changeset
   148
    private void callADialogAndClose(JFrameOperator jfo, String buttonToOpenDialog,
fd8c3312d043 8157339: Further stabilization for the SwingSet client sanity tests
prr
parents: 37677
diff changeset
   149
                                     String dialogTitle, String buttonToPush) {
fd8c3312d043 8157339: Further stabilization for the SwingSet client sanity tests
prr
parents: 37677
diff changeset
   150
        new JButtonOperator(jfo, buttonToOpenDialog).pushNoBlock();
fd8c3312d043 8157339: Further stabilization for the SwingSet client sanity tests
prr
parents: 37677
diff changeset
   151
        JDialogOperator jdo = new JDialogOperator(dialogTitle);
fd8c3312d043 8157339: Further stabilization for the SwingSet client sanity tests
prr
parents: 37677
diff changeset
   152
        new JButtonOperator(jdo, buttonToPush).push();
fd8c3312d043 8157339: Further stabilization for the SwingSet client sanity tests
prr
parents: 37677
diff changeset
   153
        jdo.waitClosed();
36744
a00905527ec2 8153141: Develop initial set of tests for SwingSet
mrkam
parents:
diff changeset
   154
    }
a00905527ec2 8153141: Develop initial set of tests for SwingSet
mrkam
parents:
diff changeset
   155
a00905527ec2 8153141: Develop initial set of tests for SwingSet
mrkam
parents:
diff changeset
   156
    public void showComponentDialog(JFrameOperator jfo) throws Exception {
a00905527ec2 8153141: Develop initial set of tests for SwingSet
mrkam
parents:
diff changeset
   157
        // Case: Cancel
39006
fd8c3312d043 8157339: Further stabilization for the SwingSet client sanity tests
prr
parents: 37677
diff changeset
   158
        callADialogAndClose(jfo, COMPONENT_BUTTON, COMPONENT_TITLE, COMPONENT_OP5);
fd8c3312d043 8157339: Further stabilization for the SwingSet client sanity tests
prr
parents: 37677
diff changeset
   159
        //TODO: wait for no dialog displayed
36744
a00905527ec2 8153141: Develop initial set of tests for SwingSet
mrkam
parents:
diff changeset
   160
a00905527ec2 8153141: Develop initial set of tests for SwingSet
mrkam
parents:
diff changeset
   161
        // Case: Yes option selected
a00905527ec2 8153141: Develop initial set of tests for SwingSet
mrkam
parents:
diff changeset
   162
        {
39006
fd8c3312d043 8157339: Further stabilization for the SwingSet client sanity tests
prr
parents: 37677
diff changeset
   163
            callADialogAndClose(jfo, COMPONENT_BUTTON, COMPONENT_TITLE, COMPONENT_OP1);
fd8c3312d043 8157339: Further stabilization for the SwingSet client sanity tests
prr
parents: 37677
diff changeset
   164
            checkMessage(COMPONENT_R1);
36744
a00905527ec2 8153141: Develop initial set of tests for SwingSet
mrkam
parents:
diff changeset
   165
        }
a00905527ec2 8153141: Develop initial set of tests for SwingSet
mrkam
parents:
diff changeset
   166
a00905527ec2 8153141: Develop initial set of tests for SwingSet
mrkam
parents:
diff changeset
   167
        // Case: No option selected
a00905527ec2 8153141: Develop initial set of tests for SwingSet
mrkam
parents:
diff changeset
   168
        {
39006
fd8c3312d043 8157339: Further stabilization for the SwingSet client sanity tests
prr
parents: 37677
diff changeset
   169
            callADialogAndClose(jfo, COMPONENT_BUTTON, COMPONENT_TITLE, COMPONENT_OP2);
fd8c3312d043 8157339: Further stabilization for the SwingSet client sanity tests
prr
parents: 37677
diff changeset
   170
            checkMessage(COMPONENT_R2);
36744
a00905527ec2 8153141: Develop initial set of tests for SwingSet
mrkam
parents:
diff changeset
   171
        }
a00905527ec2 8153141: Develop initial set of tests for SwingSet
mrkam
parents:
diff changeset
   172
a00905527ec2 8153141: Develop initial set of tests for SwingSet
mrkam
parents:
diff changeset
   173
        // Case: Maybe option selected
a00905527ec2 8153141: Develop initial set of tests for SwingSet
mrkam
parents:
diff changeset
   174
        {
39006
fd8c3312d043 8157339: Further stabilization for the SwingSet client sanity tests
prr
parents: 37677
diff changeset
   175
            callADialogAndClose(jfo, COMPONENT_BUTTON, COMPONENT_TITLE, COMPONENT_OP3);
fd8c3312d043 8157339: Further stabilization for the SwingSet client sanity tests
prr
parents: 37677
diff changeset
   176
            checkMessage(COMPONENT_R3);
36744
a00905527ec2 8153141: Develop initial set of tests for SwingSet
mrkam
parents:
diff changeset
   177
        }
a00905527ec2 8153141: Develop initial set of tests for SwingSet
mrkam
parents:
diff changeset
   178
a00905527ec2 8153141: Develop initial set of tests for SwingSet
mrkam
parents:
diff changeset
   179
        // Case: Probably option selected
a00905527ec2 8153141: Develop initial set of tests for SwingSet
mrkam
parents:
diff changeset
   180
        {
39006
fd8c3312d043 8157339: Further stabilization for the SwingSet client sanity tests
prr
parents: 37677
diff changeset
   181
            callADialogAndClose(jfo, COMPONENT_BUTTON, COMPONENT_TITLE, COMPONENT_OP4);
fd8c3312d043 8157339: Further stabilization for the SwingSet client sanity tests
prr
parents: 37677
diff changeset
   182
            checkMessage(COMPONENT_R4);
36744
a00905527ec2 8153141: Develop initial set of tests for SwingSet
mrkam
parents:
diff changeset
   183
        }
a00905527ec2 8153141: Develop initial set of tests for SwingSet
mrkam
parents:
diff changeset
   184
a00905527ec2 8153141: Develop initial set of tests for SwingSet
mrkam
parents:
diff changeset
   185
        // Case TextField and ComboBox functional
a00905527ec2 8153141: Develop initial set of tests for SwingSet
mrkam
parents:
diff changeset
   186
        {
a00905527ec2 8153141: Develop initial set of tests for SwingSet
mrkam
parents:
diff changeset
   187
            new JButtonOperator(jfo, COMPONENT_BUTTON).push();
a00905527ec2 8153141: Develop initial set of tests for SwingSet
mrkam
parents:
diff changeset
   188
a00905527ec2 8153141: Develop initial set of tests for SwingSet
mrkam
parents:
diff changeset
   189
            JDialogOperator jdo = new JDialogOperator(COMPONENT_TITLE);
a00905527ec2 8153141: Develop initial set of tests for SwingSet
mrkam
parents:
diff changeset
   190
a00905527ec2 8153141: Develop initial set of tests for SwingSet
mrkam
parents:
diff changeset
   191
            JTextFieldOperator jto = new JTextFieldOperator(jdo);
a00905527ec2 8153141: Develop initial set of tests for SwingSet
mrkam
parents:
diff changeset
   192
            jto.clearText();
a00905527ec2 8153141: Develop initial set of tests for SwingSet
mrkam
parents:
diff changeset
   193
            jto.typeText(TEXT_TO_TYPE);
39006
fd8c3312d043 8157339: Further stabilization for the SwingSet client sanity tests
prr
parents: 37677
diff changeset
   194
            jto.waitText(TEXT_TO_TYPE);
36744
a00905527ec2 8153141: Develop initial set of tests for SwingSet
mrkam
parents:
diff changeset
   195
a00905527ec2 8153141: Develop initial set of tests for SwingSet
mrkam
parents:
diff changeset
   196
            JComboBoxOperator jcbo = new JComboBoxOperator(jdo);
a00905527ec2 8153141: Develop initial set of tests for SwingSet
mrkam
parents:
diff changeset
   197
            jcbo.selectItem(2);
39006
fd8c3312d043 8157339: Further stabilization for the SwingSet client sanity tests
prr
parents: 37677
diff changeset
   198
            jcbo.waitItemSelected(2);
36744
a00905527ec2 8153141: Develop initial set of tests for SwingSet
mrkam
parents:
diff changeset
   199
39006
fd8c3312d043 8157339: Further stabilization for the SwingSet client sanity tests
prr
parents: 37677
diff changeset
   200
            new JButtonOperator(jdo, COMPONENT_OP5).push();
fd8c3312d043 8157339: Further stabilization for the SwingSet client sanity tests
prr
parents: 37677
diff changeset
   201
            jdo.waitClosed();
fd8c3312d043 8157339: Further stabilization for the SwingSet client sanity tests
prr
parents: 37677
diff changeset
   202
            //TODO: wait for no dialog displayed
36744
a00905527ec2 8153141: Develop initial set of tests for SwingSet
mrkam
parents:
diff changeset
   203
        }
a00905527ec2 8153141: Develop initial set of tests for SwingSet
mrkam
parents:
diff changeset
   204
    }
a00905527ec2 8153141: Develop initial set of tests for SwingSet
mrkam
parents:
diff changeset
   205
a00905527ec2 8153141: Develop initial set of tests for SwingSet
mrkam
parents:
diff changeset
   206
    public void showConfirmationDialog(JFrameOperator jfo) throws Exception {
a00905527ec2 8153141: Develop initial set of tests for SwingSet
mrkam
parents:
diff changeset
   207
        // Case: Yes option selected
a00905527ec2 8153141: Develop initial set of tests for SwingSet
mrkam
parents:
diff changeset
   208
        {
39006
fd8c3312d043 8157339: Further stabilization for the SwingSet client sanity tests
prr
parents: 37677
diff changeset
   209
            callADialogAndClose(jfo, CONFIRM_BUTTON, SELECT_AN_OPTION, YES);
fd8c3312d043 8157339: Further stabilization for the SwingSet client sanity tests
prr
parents: 37677
diff changeset
   210
            checkMessage(CONFIRM_YES);
36744
a00905527ec2 8153141: Develop initial set of tests for SwingSet
mrkam
parents:
diff changeset
   211
        }
a00905527ec2 8153141: Develop initial set of tests for SwingSet
mrkam
parents:
diff changeset
   212
a00905527ec2 8153141: Develop initial set of tests for SwingSet
mrkam
parents:
diff changeset
   213
        // Case: No option selected
a00905527ec2 8153141: Develop initial set of tests for SwingSet
mrkam
parents:
diff changeset
   214
        {
39006
fd8c3312d043 8157339: Further stabilization for the SwingSet client sanity tests
prr
parents: 37677
diff changeset
   215
            callADialogAndClose(jfo, CONFIRM_BUTTON, SELECT_AN_OPTION, NO);
fd8c3312d043 8157339: Further stabilization for the SwingSet client sanity tests
prr
parents: 37677
diff changeset
   216
            checkMessage(CONFIRM_NO);
36744
a00905527ec2 8153141: Develop initial set of tests for SwingSet
mrkam
parents:
diff changeset
   217
        }
a00905527ec2 8153141: Develop initial set of tests for SwingSet
mrkam
parents:
diff changeset
   218
a00905527ec2 8153141: Develop initial set of tests for SwingSet
mrkam
parents:
diff changeset
   219
        // Case: Cancel option selected
a00905527ec2 8153141: Develop initial set of tests for SwingSet
mrkam
parents:
diff changeset
   220
        {
39006
fd8c3312d043 8157339: Further stabilization for the SwingSet client sanity tests
prr
parents: 37677
diff changeset
   221
            callADialogAndClose(jfo, CONFIRM_BUTTON, SELECT_AN_OPTION, CANCEL);
fd8c3312d043 8157339: Further stabilization for the SwingSet client sanity tests
prr
parents: 37677
diff changeset
   222
            //TODO: wait for no dialog displayed
36744
a00905527ec2 8153141: Develop initial set of tests for SwingSet
mrkam
parents:
diff changeset
   223
        }
a00905527ec2 8153141: Develop initial set of tests for SwingSet
mrkam
parents:
diff changeset
   224
    }
a00905527ec2 8153141: Develop initial set of tests for SwingSet
mrkam
parents:
diff changeset
   225
a00905527ec2 8153141: Develop initial set of tests for SwingSet
mrkam
parents:
diff changeset
   226
}