コード例 #1
0
ファイル: CloseWindow.java プロジェクト: gbatalski/webtest
  public void doExecute() throws Exception {
    final Context context = getContext();

    final TopLevelWindow window =
        (TopLevelWindow) context.getCurrentResponse().getEnclosingWindow().getTopWindow();
    window.close();
  }
コード例 #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);
  }
コード例 #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);
 }
コード例 #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);
         }
       });
 }
コード例 #5
0
ファイル: DialogHelper.java プロジェクト: gbatalski/webtest
 private static void initIfNeeded(final Context context) {
   if (!context.containsKey(EXPECTED_DIALOGS_KEY)) {
     context.put(EXPECTED_DIALOGS_KEY, new ArrayList());
   }
 }
コード例 #6
0
ファイル: DialogHelper.java プロジェクト: gbatalski/webtest
 private static List getExpectedDialogs(final Context context) {
   initIfNeeded(context);
   return (List) context.get(EXPECTED_DIALOGS_KEY);
 }