diff options
author | Pascal Mugnier <pascal.mugnier@sonarsource.com> | 2018-05-01 11:10:51 +0200 |
---|---|---|
committer | SonarTech <sonartech@sonarsource.com> | 2018-05-03 20:20:51 +0200 |
commit | 50627ee0c51115fcb56e78301b57854ee01457cc (patch) | |
tree | 44c7c33ecd85b4ed5cfa318be6c777f6e6b9bc8f /tests | |
parent | b367622f75eb6a5bc4ab1d485e771f70148d5f58 (diff) | |
download | sonarqube-50627ee0c51115fcb56e78301b57854ee01457cc.tar.gz sonarqube-50627ee0c51115fcb56e78301b57854ee01457cc.zip |
Add IT tests (#200)
Diffstat (limited to 'tests')
6 files changed, 110 insertions, 7 deletions
diff --git a/tests/build.gradle b/tests/build.gradle index 2a6eb0c40e9..8164dfebb19 100644 --- a/tests/build.gradle +++ b/tests/build.gradle @@ -120,6 +120,7 @@ task integrationTest(type: Test) { includeTestsMatching 'org.sonarqube.tests.Category4Suite' includeTestsMatching 'org.sonarqube.tests.duplication.*Suite' includeTestsMatching 'org.sonarqube.tests.user.*Suite' + includeTestsMatching 'org.sonarqube.tests.ui.*Suite' includeTestsMatching 'org.sonarqube.tests.webhook.*Suite' break case 'Category5': diff --git a/tests/src/test/java/org/sonarqube/tests/Category4Suite.java b/tests/src/test/java/org/sonarqube/tests/Category4Suite.java index b0296eaf19c..378c1ea8736 100644 --- a/tests/src/test/java/org/sonarqube/tests/Category4Suite.java +++ b/tests/src/test/java/org/sonarqube/tests/Category4Suite.java @@ -59,10 +59,6 @@ import static util.ItUtils.xooPlugin; IssueExclusionsTest.class, // http HttpHeadersTest.class, - // ui - UiTest.class, - // ui extensions - UiExtensionsTest.class, WsLocalCallTest.class, WsTest.class, // quality profiles diff --git a/tests/src/test/java/org/sonarqube/tests/ui/DocumentationTest.java b/tests/src/test/java/org/sonarqube/tests/ui/DocumentationTest.java new file mode 100644 index 00000000000..2627a22197a --- /dev/null +++ b/tests/src/test/java/org/sonarqube/tests/ui/DocumentationTest.java @@ -0,0 +1,60 @@ +/* + * 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.ui; + +import com.sonar.orchestrator.Orchestrator; +import org.junit.ClassRule; +import org.junit.Rule; +import org.junit.Test; +import org.sonarqube.qa.util.Tester; +import org.sonarqube.qa.util.pageobjects.DocumentationPage; + +import static com.codeborne.selenide.Condition.visible; +import static com.codeborne.selenide.Selenide.$; +import static org.assertj.core.api.Assertions.assertThat; + +public class DocumentationTest { + + @ClassRule + public static Orchestrator orchestrator = UiSuite.ORCHESTRATOR; + + @Rule + public Tester tester = new Tester(orchestrator).disableOrganizations(); + + @Test + public void documentation_loads() { + tester.openBrowser().openDocumentation().shouldHaveLinks(); + } + + @Test + public void can_switch_between_content() { + DocumentationPage page = tester.openBrowser().openDocumentation().selectLink(0); + String content = page.getDocumentationContent(); + page.selectLink(1); + assertThat(content).isNotEqualTo(page.getDocumentationContent()); + } + + @Test + public void display_not_found() { + tester.openBrowser().open("/documentation/foobarbaz"); + $("#nonav").shouldBe(visible); + } + +} diff --git a/tests/src/test/java/org/sonarqube/tests/ui/UiExtensionsTest.java b/tests/src/test/java/org/sonarqube/tests/ui/UiExtensionsTest.java index 8b0a88df99b..262d70e2ed0 100644 --- a/tests/src/test/java/org/sonarqube/tests/ui/UiExtensionsTest.java +++ b/tests/src/test/java/org/sonarqube/tests/ui/UiExtensionsTest.java @@ -40,7 +40,7 @@ import static org.assertj.core.api.Assertions.assertThat; public class UiExtensionsTest { @ClassRule - public static Orchestrator orchestrator = Category4Suite.ORCHESTRATOR; + public static Orchestrator orchestrator = UiSuite.ORCHESTRATOR; @Rule public Tester tester = new Tester(orchestrator).disableOrganizations(); diff --git a/tests/src/test/java/org/sonarqube/tests/ui/UiSuite.java b/tests/src/test/java/org/sonarqube/tests/ui/UiSuite.java new file mode 100644 index 00000000000..e35917afc69 --- /dev/null +++ b/tests/src/test/java/org/sonarqube/tests/ui/UiSuite.java @@ -0,0 +1,47 @@ +/* + * 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.ui; + +import com.sonar.orchestrator.Orchestrator; +import org.junit.ClassRule; +import org.junit.runner.RunWith; +import org.junit.runners.Suite; + +import static util.ItUtils.newOrchestratorBuilder; +import static util.ItUtils.pluginArtifact; +import static util.ItUtils.xooPlugin; + +@RunWith(Suite.class) +@Suite.SuiteClasses({ + UiTest.class, + UiExtensionsTest.class, + DocumentationTest.class +}) +public class UiSuite { + + @ClassRule + public static final Orchestrator ORCHESTRATOR = newOrchestratorBuilder() + .addPlugin(xooPlugin()) + + // Used in UiExtensionsTest + .addPlugin(pluginArtifact("ui-extensions-plugin")) + + .build(); +} diff --git a/tests/src/test/java/org/sonarqube/tests/ui/UiTest.java b/tests/src/test/java/org/sonarqube/tests/ui/UiTest.java index ceead9bda02..dfc8a49b7d7 100644 --- a/tests/src/test/java/org/sonarqube/tests/ui/UiTest.java +++ b/tests/src/test/java/org/sonarqube/tests/ui/UiTest.java @@ -27,7 +27,6 @@ import org.junit.Rule; import org.junit.Test; import org.sonarqube.qa.util.Tester; import org.sonarqube.qa.util.pageobjects.Navigation; -import org.sonarqube.tests.Category4Suite; import org.sonarqube.ws.client.GetRequest; import org.sonarqube.ws.client.WsResponse; import util.ItUtils; @@ -44,7 +43,7 @@ import static util.ItUtils.projectDir; public class UiTest { @ClassRule - public static final Orchestrator orchestrator = Category4Suite.ORCHESTRATOR; + public static final Orchestrator orchestrator = UiSuite.ORCHESTRATOR; @Rule public Tester tester = new Tester(orchestrator).disableOrganizations(); |