Skip to content

Commit 6fb8ca3

Browse files
vprusarawagner
authored andcommitted
Added browser view tests, refactoring, added securestorage password
1 parent 947d025 commit 6fb8ca3

19 files changed

+724
-141
lines changed

tests/com.redhat.fabric8analytics.lsp.eclipse.ui.itests/META-INF/MANIFEST.MF

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ Bundle-Vendor: JBoss by Red Hat
88
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
99
Require-Bundle: org.eclipse.reddeer.go;bundle-version="2.0.0",
1010
org.junit;bundle-version="4.8.2",
11+
org.eclipse.lsp4e,
1112
org.eclipse.core.resources,
1213
org.eclipse.m2e.core.ui,
1314
org.eclipse.m2e.lifecyclemapping.defaults,

tests/com.redhat.fabric8analytics.lsp.eclipse.ui.itests/pom.xml

Lines changed: 52 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
34
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
45
<modelVersion>4.0.0</modelVersion>
56
<parent>
@@ -14,10 +15,14 @@
1415
<properties>
1516
<test.suite>com.redhat.fabric8analytics.lsp.eclipse.ui.itests</test.suite>
1617
<test.class>com.redhat.fabric8analytics.lsp.eclipse.ui.itests.SmokeSuite</test.class>
18+
<systemProperties>${integrationTestsSystemProperties}</systemProperties>
19+
<integrationTestsSystemProperties>-DOSusername=${OSusername} -DOSpassword=${OSpassword} -DOSLoginProvider=${OSLoginProvider} -Dfabric8analytics.tests.usePersistantWorkspace=${fabric8analytics.tests.usePersistantWorkspace}</integrationTestsSystemProperties>
20+
<!-- <OSusername>${OSusername}</OSusername> <OSpassword>${OSpassword}</OSpassword>
21+
<OSLoginProvider>${OSLoginProvider}</OSLoginProvider> -->
22+
<jbosstools-site>http://download.jboss.org/jbosstools/${eclipseReleaseName}/snapshots/updates/core/${stream_jbt}/</jbosstools-site>
23+
<jbosstools-tests-site>http://download.jboss.org/jbosstools/${eclipseReleaseName}/snapshots/updates/coretests/${stream_jbt}/</jbosstools-tests-site>
1724
</properties>
1825

19-
20-
2126
<profiles>
2227
<profile>
2328
<id>SmokeSuite</id>
@@ -38,6 +43,36 @@
3843
</plugins>
3944
</build>
4045
</profile>
46+
<profile>
47+
<id>SmokeSuite-prsistantWorkspace</id>
48+
<properties>
49+
<test.class>com.redhat.fabric8analytics.lsp.eclipse.ui.itests.SmokeSuite</test.class>
50+
</properties>
51+
<build>
52+
<plugins>
53+
<plugin>
54+
<groupId>org.eclipse.tycho</groupId>
55+
<artifactId>target-platform-configuration</artifactId>
56+
<configuration>
57+
<useUIThread>false</useUIThread>
58+
<testClass>${test.class}</testClass>
59+
<testSuite>${test.suite}</testSuite>
60+
</configuration>
61+
</plugin>
62+
<plugin>
63+
<groupId>org.eclipse.tycho</groupId>
64+
<artifactId>tycho-surefire-plugin</artifactId>
65+
<configuration>
66+
<appArgLine>-eclipse.password ${project.basedir}/resources/securepass -data ${fabric8analytics.tests.usePersistantWorkspace}</appArgLine>
67+
<skip>${skipITests}</skip>
68+
<useUIThread>false</useUIThread>
69+
<testClass>${test.class}</testClass>
70+
<testSuite>${test.suite}</testSuite>
71+
</configuration>
72+
</plugin>
73+
</plugins>
74+
</build>
75+
</profile>
4176
</profiles>
4277
<build>
4378
<resources>
@@ -54,6 +89,7 @@
5489
<groupId>org.eclipse.tycho</groupId>
5590
<artifactId>tycho-surefire-plugin</artifactId>
5691
<configuration>
92+
<appArgLine>-eclipse.password ${project.basedir}/resources/securepass</appArgLine>
5793
<skip>${skipITests}</skip>
5894
<useUIThread>false</useUIThread>
5995
<testClass>${test.class}</testClass>
@@ -62,4 +98,17 @@
6298
</plugin>
6399
</plugins>
64100
</build>
101+
102+
<repositories>
103+
<repository>
104+
<id>jbosstools</id>
105+
<layout>p2</layout>
106+
<url>${jbosstools-site}</url>
107+
</repository>
108+
<repository>
109+
<id>jbosstools-tests</id>
110+
<layout>p2</layout>
111+
<url>${jbosstools-tests-site}</url>
112+
</repository>
113+
</repositories>
65114
</project>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
masterpassword
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
/*******************************************************************************
2+
* Copyright (c) 2017 Red Hat Inc..
3+
* All rights reserved. This program and the accompanying materials
4+
* are made available under the terms of the Eclipse Public License v1.0
5+
* which accompanies this distribution, and is available at
6+
* http://www.eclipse.org/legal/epl-v10.html
7+
*
8+
* Contributors:
9+
* Red Hat Incorporated - initial API and implementation
10+
*******************************************************************************/
11+
package com.redhat.fabric8analytics.lsp.eclipse.ui.itests;
12+
13+
import static org.junit.Assert.assertTrue;
14+
15+
import org.eclipse.reddeer.common.logging.Logger;
16+
import org.eclipse.reddeer.junit.runner.RedDeerSuite;
17+
import org.eclipse.reddeer.workbench.ui.dialogs.WorkbenchPreferenceDialog;
18+
import org.junit.Test;
19+
import org.junit.runner.RunWith;
20+
21+
import com.redhat.fabric8analytics.lsp.eclipse.ui.itests.pages.OpenshiftServicesPreferencePage;
22+
import com.redhat.fabric8analytics.lsp.eclipse.ui.itests.requirements.OSIOLoginRequirement;
23+
24+
@RunWith(RedDeerSuite.class)
25+
public class EnableFabric8AnalyticsLSPServerTests {
26+
27+
private static final Logger log = Logger.getLogger(EnableFabric8AnalyticsLSPServerTests.class);
28+
29+
@Test
30+
public void enableFabric8AnalyticsLSPServerTest() {
31+
log.info("Check if '" + OpenshiftServicesPreferencePage.CHECKBOX_LABEL + "' is checkable and proper action follows (osio login dialog shows up)");
32+
OSIOLoginRequirement.removeAccountFromOpenShiftIOPreferencePage();
33+
WorkbenchPreferenceDialog preferences = new WorkbenchPreferenceDialog();
34+
preferences.open();
35+
OpenshiftServicesPreferencePage osServicesPreferences = new OpenshiftServicesPreferencePage(preferences);
36+
preferences.select(osServicesPreferences);
37+
38+
if(osServicesPreferences.isFabric8AnalyticsLSPServerEnabled()) {
39+
osServicesPreferences.disableFabric8AnalyticsLSPServer();
40+
}
41+
osServicesPreferences.enableFabric8AnalyticsLSPServer();
42+
43+
// open preferences anew
44+
preferences.open();
45+
preferences.select(osServicesPreferences);
46+
47+
assertTrue("Fabric8Analytics LSP server chekbox in Openshift services preferences page should be checked but it is not",osServicesPreferences.isFabric8AnalyticsLSPServerEnabled());
48+
49+
osServicesPreferences.disableFabric8AnalyticsLSPServer();
50+
osServicesPreferences.apply();
51+
//TODO add check that LSP server is disabled
52+
OSIOLoginRequirement.removeAccountFromOpenShiftIOPreferencePage();
53+
}
54+
55+
}
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@
1919

2020
@RunWith(RedDeerSuite.class)
2121
@OSIOLogin
22-
public class EnableFabric8AnalyticsTests {
22+
public class EnableFabric8AnalyticsRequirementTest {
2323

24-
private static final Logger log = Logger.getLogger(EnableFabric8AnalyticsTests.class);
24+
private static final Logger log = Logger.getLogger(EnableFabric8AnalyticsRequirementTest.class);
2525

2626
@Test
27-
public void enableFabric8AnalyticsButtonTest() {
27+
public void enableFabric8AnalyticsOSIOButtonTest() {
2828
log.info("Just check if requirement is satisfied");
2929
}
3030

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/*******************************************************************************
2+
* Copyright (c) 2017 Red Hat Inc..
3+
* All rights reserved. This program and the accompanying materials
4+
* are made available under the terms of the Eclipse Public License v1.0
5+
* which accompanies this distribution, and is available at
6+
* http://www.eclipse.org/legal/epl-v10.html
7+
*
8+
* Contributors:
9+
* Red Hat Incorporated - initial API and implementation
10+
*******************************************************************************/
11+
package com.redhat.fabric8analytics.lsp.eclipse.ui.itests;
12+
13+
import org.eclipse.reddeer.junit.runner.RedDeerSuite;
14+
import org.junit.Test;
15+
import org.junit.runner.RunWith;
16+
17+
import com.redhat.fabric8analytics.lsp.eclipse.ui.itests.requirements.ImportProjectsRequirements.ImportProjects;
18+
import com.redhat.fabric8analytics.lsp.eclipse.ui.itests.requirements.OSIOLoginRequirement.OSIOLogin;
19+
import com.redhat.fabric8analytics.lsp.eclipse.ui.itests.tabs.Fabric8AnalysisTab;
20+
21+
@RunWith(RedDeerSuite.class)
22+
@OSIOLogin
23+
@ImportProjects(projectsNames = { "maven-project-test-modules-with-errors" })
24+
public class Fabric8AnalysisModuleTabWithErrorsTests extends StackAnalysesTestProjectBase {
25+
26+
@Test
27+
public void validateFabric8AnalysisTabTest() {
28+
log.info("Validating that tab can be opened for project " + getProjectName());
29+
getProject(getProjectName()).getProjectItem("pom.xml").open();
30+
Fabric8AnalysisTab fat = Fabric8AnalysisTab.openTab();
31+
fat.generateStackReport();
32+
validateResults("/maven-project-test-modules-with-errors/pom.xml", "commons-collections:commons-collections",
33+
"ch.qos.logback:logback-core", "CVE-2015-6420", "CVE-2017-5929");
34+
}
35+
36+
}

tests/com.redhat.fabric8analytics.lsp.eclipse.ui.itests/src/com/redhat/fabric8analytics/lsp/eclipse/ui/itests/Fabric8AnalysisTabTests.java

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -10,41 +10,24 @@
1010
*******************************************************************************/
1111
package com.redhat.fabric8analytics.lsp.eclipse.ui.itests;
1212

13-
import org.eclipse.reddeer.core.exception.CoreLayerException;
14-
import org.eclipse.reddeer.eclipse.exception.EclipseLayerException;
15-
import org.eclipse.reddeer.eclipse.ui.navigator.resources.ProjectExplorer;
1613
import org.eclipse.reddeer.junit.runner.RedDeerSuite;
17-
import org.eclipse.reddeer.workbench.handler.WorkbenchShellHandler;
18-
import org.junit.AfterClass;
1914
import org.junit.Test;
2015
import org.junit.runner.RunWith;
2116

17+
import com.redhat.fabric8analytics.lsp.eclipse.ui.itests.requirements.ImportProjectsRequirements.ImportProjects;
2218
import com.redhat.fabric8analytics.lsp.eclipse.ui.itests.requirements.OSIOLoginRequirement.OSIOLogin;
23-
import com.redhat.fabric8analytics.lsp.eclipse.ui.itests.tabs.Fabric8Analysis;
19+
import com.redhat.fabric8analytics.lsp.eclipse.ui.itests.tabs.Fabric8AnalysisTab;
2420

2521
@RunWith(RedDeerSuite.class)
2622
@OSIOLogin
23+
@ImportProjects
2724
public class Fabric8AnalysisTabTests extends StackAnalysesTestProjectBase {
2825

2926
@Test
3027
public void validateFabric8AnalysisTabTest() {
3128
log.info("Validating that tab can be opened for project " + getProjectName());
3229
getProject(getProjectName()).getProjectItem("pom.xml").open();
33-
Fabric8Analysis.openTab();
34-
getProject(getProjectName()).getProjectItem("/").select();
35-
}
36-
37-
@AfterClass
38-
public static void clean() {
39-
// new ProjectExplorer().getProject(PROJECT_NAMES[0]).delete(false);
40-
try {
41-
new ProjectExplorer().deleteAllProjects(false);
42-
} catch (EclipseLayerException | CoreLayerException e) {
43-
// idk why but deletion is successfull
44-
// e.printStackTrace();
45-
log.info("Exception occured and ignored");
46-
}
47-
WorkbenchShellHandler.getInstance().closeAllNonWorbenchShells();
30+
Fabric8AnalysisTab.openTab();
4831
}
4932

5033
}

tests/com.redhat.fabric8analytics.lsp.eclipse.ui.itests/src/com/redhat/fabric8analytics/lsp/eclipse/ui/itests/SmokeSuite.java

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,22 @@
1515
import org.junit.runners.Suite;
1616

1717
@RunWith(RedDeerSuite.class)
18-
@Suite.SuiteClasses({ StackAnalysesContextMenuItemTests.class, Fabric8AnalysisTabTests.class,
19-
EnableFabric8AnalyticsTests.class })
18+
@Suite.SuiteClasses({
19+
20+
StackAnalysesContextMenuItemTests.class,
21+
22+
//needs to be first because possible caching of osio token
23+
EnableFabric8AnalyticsLSPServerTests.class,
24+
25+
EnableFabric8AnalyticsRequirementTest.class,
26+
27+
Fabric8AnalysisTabTests.class,
28+
29+
StackAnalysesModuleProjectsTests.class,
30+
31+
Fabric8AnalysisModuleTabWithErrorsTests.class
32+
33+
})
2034
public class SmokeSuite {
2135

2236
}

tests/com.redhat.fabric8analytics.lsp.eclipse.ui.itests/src/com/redhat/fabric8analytics/lsp/eclipse/ui/itests/StackAnalysesContextMenuItemTests.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,10 @@
2020
import org.junit.Test;
2121
import org.junit.runner.RunWith;
2222

23+
import com.redhat.fabric8analytics.lsp.eclipse.ui.itests.requirements.ImportProjectsRequirements.ImportProjects;
24+
2325
@RunWith(RedDeerSuite.class)
26+
@ImportProjects
2427
public class StackAnalysesContextMenuItemTests extends StackAnalysesTestProjectBase {
2528

2629
private static final Logger log = Logger.getLogger(StackAnalysesContextMenuItemTests.class);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
/*******************************************************************************
2+
* Copyright (c) 2017 Red Hat Inc..
3+
* All rights reserved. This program and the accompanying materials
4+
* are made available under the terms of the Eclipse Public License v1.0
5+
* which accompanies this distribution, and is available at
6+
* http://www.eclipse.org/legal/epl-v10.html
7+
*
8+
* Contributors:
9+
* Red Hat Incorporated - initial API and implementation
10+
*******************************************************************************/
11+
package com.redhat.fabric8analytics.lsp.eclipse.ui.itests;
12+
13+
import org.eclipse.reddeer.junit.runner.RedDeerSuite;
14+
import org.junit.Test;
15+
import org.junit.runner.RunWith;
16+
17+
import com.redhat.fabric8analytics.lsp.eclipse.ui.itests.requirements.ImportProjectsRequirements.ImportProjects;
18+
import com.redhat.fabric8analytics.lsp.eclipse.ui.itests.requirements.OSIOLoginRequirement.OSIOLogin;
19+
20+
@RunWith(RedDeerSuite.class)
21+
@OSIOLogin
22+
@ImportProjects(projectsNames={"maven-project-test-modules"})
23+
public class StackAnalysesModuleProjectsTests extends StackAnalysesTestProjectBase {
24+
25+
@Test
26+
public void runAnalysesForMainProjectTest() {
27+
log.info("Validate that project with modules is imported, stack analyses is running and has propper results");
28+
runStackAnalyses("maven-project-test-modules", "/");
29+
validateResults("/maven-project-test-modules/pom.xml", "/maven-project-test-modules/module-1/pom.xml",
30+
"/maven-project-test-modules/module-2/pom.xml");
31+
}
32+
33+
@Test
34+
public void runAnalysesForModule1Test() {
35+
log.info(
36+
"Validate that project with modules is imported, stack analyses is running and has propper results for module-1");
37+
// project module name is 'maven-project-test-modules-module-1'
38+
runStackAnalyses("maven-project-test-modules-module-1", "/");
39+
validateResults("/maven-project-test-modules-module-1/pom.xml");
40+
}
41+
42+
@Test
43+
public void runAnalysesForModule2Test() {
44+
log.info(
45+
"Validate that project with modules is imported, stack analyses is running and has propper results for module-2");
46+
// project module name is 'maven-project-test-modules-module-2'
47+
runStackAnalyses("maven-project-test-modules-module-2", "/");
48+
validateResults("/maven-project-test-modules-module-2/pom.xml");
49+
}
50+
51+
}

0 commit comments

Comments
 (0)