Example #1
0
  public void doExecute() throws Exception {
    final Context context = getContext();

    final TopLevelWindow window =
        (TopLevelWindow) context.getCurrentResponse().getEnclosingWindow().getTopWindow();
    window.close();
  }
Example #2
0
  protected void setUp() throws Exception {
    final Configuration testConfig = new Configuration();
    testConfig.setShowhtmlparseroutput(false);
    final IPropertyHandler handler = (IPropertyHandler) mock(IPropertyHandler.class, "handler");

    testConfig.setPropertyHandler(handler);
    fTestContext.getWebtest().addConfig(testConfig);

    BaseStepTestCase.executeStep(fBrowserAction); // coverage

    Logger.getRootLogger()
        .setLevel(Level.INFO); // ensure that the logged event we want to catch is not discarded
    Logger.getRootLogger().addAppender(fBuffAppender);
  }
Example #3
0
 public void testGotoTargetByUrl() throws Exception {
   fTestContext
       .getWebtest()
       .getConfig()
       .getExternalProperty(TargetHelper.CONNECTION_INITIALIZER_KEY);
   modify().returnValue(null);
   startVerification();
   fBuffAppender.getEvents().clear();
   try {
     fTargetHelper.getResponse(fTestContext, "targetUrl");
   } catch (final Exception e) {
     /* ignore */
   }
   assertTrue("should be called by url", fBuffAppender.allMessagesToString().indexOf("url") > -1);
 }
Example #4
0
 public void testPrepareConversationWithProperCustomInitializer() throws Exception {
   final IPropertyHandler customHandler =
       (IPropertyHandler) mock(IPropertyHandler.class, "customHandler");
   customHandler.getProperty(TargetHelper.CONNECTION_INITIALIZER_KEY);
   modify().returnValue(OK_CUSTOM_INITIALIZER_CLASS_NAME);
   startVerification();
   fTestContext.getConfig().setPropertyHandler(customHandler);
   ThrowAssert.assertPasses(
       "normal pass",
       new TestBlock() {
         public void call() throws Exception {
           fTargetHelper.prepareConversationIfNeeded(fTestContext);
         }
       });
 }
Example #5
0
 private static void initIfNeeded(final Context context) {
   if (!context.containsKey(EXPECTED_DIALOGS_KEY)) {
     context.put(EXPECTED_DIALOGS_KEY, new ArrayList());
   }
 }
Example #6
0
 private static List getExpectedDialogs(final Context context) {
   initIfNeeded(context);
   return (List) context.get(EXPECTED_DIALOGS_KEY);
 }