aboutsummaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
authorStas Vilchik <stas.vilchik@sonarsource.com>2018-01-08 17:52:43 +0100
committerStas Vilchik <stas.vilchik@sonarsource.com>2018-01-10 08:59:34 +0100
commit24ea33f13a2e47bf20a8ae2c922ce07be2458524 (patch)
tree029067efc85a5fb761e77ce2261f17a3c1ea69d5 /server
parent39882b335606d673c012a926383de4b797010f33 (diff)
downloadsonarqube-24ea33f13a2e47bf20a8ae2c922ce07be2458524.tar.gz
sonarqube-24ea33f13a2e47bf20a8ae2c922ce07be2458524.zip
SONAR-10258 Missing information about uncovered conditions on a line
Diffstat (limited to 'server')
-rw-r--r--server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/pageobjects/ProjectCodePage.java16
-rw-r--r--server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/pageobjects/SourceViewer.java40
-rw-r--r--server/sonar-web/src/main/js/components/SourceViewer/popups/templates/source-viewer-coverage-popup.hbs14
3 files changed, 58 insertions, 12 deletions
diff --git a/server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/pageobjects/ProjectCodePage.java b/server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/pageobjects/ProjectCodePage.java
index fe622da11c5..eab80acfcc2 100644
--- a/server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/pageobjects/ProjectCodePage.java
+++ b/server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/pageobjects/ProjectCodePage.java
@@ -22,6 +22,8 @@ package org.sonarqube.qa.util.pageobjects;
import com.codeborne.selenide.Condition;
import com.codeborne.selenide.Selenide;
+import static com.codeborne.selenide.Selenide.$;
+
public class ProjectCodePage {
public ProjectCodePage openFirstComponent() {
@@ -30,29 +32,33 @@ public class ProjectCodePage {
}
public ProjectCodePage search(String query) {
- Selenide.$(".code-search .search-box-input").val(query);
+ $(".code-search .search-box-input").val(query);
return this;
}
public ProjectCodePage shouldHaveComponent(String name) {
- Selenide.$(".code-components").shouldHave(Condition.text(name));
+ $(".code-components").shouldHave(Condition.text(name));
return this;
}
public ProjectCodePage shouldHaveCode(String code) {
- Selenide.$(".code-components .source-viewer").shouldHave(Condition.text(code));
+ $(".code-components .source-viewer").shouldHave(Condition.text(code));
return this;
}
public ProjectCodePage shouldHaveBreadcrumbs(String... breadcrumbs) {
for (String breadcrumb : breadcrumbs) {
- Selenide.$(".code-breadcrumbs").shouldHave(Condition.text(breadcrumb));
+ $(".code-breadcrumbs").shouldHave(Condition.text(breadcrumb));
}
return this;
}
public ProjectCodePage shouldSearchResult(String name) {
- Selenide.$(".code-search-with-results").shouldHave(Condition.text(name));
+ $(".code-search-with-results").shouldHave(Condition.text(name));
return this;
}
+
+ public SourceViewer getSourceViewer() {
+ return new SourceViewer($(".code-components .source-viewer"));
+ }
}
diff --git a/server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/pageobjects/SourceViewer.java b/server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/pageobjects/SourceViewer.java
new file mode 100644
index 00000000000..5da34d9c7fd
--- /dev/null
+++ b/server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/pageobjects/SourceViewer.java
@@ -0,0 +1,40 @@
+/*
+ * 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.qa.util.pageobjects;
+
+import com.codeborne.selenide.SelenideElement;
+
+import static com.codeborne.selenide.Condition.visible;
+import static com.codeborne.selenide.Selenide.$;
+
+public class SourceViewer {
+
+ private final SelenideElement el;
+
+ SourceViewer(SelenideElement el) {
+ this.el = el;
+ }
+
+ public SelenideElement openCoverageDetails(int line) {
+ this.el.$(".source-line-coverage[data-line-number=\"" + line + "\"").click();
+ return $(".bubble-popup").shouldBe(visible);
+ }
+
+}
diff --git a/server/sonar-web/src/main/js/components/SourceViewer/popups/templates/source-viewer-coverage-popup.hbs b/server/sonar-web/src/main/js/components/SourceViewer/popups/templates/source-viewer-coverage-popup.hbs
index 6238e9ffd39..bad2779d285 100644
--- a/server/sonar-web/src/main/js/components/SourceViewer/popups/templates/source-viewer-coverage-popup.hbs
+++ b/server/sonar-web/src/main/js/components/SourceViewer/popups/templates/source-viewer-coverage-popup.hbs
@@ -1,11 +1,11 @@
<div class="bubble-popup-container">
+ <div class="bubble-popup-title">
+ {{t 'source_viewer.covered'}}
+ {{#if row.conditions}}
+ ({{default row.coveredConditions 0}} of {{row.conditions}} {{t 'source_viewer.conditions'}})
+ {{/if}}
+ </div>
{{#each testFiles}}
- <div class="bubble-popup-title">
- {{t 'source_viewer.covered'}}
- {{#if row.conditions}}
- ({{default row.coveredConditions 0}} of {{row.conditions}} {{t 'source_viewer.conditions'}})
- {{/if}}
- </div>
<div class="bubble-popup-section">
<a class="component-viewer-popup-test-file link-action" data-key="{{file.key}}" title="{{file.longName}}">
<span>{{collapsePath file.longName}}</span>
@@ -16,7 +16,7 @@
<i class="component-viewer-popup-test-status {{testStatusIconClass status}}"></i>
<span class="component-viewer-popup-test-name">
<a class="component-viewer-popup-test-file link-action" title="{{name}}"
- data-key="{{../file.key}}" data-method="{{name}}">
+ data-key="{{../file.key}}" data-method="{{name}}">
{{name}}
</a>
</span>