01: // Copyright © 2004-2005 ASERT. Released under the Canoo Webtest license.
02: package com.canoo.webtest.extension.dialogs;
03:
04: import com.canoo.webtest.engine.Context;
05: import org.apache.log4j.Logger;
06:
07: /**
08: * Stores away properties related to a JavaScript dialog response in preparation for subsequent click.<p>
09: *
10: * @author Paul King, ASERT
11: * @webtest.step category="Extension"
12: * name="confirm"
13: * description="Provides the ability to set expectations in relation to user responses to <key>javascript</key> Confirm Dialog boxes. Must be nested within the <stepref name='expectDialogs'/> step."
14: */
15: public class ConfirmDialogStep extends AbstractDialogStep {
16: private static final Logger LOG = Logger
17: .getLogger(ConfirmDialogStep.class);
18:
19: {
20: setOptionalText(true);
21: }
22:
23: // used when nesting this step
24: public ConfirmDialogStep() {
25: super ();
26: }
27:
28: // used by prepareDialogResponse legacy step
29: public ConfirmDialogStep(final boolean response, final String text,
30: final String regex, final String saveProperty,
31: final String savePropertyType) {
32: super (response ? "true" : "false", text, regex, saveProperty,
33: savePropertyType);
34: }
35:
36: public void doExecute() {
37: final Context context = getContext();
38: LOG
39: .debug("Dialog expectation saved - Number of expected dialogs now = "
40: + DialogHelper.getExpectedDialogsCount(context));
41:
42: }
43: }
|