]> source.dussan.org Git - sonarqube.git/commitdiff
Add marketplace IT to check installed plugins
authorGrégoire Aubert <gregoire.aubert@sonarsource.com>
Wed, 25 Oct 2017 09:05:06 +0000 (11:05 +0200)
committerGrégoire Aubert <gregoire.aubert@sonarsource.com>
Wed, 25 Oct 2017 12:28:47 +0000 (14:28 +0200)
tests/src/test/java/org/sonarqube/pageobjects/MarketplacePage.java [new file with mode: 0644]
tests/src/test/java/org/sonarqube/pageobjects/Navigation.java
tests/src/test/java/org/sonarqube/tests/Category5Suite.java
tests/src/test/java/org/sonarqube/tests/marketplace/UpdateCenterTest.java [new file with mode: 0644]
tests/src/test/java/org/sonarqube/tests/updateCenter/UpdateCenterTest.java [deleted file]
tests/src/test/resources/marketplace/UpdateCenterTest/update-center.properties [new file with mode: 0644]
tests/src/test/resources/updateCenter/UpdateCenterTest/update-center.properties [deleted file]
tests/src/test/resources/updateCenter/installed-plugins.html [deleted file]

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 (file)
index 0000000..8e69c92
--- /dev/null
@@ -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();
+  }
+}
index 4dccfb777216c1f35ef09b279fffe308f58fd962..546d420b6d04336df45039939c0c3260fb3f8b46 100644 (file)
@@ -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);
   }
index 13e6c3d99216d740211491bed5e6c6242b981715..e2a7d70a964fc39e5b790f8b1ed31e0b0a493643 100644 (file)
@@ -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/marketplace/UpdateCenterTest.java b/tests/src/test/java/org/sonarqube/tests/marketplace/UpdateCenterTest.java
new file mode 100644 (file)
index 0000000..220be94
--- /dev/null
@@ -0,0 +1,72 @@
+/*
+ * 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.tests.marketplace;
+
+import com.sonar.orchestrator.Orchestrator;
+import org.junit.After;
+import org.junit.ClassRule;
+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;
+
+/**
+ * This class start its own orchestrator
+ */
+public class UpdateCenterTest {
+
+  @ClassRule
+  public static final Orchestrator orchestrator = Orchestrator.builderEnv()
+    .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();
+  }
+
+  @Test
+  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/java/org/sonarqube/tests/updateCenter/UpdateCenterTest.java b/tests/src/test/java/org/sonarqube/tests/updateCenter/UpdateCenterTest.java
deleted file mode 100644 (file)
index f3d8d10..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * 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.tests.updateCenter;
-
-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 util.user.UserRule;
-
-import static util.ItUtils.pluginArtifact;
-import static util.selenium.Selenese.runSelenese;
-
-/**
- * This class start its own orchestrator
- */
-public class UpdateCenterTest {
-
-  @ClassRule
-  public static final Orchestrator orchestrator = Orchestrator.builderEnv()
-    .setServerProperty("sonar.updatecenter.url", UpdateCenterTest.class.getResource("/updateCenter/UpdateCenterTest/update-center.properties").toString())
-    .addPlugin(pluginArtifact("sonar-fake-plugin"))
-    .build();
-  @Rule
-  public UserRule userRule = UserRule.from(orchestrator);
-
-  @After
-  public void tearDown() throws Exception {
-    userRule.resetUsers();
-  }
-
-  @Ignore
-  @Test
-  public void test_console() {
-    runSelenese(orchestrator, "/updateCenter/installed-plugins.html");
-  }
-
-}
diff --git a/tests/src/test/resources/marketplace/UpdateCenterTest/update-center.properties b/tests/src/test/resources/marketplace/UpdateCenterTest/update-center.properties
new file mode 100644 (file)
index 0000000..5882d43
--- /dev/null
@@ -0,0 +1,62 @@
+# THIS FILE IS USED BY THE UPDATE CENTER
+# DO NOT REMOVE OR RENAME
+#
+# Note : prefix all : by \
+#
+
+publicVersions=3.0,100.0
+
+3.0.description=Encryption of database password, TimeMachine available as widgets, New algorithm for tracking violations, 40 bugs and 40 improvements
+3.0.downloadUrl=http\://dist.sonar.codehaus.org/sonar-3.0.zip
+3.0.changelogUrl=http\://www.sonarsource.org/downloads/#3.0
+3.0.date=2012-04-17
+
+100.0.description=Hundred dot zero!
+100.0.downloadUrl=http\://dist.sonar.codehaus.org/sonar-100.0.zip
+100.0.changelogUrl=http\://www.sonarsource.org/downloads/#100.0
+100.0.date=2112-06-13
+
+
+plugins=fake,abap
+
+#--------------------------------------------------------------------------------------------------------------------------
+abap.homepageUrl=http\://www.sonarsource.com/products/plugins/languages/abap/
+abap.name=ABAP
+abap.category=Additional Languages
+abap.publicVersions=1.0,1.0.1,1.1,2.0.1
+
+abap.1.0.description=Initial version of the product
+abap.1.0.sqVersions=2.7,2.8,2.9,2.10,2.11,2.12,2.13,2.13.1,2.14,3.0,3.0.1,3.1,3.1.1
+abap.1.0.downloadUrl=
+abap.1.0.date=2011-07-29
+
+abap.1.0.1.description=Adjust computation of certain metrics
+abap.1.0.1.sqVersions=2.7,2.8,2.9,2.10,2.11,2.12,2.13,2.13.1,2.14,3.0,3.0.1,3.1,3.1.1
+abap.1.0.1.downloadUrl=
+abap.1.0.1.date=2011-08-28
+
+abap.1.1.description=Adjust computation of certain metrics
+abap.1.1.sqVersions=2.7,2.8,2.9,2.10,2.11,2.12,2.13,2.13.1,2.14,3.0,3.0.1,3.1,3.1.1
+abap.1.1.downloadUrl=
+abap.1.1.date=2012-01-05
+
+abap.2.0.1.description=This new version provides an ABAP source code extractor, adds 5 new rules and improves others
+abap.2.0.1.sqVersions=3.2,3.3,3.4,3.5,3.6,3.7,3.7.1,3.7.2,3.7.3,3.7.4,3.7.5,3.7.6,3.7.7,4.0,4.0.1,4.1,4.2,4.3,4.4,4.5,4.6,4.7,5.0,5.1,5.2,5.3,5.4,5.5,5.6,5.7,6.0,6.1,6.2,6.3,6.4,6.5,6.6
+abap.2.0.1.downloadUrl=
+abap.2.0.1.date=2012-06-25
+
+#--------------------------------------------------------------------------------------------------------------------------
+fake.category=Additional Metrics
+fake.publicVersions=1.0,1.1
+fake.name=Fake
+fake.description=Fake plugin for integration tests
+
+fake.1.0.description=Initial release
+fake.1.0.sqVersions=3.2,3.3,3.4,3.5,3.6,3.7
+fake.1.0.downloadUrl=
+fake.1.0.date=2011-05-06
+
+fake.1.1.description=Support sonarqube v100.0
+fake.1.1.sqVersions=3.2,3.3,3.4,3.5,3.6,3.7,3.7.1,3.7.2,3.7.3,3.7.4,3.7.5,3.7.6,3.7.7,4.0,4.0.1,4.1,4.2,4.3,4.4,4.5,4.6,4.7,5.0,5.1,5.2,5.3,5.4,5.5,5.6,5.7,6.0,6.1,6.2,6.3,6.4,6.5,6.6,100.0
+fake.1.1.downloadUrl=
+fake.1.1.date=2012-04-27
diff --git a/tests/src/test/resources/updateCenter/UpdateCenterTest/update-center.properties b/tests/src/test/resources/updateCenter/UpdateCenterTest/update-center.properties
deleted file mode 100644 (file)
index 5882d43..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-# THIS FILE IS USED BY THE UPDATE CENTER
-# DO NOT REMOVE OR RENAME
-#
-# Note : prefix all : by \
-#
-
-publicVersions=3.0,100.0
-
-3.0.description=Encryption of database password, TimeMachine available as widgets, New algorithm for tracking violations, 40 bugs and 40 improvements
-3.0.downloadUrl=http\://dist.sonar.codehaus.org/sonar-3.0.zip
-3.0.changelogUrl=http\://www.sonarsource.org/downloads/#3.0
-3.0.date=2012-04-17
-
-100.0.description=Hundred dot zero!
-100.0.downloadUrl=http\://dist.sonar.codehaus.org/sonar-100.0.zip
-100.0.changelogUrl=http\://www.sonarsource.org/downloads/#100.0
-100.0.date=2112-06-13
-
-
-plugins=fake,abap
-
-#--------------------------------------------------------------------------------------------------------------------------
-abap.homepageUrl=http\://www.sonarsource.com/products/plugins/languages/abap/
-abap.name=ABAP
-abap.category=Additional Languages
-abap.publicVersions=1.0,1.0.1,1.1,2.0.1
-
-abap.1.0.description=Initial version of the product
-abap.1.0.sqVersions=2.7,2.8,2.9,2.10,2.11,2.12,2.13,2.13.1,2.14,3.0,3.0.1,3.1,3.1.1
-abap.1.0.downloadUrl=
-abap.1.0.date=2011-07-29
-
-abap.1.0.1.description=Adjust computation of certain metrics
-abap.1.0.1.sqVersions=2.7,2.8,2.9,2.10,2.11,2.12,2.13,2.13.1,2.14,3.0,3.0.1,3.1,3.1.1
-abap.1.0.1.downloadUrl=
-abap.1.0.1.date=2011-08-28
-
-abap.1.1.description=Adjust computation of certain metrics
-abap.1.1.sqVersions=2.7,2.8,2.9,2.10,2.11,2.12,2.13,2.13.1,2.14,3.0,3.0.1,3.1,3.1.1
-abap.1.1.downloadUrl=
-abap.1.1.date=2012-01-05
-
-abap.2.0.1.description=This new version provides an ABAP source code extractor, adds 5 new rules and improves others
-abap.2.0.1.sqVersions=3.2,3.3,3.4,3.5,3.6,3.7,3.7.1,3.7.2,3.7.3,3.7.4,3.7.5,3.7.6,3.7.7,4.0,4.0.1,4.1,4.2,4.3,4.4,4.5,4.6,4.7,5.0,5.1,5.2,5.3,5.4,5.5,5.6,5.7,6.0,6.1,6.2,6.3,6.4,6.5,6.6
-abap.2.0.1.downloadUrl=
-abap.2.0.1.date=2012-06-25
-
-#--------------------------------------------------------------------------------------------------------------------------
-fake.category=Additional Metrics
-fake.publicVersions=1.0,1.1
-fake.name=Fake
-fake.description=Fake plugin for integration tests
-
-fake.1.0.description=Initial release
-fake.1.0.sqVersions=3.2,3.3,3.4,3.5,3.6,3.7
-fake.1.0.downloadUrl=
-fake.1.0.date=2011-05-06
-
-fake.1.1.description=Support sonarqube v100.0
-fake.1.1.sqVersions=3.2,3.3,3.4,3.5,3.6,3.7,3.7.1,3.7.2,3.7.3,3.7.4,3.7.5,3.7.6,3.7.7,4.0,4.0.1,4.1,4.2,4.3,4.4,4.5,4.6,4.7,5.0,5.1,5.2,5.3,5.4,5.5,5.6,5.7,6.0,6.1,6.2,6.3,6.4,6.5,6.6,100.0
-fake.1.1.downloadUrl=
-fake.1.1.date=2012-04-27
diff --git a/tests/src/test/resources/updateCenter/installed-plugins.html b/tests/src/test/resources/updateCenter/installed-plugins.html
deleted file mode 100644 (file)
index 8b3576a..0000000
+++ /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>