01: // Copyright © 2002-2005 Canoo Engineering AG, Switzerland.
02: package com.canoo.webtest.steps;
03:
04: import com.canoo.webtest.engine.Context;
05: import com.canoo.webtest.util.MapUtil;
06:
07: import java.util.Map;
08:
09: /**
10: * MG: what to do if previous response is in a closed window?
11: * @webtest.step category="Core"
12: * name="previousResponse"
13: * alias="previousresponse"
14: * description="This step provides the ability to revert to the previously loaded response for further testing of the previous page if testing of the current response is complete."
15: */
16: public class PreviousResponse extends AbstractBrowserAction {
17: private String fRestoredResponseUrl;
18:
19: public void doExecute() {
20: nullResponseCheck();
21: final Context context = getContext();
22: context.restorePreviousResponse();
23: fRestoredResponseUrl = context.getCurrentResponse()
24: .getWebResponse().getUrl().toString();
25: }
26:
27: /**
28: * Adds the url of the restored response to parent's call
29: * @see com.canoo.webtest.steps.Step#getParameterDictionary()
30: */
31: protected void addComputedParameters(final Map map) {
32: super .addComputedParameters(map);
33: MapUtil.putIfNotNull(map, "->url", fRestoredResponseUrl);
34: }
35: }
|