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);
}
}
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;
}
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);
}
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();
}
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();
}
Aggregations