Search in sources :

Example 26 with WaitUntil

use of org.eclipse.reddeer.common.wait.WaitUntil in project jbosstools-openshift by jbosstools.

the class BrowserContainsText method test.

@Override
public boolean test() {
    browser = new InternalBrowser();
    if (url != null) {
        browser.setURL(url);
        if (refresh)
            browser.refresh();
    } else {
        if (refresh)
            browser.refresh();
    }
    new WaitUntil(new PageIsLoaded(browser));
    if (Platform.getOS().startsWith(Platform.OS_WIN32)) {
        return browser.getText().contains(text);
    } else {
        // Workaround for webkit issues with method browser.getText(), e.g. https://bugs.eclipse.org/bugs/show_bug.cgi?id=514719
        String pageHTML = "";
        if (!StringUtils.isEmptyOrNull(browser.getURL())) {
            pageHTML = (String) browser.evaluate("return document.documentElement.innerHTML;");
        }
        return pageHTML.contains(text);
    }
}
Also used : InternalBrowser(org.eclipse.reddeer.swt.impl.browser.InternalBrowser) WaitUntil(org.eclipse.reddeer.common.wait.WaitUntil)

Example 27 with WaitUntil

use of org.eclipse.reddeer.common.wait.WaitUntil in project jbosstools-openshift by jbosstools.

the class AuthenticationTokenRetrival method retrieveToken.

/**
 * Represents action of clicking on retrieve new token link, wait for browser to
 * appear, log in and obtain new token.
 *
 * @return token string
 */
public String retrieveToken() {
    EmulatedLinkStyledText linkText = new EmulatedLinkStyledText(OpenShiftLabel.TextLabels.RETRIEVE_TOKEN);
    linkText.click(linkText.getPositionOfText(OpenShiftLabel.TextLabels.LINK_RETRIEVE) + 3);
    new WaitUntil(new ShellIsActive(new WithTextMatcher("Unnamed")), TimePeriod.MEDIUM, false);
    DefaultShell browser = new DefaultShell();
    InternalBrowser internalBrowser = new InternalBrowser(browser);
    login(internalBrowser);
    new WaitUntil(new LoginPageIsLoaded(() -> internalBrowser.getText().contains(PAGETITLE_API_TOKEN)));
    String token = getTokenFromBrowser(internalBrowser);
    // close browser shell
    new PushButton(OpenShiftLabel.Button.CLOSE).click();
    return token;
}
Also used : ShellIsActive(org.eclipse.reddeer.swt.condition.ShellIsActive) WithTextMatcher(org.eclipse.reddeer.core.matcher.WithTextMatcher) DefaultShell(org.eclipse.reddeer.swt.impl.shell.DefaultShell) InternalBrowser(org.eclipse.reddeer.swt.impl.browser.InternalBrowser) LoginPageIsLoaded(org.jboss.tools.openshift.reddeer.condition.LoginPageIsLoaded) WaitUntil(org.eclipse.reddeer.common.wait.WaitUntil) PushButton(org.eclipse.reddeer.swt.impl.button.PushButton)

Example 28 with WaitUntil

use of org.eclipse.reddeer.common.wait.WaitUntil in project jbosstools-openshift by jbosstools.

the class AuthenticationTokenRetrival method login.

private void login(final InternalBrowser browser) {
    new WaitUntil(new LoginPageIsLoaded(() -> containsLoginForm(browser)), TimePeriod.LONG);
    fillAndSubmitCredentials(browser);
}
Also used : LoginPageIsLoaded(org.jboss.tools.openshift.reddeer.condition.LoginPageIsLoaded) WaitUntil(org.eclipse.reddeer.common.wait.WaitUntil)

Example 29 with WaitUntil

use of org.eclipse.reddeer.common.wait.WaitUntil in project jbosstools-openshift by jbosstools.

the class CDK3ServerWizardTest method testNewCDK3ServerWizard.

@Test
public void testNewCDK3ServerWizard() {
    NewCDKServerWizard dialog = (NewCDKServerWizard) CDKTestUtils.openNewServerWizardDialog();
    NewServerWizardPage page = new NewServerWizardPage(dialog);
    page.selectType(SERVER_TYPE_GROUP, CDK3_SERVER_NAME);
    page.setName(getServerAdapter());
    dialog.next();
    NewCDK3ServerWizardPage containerPage = new NewCDK3ServerWizardPage();
    checkWizardPagewidget("Minishift Binary: ", CDK3_SERVER_NAME);
    // just check that default domain is choosen correctly
    assertTrue(containerPage.getDomain().equalsIgnoreCase(CREDENTIALS_DOMAIN));
    // needs to activate validator
    containerPage.setMinishiftBinary(EXISTING_PATH);
    // first the credentials are checked
    assertSameMessage(dialog, NO_USER);
    containerPage.setCredentials(USERNAME, PASSWORD);
    assertDiffMessage(dialog, NO_USER);
    // checking of minishift binary validation
    // test that existing folder cannot be run
    containerPage.setMinishiftBinary(EXISTING_PATH);
    assertSameMessage(dialog, CANNOT_RUN_PROGRAM);
    containerPage.setMinishiftBinary(NON_EXECUTABLE_FILE);
    assertSameMessage(dialog, NOT_EXECUTABLE);
    containerPage.setMinishiftBinary(NON_EXISTING_PATH);
    assertSameMessage(dialog, DOES_NOT_EXIST);
    containerPage.setMinishiftBinary(EXECUTABLE_FILE);
    assertSameMessage(dialog, CHECK_MINISHIFT_VERSION);
    // check compatibility of cdk version with server adapter
    containerPage.setMinishiftBinary(MOCK_CDK320);
    assertSameMessage(dialog, NOT_COMPATIBLE);
    // Positive test of proper minishift binary
    containerPage.setMinishiftBinary(MINISHIFT_PATH);
    assertDiffMessage(dialog, CHECK_MINISHIFT_VERSION);
    new WaitUntil(new ControlIsEnabled(new FinishButton()), TimePeriod.MEDIUM, false);
    assertTrue("Expected Finish button is not enabled", dialog.isFinishEnabled());
    dialog.cancel();
}
Also used : FinishButton(org.eclipse.reddeer.swt.impl.button.FinishButton) ControlIsEnabled(org.eclipse.reddeer.swt.condition.ControlIsEnabled) NewCDK3ServerWizardPage(org.jboss.tools.cdk.reddeer.server.ui.wizard.NewCDK3ServerWizardPage) NewCDKServerWizard(org.jboss.tools.cdk.reddeer.server.ui.wizard.NewCDKServerWizard) WaitUntil(org.eclipse.reddeer.common.wait.WaitUntil) NewServerWizardPage(org.eclipse.reddeer.eclipse.wst.server.ui.wizard.NewServerWizardPage) Test(org.junit.Test)

Example 30 with WaitUntil

use of org.eclipse.reddeer.common.wait.WaitUntil in project jbosstools-openshift by jbosstools.

the class ImportApplicationWizardGitTest method testNotGitRepo.

@Test
public void testNotGitRepo() {
    assertTrue("Failed to create test project non git folder!", projectFolder.mkdir());
    service.select();
    new ContextMenuItem(OpenShiftLabel.ContextMenu.IMPORT_APPLICATION).select();
    new WaitUntil(new ShellIsAvailable(OpenShiftLabel.Shell.IMPORT_APPLICATION));
    ImportApplicationWizard importWizard = new ImportApplicationWizard();
    assertProjectExistsErrorInWizard(importWizard);
    CheckBox useExistingRepositoryCheckBox = new CheckBox(new DefaultGroup("Clone destination"), "Do not clone - use existing repository");
    assertFalse("Empty non git folder should not be able to choose!", useExistingRepositoryCheckBox.isEnabled());
    importWizard.cancel();
}
Also used : ShellIsAvailable(org.eclipse.reddeer.swt.condition.ShellIsAvailable) ContextMenuItem(org.eclipse.reddeer.swt.impl.menu.ContextMenuItem) CheckBox(org.eclipse.reddeer.swt.impl.button.CheckBox) DefaultGroup(org.eclipse.reddeer.swt.impl.group.DefaultGroup) ImportApplicationWizard(org.jboss.tools.openshift.reddeer.wizard.importapp.ImportApplicationWizard) WaitUntil(org.eclipse.reddeer.common.wait.WaitUntil) Test(org.junit.Test)

Aggregations

WaitUntil (org.eclipse.reddeer.common.wait.WaitUntil)178 ShellIsAvailable (org.eclipse.reddeer.swt.condition.ShellIsAvailable)74 WaitWhile (org.eclipse.reddeer.common.wait.WaitWhile)73 JobIsRunning (org.eclipse.reddeer.workbench.core.condition.JobIsRunning)63 DefaultShell (org.eclipse.reddeer.swt.impl.shell.DefaultShell)59 ControlIsEnabled (org.eclipse.reddeer.swt.condition.ControlIsEnabled)54 Test (org.junit.Test)44 PushButton (org.eclipse.reddeer.swt.impl.button.PushButton)40 WaitTimeoutExpiredException (org.eclipse.reddeer.common.exception.WaitTimeoutExpiredException)36 OkButton (org.eclipse.reddeer.swt.impl.button.OkButton)36 FinishButton (org.eclipse.reddeer.swt.impl.button.FinishButton)34 ContextMenuItem (org.eclipse.reddeer.swt.impl.menu.ContextMenuItem)30 LabeledText (org.eclipse.reddeer.swt.impl.text.LabeledText)25 AbstractTest (org.jboss.tools.openshift.ui.bot.test.application.v3.basic.AbstractTest)22 OpenShiftExplorerView (org.jboss.tools.openshift.reddeer.view.OpenShiftExplorerView)20 NextButton (org.eclipse.reddeer.swt.impl.button.NextButton)18 OpenShiftResourceExists (org.jboss.tools.openshift.reddeer.condition.OpenShiftResourceExists)18 BackButton (org.eclipse.reddeer.swt.impl.button.BackButton)15 DefaultTreeItem (org.eclipse.reddeer.swt.impl.tree.DefaultTreeItem)13 RedDeerException (org.eclipse.reddeer.common.exception.RedDeerException)12