Search in sources :

Example 1 with RunIf

use of org.eclipse.reddeer.junit.execution.annotation.RunIf in project jbosstools-openshift by jbosstools.

the class CreateNewConnectionTest method testCreateNewV3BasicConnection.

@Test
@RunIf(conditionClass = ConnectionCredentialsExists.class)
public void testCreateNewV3BasicConnection() {
    OpenShiftExplorerView explorer = new OpenShiftExplorerView();
    explorer.open();
    DatastoreOS3.AUTH_METHOD = AuthenticationMethod.BASIC;
    explorer.openConnectionShell();
    OpenShift3ConnectionWizard connectionWizard = new OpenShift3ConnectionWizard();
    connectionWizard.setServer(DatastoreOS3.SERVER);
    connectionWizard.switchAuthenticationSection(DatastoreOS3.AUTH_METHOD);
    BasicAuthenticationSection authSection = (BasicAuthenticationSection) connectionWizard.getAuthSection();
    authSection.setUsername(DatastoreOS3.USERNAME);
    authSection.setPassword(DatastoreOS3.PASSWORD);
    authSection.setSavePassword(false);
    connectionWizard.finishAndHandleCertificate();
    assertTrue("Connection does not exist in OpenShift Explorer view", explorer.connectionExists(DatastoreOS3.USERNAME));
}
Also used : OpenShift3ConnectionWizard(org.jboss.tools.openshift.reddeer.wizard.v3.OpenShift3ConnectionWizard) BasicAuthenticationSection(org.jboss.tools.openshift.reddeer.wizard.v3.BasicAuthenticationSection) OpenShiftExplorerView(org.jboss.tools.openshift.reddeer.view.OpenShiftExplorerView) RunIf(org.eclipse.reddeer.junit.execution.annotation.RunIf) AbstractTest(org.jboss.tools.openshift.ui.bot.test.application.v3.basic.AbstractTest) Test(org.junit.Test)

Example 2 with RunIf

use of org.eclipse.reddeer.junit.execution.annotation.RunIf in project jbosstools-openshift by jbosstools.

the class CreateNewConnectionTest method testCreateNewV3OAuthConnection.

@Test
@RunIf(conditionClass = ConnectionCredentialsExists.class)
public void testCreateNewV3OAuthConnection() {
    OpenShiftExplorerView explorer = new OpenShiftExplorerView();
    explorer.open();
    DatastoreOS3.AUTH_METHOD = AuthenticationMethod.OAUTH;
    explorer.openConnectionShell();
    try {
        explorer.connectToOpenShift(DatastoreOS3.SERVER, null, DatastoreOS3.TOKEN, false, false, AuthenticationMethod.OAUTH, true);
    } catch (RedDeerException ex) {
        fail("Creating an OpenShift v3 OAuth connection failed." + ex.getCause());
    }
    assertTrue("Connection does not exist in OpenShift Explorer view", explorer.connectionExists(DatastoreOS3.USERNAME));
}
Also used : RedDeerException(org.eclipse.reddeer.common.exception.RedDeerException) OpenShiftExplorerView(org.jboss.tools.openshift.reddeer.view.OpenShiftExplorerView) RunIf(org.eclipse.reddeer.junit.execution.annotation.RunIf) AbstractTest(org.jboss.tools.openshift.ui.bot.test.application.v3.basic.AbstractTest) Test(org.junit.Test)

Example 3 with RunIf

use of org.eclipse.reddeer.junit.execution.annotation.RunIf in project jbosstools-openshift by jbosstools.

the class CreateNewConnectionTest method invalidRegistryURLShouldReportErrorMessage.

@Test
@RunIf(conditionClass = ConnectionCredentialsExists.class)
public void invalidRegistryURLShouldReportErrorMessage() {
    openConnectionWizardAndSetDefaultServer();
    new LabeledCombo(OpenShiftLabel.TextLabels.PROTOCOL).setSelection(AuthenticationMethod.BASIC.toString());
    new LabeledText(OpenShiftLabel.TextLabels.USERNAME).setText(DatastoreOS3.USERNAME);
    new LabeledText(OpenShiftLabel.TextLabels.PASSWORD).setText(DatastoreOS3.PASSWORD);
    new PushButton(OpenShiftLabel.Button.ADVANCED_OPEN).click();
    new LabeledText(OpenShiftLabel.TextLabels.IMAGE_REGISTRY_URL).setText("invalidURL");
    new WaitUntil(new ControlIsEnabled(new CancelButton()), TimePeriod.DEFAULT);
    new WaitUntil(new ControlIsEnabled(new DefaultText(" Please provide a valid image registry (HTTP/S) URL.")), TimePeriod.DEFAULT);
    new CancelButton().click();
}
Also used : DefaultText(org.eclipse.reddeer.swt.impl.text.DefaultText) LabeledCombo(org.eclipse.reddeer.swt.impl.combo.LabeledCombo) LabeledText(org.eclipse.reddeer.swt.impl.text.LabeledText) ControlIsEnabled(org.eclipse.reddeer.swt.condition.ControlIsEnabled) CancelButton(org.eclipse.reddeer.swt.impl.button.CancelButton) PushButton(org.eclipse.reddeer.swt.impl.button.PushButton) WaitUntil(org.eclipse.reddeer.common.wait.WaitUntil) RunIf(org.eclipse.reddeer.junit.execution.annotation.RunIf) AbstractTest(org.jboss.tools.openshift.ui.bot.test.application.v3.basic.AbstractTest) Test(org.junit.Test)

Example 4 with RunIf

use of org.eclipse.reddeer.junit.execution.annotation.RunIf in project jbosstools-openshift by jbosstools.

the class CreateNewConnectionTest method shouldExtractTokenInBrowserWindow.

// Skip Test for now, not stable
// @Test
@RunIf(conditionClass = ConnectionCredentialsExists.class)
public void shouldExtractTokenInBrowserWindow() {
    openConnectionWizardAndSetDefaultServerOAuth();
    String token = new AuthenticationTokenRetrival(DatastoreOS3.USERNAME, DatastoreOS3.PASSWORD).retrieveToken();
    String tokenText = new LabeledText(OpenShiftLabel.TextLabels.TOKEN).getText();
    assertEquals(token, tokenText);
    new CancelButton().click();
}
Also used : AuthenticationTokenRetrival(org.jboss.tools.openshift.reddeer.utils.AuthenticationTokenRetrival) LabeledText(org.eclipse.reddeer.swt.impl.text.LabeledText) CancelButton(org.eclipse.reddeer.swt.impl.button.CancelButton) RunIf(org.eclipse.reddeer.junit.execution.annotation.RunIf)

Aggregations

RunIf (org.eclipse.reddeer.junit.execution.annotation.RunIf)4 AbstractTest (org.jboss.tools.openshift.ui.bot.test.application.v3.basic.AbstractTest)3 Test (org.junit.Test)3 CancelButton (org.eclipse.reddeer.swt.impl.button.CancelButton)2 LabeledText (org.eclipse.reddeer.swt.impl.text.LabeledText)2 OpenShiftExplorerView (org.jboss.tools.openshift.reddeer.view.OpenShiftExplorerView)2 RedDeerException (org.eclipse.reddeer.common.exception.RedDeerException)1 WaitUntil (org.eclipse.reddeer.common.wait.WaitUntil)1 ControlIsEnabled (org.eclipse.reddeer.swt.condition.ControlIsEnabled)1 PushButton (org.eclipse.reddeer.swt.impl.button.PushButton)1 LabeledCombo (org.eclipse.reddeer.swt.impl.combo.LabeledCombo)1 DefaultText (org.eclipse.reddeer.swt.impl.text.DefaultText)1 AuthenticationTokenRetrival (org.jboss.tools.openshift.reddeer.utils.AuthenticationTokenRetrival)1 BasicAuthenticationSection (org.jboss.tools.openshift.reddeer.wizard.v3.BasicAuthenticationSection)1 OpenShift3ConnectionWizard (org.jboss.tools.openshift.reddeer.wizard.v3.OpenShift3ConnectionWizard)1