Skip to content

Commit

Permalink
Added browser view tests, refactoring, added securestorage password
Browse files Browse the repository at this point in the history
  • Loading branch information
vprusa authored and rawagner committed Mar 28, 2018
1 parent 947d025 commit 6fb8ca3
Show file tree
Hide file tree
Showing 19 changed files with 724 additions and 141 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Bundle-Vendor: JBoss by Red Hat
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Require-Bundle: org.eclipse.reddeer.go;bundle-version="2.0.0",
org.junit;bundle-version="4.8.2",
org.eclipse.lsp4e,
org.eclipse.core.resources,
org.eclipse.m2e.core.ui,
org.eclipse.m2e.lifecyclemapping.defaults,
Expand Down
55 changes: 52 additions & 3 deletions tests/com.redhat.fabric8analytics.lsp.eclipse.ui.itests/pom.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
Expand All @@ -14,10 +15,14 @@
<properties>
<test.suite>com.redhat.fabric8analytics.lsp.eclipse.ui.itests</test.suite>
<test.class>com.redhat.fabric8analytics.lsp.eclipse.ui.itests.SmokeSuite</test.class>
<systemProperties>${integrationTestsSystemProperties}</systemProperties>
<integrationTestsSystemProperties>-DOSusername=${OSusername} -DOSpassword=${OSpassword} -DOSLoginProvider=${OSLoginProvider} -Dfabric8analytics.tests.usePersistantWorkspace=${fabric8analytics.tests.usePersistantWorkspace}</integrationTestsSystemProperties>
<!-- <OSusername>${OSusername}</OSusername> <OSpassword>${OSpassword}</OSpassword>
<OSLoginProvider>${OSLoginProvider}</OSLoginProvider> -->
<jbosstools-site>http://download.jboss.org/jbosstools/${eclipseReleaseName}/snapshots/updates/core/${stream_jbt}/</jbosstools-site>
<jbosstools-tests-site>http://download.jboss.org/jbosstools/${eclipseReleaseName}/snapshots/updates/coretests/${stream_jbt}/</jbosstools-tests-site>
</properties>



<profiles>
<profile>
<id>SmokeSuite</id>
Expand All @@ -38,6 +43,36 @@
</plugins>
</build>
</profile>
<profile>
<id>SmokeSuite-prsistantWorkspace</id>
<properties>
<test.class>com.redhat.fabric8analytics.lsp.eclipse.ui.itests.SmokeSuite</test.class>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>target-platform-configuration</artifactId>
<configuration>
<useUIThread>false</useUIThread>
<testClass>${test.class}</testClass>
<testSuite>${test.suite}</testSuite>
</configuration>
</plugin>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-surefire-plugin</artifactId>
<configuration>
<appArgLine>-eclipse.password ${project.basedir}/resources/securepass -data ${fabric8analytics.tests.usePersistantWorkspace}</appArgLine>
<skip>${skipITests}</skip>
<useUIThread>false</useUIThread>
<testClass>${test.class}</testClass>
<testSuite>${test.suite}</testSuite>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
<build>
<resources>
Expand All @@ -54,6 +89,7 @@
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-surefire-plugin</artifactId>
<configuration>
<appArgLine>-eclipse.password ${project.basedir}/resources/securepass</appArgLine>
<skip>${skipITests}</skip>
<useUIThread>false</useUIThread>
<testClass>${test.class}</testClass>
Expand All @@ -62,4 +98,17 @@
</plugin>
</plugins>
</build>

<repositories>
<repository>
<id>jbosstools</id>
<layout>p2</layout>
<url>${jbosstools-site}</url>
</repository>
<repository>
<id>jbosstools-tests</id>
<layout>p2</layout>
<url>${jbosstools-tests-site}</url>
</repository>
</repositories>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
masterpassword
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/*******************************************************************************
* Copyright (c) 2017 Red Hat Inc..
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Red Hat Incorporated - initial API and implementation
*******************************************************************************/
package com.redhat.fabric8analytics.lsp.eclipse.ui.itests;

import static org.junit.Assert.assertTrue;

import org.eclipse.reddeer.common.logging.Logger;
import org.eclipse.reddeer.junit.runner.RedDeerSuite;
import org.eclipse.reddeer.workbench.ui.dialogs.WorkbenchPreferenceDialog;
import org.junit.Test;
import org.junit.runner.RunWith;

import com.redhat.fabric8analytics.lsp.eclipse.ui.itests.pages.OpenshiftServicesPreferencePage;
import com.redhat.fabric8analytics.lsp.eclipse.ui.itests.requirements.OSIOLoginRequirement;

@RunWith(RedDeerSuite.class)
public class EnableFabric8AnalyticsLSPServerTests {

private static final Logger log = Logger.getLogger(EnableFabric8AnalyticsLSPServerTests.class);

@Test
public void enableFabric8AnalyticsLSPServerTest() {
log.info("Check if '" + OpenshiftServicesPreferencePage.CHECKBOX_LABEL + "' is checkable and proper action follows (osio login dialog shows up)");
OSIOLoginRequirement.removeAccountFromOpenShiftIOPreferencePage();
WorkbenchPreferenceDialog preferences = new WorkbenchPreferenceDialog();
preferences.open();
OpenshiftServicesPreferencePage osServicesPreferences = new OpenshiftServicesPreferencePage(preferences);
preferences.select(osServicesPreferences);

if(osServicesPreferences.isFabric8AnalyticsLSPServerEnabled()) {
osServicesPreferences.disableFabric8AnalyticsLSPServer();
}
osServicesPreferences.enableFabric8AnalyticsLSPServer();

// open preferences anew
preferences.open();
preferences.select(osServicesPreferences);

assertTrue("Fabric8Analytics LSP server chekbox in Openshift services preferences page should be checked but it is not",osServicesPreferences.isFabric8AnalyticsLSPServerEnabled());

osServicesPreferences.disableFabric8AnalyticsLSPServer();
osServicesPreferences.apply();
//TODO add check that LSP server is disabled
OSIOLoginRequirement.removeAccountFromOpenShiftIOPreferencePage();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@

@RunWith(RedDeerSuite.class)
@OSIOLogin
public class EnableFabric8AnalyticsTests {
public class EnableFabric8AnalyticsRequirementTest {

private static final Logger log = Logger.getLogger(EnableFabric8AnalyticsTests.class);
private static final Logger log = Logger.getLogger(EnableFabric8AnalyticsRequirementTest.class);

@Test
public void enableFabric8AnalyticsButtonTest() {
public void enableFabric8AnalyticsOSIOButtonTest() {
log.info("Just check if requirement is satisfied");
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*******************************************************************************
* Copyright (c) 2017 Red Hat Inc..
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Red Hat Incorporated - initial API and implementation
*******************************************************************************/
package com.redhat.fabric8analytics.lsp.eclipse.ui.itests;

import org.eclipse.reddeer.junit.runner.RedDeerSuite;
import org.junit.Test;
import org.junit.runner.RunWith;

import com.redhat.fabric8analytics.lsp.eclipse.ui.itests.requirements.ImportProjectsRequirements.ImportProjects;
import com.redhat.fabric8analytics.lsp.eclipse.ui.itests.requirements.OSIOLoginRequirement.OSIOLogin;
import com.redhat.fabric8analytics.lsp.eclipse.ui.itests.tabs.Fabric8AnalysisTab;

@RunWith(RedDeerSuite.class)
@OSIOLogin
@ImportProjects(projectsNames = { "maven-project-test-modules-with-errors" })
public class Fabric8AnalysisModuleTabWithErrorsTests extends StackAnalysesTestProjectBase {

@Test
public void validateFabric8AnalysisTabTest() {
log.info("Validating that tab can be opened for project " + getProjectName());
getProject(getProjectName()).getProjectItem("pom.xml").open();
Fabric8AnalysisTab fat = Fabric8AnalysisTab.openTab();
fat.generateStackReport();
validateResults("/maven-project-test-modules-with-errors/pom.xml", "commons-collections:commons-collections",
"ch.qos.logback:logback-core", "CVE-2015-6420", "CVE-2017-5929");
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -10,41 +10,24 @@
*******************************************************************************/
package com.redhat.fabric8analytics.lsp.eclipse.ui.itests;

import org.eclipse.reddeer.core.exception.CoreLayerException;
import org.eclipse.reddeer.eclipse.exception.EclipseLayerException;
import org.eclipse.reddeer.eclipse.ui.navigator.resources.ProjectExplorer;
import org.eclipse.reddeer.junit.runner.RedDeerSuite;
import org.eclipse.reddeer.workbench.handler.WorkbenchShellHandler;
import org.junit.AfterClass;
import org.junit.Test;
import org.junit.runner.RunWith;

import com.redhat.fabric8analytics.lsp.eclipse.ui.itests.requirements.ImportProjectsRequirements.ImportProjects;
import com.redhat.fabric8analytics.lsp.eclipse.ui.itests.requirements.OSIOLoginRequirement.OSIOLogin;
import com.redhat.fabric8analytics.lsp.eclipse.ui.itests.tabs.Fabric8Analysis;
import com.redhat.fabric8analytics.lsp.eclipse.ui.itests.tabs.Fabric8AnalysisTab;

@RunWith(RedDeerSuite.class)
@OSIOLogin
@ImportProjects
public class Fabric8AnalysisTabTests extends StackAnalysesTestProjectBase {

@Test
public void validateFabric8AnalysisTabTest() {
log.info("Validating that tab can be opened for project " + getProjectName());
getProject(getProjectName()).getProjectItem("pom.xml").open();
Fabric8Analysis.openTab();
getProject(getProjectName()).getProjectItem("/").select();
}

@AfterClass
public static void clean() {
// new ProjectExplorer().getProject(PROJECT_NAMES[0]).delete(false);
try {
new ProjectExplorer().deleteAllProjects(false);
} catch (EclipseLayerException | CoreLayerException e) {
// idk why but deletion is successfull
// e.printStackTrace();
log.info("Exception occured and ignored");
}
WorkbenchShellHandler.getInstance().closeAllNonWorbenchShells();
Fabric8AnalysisTab.openTab();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,22 @@
import org.junit.runners.Suite;

@RunWith(RedDeerSuite.class)
@Suite.SuiteClasses({ StackAnalysesContextMenuItemTests.class, Fabric8AnalysisTabTests.class,
EnableFabric8AnalyticsTests.class })
@Suite.SuiteClasses({

StackAnalysesContextMenuItemTests.class,

//needs to be first because possible caching of osio token
EnableFabric8AnalyticsLSPServerTests.class,

EnableFabric8AnalyticsRequirementTest.class,

Fabric8AnalysisTabTests.class,

StackAnalysesModuleProjectsTests.class,

Fabric8AnalysisModuleTabWithErrorsTests.class

})
public class SmokeSuite {

}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@
import org.junit.Test;
import org.junit.runner.RunWith;

import com.redhat.fabric8analytics.lsp.eclipse.ui.itests.requirements.ImportProjectsRequirements.ImportProjects;

@RunWith(RedDeerSuite.class)
@ImportProjects
public class StackAnalysesContextMenuItemTests extends StackAnalysesTestProjectBase {

private static final Logger log = Logger.getLogger(StackAnalysesContextMenuItemTests.class);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/*******************************************************************************
* Copyright (c) 2017 Red Hat Inc..
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Red Hat Incorporated - initial API and implementation
*******************************************************************************/
package com.redhat.fabric8analytics.lsp.eclipse.ui.itests;

import org.eclipse.reddeer.junit.runner.RedDeerSuite;
import org.junit.Test;
import org.junit.runner.RunWith;

import com.redhat.fabric8analytics.lsp.eclipse.ui.itests.requirements.ImportProjectsRequirements.ImportProjects;
import com.redhat.fabric8analytics.lsp.eclipse.ui.itests.requirements.OSIOLoginRequirement.OSIOLogin;

@RunWith(RedDeerSuite.class)
@OSIOLogin
@ImportProjects(projectsNames={"maven-project-test-modules"})
public class StackAnalysesModuleProjectsTests extends StackAnalysesTestProjectBase {

@Test
public void runAnalysesForMainProjectTest() {
log.info("Validate that project with modules is imported, stack analyses is running and has propper results");
runStackAnalyses("maven-project-test-modules", "/");
validateResults("/maven-project-test-modules/pom.xml", "/maven-project-test-modules/module-1/pom.xml",
"/maven-project-test-modules/module-2/pom.xml");
}

@Test
public void runAnalysesForModule1Test() {
log.info(
"Validate that project with modules is imported, stack analyses is running and has propper results for module-1");
// project module name is 'maven-project-test-modules-module-1'
runStackAnalyses("maven-project-test-modules-module-1", "/");
validateResults("/maven-project-test-modules-module-1/pom.xml");
}

@Test
public void runAnalysesForModule2Test() {
log.info(
"Validate that project with modules is imported, stack analyses is running and has propper results for module-2");
// project module name is 'maven-project-test-modules-module-2'
runStackAnalyses("maven-project-test-modules-module-2", "/");
validateResults("/maven-project-test-modules-module-2/pom.xml");
}

}
Loading

0 comments on commit 6fb8ca3

Please sign in to comment.