Skip to content

Commit

Permalink
Change the way the install test is executed
Browse files Browse the repository at this point in the history
 - fixes eclipse-archived#2194

Signed-off-by: Ondrej Dockal <[email protected]>
  • Loading branch information
odockal committed Mar 1, 2023
1 parent 6adbba9 commit cf81ca9
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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)) {
Expand Down Expand Up @@ -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.");
Expand Down

0 comments on commit cf81ca9

Please sign in to comment.