aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorStas Vilchik <stas.vilchik@sonarsource.com>2017-08-04 09:14:23 +0200
committerGitHub <noreply@github.com>2017-08-04 09:14:23 +0200
commitb0dee2eb4911050c06a1f4665d0813151739ca95 (patch)
tree53b8a5409da83217804fcc2530861fb389f9a75e /tests
parente474853db05f6c6432818ed3eaf0f13976bb7018 (diff)
downloadsonarqube-b0dee2eb4911050c06a1f4665d0813151739ca95.tar.gz
sonarqube-b0dee2eb4911050c06a1f4665d0813151739ca95.zip
fix quality profile project selection (#2316)
Diffstat (limited to 'tests')
-rw-r--r--tests/src/test/java/org/sonarqube/pageobjects/QualityProfilePage.java15
-rw-r--r--tests/src/test/java/org/sonarqube/tests/qualityProfile/OrganizationQualityProfilesUiTest.java22
-rw-r--r--tests/src/test/resources/organization/OrganizationQualityProfilesUiTest/should_display_profile_projects.html50
3 files changed, 28 insertions, 59 deletions
diff --git a/tests/src/test/java/org/sonarqube/pageobjects/QualityProfilePage.java b/tests/src/test/java/org/sonarqube/pageobjects/QualityProfilePage.java
index 9c21c692d36..803f55357a0 100644
--- a/tests/src/test/java/org/sonarqube/pageobjects/QualityProfilePage.java
+++ b/tests/src/test/java/org/sonarqube/pageobjects/QualityProfilePage.java
@@ -21,6 +21,8 @@ package org.sonarqube.pageobjects;
import com.codeborne.selenide.Condition;
+import static com.codeborne.selenide.Condition.text;
+import static com.codeborne.selenide.Condition.visible;
import static com.codeborne.selenide.Selenide.$;
import static com.codeborne.selenide.Selenide.page;
@@ -32,7 +34,7 @@ public class QualityProfilePage {
public QualityProfilePage shouldHaveMissingSonarWayRules(Integer nbRules) {
$(".quality-profile-rules-sonarway-missing")
.shouldBe(Condition.visible)
- .$("a").shouldHave(Condition.text(nbRules.toString()));
+ .$("a").shouldHave(text(nbRules.toString()));
return this;
}
@@ -42,4 +44,15 @@ public class QualityProfilePage {
$(".coding-rules").shouldBe(Condition.visible);
return page(RulesPage.class);
}
+
+ public QualityProfilePage shouldHaveAssociatedProject(String projectName) {
+ $(".js-profile-project").shouldHave(text(projectName));
+ return this;
+ }
+
+ public QualityProfilePage shouldAllowToChangeProjects() {
+ $(".js-change-projects").shouldBe(visible).click();
+ $("#profile-projects .select-list-list").shouldBe(visible);
+ return this;
+ }
}
diff --git a/tests/src/test/java/org/sonarqube/tests/qualityProfile/OrganizationQualityProfilesUiTest.java b/tests/src/test/java/org/sonarqube/tests/qualityProfile/OrganizationQualityProfilesUiTest.java
index 83f63e34439..ad75bcdf9d9 100644
--- a/tests/src/test/java/org/sonarqube/tests/qualityProfile/OrganizationQualityProfilesUiTest.java
+++ b/tests/src/test/java/org/sonarqube/tests/qualityProfile/OrganizationQualityProfilesUiTest.java
@@ -22,21 +22,22 @@ package org.sonarqube.tests.qualityProfile;
import com.codeborne.selenide.Condition;
import com.sonar.orchestrator.Orchestrator;
import com.sonar.orchestrator.build.SonarScanner;
-import org.sonarqube.pageobjects.QualityProfilePage;
-import org.sonarqube.pageobjects.RulesPage;
-import org.sonarqube.tests.Category6Suite;
import org.junit.Before;
import org.junit.ClassRule;
import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
+import org.sonarqube.pageobjects.Navigation;
+import org.sonarqube.pageobjects.QualityProfilePage;
+import org.sonarqube.pageobjects.RulesPage;
+import org.sonarqube.tests.Category6Suite;
import org.sonarqube.tests.Tester;
-import org.sonarqube.ws.Organizations;
+import org.sonarqube.ws.Organizations.Organization;
import org.sonarqube.ws.QualityProfiles;
+import org.sonarqube.ws.WsUsers.CreateWsResponse.User;
import org.sonarqube.ws.client.PostRequest;
import org.sonarqube.ws.client.qualityprofile.AddProjectRequest;
import org.sonarqube.ws.client.qualityprofile.ChangeParentRequest;
-import org.sonarqube.pageobjects.Navigation;
import static com.codeborne.selenide.Selenide.$;
import static util.ItUtils.projectDir;
@@ -49,13 +50,14 @@ public class OrganizationQualityProfilesUiTest {
@Rule
public Tester tester = new Tester(orchestrator);
- private Organizations.Organization organization;
+ private Organization organization;
+ private User user;
@Before
public void setUp() {
// key and name are overridden for HTML Selenese tests
organization = tester.organizations().generate(o -> o.setKey("test-org").setName("test-org"));
- tester.users().generateAdministrator(organization, u -> u.setLogin("admin2").setPassword("admin2"));
+ user = tester.users().generateAdministrator(organization, u -> u.setLogin("admin2").setPassword("admin2"));
createProfile("xoo", "sample");
inheritProfile("xoo", "sample", "Basic");
analyzeProject("shared/xoo-sample");
@@ -82,8 +84,12 @@ public class OrganizationQualityProfilesUiTest {
tester.runHtmlTests(
"/organization/OrganizationQualityProfilesUiTest/should_display_profile_rules.html",
"/organization/OrganizationQualityProfilesUiTest/should_display_profile_inheritance.html",
- "/organization/OrganizationQualityProfilesUiTest/should_display_profile_projects.html",
"/organization/OrganizationQualityProfilesUiTest/should_display_profile_exporters.html");
+
+ tester.openBrowser().openHome().logIn().submitCredentials(user.getLogin())
+ .openQualityProfile("xoo", "sample", organization.getKey())
+ .shouldHaveAssociatedProject("Sample")
+ .shouldAllowToChangeProjects();
}
@Test
diff --git a/tests/src/test/resources/organization/OrganizationQualityProfilesUiTest/should_display_profile_projects.html b/tests/src/test/resources/organization/OrganizationQualityProfilesUiTest/should_display_profile_projects.html
deleted file mode 100644
index 062014eb239..00000000000
--- a/tests/src/test/resources/organization/OrganizationQualityProfilesUiTest/should_display_profile_projects.html
+++ /dev/null
@@ -1,50 +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"/>
- <link rel="selenium.base" href="http://localhost:49506"/>
- <title>should_display_profile_projects.html</title>
-</head>
-<body>
-<table cellpadding="1" cellspacing="1" border="1">
-<thead>
-<tr>
-<td rowspan="1" colspan="3">should_display_profile_projects.html</td>
-</tr>
-</thead>
-<tbody>
-<tr>
- <td>open</td>
- <td>/organizations/test-org/quality_profiles</td>
- <td></td>
-</tr>
-<tr>
- <td>waitForElementPresent</td>
- <td>css=table[data-language=&quot;xoo&quot;] tr[data-name=&quot;sample&quot;] .quality-profiles-table-name a</td>
- <td></td>
-</tr>
-<tr>
- <td>click</td>
- <td>css=table[data-language=&quot;xoo&quot;] tr[data-name=&quot;sample&quot;] .quality-profiles-table-name a</td>
- <td></td>
-</tr>
-<tr>
- <td>waitForElementPresent</td>
- <td>css=.quality-profile-projects</td>
- <td></td>
-</tr>
-<tr>
- <td>waitForElementPresent</td>
- <td>css=.js-profile-project</td>
- <td></td>
-</tr>
-<tr>
- <td>assertText</td>
- <td>css=.js-profile-project</td>
- <td>*Sample*</td>
-</tr>
-</tbody>
-</table>
-</body>
-</html>