diff options
author | Grégoire Aubert <gregoire.aubert@sonarsource.com> | 2017-10-25 11:05:06 +0200 |
---|---|---|
committer | Grégoire Aubert <gregoire.aubert@sonarsource.com> | 2017-10-25 14:28:47 +0200 |
commit | 83c615c8afe8ceb63ccac52858da14afec6b36f0 (patch) | |
tree | 0b60af9b20332ce01d61efb6925f3be48ff67721 | |
parent | 37a16f673702a7475766338feac6f235ff513509 (diff) | |
download | sonarqube-83c615c8afe8ceb63ccac52858da14afec6b36f0.tar.gz sonarqube-83c615c8afe8ceb63ccac52858da14afec6b36f0.zip |
Add marketplace IT to check installed plugins
-rw-r--r-- | tests/src/test/java/org/sonarqube/pageobjects/MarketplacePage.java | 63 | ||||
-rw-r--r-- | tests/src/test/java/org/sonarqube/pageobjects/Navigation.java | 2 | ||||
-rw-r--r-- | tests/src/test/java/org/sonarqube/tests/Category5Suite.java | 2 | ||||
-rw-r--r-- | tests/src/test/java/org/sonarqube/tests/marketplace/UpdateCenterTest.java (renamed from tests/src/test/java/org/sonarqube/tests/updateCenter/UpdateCenterTest.java) | 31 | ||||
-rw-r--r-- | tests/src/test/resources/marketplace/UpdateCenterTest/update-center.properties (renamed from tests/src/test/resources/updateCenter/UpdateCenterTest/update-center.properties) | 0 | ||||
-rw-r--r-- | tests/src/test/resources/updateCenter/installed-plugins.html | 60 |
6 files changed, 89 insertions, 69 deletions
diff --git a/tests/src/test/java/org/sonarqube/pageobjects/MarketplacePage.java b/tests/src/test/java/org/sonarqube/pageobjects/MarketplacePage.java new file mode 100644 index 00000000000..8e69c92e795 --- /dev/null +++ b/tests/src/test/java/org/sonarqube/pageobjects/MarketplacePage.java @@ -0,0 +1,63 @@ +/* + * SonarQube + * Copyright (C) 2009-2017 SonarSource SA + * mailto:info AT sonarsource DOT com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +package org.sonarqube.pageobjects; + +import com.codeborne.selenide.Condition; +import com.codeborne.selenide.SelenideElement; +import org.yaml.snakeyaml.error.Mark; + +import static com.codeborne.selenide.Selenide.$; +import static com.codeborne.selenide.Selenide.$$; + +public class MarketplacePage { + + public MarketplacePage() { + $("#marketplace-page").should(Condition.exist); + } + + public MarketplacePage hasPendingPlugins(String text) { + $(".js-pending").should(Condition.exist).shouldHave(Condition.text(text)); + return this; + } + + public MarketplacePage hasPluginsCount(int count) { + $$("#marketplace-plugins>ul>li").shouldHaveSize(count); + return this; + } + + public MarketplacePage hasPluginWithText(String name, String text) { + getPlugin(name).shouldHave(Condition.text(text)); + return this; + } + + public MarketplacePage searchPlugin(String search) { + $("#marketplace-search input.search-box-input").should(Condition.exist).sendKeys(search); + return this; + } + + public MarketplacePage uninstallPlugin(String name) { + getPlugin(name).$("button.js-uninstall").click(); + return this; + } + + private SelenideElement getPlugin(String name) { + return $$(".js-plugin-name").findBy(Condition.text(name)).should(Condition.exist).parent().parent().parent(); + } +} diff --git a/tests/src/test/java/org/sonarqube/pageobjects/Navigation.java b/tests/src/test/java/org/sonarqube/pageobjects/Navigation.java index 4dccfb77721..546d420b6d0 100644 --- a/tests/src/test/java/org/sonarqube/pageobjects/Navigation.java +++ b/tests/src/test/java/org/sonarqube/pageobjects/Navigation.java @@ -169,6 +169,8 @@ public class Navigation { return open("/admin/system", SystemInfoPage.class); } + public MarketplacePage openMarketplace() { return open("/admin/marketplace", MarketplacePage.class);} + public NotificationsPage openNotifications() { return open("/account/notifications", NotificationsPage.class); } diff --git a/tests/src/test/java/org/sonarqube/tests/Category5Suite.java b/tests/src/test/java/org/sonarqube/tests/Category5Suite.java index 13e6c3d9921..e2a7d70a964 100644 --- a/tests/src/test/java/org/sonarqube/tests/Category5Suite.java +++ b/tests/src/test/java/org/sonarqube/tests/Category5Suite.java @@ -37,7 +37,7 @@ import org.sonarqube.tests.settings.SettingsTestRestartingOrchestrator; import org.sonarqube.tests.startup.StartupIndexationTest; import org.sonarqube.tests.telemetry.TelemetryOptOutTest; import org.sonarqube.tests.telemetry.TelemetryUploadTest; -import org.sonarqube.tests.updateCenter.UpdateCenterTest; +import org.sonarqube.tests.marketplace.UpdateCenterTest; import org.sonarqube.tests.user.OnboardingTest; import org.sonarqube.tests.user.RealmAuthenticationTest; import org.sonarqube.tests.user.SsoAuthenticationTest; diff --git a/tests/src/test/java/org/sonarqube/tests/updateCenter/UpdateCenterTest.java b/tests/src/test/java/org/sonarqube/tests/marketplace/UpdateCenterTest.java index f3d8d1097b6..220be947dcd 100644 --- a/tests/src/test/java/org/sonarqube/tests/updateCenter/UpdateCenterTest.java +++ b/tests/src/test/java/org/sonarqube/tests/marketplace/UpdateCenterTest.java @@ -17,18 +17,18 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package org.sonarqube.tests.updateCenter; +package org.sonarqube.tests.marketplace; import com.sonar.orchestrator.Orchestrator; import org.junit.After; import org.junit.ClassRule; -import org.junit.Ignore; import org.junit.Rule; import org.junit.Test; +import org.sonarqube.pageobjects.MarketplacePage; +import org.sonarqube.pageobjects.Navigation; import util.user.UserRule; import static util.ItUtils.pluginArtifact; -import static util.selenium.Selenese.runSelenese; /** * This class start its own orchestrator @@ -37,21 +37,36 @@ public class UpdateCenterTest { @ClassRule public static final Orchestrator orchestrator = Orchestrator.builderEnv() - .setServerProperty("sonar.updatecenter.url", UpdateCenterTest.class.getResource("/updateCenter/UpdateCenterTest/update-center.properties").toString()) + .setServerProperty("sonar.updatecenter.url", UpdateCenterTest.class.getResource("/marketplace/UpdateCenterTest/update-center.properties").toString()) .addPlugin(pluginArtifact("sonar-fake-plugin")) .build(); + @Rule public UserRule userRule = UserRule.from(orchestrator); + private Navigation nav = Navigation.create(orchestrator); + @After public void tearDown() throws Exception { userRule.resetUsers(); } - @Ignore @Test - public void test_console() { - runSelenese(orchestrator, "/updateCenter/installed-plugins.html"); - } + public void test_updatecenter_installed_plugins() { + MarketplacePage page = nav.logIn().submitCredentials(userRule.createAdminUser()).openMarketplace(); + page + .hasPluginsCount(2) + .hasPluginWithText("Fake","installed") + .hasPluginWithText("Fake","Uninstall") + .hasPluginWithText("Fake","Licensed under GNU LGPL 3") + .hasPluginWithText("Fake","Developed by SonarSource"); + page + .searchPlugin("fa") + .hasPluginsCount(1); + + page + .uninstallPlugin("Fake") + .hasPendingPlugins("uninstall 1"); + } } diff --git a/tests/src/test/resources/updateCenter/UpdateCenterTest/update-center.properties b/tests/src/test/resources/marketplace/UpdateCenterTest/update-center.properties index 5882d43188f..5882d43188f 100644 --- a/tests/src/test/resources/updateCenter/UpdateCenterTest/update-center.properties +++ b/tests/src/test/resources/marketplace/UpdateCenterTest/update-center.properties diff --git a/tests/src/test/resources/updateCenter/installed-plugins.html b/tests/src/test/resources/updateCenter/installed-plugins.html deleted file mode 100644 index 8b3576a0b78..00000000000 --- a/tests/src/test/resources/updateCenter/installed-plugins.html +++ /dev/null @@ -1,60 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> -<head profile="http://selenium-ide.openqa.org/profiles/test-case"> - <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> - <title>installed-plugins</title> -</head> -<body> -<table cellpadding="1" cellspacing="1" border="1"> - <tbody> - - <tr> - <td>open</td> - <td>/sessions/login</td> - <td></td> - </tr> - <tr> - <td>waitForElementPresent</td> - <td>commit</td> - <td></td> - </tr> - <tr> - <td>type</td> - <td>login</td> - <td>admin</td> - </tr> - <tr> - <td>type</td> - <td>password</td> - <td>admin</td> - </tr> - <tr> - <td>clickAndWait</td> - <td>commit</td> - <td></td> - </tr> - <tr> - <td>waitForElementPresent</td> - <td>css=.js-user-authenticated</td> - <td></td> - </tr> - <tr> - <td>open</td> - <td>/updatecenter</td> - <td></td> - </tr> - <tr> - <td>waitForText</td> - <td>content</td> - <td>*Fake*</td> - </tr> - <tr> - <td>waitForText</td> - <td>id=update-center-plugins</td> - <td>*Fake*1.0-SNAPSHOT*</td> - </tr> - </tbody> -</table> -</body> -</html> |