diff --git a/tests/org.eclipse.reddeer.integration.test/src/org/eclipse/reddeer/integration/test/InstallSoftwareFromUpdateSiteTest.java b/tests/org.eclipse.reddeer.integration.test/src/org/eclipse/reddeer/integration/test/InstallSoftwareFromUpdateSiteTest.java index 144ff5d58c..7289b4ea3d 100644 --- a/tests/org.eclipse.reddeer.integration.test/src/org/eclipse/reddeer/integration/test/InstallSoftwareFromUpdateSiteTest.java +++ b/tests/org.eclipse.reddeer.integration.test/src/org/eclipse/reddeer/integration/test/InstallSoftwareFromUpdateSiteTest.java @@ -17,12 +17,16 @@ import java.net.MalformedURLException; import java.net.URL; +import org.eclipse.reddeer.common.wait.TimePeriod; +import org.eclipse.reddeer.common.wait.WaitWhile; import org.eclipse.reddeer.integration.test.installation.common.dialog.InstallNewSoftwareDialog; import org.eclipse.reddeer.integration.test.installation.common.page.AvailableSoftwarePage; import org.eclipse.reddeer.integration.test.installation.common.preferences.AvailableSoftwareSitesPreferencePage; import org.eclipse.reddeer.integration.test.installation.common.util.InstallationOperator; -import org.eclipse.reddeer.jface.preference.PreferencePage; import org.eclipse.reddeer.junit.runner.RedDeerSuite; +import org.eclipse.reddeer.swt.condition.ShellIsAvailable; +import org.eclipse.reddeer.swt.impl.button.PushButton; +import org.eclipse.reddeer.swt.impl.shell.DefaultShell; import org.eclipse.reddeer.workbench.ui.dialogs.WorkbenchPreferenceDialog; import org.junit.BeforeClass; import org.junit.Rule; @@ -47,8 +51,13 @@ public static void prepareTestEnv() { dialog.open(); AvailableSoftwareSitesPreferencePage page = new AvailableSoftwareSitesPreferencePage(dialog); dialog.select(page); - page.getItems().stream().forEach(item -> System.out.println(item.getText())); - page.toggleAllItems(false); + for (int i = 0; i < page.getItems().size(); i++) { + page.getItems().get(0).select(); + page.clickRemove(); + DefaultShell removeSites = new DefaultShell("Remove Sites"); + new PushButton("Yes").click(); + new WaitWhile(new ShellIsAvailable(removeSites), TimePeriod.SHORT); + } dialog.ok(); } } diff --git a/tests/org.eclipse.reddeer.integration.test/src/org/eclipse/reddeer/integration/test/installation/common/util/InstallationOperator.java b/tests/org.eclipse.reddeer.integration.test/src/org/eclipse/reddeer/integration/test/installation/common/util/InstallationOperator.java index 93dd1b7d67..62fd78e6bc 100644 --- a/tests/org.eclipse.reddeer.integration.test/src/org/eclipse/reddeer/integration/test/installation/common/util/InstallationOperator.java +++ b/tests/org.eclipse.reddeer.integration.test/src/org/eclipse/reddeer/integration/test/installation/common/util/InstallationOperator.java @@ -12,6 +12,8 @@ package org.eclipse.reddeer.integration.test.installation.common.util; +import static org.junit.Assert.fail; + import org.eclipse.reddeer.common.logging.Logger; import org.eclipse.reddeer.common.matcher.RegexMatcher; import org.eclipse.reddeer.common.wait.TimePeriod; @@ -52,6 +54,9 @@ public InstallationOperator(WizardDialog installWizard, ErrorCollector collector public void completeInstallation() { if (new WithTextMatcher(new RegexMatcher(RemediationActionPage.PAGE_TITLE)).matches(installWizard.getTitle())) { dealWithRemediationPage(); + if (Boolean.getBoolean("fail.on.remediation")) { + fail("Remediation page was shown, see the logs"); + } } if (installWizard.getTitle().equals(InstallDetailsPage.PAGE_TITLE)) { @@ -186,23 +191,23 @@ public void dealWithCertificatesWindow() { public void dealWithRemediationPage() { LOG.warn("Remediation Action page has been displayed."); - RemediationActionPage remetiationPage = new RemediationActionPage(installWizard); + RemediationActionPage remediationPage = new RemediationActionPage(installWizard); - if (remetiationPage.isEnabledShowOriginalErrors()) { - remetiationPage.chooseShowOriginalErrors(); + if (remediationPage.isEnabledShowOriginalErrors()) { + remediationPage.chooseShowOriginalErrors(); capture("Remediation_Page_Show_Original_Errors"); - LOG.warn("Remediation Action needed. Original error:\n" + remetiationPage.getOriginalError()); + LOG.warn("Remediation Action needed. Original error:\n" + remediationPage.getOriginalError()); } - if (remetiationPage.isEnabledKeepMyInstallation()) { - remetiationPage.chooseKeepMyInstallation(); + if (remediationPage.isEnabledKeepMyInstallation()) { + remediationPage.chooseKeepMyInstallation(); capture("Remediation_Page_Keep_My_Installation"); } - if (remetiationPage.isEnabledUpdateMyInstallation()) { - remetiationPage.chooseUpdateMyInstallation(); + if (remediationPage.isEnabledUpdateMyInstallation()) { + remediationPage.chooseUpdateMyInstallation(); capture("Remediation_Page_Update_My_Installation"); - RemediationActionValidator.validateSolution(remetiationPage, collector); + RemediationActionValidator.validateSolution(remediationPage, collector); } else { //collector.addError(new AssertionError("Remediation Action is needed and 'Update' choice is not available.")); LOG.warn("Remediation Action is needed and 'Update' choice is not available.");