summaryrefslogtreecommitdiffstats
path: root/tests/src
diff options
context:
space:
mode:
authorGrégoire Aubert <gregoire.aubert@sonarsource.com>2018-02-02 16:29:10 +0100
committerGuillaume Jambet <guillaume.jambet@gmail.com>2018-03-01 15:21:05 +0100
commit85f7f977c021ea177d3f2442efa114997e313aa2 (patch)
tree365e7cc53253a906d205bd207391072c52009695 /tests/src
parent21b4be2173e36fef157e46582060e265edb1bf45 (diff)
downloadsonarqube-85f7f977c021ea177d3f2442efa114997e313aa2.tar.gz
sonarqube-85f7f977c021ea177d3f2442efa114997e313aa2.zip
SONAR-10344 Create IT's for webhooks console page
Diffstat (limited to 'tests/src')
-rw-r--r--tests/src/test/java/org/sonarqube/tests/Category3Suite.java3
-rw-r--r--tests/src/test/java/org/sonarqube/tests/webhook/WebhooksSuite.java43
-rw-r--r--tests/src/test/java/org/sonarqube/tests/webhook/WebhooksTest.java28
3 files changed, 70 insertions, 4 deletions
diff --git a/tests/src/test/java/org/sonarqube/tests/Category3Suite.java b/tests/src/test/java/org/sonarqube/tests/Category3Suite.java
index 60fbc385ab8..2924b41373f 100644
--- a/tests/src/test/java/org/sonarqube/tests/Category3Suite.java
+++ b/tests/src/test/java/org/sonarqube/tests/Category3Suite.java
@@ -65,8 +65,7 @@ import static util.ItUtils.xooPlugin;
ReportDumpTest.class,
SSLTest.class,
FavoriteTest.class,
- RedirectTest.class,
- WebhooksTest.class
+ RedirectTest.class
})
public class Category3Suite {
diff --git a/tests/src/test/java/org/sonarqube/tests/webhook/WebhooksSuite.java b/tests/src/test/java/org/sonarqube/tests/webhook/WebhooksSuite.java
new file mode 100644
index 00000000000..261c88ff139
--- /dev/null
+++ b/tests/src/test/java/org/sonarqube/tests/webhook/WebhooksSuite.java
@@ -0,0 +1,43 @@
+/*
+ * SonarQube
+ * Copyright (C) 2009-2018 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.webhook;
+
+import com.sonar.orchestrator.Orchestrator;
+import org.junit.ClassRule;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+import static util.ItUtils.xooPlugin;
+
+@RunWith(Suite.class)
+@Suite.SuiteClasses({
+ WebhooksTest.class
+})
+public class WebhooksSuite {
+
+ @ClassRule
+ public static final Orchestrator ORCHESTRATOR = Orchestrator.builderEnv()
+ .addPlugin(xooPlugin())
+
+ // reduce memory for Elasticsearch
+ .setServerProperty("sonar.search.javaOpts", "-Xms128m -Xmx128m")
+
+ .build();
+}
diff --git a/tests/src/test/java/org/sonarqube/tests/webhook/WebhooksTest.java b/tests/src/test/java/org/sonarqube/tests/webhook/WebhooksTest.java
index 0bbed529135..2531d8674b1 100644
--- a/tests/src/test/java/org/sonarqube/tests/webhook/WebhooksTest.java
+++ b/tests/src/test/java/org/sonarqube/tests/webhook/WebhooksTest.java
@@ -33,12 +33,14 @@ import org.junit.ClassRule;
import org.junit.Rule;
import org.junit.Test;
import org.sonarqube.qa.util.Tester;
-import org.sonarqube.tests.Category3Suite;
+import org.sonarqube.qa.util.pageobjects.WebhooksPage;
import org.sonarqube.ws.Issues.Issue;
import org.sonarqube.ws.Organizations.Organization;
import org.sonarqube.ws.Projects.CreateWsResponse.Project;
import org.sonarqube.ws.Qualitygates;
import org.sonarqube.ws.Qualityprofiles.CreateWsResponse.QualityProfile;
+import org.sonarqube.ws.Users;
+import org.sonarqube.ws.Users.CreateWsResponse.User;
import org.sonarqube.ws.Webhooks;
import org.sonarqube.ws.client.HttpException;
import org.sonarqube.ws.client.WsClient;
@@ -67,7 +69,7 @@ public class WebhooksTest {
private static final String PROJECT_WEBHOOK_PROPERTY = "sonar.webhooks.project";
@ClassRule
- public static Orchestrator orchestrator = Category3Suite.ORCHESTRATOR;
+ public static Orchestrator orchestrator = WebhooksSuite.ORCHESTRATOR;
@ClassRule
public static ExternalServer externalServer = new ExternalServer();
@@ -287,6 +289,28 @@ public class WebhooksTest {
assertThat(gate.get("status")).isEqualTo("OK");
}
+ @Test
+ public void list_global_webhooks() {
+ enableGlobalWebhooks(new Webhook("foo", "http://foo.bar"), new Webhook("bar", "https://bar.baz/test"));
+ tester.wsClient().users().skipOnboardingTutorial();
+ WebhooksPage webhooksPage = tester.openBrowser().logIn().submitCredentials("admin").openWebhooks();
+ webhooksPage
+ .countWebhooks(2)
+ .hasWebhook("http://foo.bar");
+ }
+
+ @Test
+ public void list_project_webhooks() {
+ analyseProject();
+ enableProjectWebhooks(PROJECT_KEY, new Webhook("foo", "http://foo.bar"), new Webhook("bar", "https://bar.baz/test"));
+ User user = tester.users().generateAdministratorOnDefaultOrganization();
+ tester.wsClient().users().skipOnboardingTutorial();
+ WebhooksPage webhooksPage = tester.openBrowser().logIn().submitCredentials(user.getLogin()).openProjectWebhooks(PROJECT_KEY);
+ webhooksPage
+ .countWebhooks(2)
+ .hasWebhook("http://foo.bar");
+ }
+
private void analyseProject() {
runProjectAnalysis(orchestrator, "shared/xoo-sample",
"sonar.projectKey", PROJECT_KEY,