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="alert"
13: * description="Provides the ability to set expectations in relation to user responses to <key>javascript</key> Alert Dialog boxes. Must be nested within the <stepref name='expectDialogs'/> step."
14: */
15: public class AlertDialogStep extends AbstractDialogStep {
16: private static final Logger LOG = Logger
17: .getLogger(AlertDialogStep.class);
18:
19: {
20: setOptionalText(true);
21: }
22:
23: // used when nesting this step
24: public AlertDialogStep() {
25: super ();
26: }
27:
28: // used by prepareDialogResponse legacy step
29: public AlertDialogStep(final String text, final String regex,
30: final String saveProperty, final String savePropertyType) {
31: super (null, text, regex, saveProperty, savePropertyType);
32: }
33:
34: public void doExecute() {
35: final Context context = getContext();
36: LOG
37: .debug("Dialog expectation saved - Number of expected dialogs now = "
38: + DialogHelper.getExpectedDialogsCount(context));
39:
40: }
41: }
|