Browse Source

Move pageobjects to new module sonar-qa-util

tags/7.0-RC1
Simon Brandhof 6 years ago
parent
commit
a7b805384a
78 changed files with 532 additions and 515 deletions
  1. 1
    0
      server/pom.xml
  2. 46
    0
      server/sonar-qa-util/pom.xml
  3. 1
    1
      server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/SelenideConfig.java
  4. 23
    0
      server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/package-info.java
  5. 10
    12
      server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/pageobjects/BackgroundTaskItem.java
  6. 5
    7
      server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/pageobjects/BackgroundTasksPage.java
  7. 11
    13
      server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/pageobjects/EncryptionPage.java
  8. 15
    17
      server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/pageobjects/LoginPage.java
  9. 7
    10
      server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/pageobjects/MarketplacePage.java
  10. 23
    30
      server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/pageobjects/Navigation.java
  11. 11
    13
      server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/pageobjects/NotificationsPage.java
  12. 8
    11
      server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/pageobjects/ProjectActivityPage.java
  13. 17
    19
      server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/pageobjects/ProjectAnalysisItem.java
  14. 11
    11
      server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/pageobjects/ProjectCodePage.java
  15. 23
    26
      server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/pageobjects/ProjectDashboardPage.java
  16. 28
    31
      server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/pageobjects/ProjectKeyPage.java
  17. 1
    1
      server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/pageobjects/ProjectLinkItem.java
  18. 4
    7
      server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/pageobjects/ProjectLinksPage.java
  19. 11
    13
      server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/pageobjects/ProjectPermissionsPage.java
  20. 8
    9
      server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/pageobjects/ProjectQualityGatePage.java
  21. 16
    19
      server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/pageobjects/ProjectsManagementPage.java
  22. 8
    10
      server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/pageobjects/QualityGatePage.java
  23. 11
    15
      server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/pageobjects/QualityProfilePage.java
  24. 4
    5
      server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/pageobjects/RuleDetails.java
  25. 1
    1
      server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/pageobjects/RuleItem.java
  26. 12
    16
      server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/pageobjects/RulesPage.java
  27. 8
    11
      server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/pageobjects/SystemInfoPage.java
  28. 11
    14
      server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/pageobjects/SystemInfoPageItem.java
  29. 10
    12
      server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/pageobjects/issues/Issue.java
  30. 15
    19
      server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/pageobjects/issues/IssuesPage.java
  31. 7
    9
      server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/pageobjects/measures/MeasureContent.java
  32. 21
    23
      server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/pageobjects/measures/MeasuresPage.java
  33. 4
    5
      server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/pageobjects/organization/MemberItem.java
  34. 11
    15
      server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/pageobjects/organization/MembersPage.java
  35. 23
    0
      server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/pageobjects/package-info.java
  36. 1
    1
      server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/pageobjects/projects/FacetItem.java
  37. 1
    1
      server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/pageobjects/projects/ProjectItem.java
  38. 15
    19
      server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/pageobjects/projects/ProjectsPage.java
  39. 3
    4
      server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/pageobjects/settings/PropertySetInput.java
  40. 15
    19
      server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/pageobjects/settings/SettingsPage.java
  41. 6
    0
      tests/pom.xml
  42. 1
    1
      tests/src/test/java/org/sonarqube/tests/Tester.java
  43. 3
    3
      tests/src/test/java/org/sonarqube/tests/issue/IssuesPageTest.java
  44. 1
    1
      tests/src/test/java/org/sonarqube/tests/issue/OrganizationIssueAssignTest.java
  45. 1
    1
      tests/src/test/java/org/sonarqube/tests/issue/OrganizationIssuesPageTest.java
  46. 2
    2
      tests/src/test/java/org/sonarqube/tests/marketplace/UpdateCenterTest.java
  47. 1
    1
      tests/src/test/java/org/sonarqube/tests/measure/DifferentialPeriodsTest.java
  48. 2
    3
      tests/src/test/java/org/sonarqube/tests/measure/ProjectDashboardTest.java
  49. 3
    3
      tests/src/test/java/org/sonarqube/tests/measure/ProjectMeasuresPageTest.java
  50. 1
    1
      tests/src/test/java/org/sonarqube/tests/organization/BillingTest.java
  51. 1
    1
      tests/src/test/java/org/sonarqube/tests/organization/OrganizationMembershipUiTest.java
  52. 3
    3
      tests/src/test/java/org/sonarqube/tests/projectAdministration/BackgroundTasksTest.java
  53. 3
    3
      tests/src/test/java/org/sonarqube/tests/projectAdministration/ProjectAdministrationTest.java
  54. 2
    2
      tests/src/test/java/org/sonarqube/tests/projectAdministration/ProjectKeyUpdatePageTest.java
  55. 3
    3
      tests/src/test/java/org/sonarqube/tests/projectAdministration/ProjectLinksPageTest.java
  56. 2
    2
      tests/src/test/java/org/sonarqube/tests/projectAdministration/ProjectPermissionsTest.java
  57. 2
    2
      tests/src/test/java/org/sonarqube/tests/projectAdministration/ProjectQualityGatePageTest.java
  58. 2
    2
      tests/src/test/java/org/sonarqube/tests/projectAdministration/ProjectVisibilityPageTest.java
  59. 3
    3
      tests/src/test/java/org/sonarqube/tests/projectEvent/ProjectActivityPageTest.java
  60. 1
    1
      tests/src/test/java/org/sonarqube/tests/projectSearch/LeakProjectsPageTest.java
  61. 2
    2
      tests/src/test/java/org/sonarqube/tests/projectSearch/ProjectsPageTest.java
  62. 2
    2
      tests/src/test/java/org/sonarqube/tests/qualityGate/OrganizationQualityGateUiTest.java
  63. 2
    2
      tests/src/test/java/org/sonarqube/tests/qualityGate/QualityGateUiTest.java
  64. 3
    3
      tests/src/test/java/org/sonarqube/tests/qualityProfile/OrganizationQualityProfilesUiTest.java
  65. 1
    1
      tests/src/test/java/org/sonarqube/tests/qualityProfile/QualityProfilesUiTest.java
  66. 1
    1
      tests/src/test/java/org/sonarqube/tests/rule/RulesPageTest.java
  67. 1
    1
      tests/src/test/java/org/sonarqube/tests/serverSystem/SystemInfoTest.java
  68. 2
    2
      tests/src/test/java/org/sonarqube/tests/settings/PropertySetsTest.java
  69. 2
    2
      tests/src/test/java/org/sonarqube/tests/settings/SettingsTestRestartingOrchestrator.java
  70. 1
    1
      tests/src/test/java/org/sonarqube/tests/ui/SourceViewerTest.java
  71. 1
    1
      tests/src/test/java/org/sonarqube/tests/ui/UiTest.java
  72. 2
    2
      tests/src/test/java/org/sonarqube/tests/user/BaseIdentityProviderTest.java
  73. 1
    1
      tests/src/test/java/org/sonarqube/tests/user/ForceAuthenticationTest.java
  74. 2
    2
      tests/src/test/java/org/sonarqube/tests/user/LocalAuthenticationTest.java
  75. 2
    2
      tests/src/test/java/org/sonarqube/tests/user/MyAccountPageTest.java
  76. 1
    1
      tests/src/test/java/org/sonarqube/tests/user/OAuth2IdentityProviderTest.java
  77. 1
    1
      tests/src/test/java/org/sonarqube/tests/user/RealmAuthenticationTest.java
  78. 1
    1
      tests/src/test/java/util/selenium/SeleneseRunner.java

+ 1
- 0
server/pom.xml View File

@@ -23,6 +23,7 @@
<module>sonar-ce</module>
<module>sonar-plugin-bridge</module>
<module>sonar-web</module>
<module>sonar-qa-util</module>
</modules>

<profiles>

+ 46
- 0
server/sonar-qa-util/pom.xml View File

@@ -0,0 +1,46 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.sonarsource.sonarqube</groupId>
<artifactId>server</artifactId>
<version>7.0-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
<artifactId>sonar-qa-util</artifactId>
<name>SonarQube :: Utilities for QA Tests</name>

<properties>
<sonar.coverage.exclusions>src/main/java/**/*</sonar.coverage.exclusions>
</properties>

<dependencies>
<dependency>
<groupId>com.codeborne</groupId>
<artifactId>selenide</artifactId>
<version>4.4.3</version>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
</dependency>
<dependency>
<groupId>org.sonarsource.orchestrator</groupId>
<artifactId>sonar-orchestrator</artifactId>
<version>${orchestrator.version}</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<!-- required for selenide -->
<version>21.0</version>
</dependency>

<dependency>
<groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>

</project>

tests/src/test/java/org/sonarqube/pageobjects/SelenideConfig.java → server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/SelenideConfig.java View File

@@ -17,7 +17,7 @@
* 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;
package org.sonarqube.qa.util;

import com.codeborne.selenide.Configuration;
import com.codeborne.selenide.WebDriverRunner;

+ 23
- 0
server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/package-info.java View File

@@ -0,0 +1,23 @@
/*
* 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.
*/
@ParametersAreNonnullByDefault
package org.sonarqube.qa.util;

import javax.annotation.ParametersAreNonnullByDefault;

tests/src/test/java/org/sonarqube/pageobjects/BackgroundTaskItem.java → server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/pageobjects/BackgroundTaskItem.java View File

@@ -17,14 +17,12 @@
* 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;
package org.sonarqube.qa.util.pageobjects;

import com.codeborne.selenide.Condition;
import com.codeborne.selenide.Selenide;
import com.codeborne.selenide.SelenideElement;

import static com.codeborne.selenide.Condition.hasText;
import static com.codeborne.selenide.Condition.visible;
import static com.codeborne.selenide.Selenide.$;

public class BackgroundTaskItem {

private final SelenideElement elt;
@@ -39,29 +37,29 @@ public class BackgroundTaskItem {

public BackgroundTaskItem openActions() {
elt.$(".js-task-action > .dropdown-toggle").click();
elt.$(".js-task-action > .dropdown-menu").shouldBe(visible);
elt.$(".js-task-action > .dropdown-menu").shouldBe(Condition.visible);
return this;
}

public BackgroundTaskItem openScannerContext () {
public BackgroundTaskItem openScannerContext() {
elt.$(".js-task-show-scanner-context").click();
$(".js-task-scanner-context").shouldBe(visible);
Selenide.$(".js-task-scanner-context").shouldBe(Condition.visible);
return this;
}

public BackgroundTaskItem assertScannerContextContains(String text) {
$(".js-task-scanner-context").should(hasText(text));
Selenide.$(".js-task-scanner-context").should(Condition.hasText(text));
return this;
}

public BackgroundTaskItem openErrorStacktrace () {
public BackgroundTaskItem openErrorStacktrace() {
elt.$(".js-task-show-stacktrace").click();
$(".js-task-stacktrace").shouldBe(visible);
Selenide.$(".js-task-stacktrace").shouldBe(Condition.visible);
return this;
}

public BackgroundTaskItem assertErrorStacktraceContains(String text) {
$(".js-task-stacktrace").should(hasText(text));
Selenide.$(".js-task-stacktrace").should(Condition.hasText(text));
return this;
}
}

tests/src/test/java/org/sonarqube/pageobjects/BackgroundTasksPage.java → server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/pageobjects/BackgroundTasksPage.java View File

@@ -17,25 +17,23 @@
* 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;
package org.sonarqube.qa.util.pageobjects;

import com.codeborne.selenide.Condition;
import com.codeborne.selenide.ElementsCollection;
import com.codeborne.selenide.Selenide;
import java.util.List;
import java.util.stream.Collectors;
import org.openqa.selenium.By;

import static com.codeborne.selenide.Condition.exist;
import static com.codeborne.selenide.Selenide.$;
import static com.codeborne.selenide.Selenide.$$;

public class BackgroundTasksPage {

public BackgroundTasksPage() {
$(By.cssSelector(".background-tasks")).should(exist);
Selenide.$(By.cssSelector(".background-tasks")).should(Condition.exist);
}

public ElementsCollection getTasks() {
return $$(".background-tasks > tbody > tr");
return Selenide.$$(".background-tasks > tbody > tr");
}

public List<BackgroundTaskItem> getTasksAsItems() {

tests/src/test/java/org/sonarqube/pageobjects/EncryptionPage.java → server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/pageobjects/EncryptionPage.java View File

@@ -17,37 +17,35 @@
* 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;
package org.sonarqube.qa.util.pageobjects;

import com.codeborne.selenide.Condition;
import com.codeborne.selenide.Selenide;
import com.codeborne.selenide.SelenideElement;

import static com.codeborne.selenide.Condition.exist;
import static com.codeborne.selenide.Condition.visible;
import static com.codeborne.selenide.Selenide.$;

public class EncryptionPage extends Navigation {

public EncryptionPage() {
$("#encryption-page").should(exist);
Selenide.$("#encryption-page").should(Condition.exist);
}

public SelenideElement generationForm() {
return $("#generate-secret-key-form");
return Selenide.$("#generate-secret-key-form");
}

public SelenideElement newSecretKey() {
return $("#secret-key");
return Selenide.$("#secret-key");
}

public String encryptValue(String value) {
$("#encryption-form-value").val(value);
$("#encryption-form").submit();
return $("#encrypted-value").shouldBe(visible).val();
Selenide.$("#encryption-form-value").val(value);
Selenide.$("#encryption-form").submit();
return Selenide.$("#encrypted-value").shouldBe(Condition.visible).val();
}

public EncryptionPage generateNewKey() {
$("#encryption-new-key-form").submit();
$("#generate-secret-key-form").shouldBe(visible);
Selenide.$("#encryption-new-key-form").submit();
Selenide.$("#generate-secret-key-form").shouldBe(Condition.visible);
return this;
}
}

tests/src/test/java/org/sonarqube/pageobjects/LoginPage.java → server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/pageobjects/LoginPage.java View File

@@ -17,19 +17,17 @@
* 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;
package org.sonarqube.qa.util.pageobjects;

import com.codeborne.selenide.Condition;
import com.codeborne.selenide.Selenide;
import com.codeborne.selenide.SelenideElement;
import org.openqa.selenium.By;

import static com.codeborne.selenide.Selenide.$;
import static com.codeborne.selenide.Selenide.page;

public class LoginPage {

public LoginPage() {
$("#login_form").should(Condition.exist);
Selenide.$("#login_form").should(Condition.exist);
}

public Navigation submitCredentials(String login) {
@@ -41,26 +39,26 @@ public class LoginPage {
}

public Navigation useOAuth2() {
$(".oauth-providers a").click();
return page(Navigation.class);
Selenide.$(".oauth-providers a").click();
return Selenide.page(Navigation.class);
}

public LoginPage submitWrongCredentials(String login, String password) {
$("#login").val(login);
$("#password").val(password);
$(By.name("commit")).click();
return page(LoginPage.class);
Selenide.$("#login").val(login);
Selenide.$("#password").val(password);
Selenide.$(By.name("commit")).click();
return Selenide.page(LoginPage.class);
}

public SelenideElement getErrorMessage() {
return $(".process-spinner-failed");
return Selenide.$(".process-spinner-failed");
}

private <T> T submitCredentials(String login, String password, Class<T> expectedResultPage) {
$("#login").val(login);
$("#password").val(password);
$(By.name("commit")).click();
$("#login").should(Condition.disappear);
return page(expectedResultPage);
Selenide.$("#login").val(login);
Selenide.$("#password").val(password);
Selenide.$(By.name("commit")).click();
Selenide.$("#login").should(Condition.disappear);
return Selenide.page(expectedResultPage);
}
}

tests/src/test/java/org/sonarqube/pageobjects/MarketplacePage.java → server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/pageobjects/MarketplacePage.java View File

@@ -17,28 +17,25 @@
* 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;
package org.sonarqube.qa.util.pageobjects;

import com.codeborne.selenide.Condition;
import com.codeborne.selenide.Selenide;
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);
Selenide.$("#marketplace-page").should(Condition.exist);
}

public MarketplacePage hasPendingPlugins(String text) {
$(".js-pending").should(Condition.exist).shouldHave(Condition.text(text));
Selenide.$(".js-pending").should(Condition.exist).shouldHave(Condition.text(text));
return this;
}

public MarketplacePage hasPluginsCount(int count) {
$$("#marketplace-plugins>ul>li").shouldHaveSize(count);
Selenide.$$("#marketplace-plugins>ul>li").shouldHaveSize(count);
return this;
}

@@ -48,7 +45,7 @@ public class MarketplacePage {
}

public MarketplacePage searchPlugin(String search) {
$("#marketplace-search input.search-box-input").should(Condition.exist).sendKeys(search);
Selenide.$("#marketplace-search input.search-box-input").should(Condition.exist).sendKeys(search);
return this;
}

@@ -58,6 +55,6 @@ public class MarketplacePage {
}

private SelenideElement getPlugin(String name) {
return $$(".js-plugin-name").findBy(Condition.text(name)).should(Condition.exist).parent().parent().parent();
return Selenide.$$(".js-plugin-name").findBy(Condition.text(name)).should(Condition.exist).parent().parent().parent();
}
}

tests/src/test/java/org/sonarqube/pageobjects/Navigation.java → server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/pageobjects/Navigation.java View File

@@ -17,7 +17,7 @@
* 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;
package org.sonarqube.qa.util.pageobjects;

import com.codeborne.selenide.Condition;
import com.codeborne.selenide.Selenide;
@@ -31,34 +31,25 @@ import javax.annotation.Nullable;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.html5.WebStorage;
import org.sonarqube.pageobjects.issues.IssuesPage;
import org.sonarqube.pageobjects.measures.MeasuresPage;
import org.sonarqube.pageobjects.organization.MembersPage;
import org.sonarqube.pageobjects.projects.ProjectsPage;
import org.sonarqube.pageobjects.settings.SettingsPage;
import org.sonarqube.tests.Tester;

import static com.codeborne.selenide.Condition.visible;
import static com.codeborne.selenide.Selenide.$;
import static com.codeborne.selenide.Selenide.clearBrowserLocalStorage;
import static com.codeborne.selenide.Selenide.page;
import org.sonarqube.qa.util.SelenideConfig;
import org.sonarqube.qa.util.pageobjects.issues.IssuesPage;
import org.sonarqube.qa.util.pageobjects.measures.MeasuresPage;
import org.sonarqube.qa.util.pageobjects.organization.MembersPage;
import org.sonarqube.qa.util.pageobjects.projects.ProjectsPage;
import org.sonarqube.qa.util.pageobjects.settings.SettingsPage;

public class Navigation {

public Navigation() {
$("#content").shouldBe(Condition.exist);
Selenide.$("#content").shouldBe(Condition.exist);
}

/**
* @deprecated use {@link Tester#openBrowser()}
*/
@Deprecated
public static Navigation create(Orchestrator orchestrator) {
WebDriver driver = SelenideConfig.configure(orchestrator);
driver.manage().deleteAllCookies();
clearStorage(d -> d.getLocalStorage().clear());
clearStorage(d -> d.getSessionStorage().clear());
clearStorage(d -> clearBrowserLocalStorage());
clearStorage(d -> Selenide.clearBrowserLocalStorage());
return Selenide.open("/", Navigation.class);
}

@@ -165,7 +156,7 @@ public class Navigation {

public QualityProfilePage openQualityProfile(String language, String name, String organization) {
String profileUrl = "/quality_profiles/show?language=" + language + "&name=" + name;
return open("/organizations/" + organization + profileUrl , QualityProfilePage.class);
return open("/organizations/" + organization + profileUrl, QualityProfilePage.class);
}

public BackgroundTasksPage openBackgroundTasksPage() {
@@ -185,7 +176,9 @@ public class Navigation {
return open("/admin/system", SystemInfoPage.class);
}

public MarketplacePage openMarketplace() { return open("/admin/marketplace", MarketplacePage.class);}
public MarketplacePage openMarketplace() {
return open("/admin/marketplace", MarketplacePage.class);
}

public NotificationsPage openNotifications() {
return open("/account/notifications", NotificationsPage.class);
@@ -213,18 +206,18 @@ public class Navigation {
}

public Navigation shouldBeLoggedIn() {
loggedInDropdown().should(visible);
loggedInDropdown().should(Condition.visible);
return this;
}

public Navigation shouldNotBeLoggedIn() {
logInLink().should(visible);
logInLink().should(Condition.visible);
return this;
}

public LoginPage logIn() {
logInLink().click();
return page(LoginPage.class);
return Selenide.page(LoginPage.class);
}

public Navigation logOut() {
@@ -241,31 +234,31 @@ public class Navigation {
}

public SelenideElement clickOnQualityProfiles() {
return $(By.linkText("Quality Profiles"));
return Selenide.$(By.linkText("Quality Profiles"));
}

public SelenideElement getRightBar() {
return $("#global-navigation .navbar-right");
return Selenide.$("#global-navigation .navbar-right");
}

public SelenideElement getFooter() {
return $("#footer");
return Selenide.$("#footer");
}

public SelenideElement getErrorMessage() {
return $("#error");
return Selenide.$("#error");
}

private SelenideElement logInLink() {
return $(By.linkText("Log in"));
return Selenide.$(By.linkText("Log in"));
}

private SelenideElement loggedInDropdown() {
return $(".js-user-authenticated");
return Selenide.$(".js-user-authenticated");
}

public Navigation shouldBeRedirectedToLogin() {
$("#login_form").should(visible);
Selenide.$("#login_form").should(Condition.visible);
return this;
}


tests/src/test/java/org/sonarqube/pageobjects/NotificationsPage.java → server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/pageobjects/NotificationsPage.java View File

@@ -17,19 +17,17 @@
* 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;
package org.sonarqube.qa.util.pageobjects;

import static com.codeborne.selenide.Condition.cssClass;
import static com.codeborne.selenide.Condition.text;
import static com.codeborne.selenide.Condition.visible;
import static com.codeborne.selenide.Selenide.$;
import com.codeborne.selenide.Condition;
import com.codeborne.selenide.Selenide;

public class NotificationsPage extends Navigation {

private final String EMAIL = "EmailNotificationChannel";

public NotificationsPage() {
$("#account-page").shouldHave(text("Overall notifications"));
Selenide.$("#account-page").shouldHave(Condition.text("Overall notifications"));
}

public NotificationsPage shouldHaveGlobalNotification(String type) {
@@ -101,20 +99,20 @@ public class NotificationsPage extends Navigation {
}

private NotificationsPage shouldBeChecked(String selector) {
$(selector)
.shouldBe(visible)
.shouldHave(cssClass("icon-checkbox-checked"));
Selenide.$(selector)
.shouldBe(Condition.visible)
.shouldHave(Condition.cssClass("icon-checkbox-checked"));
return this;
}

private NotificationsPage shouldNotBeChecked(String selector) {
$(selector)
.shouldBe(visible)
.shouldNotHave(cssClass("icon-checkbox-checked"));
Selenide.$(selector)
.shouldBe(Condition.visible)
.shouldNotHave(Condition.cssClass("icon-checkbox-checked"));
return this;
}

private void toggleCheckbox(String selector) {
$(selector).click();
Selenide.$(selector).click();
}
}

tests/src/test/java/org/sonarqube/pageobjects/ProjectActivityPage.java → server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/pageobjects/ProjectActivityPage.java View File

@@ -17,25 +17,22 @@
* 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;
package org.sonarqube.qa.util.pageobjects;

import com.codeborne.selenide.Condition;
import com.codeborne.selenide.ElementsCollection;
import com.codeborne.selenide.Selenide;
import java.util.List;
import java.util.stream.Collectors;

import static com.codeborne.selenide.Condition.hasText;
import static com.codeborne.selenide.Selenide.$;
import static com.codeborne.selenide.Selenide.$$;

public class ProjectActivityPage {

public ProjectActivityPage() {
$("#project-activity").should(Condition.exist);
Selenide.$("#project-activity").should(Condition.exist);
}

public ElementsCollection getAnalyses() {
return $$(".project-activity-analysis");
return Selenide.$$(".project-activity-analysis");
}

public List<ProjectAnalysisItem> getAnalysesAsItems() {
@@ -46,18 +43,18 @@ public class ProjectActivityPage {
}

public ProjectAnalysisItem getLastAnalysis() {
return new ProjectAnalysisItem($(".project-activity-analysis"));
return new ProjectAnalysisItem(Selenide.$(".project-activity-analysis"));
}

public ProjectAnalysisItem getFirstAnalysis() {
return new ProjectAnalysisItem($$(".project-activity-analysis").last());
return new ProjectAnalysisItem(Selenide.$$(".project-activity-analysis").last());
}

public ProjectActivityPage assertFirstAnalysisOfTheDayHasText(String day, String text) {
$("#project-activity")
Selenide.$("#project-activity")
.find(".project-activity-day[data-day=\"" + day + "\"]")
.find(".project-activity-analysis")
.should(hasText(text));
.should(Condition.hasText(text));
return this;
}
}

tests/src/test/java/org/sonarqube/pageobjects/ProjectAnalysisItem.java → server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/pageobjects/ProjectAnalysisItem.java View File

@@ -17,14 +17,12 @@
* 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;
package org.sonarqube.qa.util.pageobjects;

import com.codeborne.selenide.Condition;
import com.codeborne.selenide.Selenide;
import com.codeborne.selenide.SelenideElement;

import static com.codeborne.selenide.Condition.text;
import static com.codeborne.selenide.Condition.visible;
import static com.codeborne.selenide.Selenide.$;

public class ProjectAnalysisItem {

private final SelenideElement elt;
@@ -34,19 +32,19 @@ public class ProjectAnalysisItem {
}

public ProjectAnalysisItem shouldHaveEventWithText(String text) {
elt.find(".project-activity-events").shouldHave(text(text));
elt.find(".project-activity-events").shouldHave(Condition.text(text));
return this;
}

public ProjectAnalysisItem shouldHaveDeleteButton() {
elt.find(".js-analysis-actions").click();
elt.find(".js-delete-analysis").shouldBe(visible);
elt.find(".js-delete-analysis").shouldBe(Condition.visible);
return this;
}

public ProjectAnalysisItem shouldNotHaveDeleteButton() {
elt.find(".js-analysis-actions").click();
elt.find(".js-delete-analysis").shouldNotBe(visible);
elt.find(".js-delete-analysis").shouldNotBe(Condition.visible);
return this;
}

@@ -54,23 +52,23 @@ public class ProjectAnalysisItem {
elt.find(".js-analysis-actions").click();
elt.find(".js-delete-analysis").click();

SelenideElement modal = $(".modal");
modal.shouldBe(visible);
SelenideElement modal = Selenide.$(".modal");
modal.shouldBe(Condition.visible);
modal.find("button[type=\"submit\"]").click();

elt.shouldNotBe(visible);
elt.shouldNotBe(Condition.visible);
}

public ProjectAnalysisItem addCustomEvent(String name) {
elt.find(".js-analysis-actions").click();
elt.find(".js-add-event").click();

SelenideElement modal = $(".modal");
modal.shouldBe(visible);
SelenideElement modal = Selenide.$(".modal");
modal.shouldBe(Condition.visible);
modal.find("input").setValue(name);
modal.find("button[type=\"submit\"]").click();

elt.find(".project-activity-event:first-child").shouldHave(text(name));
elt.find(".project-activity-event:first-child").shouldHave(Condition.text(name));
return this;
}

@@ -78,12 +76,12 @@ public class ProjectAnalysisItem {
SelenideElement firstEvent = elt.find(".project-activity-event:first-child");
firstEvent.find(".js-change-event").click();

SelenideElement modal = $(".modal");
modal.shouldBe(visible);
SelenideElement modal = Selenide.$(".modal");
modal.shouldBe(Condition.visible);
modal.find("input").setValue(newName);
modal.find("button[type=\"submit\"]").click();

firstEvent.shouldHave(text(newName));
firstEvent.shouldHave(Condition.text(newName));
return this;
}

@@ -93,8 +91,8 @@ public class ProjectAnalysisItem {
SelenideElement firstEvent = elt.find(".project-activity-event:first-child");
firstEvent.find(".js-delete-event").click();

SelenideElement modal = $(".modal");
modal.shouldBe(visible);
SelenideElement modal = Selenide.$(".modal");
modal.shouldBe(Condition.visible);
modal.find("button[type=\"submit\"]").click();

elt.findAll(".project-activity-event").shouldHaveSize(eventsCount - 1);

tests/src/test/java/org/sonarqube/pageobjects/ProjectCodePage.java → server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/pageobjects/ProjectCodePage.java View File

@@ -17,45 +17,45 @@
* 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;
package org.sonarqube.qa.util.pageobjects;

import static com.codeborne.selenide.Condition.text;
import static com.codeborne.selenide.Selenide.$;
import static com.codeborne.selenide.Selenide.$$;
import com.codeborne.selenide.Condition;
import com.codeborne.selenide.Selenide;

public class ProjectCodePage {

public ProjectCodePage() {}
public ProjectCodePage() {
}

public ProjectCodePage openFirstComponent() {
$$(".code-name-cell a").first().click();
Selenide.$$(".code-name-cell a").first().click();
return this;
}

public ProjectCodePage search(String query) {
$(".code-search .search-box-input").val(query);
Selenide.$(".code-search .search-box-input").val(query);
return this;
}

public ProjectCodePage shouldHaveComponent(String name) {
$(".code-components").shouldHave(text(name));
Selenide.$(".code-components").shouldHave(Condition.text(name));
return this;
}

public ProjectCodePage shouldHaveCode(String code) {
$(".code-components .source-viewer").shouldHave(text(code));
Selenide.$(".code-components .source-viewer").shouldHave(Condition.text(code));
return this;
}

public ProjectCodePage shouldHaveBreadcrumbs(String... breadcrumbs) {
for (String breadcrumb : breadcrumbs) {
$(".code-breadcrumbs").shouldHave(text(breadcrumb));
Selenide.$(".code-breadcrumbs").shouldHave(Condition.text(breadcrumb));
}
return this;
}

public ProjectCodePage shouldSearchResult(String name) {
$(".code-search-with-results").shouldHave(text(name));
Selenide.$(".code-search-with-results").shouldHave(Condition.text(name));
return this;
}
}

tests/src/test/java/org/sonarqube/pageobjects/ProjectDashboardPage.java → server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/pageobjects/ProjectDashboardPage.java View File

@@ -17,80 +17,77 @@
* 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;
package org.sonarqube.qa.util.pageobjects;

import com.codeborne.selenide.Condition;
import com.codeborne.selenide.ElementsCollection;
import com.codeborne.selenide.Selenide;
import com.codeborne.selenide.SelenideElement;
import java.util.Arrays;
import org.openqa.selenium.By;

import static com.codeborne.selenide.Condition.exist;
import static com.codeborne.selenide.Condition.hasText;
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.$$;
import static org.assertj.core.api.Assertions.assertThat;


public class ProjectDashboardPage {

public ProjectDashboardPage() {
$(".overview").shouldBe(visible);
Selenide.$(".overview").shouldBe(Condition.visible);
}

public SelenideElement getLinesOfCode() {
SelenideElement element = $("#overview-ncloc");
element.shouldBe(visible);
SelenideElement element = Selenide.$("#overview-ncloc");
element.shouldBe(Condition.visible);
return element;
}

public SelenideElement getLanguageDistribution() {
SelenideElement element = $("#overview-language-distribution");
element.shouldBe(visible);
SelenideElement element = Selenide.$("#overview-language-distribution");
element.shouldBe(Condition.visible);
return element;
}

public SelenideElement getOverviewMeasure(String measure) {
ElementsCollection measures = $$(".overview-domain-measure");
SelenideElement element = measures.find(text(measure)).shouldBe(visible);
ElementsCollection measures = Selenide.$$(".overview-domain-measure");
SelenideElement element = measures.find(Condition.text(measure)).shouldBe(Condition.visible);
return element;
}

private SelenideElement getTagsMeta() {
SelenideElement element = $(".overview-meta-tags");
element.shouldBe(visible);
SelenideElement element = Selenide.$(".overview-meta-tags");
element.shouldBe(Condition.visible);
return element;
}

public ProjectDashboardPage shouldHaveTags(String... tags) {
String tagsList = String.join(", ", Arrays.asList(tags));
this.getTagsMeta().$(".tags-list > span").should(hasText(tagsList));
this.getTagsMeta().$(".tags-list > span").should(Condition.hasText(tagsList));
return this;
}

public ProjectDashboardPage shouldNotBeEditable() {
SelenideElement tagsElem = this.getTagsMeta();
tagsElem.$("button").shouldNot(exist);
tagsElem.$("div.multi-select").shouldNot(exist);
tagsElem.$("button").shouldNot(Condition.exist);
tagsElem.$("div.multi-select").shouldNot(Condition.exist);
return this;
}

public ProjectDashboardPage shouldBeEditable() {
SelenideElement tagsElem = this.getTagsMeta();
tagsElem.$("button").shouldBe(visible);
tagsElem.$("button").shouldBe(Condition.visible);
return this;
}

public ProjectDashboardPage openTagEditor() {
SelenideElement tagsElem = this.getTagsMeta();
tagsElem.$("button").shouldBe(visible).click();
tagsElem.$("div.multi-select").shouldBe(visible);
tagsElem.$("button").shouldBe(Condition.visible).click();
tagsElem.$("div.multi-select").shouldBe(Condition.visible);
return this;
}

public SelenideElement getTagAtIdx(Integer idx) {
SelenideElement tagsElem = this.getTagsMeta();
tagsElem.$("div.multi-select").shouldBe(visible);
tagsElem.$("div.multi-select").shouldBe(Condition.visible);
return tagsElem.$$("ul.menu a").get(idx);
}

@@ -101,9 +98,9 @@ public class ProjectDashboardPage {
}

public ProjectDashboardPage hasQualityGateLink(String name, String link) {
SelenideElement elem = $$(".overview-meta-card")
.findBy(text("Quality Gate")).should(exist)
.find(By.linkText(name)).should(exist);
SelenideElement elem = Selenide.$$(".overview-meta-card")
.findBy(Condition.text("Quality Gate")).should(Condition.exist)
.find(By.linkText(name)).should(Condition.exist);
assertThat(elem.attr("href")).endsWith(link);
return this;
}

tests/src/test/java/org/sonarqube/pageobjects/ProjectKeyPage.java → server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/pageobjects/ProjectKeyPage.java View File

@@ -17,87 +17,84 @@
* 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;
package org.sonarqube.qa.util.pageobjects;

import com.codeborne.selenide.Condition;
import com.codeborne.selenide.Selenide;
import com.codeborne.selenide.SelenideElement;

import static com.codeborne.selenide.Condition.exist;
import static com.codeborne.selenide.Condition.hasText;
import static com.codeborne.selenide.Condition.visible;
import static com.codeborne.selenide.Selenide.$;

public class ProjectKeyPage {

public ProjectKeyPage() {
$("#project-key").should(exist);
Selenide.$("#project-key").should(Condition.exist);
}

public ProjectKeyPage assertSimpleUpdate() {
$("#update-key-new-key").shouldBe(visible);
$("#update-key-submit").shouldBe(visible);
Selenide.$("#update-key-new-key").shouldBe(Condition.visible);
Selenide.$("#update-key-submit").shouldBe(Condition.visible);
return this;
}

public ProjectKeyPage trySimpleUpdate(String newKey) {
$("#update-key-new-key").val(newKey);
$("#update-key-submit").click();
$("#update-key-confirm").click();
Selenide.$("#update-key-new-key").val(newKey);
Selenide.$("#update-key-submit").click();
Selenide.$("#update-key-confirm").click();
return this;
}

public ProjectKeyPage openFineGrainedUpdate() {
$("#update-key-tab-fine").click();
$("#project-key-fine-grained-update").shouldBe(visible);
Selenide.$("#update-key-tab-fine").click();
Selenide.$("#project-key-fine-grained-update").shouldBe(Condition.visible);
return this;
}

public ProjectKeyPage tryFineGrainedUpdate(String key, String newKey) {
SelenideElement form = $(".js-fine-grained-update[data-key=\"" + key + "\"]");
form.shouldBe(visible);
SelenideElement form = Selenide.$(".js-fine-grained-update[data-key=\"" + key + "\"]");
form.shouldBe(Condition.visible);

form.$("input").val(newKey);
form.$("button").click();

$("#update-key-confirm").click();
Selenide.$("#update-key-confirm").click();
return this;
}

public ProjectKeyPage assertBulkChange() {
$("#bulk-update-replace").shouldBe(visible);
$("#bulk-update-by").shouldBe(visible);
$("#bulk-update-see-results").shouldBe(visible);
Selenide.$("#bulk-update-replace").shouldBe(Condition.visible);
Selenide.$("#bulk-update-by").shouldBe(Condition.visible);
Selenide.$("#bulk-update-see-results").shouldBe(Condition.visible);
return this;
}

public ProjectKeyPage simulateBulkChange(String replace, String by) {
$("#bulk-update-replace").val(replace);
$("#bulk-update-by").val(by);
$("#bulk-update-see-results").click();
Selenide.$("#bulk-update-replace").val(replace);
Selenide.$("#bulk-update-by").val(by);
Selenide.$("#bulk-update-see-results").click();

$("#bulk-update-simulation").shouldBe(visible);
Selenide.$("#bulk-update-simulation").shouldBe(Condition.visible);
return this;
}

public ProjectKeyPage assertBulkChangeSimulationResult(String oldKey, String newKey) {
SelenideElement row = $("#bulk-update-results").$("[data-key=\"" + oldKey + "\"]");
row.$(".js-old-key").should(hasText(oldKey));
row.$(".js-new-key").should(hasText(newKey));
SelenideElement row = Selenide.$("#bulk-update-results").$("[data-key=\"" + oldKey + "\"]");
row.$(".js-old-key").should(Condition.hasText(oldKey));
row.$(".js-new-key").should(Condition.hasText(newKey));
return this;
}

public ProjectKeyPage assertDuplicated(String oldKey) {
SelenideElement row = $("#bulk-update-results").$("[data-key=\"" + oldKey + "\"]");
row.$(".js-new-key").$(".badge-danger").shouldBe(visible);
SelenideElement row = Selenide.$("#bulk-update-results").$("[data-key=\"" + oldKey + "\"]");
row.$(".js-new-key").$(".badge-danger").shouldBe(Condition.visible);
return this;
}

public ProjectKeyPage confirmBulkUpdate() {
$("#bulk-update-confirm").click();
Selenide.$("#bulk-update-confirm").click();
return this;
}

public ProjectKeyPage assertSuccessfulBulkUpdate() {
$("#project-key-bulk-update").$(".alert.alert-success").shouldBe(visible);
Selenide.$("#project-key-bulk-update").$(".alert.alert-success").shouldBe(Condition.visible);
return this;
}
}

tests/src/test/java/org/sonarqube/pageobjects/ProjectLinkItem.java → server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/pageobjects/ProjectLinkItem.java View File

@@ -17,7 +17,7 @@
* 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;
package org.sonarqube.qa.util.pageobjects;

import com.codeborne.selenide.SelenideElement;
import org.openqa.selenium.NoSuchElementException;

tests/src/test/java/org/sonarqube/pageobjects/ProjectLinksPage.java → server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/pageobjects/ProjectLinksPage.java View File

@@ -17,25 +17,22 @@
* 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;
package org.sonarqube.qa.util.pageobjects;

import com.codeborne.selenide.Condition;
import com.codeborne.selenide.ElementsCollection;
import com.codeborne.selenide.Selenide;
import java.util.List;
import java.util.stream.Collectors;

import static com.codeborne.selenide.Selenide.$;
import static com.codeborne.selenide.Selenide.$$;

public class ProjectLinksPage {

public ProjectLinksPage() {
$("#project-links").should(Condition.exist);
Selenide.$("#project-links").should(Condition.exist);
}

public ElementsCollection getLinks() {
return $$("#project-links tr[data-name]");
return Selenide.$$("#project-links tr[data-name]");
}

public List<ProjectLinkItem> getLinksAsItems() {

tests/src/test/java/org/sonarqube/pageobjects/ProjectPermissionsPage.java → server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/pageobjects/ProjectPermissionsPage.java View File

@@ -17,45 +17,43 @@
* 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;
package org.sonarqube.qa.util.pageobjects;

import static com.codeborne.selenide.Condition.cssClass;
import static com.codeborne.selenide.Condition.exist;
import static com.codeborne.selenide.Condition.visible;
import static com.codeborne.selenide.Selenide.$;
import com.codeborne.selenide.Condition;
import com.codeborne.selenide.Selenide;

public class ProjectPermissionsPage {

public ProjectPermissionsPage() {
$("#project-permissions-page").should(exist);
Selenide.$("#project-permissions-page").should(Condition.exist);
}

public ProjectPermissionsPage shouldBePublic() {
$("#visibility-public .icon-radio.is-checked").shouldBe(visible);
Selenide.$("#visibility-public .icon-radio.is-checked").shouldBe(Condition.visible);
return this;
}

public ProjectPermissionsPage shouldBePrivate() {
$("#visibility-private .icon-radio.is-checked").shouldBe(visible);
Selenide.$("#visibility-private .icon-radio.is-checked").shouldBe(Condition.visible);
return this;
}

public ProjectPermissionsPage turnToPublic() {
$("#visibility-public").click();
$("#confirm-turn-to-public").click();
Selenide.$("#visibility-public").click();
Selenide.$("#confirm-turn-to-public").click();
shouldBePublic();
return this;
}

public ProjectPermissionsPage turnToPrivate() {
$("#visibility-private").click();
Selenide.$("#visibility-private").click();
shouldBePrivate();
return this;
}

public ProjectPermissionsPage shouldNotAllowPrivate() {
$("#visibility-private").shouldHave(cssClass("text-muted"));
$(".upgrade-organization-box").shouldBe(visible);
Selenide.$("#visibility-private").shouldHave(Condition.cssClass("text-muted"));
Selenide.$(".upgrade-organization-box").shouldBe(Condition.visible);
return this;
}
}

tests/src/test/java/org/sonarqube/pageobjects/ProjectQualityGatePage.java → server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/pageobjects/ProjectQualityGatePage.java View File

@@ -17,29 +17,28 @@
* 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;
package org.sonarqube.qa.util.pageobjects;

import com.codeborne.selenide.Condition;
import com.codeborne.selenide.Selenide;
import com.codeborne.selenide.SelenideElement;

import static com.codeborne.selenide.Condition.exist;
import static com.codeborne.selenide.Selenide.$;

public class ProjectQualityGatePage {

public ProjectQualityGatePage() {
$("#project-quality-gate").should(exist);
Selenide.$("#project-quality-gate").should(Condition.exist);
}

public SelenideElement getSelectedQualityGate() {
return $(".Select-value-label");
return Selenide.$(".Select-value-label");
}

public void assertNotSelected() {
$(".Select-placeholder").should(exist);
$(".Select-value-label").shouldNot(exist);
Selenide.$(".Select-placeholder").should(Condition.exist);
Selenide.$(".Select-value-label").shouldNot(Condition.exist);
}

public void setQualityGate(String name) {
$(".Select-input input").val(name).pressEnter();
Selenide.$(".Select-input input").val(name).pressEnter();
}
}

tests/src/test/java/org/sonarqube/pageobjects/ProjectsManagementPage.java → server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/pageobjects/ProjectsManagementPage.java View File

@@ -17,45 +17,42 @@
* 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;
package org.sonarqube.qa.util.pageobjects;

import static com.codeborne.selenide.Condition.exist;
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.$$;
import com.codeborne.selenide.Condition;
import com.codeborne.selenide.Selenide;

public class ProjectsManagementPage {

public ProjectsManagementPage() {
$("#projects-management-page").should(exist);
Selenide.$("#projects-management-page").should(Condition.exist);
}

public ProjectsManagementPage shouldHaveProjectsCount(int count) {
$$("#projects-management-page-projects tbody tr").shouldHaveSize(count);
Selenide.$$("#projects-management-page-projects tbody tr").shouldHaveSize(count);
return this;
}

public ProjectsManagementPage shouldHaveProject(String key) {
$("#projects-management-page-projects").shouldHave(text(key));
Selenide.$("#projects-management-page-projects").shouldHave(Condition.text(key));
return this;
}

public ProjectsManagementPage createProject(String key, String name, String visibility) {
$("#create-project").click();
$("#create-project-name").val(key);
$("#create-project-key").val(name);
$("#visibility-" + visibility).click();
$("#create-project-submit").submit();
Selenide.$("#create-project").click();
Selenide.$("#create-project-name").val(key);
Selenide.$("#create-project-key").val(name);
Selenide.$("#visibility-" + visibility).click();
Selenide.$("#create-project-submit").submit();
return this;
}

public ProjectsManagementPage bulkApplyPermissionTemplate(String template) {
$(".js-bulk-apply-permission-template").click();
$(".modal .Select-value").click();
$$(".modal .Select-option").findBy(text(template)).click();
$(".modal-foot button").click();
$(".modal-body .alert-success").shouldBe(visible);
Selenide.$(".js-bulk-apply-permission-template").click();
Selenide.$(".modal .Select-value").click();
Selenide.$$(".modal .Select-option").findBy(Condition.text(template)).click();
Selenide.$(".modal-foot button").click();
Selenide.$(".modal-body .alert-success").shouldBe(Condition.visible);
return this;
}
}

tests/src/test/java/org/sonarqube/pageobjects/QualityGatePage.java → server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/pageobjects/QualityGatePage.java View File

@@ -17,40 +17,38 @@
* 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;
package org.sonarqube.qa.util.pageobjects;

import com.codeborne.selenide.Condition;

import static com.codeborne.selenide.Selenide.$;
import static com.codeborne.selenide.Selenide.$$;
import com.codeborne.selenide.Selenide;

public class QualityGatePage {
public QualityGatePage() {
$("#quality-gates-page").shouldBe(Condition.visible);
Selenide.$("#quality-gates-page").shouldBe(Condition.visible);
}

public QualityGatePage countQualityGates(Integer count) {
$$("#quality-gates-page .list-group-item").shouldHaveSize(count);
Selenide.$$("#quality-gates-page .list-group-item").shouldHaveSize(count);
return this;
}

public QualityGatePage canCreateQG() {
$("#quality-gate-add").should(Condition.exist).shouldBe(Condition.visible);
Selenide.$("#quality-gate-add").should(Condition.exist).shouldBe(Condition.visible);
return this;
}

public QualityGatePage canNotCreateQG() {
$("#quality-gate-add").shouldNot(Condition.exist);
Selenide.$("#quality-gate-add").shouldNot(Condition.exist);
return this;
}

public QualityGatePage displayIntro() {
$(".search-navigator-intro").should(Condition.exist).shouldBe(Condition.visible);
Selenide.$(".search-navigator-intro").should(Condition.exist).shouldBe(Condition.visible);
return this;
}

public QualityGatePage displayQualityGateDetail(String qualityGateName) {
$(".layout-page-main-header").shouldHave(Condition.text(qualityGateName));
Selenide.$(".layout-page-main-header").shouldHave(Condition.text(qualityGateName));
return this;
}
}

tests/src/test/java/org/sonarqube/pageobjects/QualityProfilePage.java → server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/pageobjects/QualityProfilePage.java View File

@@ -17,42 +17,38 @@
* 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;
package org.sonarqube.qa.util.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;
import com.codeborne.selenide.Selenide;

public class QualityProfilePage {
public QualityProfilePage() {
$("#quality-profile").shouldBe(Condition.visible);
Selenide.$("#quality-profile").shouldBe(Condition.visible);
}

public QualityProfilePage shouldHaveMissingSonarWayRules(Integer nbRules) {
$(".quality-profile-rules-sonarway-missing")
Selenide.$(".quality-profile-rules-sonarway-missing")
.shouldBe(Condition.visible)
.$("a").shouldHave(text(nbRules.toString()));
.$("a").shouldHave(Condition.text(nbRules.toString()));
return this;
}

public RulesPage showMissingSonarWayRules() {
$(".quality-profile-rules-sonarway-missing")
Selenide.$(".quality-profile-rules-sonarway-missing")
.shouldBe(Condition.visible).$("a").click();
$(".coding-rules").shouldBe(Condition.visible);
return page(RulesPage.class);
Selenide.$(".coding-rules").shouldBe(Condition.visible);
return Selenide.page(RulesPage.class);
}

public QualityProfilePage shouldHaveAssociatedProject(String projectName) {
$(".js-profile-project").shouldHave(text(projectName));
Selenide.$(".js-profile-project").shouldHave(Condition.text(projectName));
return this;
}

public QualityProfilePage shouldAllowToChangeProjects() {
$(".js-change-projects").shouldBe(visible).click();
$("#profile-projects .select-list-list").shouldBe(visible);
Selenide.$(".js-change-projects").shouldBe(Condition.visible).click();
Selenide.$("#profile-projects .select-list-list").shouldBe(Condition.visible);
return this;
}
}

tests/src/test/java/org/sonarqube/pageobjects/RuleDetails.java → server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/pageobjects/RuleDetails.java View File

@@ -17,13 +17,12 @@
* 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;
package org.sonarqube.qa.util.pageobjects;

import com.codeborne.selenide.Condition;
import com.codeborne.selenide.Selenide;
import com.codeborne.selenide.SelenideElement;

import static com.codeborne.selenide.Condition.text;
import static com.codeborne.selenide.Selenide.$;

public class RuleDetails {

private final SelenideElement elt;
@@ -33,7 +32,7 @@ public class RuleDetails {
}

public RuleDetails shouldBeActivatedOn(String profileName) {
$("#coding-rules-detail-quality-profiles").shouldHave(text(profileName));
Selenide.$("#coding-rules-detail-quality-profiles").shouldHave(Condition.text(profileName));
return this;
}


tests/src/test/java/org/sonarqube/pageobjects/RuleItem.java → server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/pageobjects/RuleItem.java View File

@@ -17,7 +17,7 @@
* 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;
package org.sonarqube.qa.util.pageobjects;

import com.codeborne.selenide.SelenideElement;


tests/src/test/java/org/sonarqube/pageobjects/RulesPage.java → server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/pageobjects/RulesPage.java View File

@@ -17,54 +17,50 @@
* 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;
package org.sonarqube.qa.util.pageobjects;

import com.codeborne.selenide.Condition;
import com.codeborne.selenide.ElementsCollection;
import com.codeborne.selenide.Selenide;
import com.codeborne.selenide.SelenideElement;
import org.openqa.selenium.By;

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.$$;

public class RulesPage extends Navigation {

public RulesPage() {
$(By.cssSelector(".coding-rules")).should(Condition.exist);
Selenide.$(By.cssSelector(".coding-rules")).should(Condition.exist);
}

public int getTotal() {
// warning - number is localized
return Integer.parseInt($("#coding-rules-total").text());
return Integer.parseInt(Selenide.$("#coding-rules-total").text());
}

public ElementsCollection getSelectedFacetItems(String facetName) {
SelenideElement facet = $(".search-navigator-facet-box[data-property='"+ facetName+"']").shouldBe(Condition.visible);
SelenideElement facet = Selenide.$(".search-navigator-facet-box[data-property='"+ facetName+"']").shouldBe(Condition.visible);
return facet.$$(".js-facet.active");
}

public RulesPage shouldHaveTotalRules(Integer total) {
$("#coding-rules-total").shouldHave(text(total.toString()));
Selenide.$("#coding-rules-total").shouldHave(Condition.text(total.toString()));
return this;
}

public RulesPage openFacet(String facet) {
$(".search-navigator-facet-box[data-property=\"" + facet + "\"] .js-facet-toggle").click();
Selenide.$(".search-navigator-facet-box[data-property=\"" + facet + "\"] .js-facet-toggle").click();
return this;
}

public RulesPage selectFacetItemByText(String facet, String itemText) {
$$(".search-navigator-facet-box[data-property=\"" + facet + "\"] .js-facet")
.findBy(text(itemText)).click();
Selenide.$$(".search-navigator-facet-box[data-property=\"" + facet + "\"] .js-facet")
.findBy(Condition.text(itemText)).click();
return this;
}

public RuleDetails openFirstRule() {
$$(".js-rule").first().click();
$(".coding-rules-details").shouldBe(visible);
return new RuleDetails($(".coding-rules-details"));
Selenide.$$(".js-rule").first().click();
Selenide.$(".coding-rules-details").shouldBe(Condition.visible);
return new RuleDetails(Selenide.$(".coding-rules-details"));
}

}

tests/src/test/java/org/sonarqube/pageobjects/SystemInfoPage.java → server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/pageobjects/SystemInfoPage.java View File

@@ -17,33 +17,30 @@
* 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;
package org.sonarqube.qa.util.pageobjects;

import com.codeborne.selenide.CollectionCondition;
import com.codeborne.selenide.Condition;
import com.codeborne.selenide.Selenide;
import com.codeborne.selenide.SelenideElement;

import static com.codeborne.selenide.Condition.exist;
import static com.codeborne.selenide.Condition.text;
import static com.codeborne.selenide.Selenide.$;
import static com.codeborne.selenide.Selenide.$$;

public class SystemInfoPage {
public SystemInfoPage() {
$(".page-title").should(exist).shouldHave(text("System Info"));
Selenide.$(".page-title").should(Condition.exist).shouldHave(Condition.text("System Info"));
}

public SystemInfoPage shouldHaveCard(String title) {
$$(".system-info-health-card-title").find(text(title)).should(exist);
Selenide.$$(".system-info-health-card-title").find(Condition.text(title)).should(Condition.exist);
return this;
}

public SystemInfoPage shouldHaveCards(String... titles) {
$$(".system-info-health-card-title").shouldHave(CollectionCondition.texts(titles));
Selenide.$$(".system-info-health-card-title").shouldHave(CollectionCondition.texts(titles));
return this;
}

public SystemInfoPageItem getCardItem(String card) {
SelenideElement cardTitle = $$(".system-info-health-card-title").find(text(card)).should(exist);
SelenideElement cardTitle = Selenide.$$(".system-info-health-card-title").find(Condition.text(card)).should(Condition.exist);
return new SystemInfoPageItem(cardTitle.parent().parent());
}
}
}

tests/src/test/java/org/sonarqube/pageobjects/SystemInfoPageItem.java → server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/pageobjects/SystemInfoPageItem.java View File

@@ -17,14 +17,11 @@
* 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;
package org.sonarqube.qa.util.pageobjects;

import com.codeborne.selenide.Condition;
import com.codeborne.selenide.SelenideElement;

import static com.codeborne.selenide.Condition.exactText;
import static com.codeborne.selenide.Condition.exist;
import static com.codeborne.selenide.Condition.text;

public class SystemInfoPageItem {
private final SelenideElement elt;

@@ -33,51 +30,51 @@ public class SystemInfoPageItem {
}

public SystemInfoPageItem shouldHaveHealth() {
elt.$(".system-info-health-info .status-indicator").should(exist);
elt.$(".system-info-health-info .status-indicator").should(Condition.exist);
return this;
}

public SystemInfoPageItem shouldHaveSection(String section) {
ensureOpen();
elt.$$("h4").findBy(text(section)).should(exist);
elt.$$("h4").findBy(Condition.text(section)).should(Condition.exist);
return this;
}

public SystemInfoPageItem shouldNotHaveSection(String section) {
ensureOpen();
elt.$$("h4").findBy(text(section)).shouldNot(exist);
elt.$$("h4").findBy(Condition.text(section)).shouldNot(Condition.exist);
return this;
}

public SystemInfoPageItem shouldHaveMainSection() {
ensureOpen();
elt.$$(".system-info-section").get(0).find("h4").shouldNot(exist);
elt.$$(".system-info-section").get(0).find("h4").shouldNot(Condition.exist);
return this;
}

public SystemInfoPageItem shouldHaveField(String field) {
ensureOpen();
elt.$$(".system-info-section-item-name").findBy(text(field)).should(exist);
elt.$$(".system-info-section-item-name").findBy(Condition.text(field)).should(Condition.exist);
return this;
}

public SystemInfoPageItem shouldNotHaveField(String field) {
ensureOpen();
elt.$$(".system-info-section-item-name").findBy(exactText(field)).shouldNot(exist);
elt.$$(".system-info-section-item-name").findBy(Condition.exactText(field)).shouldNot(Condition.exist);
return this;
}

public SystemInfoPageItem shouldHaveFieldWithValue(String field, String value) {
ensureOpen();
SelenideElement fieldElem = elt.$$(".system-info-section-item-name").findBy(text(field)).should(exist);
fieldElem.parent().parent().$$("td").shouldHaveSize(2).get(1).shouldHave(text(value));
SelenideElement fieldElem = elt.$$(".system-info-section-item-name").findBy(Condition.text(field)).should(Condition.exist);
fieldElem.parent().parent().$$("td").shouldHaveSize(2).get(1).shouldHave(Condition.text(value));
return this;
}

public SystemInfoPageItem ensureOpen() {
if(!isOpen()) {
elt.click();
elt.$(".boxed-group-inner").should(exist);
elt.$(".boxed-group-inner").should(Condition.exist);
}
return this;
}

tests/src/test/java/org/sonarqube/pageobjects/issues/Issue.java → server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/pageobjects/issues/Issue.java View File

@@ -17,14 +17,12 @@
* 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.issues;
package org.sonarqube.qa.util.pageobjects.issues;

import com.codeborne.selenide.Condition;
import com.codeborne.selenide.Selenide;
import com.codeborne.selenide.SelenideElement;

import static com.codeborne.selenide.Condition.exist;
import static com.codeborne.selenide.Condition.visible;
import static com.codeborne.selenide.Selenide.$;

public class Issue {

private final SelenideElement elt;
@@ -34,31 +32,31 @@ public class Issue {
}

public Issue shouldAllowAssign() {
elt.find(".js-issue-assign").shouldBe(visible);
elt.find(".js-issue-assign").shouldBe(Condition.visible);
return this;
}

public Issue shouldAllowChangeType() {
elt.find(".js-issue-set-type").shouldBe(visible);
elt.find(".js-issue-set-type").shouldBe(Condition.visible);
return this;
}

public Issue shouldNotAllowAssign() {
elt.find(".js-issue-assign").shouldNotBe(visible);
elt.find(".js-issue-assign").shouldNotBe(Condition.visible);
return this;
}

public Issue shouldNotAllowChangeType() {
elt.find(".js-issue-set-type").shouldNotBe(visible);
elt.find(".js-issue-set-type").shouldNotBe(Condition.visible);
return this;
}

public Issue assigneeSearchResultCount(String query, Integer count) {
SelenideElement assignLink = elt.find(".js-issue-assign");
assignLink.click();
SelenideElement popupMenu = $(".bubble-popup ul.menu").shouldBe(visible);
$(".bubble-popup input.search-box-input").shouldBe(visible).val("").sendKeys(query);
popupMenu.$("li a[data-text='Not assigned']").shouldNot(exist);
SelenideElement popupMenu = Selenide.$(".bubble-popup ul.menu").shouldBe(Condition.visible);
Selenide.$(".bubble-popup input.search-box-input").shouldBe(Condition.visible).val("").sendKeys(query);
popupMenu.$("li a[data-text='Not assigned']").shouldNot(Condition.exist);
popupMenu.$$("li").shouldHaveSize(count);
assignLink.click();
return this;

tests/src/test/java/org/sonarqube/pageobjects/issues/IssuesPage.java → server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/pageobjects/issues/IssuesPage.java View File

@@ -17,31 +17,27 @@
* 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.issues;
package org.sonarqube.qa.util.pageobjects.issues;

import com.codeborne.selenide.CollectionCondition;
import com.codeborne.selenide.Condition;
import com.codeborne.selenide.ElementsCollection;
import com.codeborne.selenide.Selenide;
import java.util.List;
import java.util.stream.Collectors;

import static com.codeborne.selenide.CollectionCondition.sizeGreaterThan;
import static com.codeborne.selenide.Condition.exist;
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.$$;

public class IssuesPage {

public IssuesPage() {
$(".issues").should(exist);
Selenide.$(".issues").should(Condition.exist);
}

private ElementsCollection getIssuesElements() {
return $$(".issues .issue");
return Selenide.$$(".issues .issue");
}

private ElementsCollection getIssuesPathComponents() {
return $$(".issues-workspace-list-component");
return Selenide.$$(".issues-workspace-list-component");
}

public List<Issue> getIssues() {
@@ -57,30 +53,30 @@ public class IssuesPage {
}

public Issue getFirstIssue() {
getIssuesElements().shouldHave(sizeGreaterThan(0));
getIssuesElements().shouldHave(CollectionCondition.sizeGreaterThan(0));
return new Issue(getIssuesElements().first());
}

public IssuesPage componentsShouldContain(String path) {
this.getIssuesPathComponents().forEach(element -> element.shouldHave(text(path)));
this.getIssuesPathComponents().forEach(element -> element.shouldHave(Condition.text(path)));
return this;
}

public IssuesPage componentsShouldNotContain(String path) {
this.getIssuesPathComponents().forEach(element -> element.shouldNotHave(text(path)));
this.getIssuesPathComponents().forEach(element -> element.shouldNotHave(Condition.text(path)));
return this;
}

public IssuesPage bulkChangeOpen() {
$("#issues-bulk-change").shouldBe(visible).click();
$("#bulk-change-form").shouldBe(visible);
Selenide.$("#issues-bulk-change").shouldBe(Condition.visible).click();
Selenide.$("#bulk-change-form").shouldBe(Condition.visible);
return this;
}

public IssuesPage bulkChangeAssigneeSearchCount(String query, Integer count) {
$("#issues-bulk-change-assignee .Select-input input").val(query);
$$("#issues-bulk-change-assignee .Select-option").shouldHaveSize(count);
$("#issues-bulk-change-assignee .Select-input input").pressEscape();
Selenide.$("#issues-bulk-change-assignee .Select-input input").val(query);
Selenide.$$("#issues-bulk-change-assignee .Select-option").shouldHaveSize(count);
Selenide.$("#issues-bulk-change-assignee .Select-input input").pressEscape();
return this;
}
}

tests/src/test/java/org/sonarqube/pageobjects/measures/MeasureContent.java → server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/pageobjects/measures/MeasureContent.java View File

@@ -17,14 +17,12 @@
* 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.measures;
package org.sonarqube.qa.util.pageobjects.measures;

import com.codeborne.selenide.Condition;
import com.codeborne.selenide.ElementsCollection;
import com.codeborne.selenide.SelenideElement;

import static com.codeborne.selenide.Condition.exist;
import static com.codeborne.selenide.Condition.text;

public class MeasureContent {
private final SelenideElement elt;

@@ -33,27 +31,27 @@ public class MeasureContent {
}

public MeasureContent shouldHaveTitle(String title) {
this.elt.$(".measure-details-header .measure-details-metric").should(exist).shouldHave(text(title));
this.elt.$(".measure-details-header .measure-details-metric").should(Condition.exist).shouldHave(Condition.text(title));
return this;
}

public MeasureContent shouldHaveHeaderValue(String value) {
this.elt.$(".measure-details-header .measure-details-value").should(exist).shouldHave(text(value));
this.elt.$(".measure-details-header .measure-details-value").should(Condition.exist).shouldHave(Condition.text(value));
return this;
}

public MeasureContent shouldHaveFile(String path) {
this.getFiles().find(text(path)).should(exist);
this.getFiles().find(Condition.text(path)).should(Condition.exist);
return this;
}

public MeasureContent drillDown(String item) {
this.getFiles().find(text(item)).should(exist).find("a").click();
this.getFiles().find(Condition.text(item)).should(Condition.exist).find("a").click();
return this;
}

public MeasureContent shouldDisplayCode() {
this.elt.$(".source-line-code").should(exist);
this.elt.$(".source-line-code").should(Condition.exist);
return this;
}


tests/src/test/java/org/sonarqube/pageobjects/measures/MeasuresPage.java → server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/pageobjects/measures/MeasuresPage.java View File

@@ -17,69 +17,67 @@
* 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.measures;
package org.sonarqube.qa.util.pageobjects.measures;

import com.codeborne.selenide.CollectionCondition;
import com.codeborne.selenide.Condition;
import com.codeborne.selenide.Selenide;
import com.codeborne.selenide.SelenideElement;
import org.openqa.selenium.Keys;

import static com.codeborne.selenide.Condition.exist;
import static com.codeborne.selenide.Condition.text;
import static com.codeborne.selenide.Selenide.$;
import static com.codeborne.selenide.Selenide.$$;

public class MeasuresPage {
public MeasuresPage() {
$("#component-measures").should(exist);
Selenide.$("#component-measures").should(Condition.exist);
}

public MeasuresPage displayBubbleChart(String title) {
SelenideElement bubblechart = $("#component-measures .measure-overview-bubble-chart");
bubblechart.$(".measure-overview-bubble-chart-title").shouldHave(text(title));
SelenideElement bubblechart = Selenide.$("#component-measures .measure-overview-bubble-chart");
bubblechart.$(".measure-overview-bubble-chart-title").shouldHave(Condition.text(title));
return this;
}

public MeasuresPage measureHasValue(String measure, Integer value) {
SelenideElement sidebar = this.getSideBar();
sidebar.$("#measure-" + measure + "-name").should(exist);
sidebar.$("#measure-" + measure + "-value").should(exist).shouldHave(text(value.toString()));
sidebar.$("#measure-" + measure + "-name").should(Condition.exist);
sidebar.$("#measure-" + measure + "-value").should(Condition.exist).shouldHave(Condition.text(value.toString()));
return this;
}

public MeasuresPage measureHasLeak(String measure, Integer value) {
SelenideElement sidebar = this.getSideBar();
sidebar.$("#measure-" + measure + "-name").should(exist);
sidebar.$("#measure-" + measure + "-leak").should(exist).shouldHave(text(value.toString()));
sidebar.$("#measure-" + measure + "-name").should(Condition.exist);
sidebar.$("#measure-" + measure + "-leak").should(Condition.exist).shouldHave(Condition.text(value.toString()));
return this;
}

public MeasuresPage breadcrumbsShouldHave(String item) {
$(".layout-page-header-panel .measure-breadcrumbs").shouldHave(text(item));
Selenide.$(".layout-page-header-panel .measure-breadcrumbs").shouldHave(Condition.text(item));
return this;
}

public MeasuresPage breadcrumbsShouldNotHave(String item) {
$(".layout-page-header-panel .measure-breadcrumbs").shouldNotHave(text(item));
Selenide.$(".layout-page-header-panel .measure-breadcrumbs").shouldNotHave(Condition.text(item));
return this;
}

public MeasuresPage backShortcut() {
$(".layout-page-header-panel").sendKeys(Keys.LEFT);
Selenide.$(".layout-page-header-panel").sendKeys(Keys.LEFT);
return this;
}

public MeasuresPage switchView(String view) {
SelenideElement select = $(".measure-view-select").should(exist);
SelenideElement select = Selenide.$(".measure-view-select").should(Condition.exist);
select.click();
select.$(".Select-menu-outer").should(exist)
select.$(".Select-menu-outer").should(Condition.exist)
.$$(".Select-option").shouldHave(CollectionCondition.sizeGreaterThan(1))
.find(text(view)).should(exist).click();
.find(Condition.text(view)).should(Condition.exist).click();
return this;
}

public MeasuresPage openFacet(String facet) {
SelenideElement facetBox = $$(".search-navigator-facet-box").find(text(facet));
SelenideElement facetBox = Selenide.$$(".search-navigator-facet-box").find(Condition.text(facet));
if(!facetBox.find("search-navigator-facet-list").isDisplayed()) {
facetBox.$(".search-navigator-facet-header a").should(exist).click();
facetBox.$(".search-navigator-facet-header a").should(Condition.exist).click();
}
return this;
}
@@ -88,12 +86,12 @@ public class MeasuresPage {
SelenideElement sidebar = this.getSideBar();
SelenideElement facetItem = sidebar.$("#measure-" + measure + "-name");
facetItem.click();
MeasureContent content = new MeasureContent($("#component-measures .measure-details-content").should(exist));
MeasureContent content = new MeasureContent(Selenide.$("#component-measures .measure-details-content").should(Condition.exist));
content.shouldHaveTitle(facetItem.getText());
return content;
}

private SelenideElement getSideBar() {
return $("#component-measures .layout-page-side").should(exist);
return Selenide.$("#component-measures .layout-page-side").should(Condition.exist);
}
}

tests/src/test/java/org/sonarqube/pageobjects/organization/MemberItem.java → server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/pageobjects/organization/MemberItem.java View File

@@ -18,15 +18,14 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/

package org.sonarqube.pageobjects.organization;
package org.sonarqube.qa.util.pageobjects.organization;

import com.codeborne.selenide.CollectionCondition;
import com.codeborne.selenide.Condition;
import com.codeborne.selenide.ElementsCollection;
import com.codeborne.selenide.Selenide;
import com.codeborne.selenide.SelenideElement;

import static com.codeborne.selenide.Selenide.$;

public class MemberItem {
private final SelenideElement elt;

@@ -87,8 +86,8 @@ public class MemberItem {
}

private SelenideElement getModal(String title) {
$(".modal-head").should(Condition.exist).shouldHave(Condition.text(title));
SelenideElement form = $(".ReactModalPortal form");
Selenide.$(".modal-head").should(Condition.exist).shouldHave(Condition.text(title));
SelenideElement form = Selenide.$(".ReactModalPortal form");
form.should(Condition.exist);
return form;
}

tests/src/test/java/org/sonarqube/pageobjects/organization/MembersPage.java → server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/pageobjects/organization/MembersPage.java View File

@@ -18,25 +18,21 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/

package org.sonarqube.pageobjects.organization;
package org.sonarqube.qa.util.pageobjects.organization;

import com.codeborne.selenide.Condition;
import com.codeborne.selenide.ElementsCollection;
import com.codeborne.selenide.Selenide;
import com.codeborne.selenide.SelenideElement;

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.$$;

public class MembersPage {

public MembersPage() {
$(".navbar-tabs a.active").shouldBe(visible).shouldHave(text("Members"));
Selenide.$(".navbar-tabs a.active").shouldBe(Condition.visible).shouldHave(Condition.text("Members"));
}

public ElementsCollection getMembers() {
return $$("table.data tr");
return Selenide.$$("table.data tr");
}

public MemberItem getMembersByIdx(Integer idx) {
@@ -44,28 +40,28 @@ public class MembersPage {
}

public MembersPage shouldHaveTotal(int total) {
$(".panel-vertical > span > strong").shouldHave(text(String.valueOf(total)));
Selenide.$(".panel-vertical > span > strong").shouldHave(Condition.text(String.valueOf(total)));
return this;
}

public MembersPage searchForMember(String query) {
$(".page .search-box-input").shouldBe(visible).val("").sendKeys(query);
Selenide.$(".page .search-box-input").shouldBe(Condition.visible).val("").sendKeys(query);
return this;
}

public MembersPage canAddMember() {
$(".page-actions").shouldBe(visible);
Selenide.$(".page-actions").shouldBe(Condition.visible);
return this;
}

public MembersPage canNotAddMember() {
$(".page-actions").shouldNot(Condition.exist);
Selenide.$(".page-actions").shouldNot(Condition.exist);
return this;
}

public MembersPage addMember(String login) {
this.canAddMember();
$(".page-actions button").click();
Selenide.$(".page-actions button").click();

SelenideElement modal = this.getModal("Add user");
SelenideElement input = modal.$(".Select-input input");
@@ -77,8 +73,8 @@ public class MembersPage {
}

private SelenideElement getModal(String title) {
$(".modal-head").should(Condition.exist).shouldHave(text(title));
SelenideElement form = $(".ReactModalPortal form");
Selenide.$(".modal-head").should(Condition.exist).shouldHave(Condition.text(title));
SelenideElement form = Selenide.$(".ReactModalPortal form");
form.should(Condition.exist);
return form;
}

+ 23
- 0
server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/pageobjects/package-info.java View File

@@ -0,0 +1,23 @@
/*
* 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.
*/
@ParametersAreNonnullByDefault
package org.sonarqube.qa.util.pageobjects;

import javax.annotation.ParametersAreNonnullByDefault;

tests/src/test/java/org/sonarqube/pageobjects/projects/FacetItem.java → server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/pageobjects/projects/FacetItem.java View File

@@ -17,7 +17,7 @@
* 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.projects;
package org.sonarqube.qa.util.pageobjects.projects;

import com.codeborne.selenide.Condition;
import com.codeborne.selenide.SelenideElement;

tests/src/test/java/org/sonarqube/pageobjects/projects/ProjectItem.java → server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/pageobjects/projects/ProjectItem.java View File

@@ -17,7 +17,7 @@
* 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.projects;
package org.sonarqube.qa.util.pageobjects.projects;

import com.codeborne.selenide.Condition;
import com.codeborne.selenide.SelenideElement;

tests/src/test/java/org/sonarqube/pageobjects/projects/ProjectsPage.java → server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/pageobjects/projects/ProjectsPage.java View File

@@ -17,31 +17,27 @@
* 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.projects;
package org.sonarqube.qa.util.pageobjects.projects;

import com.codeborne.selenide.Condition;
import com.codeborne.selenide.ElementsCollection;
import com.codeborne.selenide.Selenide;
import com.codeborne.selenide.SelenideElement;

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.$$;
import static com.codeborne.selenide.WebDriverRunner.url;
import static org.assertj.core.api.Assertions.assertThat;
import com.codeborne.selenide.WebDriverRunner;
import org.assertj.core.api.Assertions;

public class ProjectsPage {

public ProjectsPage() {
$("#projects-page").shouldBe(visible);
Selenide.$("#projects-page").shouldBe(Condition.visible);
}

public ElementsCollection getProjects() {
return $$(".projects-list > .boxed-group");
return Selenide.$$(".projects-list > .boxed-group");
}

public ElementsCollection getFacets() {
return $$(".search-navigator-facet-box");
return Selenide.$$(".search-navigator-facet-box");
}

public ProjectItem getProjectByKey(String projectKey) {
@@ -60,37 +56,37 @@ public class ProjectsPage {

public ProjectsPage shouldHaveTotal(int total) {
// warning - number is localized
$("#projects-total").shouldHave(text(String.valueOf(total)));
Selenide.$("#projects-total").shouldHave(Condition.text(String.valueOf(total)));
return this;
}

public ProjectsPage shouldDisplayAllProjects() {
assertThat(url()).endsWith("/projects");
Assertions.assertThat(WebDriverRunner.url()).endsWith("/projects");
return this;
}

public ProjectsPage shouldDisplayAllProjectsWidthSort(String sort) {
assertThat(url()).endsWith("/projects?sort=" + sort);
Assertions.assertThat(WebDriverRunner.url()).endsWith("/projects?sort=" + sort);
return this;
}

public ProjectsPage shouldDisplayFavoriteProjects() {
assertThat(url()).endsWith("/projects/favorite");
Assertions.assertThat(WebDriverRunner.url()).endsWith("/projects/favorite");
return this;
}

public ProjectsPage selectAllProjects() {
$("#all-projects").click();
Selenide.$("#all-projects").click();
return shouldDisplayAllProjects();
}

public ProjectsPage selectFavoriteProjects() {
$("#favorite-projects").click();
Selenide.$("#favorite-projects").click();
return shouldDisplayFavoriteProjects();
}

public ProjectsPage searchProject(String search) {
SelenideElement searchInput = $(".projects-topbar-item-search input");
SelenideElement searchInput = Selenide.$(".projects-topbar-item-search input");
searchInput.setValue("").sendKeys(search);
return this;
}
@@ -115,6 +111,6 @@ public class ProjectsPage {
}

private SelenideElement getOpenTopBar() {
return $(".projects-topbar-items").should(Condition.exist);
return Selenide.$(".projects-topbar-items").should(Condition.exist);
}
}

tests/src/test/java/org/sonarqube/pageobjects/settings/PropertySetInput.java → server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/pageobjects/settings/PropertySetInput.java View File

@@ -17,12 +17,11 @@
* 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.settings;
package org.sonarqube.qa.util.pageobjects.settings;

import com.codeborne.selenide.Condition;
import com.codeborne.selenide.SelenideElement;

import static com.codeborne.selenide.Condition.exist;

public class PropertySetInput {

private final SelenideElement elt;
@@ -42,7 +41,7 @@ public class PropertySetInput {

public PropertySetInput save() {
elt.find(".js-save-changes").click();
elt.find(".js-save-changes").shouldNot(exist);
elt.find(".js-save-changes").shouldNot(Condition.exist);
return this;
}
}

tests/src/test/java/org/sonarqube/pageobjects/settings/SettingsPage.java → server/sonar-qa-util/src/main/java/org/sonarqube/qa/util/pageobjects/settings/SettingsPage.java View File

@@ -17,68 +17,64 @@
* 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.settings;
package org.sonarqube.qa.util.pageobjects.settings;

import com.codeborne.selenide.Condition;
import com.codeborne.selenide.Selenide;
import com.codeborne.selenide.SelenideElement;
import org.openqa.selenium.By;

import static com.codeborne.selenide.Condition.cssClass;
import static com.codeborne.selenide.Condition.exactValue;
import static com.codeborne.selenide.Condition.exist;
import static com.codeborne.selenide.Condition.visible;
import static com.codeborne.selenide.Selenide.$;

public class SettingsPage {

public SettingsPage() {
$("#settings-page").shouldBe(visible);
Selenide.$("#settings-page").shouldBe(Condition.visible);
}

public SettingsPage assertMenuContains(String categoryName) {
$(".side-tabs-menu").$(By.linkText(categoryName)).shouldBe(visible);
Selenide.$(".side-tabs-menu").$(By.linkText(categoryName)).shouldBe(Condition.visible);
return this;
}

public SettingsPage assertSettingDisplayed(String settingKey) {
$(".settings-definition[data-key='" + settingKey + "']").shouldBe(visible);
Selenide.$(".settings-definition[data-key='" + settingKey + "']").shouldBe(Condition.visible);
return this;
}

public SettingsPage assertSettingNotDisplayed(String settingKey) {
$(".settings-definition[data-key='" + settingKey + "']").shouldNotBe(visible);
Selenide.$(".settings-definition[data-key='" + settingKey + "']").shouldNotBe(Condition.visible);
return this;
}

public SettingsPage openCategory(String categoryName) {
$(".side-tabs-menu").$(By.linkText(categoryName)).click();
Selenide.$(".side-tabs-menu").$(By.linkText(categoryName)).click();
return this;
}

public SettingsPage assertStringSettingValue(String settingKey, String value) {
$("input[name=\"settings[" + settingKey + "]\"]").shouldHave(exactValue(value));
Selenide.$("input[name=\"settings[" + settingKey + "]\"]").shouldHave(Condition.exactValue(value));
return this;
}

public SettingsPage assertBooleanSettingValue(String settingKey, boolean value) {
SelenideElement toggle = $("button[name=\"settings[" + settingKey + "]\"]");
SelenideElement toggle = Selenide.$("button[name=\"settings[" + settingKey + "]\"]");
if (value) {
toggle.shouldHave(cssClass("boolean-toggle-on"));
toggle.shouldHave(Condition.cssClass("boolean-toggle-on"));
} else {
toggle.shouldNotHave(cssClass("boolean-toggle-on"));
toggle.shouldNotHave(Condition.cssClass("boolean-toggle-on"));
}
return this;
}

public SettingsPage setStringValue(String settingKey, String value) {
SelenideElement setting = $(".settings-definition[data-key=\"" + settingKey + "\"]");
SelenideElement setting = Selenide.$(".settings-definition[data-key=\"" + settingKey + "\"]");
setting.find("input").val(value);
setting.find(".js-save-changes").click();
setting.find(".js-save-changes").shouldNot(exist);
setting.find(".js-save-changes").shouldNot(Condition.exist);
return this;
}

public PropertySetInput getPropertySetInput(String settingKey) {
SelenideElement setting = $(".settings-definition[data-key=\"" + settingKey + "\"]");
SelenideElement setting = Selenide.$(".settings-definition[data-key=\"" + settingKey + "\"]");
return new PropertySetInput(setting);
}
}

+ 6
- 0
tests/pom.xml View File

@@ -42,6 +42,12 @@
<type>zip</type>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.sonarsource.sonarqube</groupId>
<artifactId>sonar-qa-util</artifactId>
<version>${project.parent.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.sonarsource.sonarqube</groupId>
<artifactId>sonar-process</artifactId>

+ 1
- 1
tests/src/test/java/org/sonarqube/tests/Tester.java View File

@@ -23,7 +23,7 @@ import com.sonar.orchestrator.Orchestrator;
import javax.annotation.Nullable;
import org.apache.commons.lang.StringUtils;
import org.junit.rules.ExternalResource;
import org.sonarqube.pageobjects.Navigation;
import org.sonarqube.qa.util.pageobjects.Navigation;
import org.sonarqube.ws.client.WsClient;
import util.selenium.Selenese;


+ 3
- 3
tests/src/test/java/org/sonarqube/tests/issue/IssuesPageTest.java View File

@@ -26,9 +26,9 @@ import org.junit.BeforeClass;
import org.junit.ClassRule;
import org.junit.Rule;
import org.junit.Test;
import org.sonarqube.pageobjects.Navigation;
import org.sonarqube.pageobjects.issues.Issue;
import org.sonarqube.pageobjects.issues.IssuesPage;
import org.sonarqube.qa.util.pageobjects.Navigation;
import org.sonarqube.qa.util.pageobjects.issues.Issue;
import org.sonarqube.qa.util.pageobjects.issues.IssuesPage;
import util.ItUtils;
import util.user.UserRule;


+ 1
- 1
tests/src/test/java/org/sonarqube/tests/issue/OrganizationIssueAssignTest.java View File

@@ -38,7 +38,7 @@ import org.sonarqube.ws.client.issue.BulkChangeRequest;
import org.sonarqube.ws.client.issue.SearchWsRequest;
import org.sonarqube.ws.client.project.CreateRequest;
import org.sonarqube.ws.client.qualityprofile.AddProjectRequest;
import org.sonarqube.pageobjects.issues.IssuesPage;
import org.sonarqube.qa.util.pageobjects.issues.IssuesPage;
import util.issue.IssueRule;

import static java.lang.String.format;

+ 1
- 1
tests/src/test/java/org/sonarqube/tests/issue/OrganizationIssuesPageTest.java View File

@@ -25,7 +25,7 @@ import org.junit.Before;
import org.junit.ClassRule;
import org.junit.Rule;
import org.junit.Test;
import org.sonarqube.pageobjects.Navigation;
import org.sonarqube.qa.util.pageobjects.Navigation;
import org.sonarqube.tests.Category6Suite;
import org.sonarqube.tests.Tester;
import org.sonarqube.ws.Organizations;

+ 2
- 2
tests/src/test/java/org/sonarqube/tests/marketplace/UpdateCenterTest.java View File

@@ -24,8 +24,8 @@ 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 org.sonarqube.qa.util.pageobjects.MarketplacePage;
import org.sonarqube.qa.util.pageobjects.Navigation;
import util.user.UserRule;

import static util.ItUtils.pluginArtifact;

+ 1
- 1
tests/src/test/java/org/sonarqube/tests/measure/DifferentialPeriodsTest.java View File

@@ -29,7 +29,7 @@ import org.junit.ClassRule;
import org.junit.Rule;
import org.junit.Test;
import org.sonarqube.ws.client.WsClient;
import org.sonarqube.pageobjects.Navigation;
import org.sonarqube.qa.util.pageobjects.Navigation;
import util.ItUtils;
import util.user.UserRule;


+ 2
- 3
tests/src/test/java/org/sonarqube/tests/measure/ProjectDashboardTest.java View File

@@ -30,14 +30,13 @@ import org.junit.Test;
import org.openqa.selenium.Keys;
import org.sonarqube.ws.client.PostRequest;
import org.sonarqube.ws.client.WsClient;
import org.sonarqube.pageobjects.Navigation;
import org.sonarqube.pageobjects.ProjectDashboardPage;
import org.sonarqube.qa.util.pageobjects.Navigation;
import org.sonarqube.qa.util.pageobjects.ProjectDashboardPage;
import util.user.UserRule;

import static com.codeborne.selenide.Condition.exist;
import static com.codeborne.selenide.Condition.hasText;
import static com.codeborne.selenide.Condition.text;
import static com.codeborne.selenide.Condition.visible;
import static util.ItUtils.newAdminWsClient;
import static util.ItUtils.projectDir;
import static util.selenium.Selenese.runSelenese;

+ 3
- 3
tests/src/test/java/org/sonarqube/tests/measure/ProjectMeasuresPageTest.java View File

@@ -25,9 +25,9 @@ import org.junit.Before;
import org.junit.ClassRule;
import org.junit.Rule;
import org.junit.Test;
import org.sonarqube.pageobjects.Navigation;
import org.sonarqube.pageobjects.measures.MeasureContent;
import org.sonarqube.pageobjects.measures.MeasuresPage;
import org.sonarqube.qa.util.pageobjects.Navigation;
import org.sonarqube.qa.util.pageobjects.measures.MeasureContent;
import org.sonarqube.qa.util.pageobjects.measures.MeasuresPage;
import org.sonarqube.tests.Category1Suite;
import org.sonarqube.tests.Tester;


+ 1
- 1
tests/src/test/java/org/sonarqube/tests/organization/BillingTest.java View File

@@ -36,7 +36,7 @@ import org.sonarqube.ws.client.WsResponse;
import org.sonarqube.ws.client.organization.UpdateProjectVisibilityWsRequest;
import org.sonarqube.ws.client.project.CreateRequest;
import org.sonarqube.ws.client.project.UpdateVisibilityRequest;
import org.sonarqube.pageobjects.Navigation;
import org.sonarqube.qa.util.pageobjects.Navigation;
import util.ItUtils;

import static java.lang.String.format;

+ 1
- 1
tests/src/test/java/org/sonarqube/tests/organization/OrganizationMembershipUiTest.java View File

@@ -26,7 +26,7 @@ import org.junit.Before;
import org.junit.ClassRule;
import org.junit.Rule;
import org.junit.Test;
import org.sonarqube.pageobjects.organization.MembersPage;
import org.sonarqube.qa.util.pageobjects.organization.MembersPage;
import org.sonarqube.tests.Category6Suite;
import org.sonarqube.tests.Tester;
import org.sonarqube.ws.Organizations.Organization;

+ 3
- 3
tests/src/test/java/org/sonarqube/tests/projectAdministration/BackgroundTasksTest.java View File

@@ -28,9 +28,9 @@ import org.junit.BeforeClass;
import org.junit.ClassRule;
import org.junit.Rule;
import org.junit.Test;
import org.sonarqube.pageobjects.BackgroundTaskItem;
import org.sonarqube.pageobjects.BackgroundTasksPage;
import org.sonarqube.pageobjects.Navigation;
import org.sonarqube.qa.util.pageobjects.BackgroundTaskItem;
import org.sonarqube.qa.util.pageobjects.BackgroundTasksPage;
import org.sonarqube.qa.util.pageobjects.Navigation;
import util.user.UserRule;

import static com.codeborne.selenide.CollectionCondition.sizeGreaterThan;

+ 3
- 3
tests/src/test/java/org/sonarqube/tests/projectAdministration/ProjectAdministrationTest.java View File

@@ -38,9 +38,9 @@ import org.openqa.selenium.By;
import org.sonar.wsclient.SonarClient;
import org.sonar.wsclient.base.HttpException;
import org.sonar.wsclient.user.UserParameters;
import org.sonarqube.pageobjects.Navigation;
import org.sonarqube.pageobjects.ProjectsManagementPage;
import org.sonarqube.pageobjects.settings.SettingsPage;
import org.sonarqube.qa.util.pageobjects.Navigation;
import org.sonarqube.qa.util.pageobjects.ProjectsManagementPage;
import org.sonarqube.qa.util.pageobjects.settings.SettingsPage;
import org.sonarqube.tests.Category1Suite;
import org.sonarqube.tests.Tester;
import org.sonarqube.ws.WsPermissions;

+ 2
- 2
tests/src/test/java/org/sonarqube/tests/projectAdministration/ProjectKeyUpdatePageTest.java View File

@@ -28,8 +28,8 @@ import org.junit.ClassRule;
import org.junit.Test;
import org.sonarqube.ws.client.PostRequest;
import org.sonarqube.ws.client.WsClient;
import org.sonarqube.pageobjects.Navigation;
import org.sonarqube.pageobjects.ProjectKeyPage;
import org.sonarqube.qa.util.pageobjects.Navigation;
import org.sonarqube.qa.util.pageobjects.ProjectKeyPage;

import static com.codeborne.selenide.Condition.visible;
import static com.codeborne.selenide.Selenide.$;

+ 3
- 3
tests/src/test/java/org/sonarqube/tests/projectAdministration/ProjectLinksPageTest.java View File

@@ -34,9 +34,9 @@ import org.sonarqube.ws.WsProjectLinks.CreateWsResponse;
import org.sonarqube.ws.client.WsClient;
import org.sonarqube.ws.client.projectlinks.CreateWsRequest;
import org.sonarqube.ws.client.projectlinks.DeleteWsRequest;
import org.sonarqube.pageobjects.Navigation;
import org.sonarqube.pageobjects.ProjectLinkItem;
import org.sonarqube.pageobjects.ProjectLinksPage;
import org.sonarqube.qa.util.pageobjects.Navigation;
import org.sonarqube.qa.util.pageobjects.ProjectLinkItem;
import org.sonarqube.qa.util.pageobjects.ProjectLinksPage;
import util.user.UserRule;

import static com.codeborne.selenide.Condition.hasText;

+ 2
- 2
tests/src/test/java/org/sonarqube/tests/projectAdministration/ProjectPermissionsTest.java View File

@@ -27,8 +27,8 @@ import org.junit.BeforeClass;
import org.junit.ClassRule;
import org.junit.Rule;
import org.junit.Test;
import org.sonarqube.pageobjects.Navigation;
import org.sonarqube.pageobjects.ProjectPermissionsPage;
import org.sonarqube.qa.util.pageobjects.Navigation;
import org.sonarqube.qa.util.pageobjects.ProjectPermissionsPage;
import util.user.UserRule;

import static util.ItUtils.projectDir;

+ 2
- 2
tests/src/test/java/org/sonarqube/tests/projectAdministration/ProjectQualityGatePageTest.java View File

@@ -33,8 +33,8 @@ import org.sonar.wsclient.qualitygate.QualityGateClient;
import org.sonarqube.ws.client.PostRequest;
import org.sonarqube.ws.client.WsClient;
import org.sonarqube.ws.client.qualitygate.SelectWsRequest;
import org.sonarqube.pageobjects.Navigation;
import org.sonarqube.pageobjects.ProjectQualityGatePage;
import org.sonarqube.qa.util.pageobjects.Navigation;
import org.sonarqube.qa.util.pageobjects.ProjectQualityGatePage;

import static util.ItUtils.newAdminWsClient;


+ 2
- 2
tests/src/test/java/org/sonarqube/tests/projectAdministration/ProjectVisibilityPageTest.java View File

@@ -31,8 +31,8 @@ import org.sonarqube.ws.WsComponents;
import org.sonarqube.ws.client.component.SearchProjectsRequest;
import org.sonarqube.ws.client.permission.RemoveGroupWsRequest;
import org.sonarqube.ws.client.project.UpdateVisibilityRequest;
import org.sonarqube.pageobjects.Navigation;
import org.sonarqube.pageobjects.ProjectsManagementPage;
import org.sonarqube.qa.util.pageobjects.Navigation;
import org.sonarqube.qa.util.pageobjects.ProjectsManagementPage;
import util.user.UserRule;

import static org.assertj.core.api.Assertions.assertThat;

+ 3
- 3
tests/src/test/java/org/sonarqube/tests/projectEvent/ProjectActivityPageTest.java View File

@@ -27,9 +27,9 @@ import org.junit.Before;
import org.junit.ClassRule;
import org.junit.Rule;
import org.junit.Test;
import org.sonarqube.pageobjects.Navigation;
import org.sonarqube.pageobjects.ProjectActivityPage;
import org.sonarqube.pageobjects.ProjectAnalysisItem;
import org.sonarqube.qa.util.pageobjects.Navigation;
import org.sonarqube.qa.util.pageobjects.ProjectActivityPage;
import org.sonarqube.qa.util.pageobjects.ProjectAnalysisItem;
import util.user.UserRule;

import static util.ItUtils.projectDir;

+ 1
- 1
tests/src/test/java/org/sonarqube/tests/projectSearch/LeakProjectsPageTest.java View File

@@ -33,7 +33,7 @@ import org.junit.Rule;
import org.junit.Test;
import org.sonarqube.tests.Tester;
import org.sonarqube.ws.Organizations.Organization;
import org.sonarqube.pageobjects.projects.ProjectsPage;
import org.sonarqube.qa.util.pageobjects.projects.ProjectsPage;

import static com.codeborne.selenide.WebDriverRunner.url;
import static java.util.Arrays.asList;

+ 2
- 2
tests/src/test/java/org/sonarqube/tests/projectSearch/ProjectsPageTest.java View File

@@ -27,8 +27,8 @@ import org.junit.BeforeClass;
import org.junit.ClassRule;
import org.junit.Test;
import org.junit.rules.RuleChain;
import org.sonarqube.pageobjects.Navigation;
import org.sonarqube.pageobjects.projects.ProjectsPage;
import org.sonarqube.qa.util.pageobjects.Navigation;
import org.sonarqube.qa.util.pageobjects.projects.ProjectsPage;
import org.sonarqube.tests.Category1Suite;
import org.sonarqube.tests.Tester;
import org.sonarqube.ws.WsUsers;

+ 2
- 2
tests/src/test/java/org/sonarqube/tests/qualityGate/OrganizationQualityGateUiTest.java View File

@@ -27,8 +27,8 @@ import org.junit.ClassRule;
import org.junit.Rule;
import org.junit.Test;
import org.openqa.selenium.By;
import org.sonarqube.pageobjects.ProjectDashboardPage;
import org.sonarqube.pageobjects.QualityGatePage;
import org.sonarqube.qa.util.pageobjects.ProjectDashboardPage;
import org.sonarqube.qa.util.pageobjects.QualityGatePage;
import org.sonarqube.tests.Category6Suite;
import org.sonarqube.tests.Tester;
import org.sonarqube.ws.Organizations;

+ 2
- 2
tests/src/test/java/org/sonarqube/tests/qualityGate/QualityGateUiTest.java View File

@@ -31,8 +31,8 @@ import org.junit.ClassRule;
import org.junit.Rule;
import org.junit.Test;
import org.openqa.selenium.By;
import org.sonarqube.pageobjects.Navigation;
import org.sonarqube.pageobjects.ProjectActivityPage;
import org.sonarqube.qa.util.pageobjects.Navigation;
import org.sonarqube.qa.util.pageobjects.ProjectActivityPage;
import org.sonarqube.tests.Category1Suite;
import org.sonarqube.tests.Tester;
import org.sonarqube.ws.WsProjects.CreateWsResponse.Project;

+ 3
- 3
tests/src/test/java/org/sonarqube/tests/qualityProfile/OrganizationQualityProfilesUiTest.java View File

@@ -27,9 +27,9 @@ 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.qa.util.pageobjects.Navigation;
import org.sonarqube.qa.util.pageobjects.QualityProfilePage;
import org.sonarqube.qa.util.pageobjects.RulesPage;
import org.sonarqube.tests.Category6Suite;
import org.sonarqube.tests.Tester;
import org.sonarqube.ws.Organizations.Organization;

+ 1
- 1
tests/src/test/java/org/sonarqube/tests/qualityProfile/QualityProfilesUiTest.java View File

@@ -28,7 +28,7 @@ import org.junit.ClassRule;
import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
import org.sonarqube.pageobjects.Navigation;
import org.sonarqube.qa.util.pageobjects.Navigation;
import org.sonarqube.tests.Category4Suite;
import org.sonarqube.tests.Tester;
import org.sonarqube.ws.client.PostRequest;

+ 1
- 1
tests/src/test/java/org/sonarqube/tests/rule/RulesPageTest.java View File

@@ -23,7 +23,7 @@ import com.sonar.orchestrator.Orchestrator;
import org.junit.ClassRule;
import org.junit.Rule;
import org.junit.Test;
import org.sonarqube.pageobjects.RulesPage;
import org.sonarqube.qa.util.pageobjects.RulesPage;
import org.sonarqube.tests.Category2Suite;
import org.sonarqube.tests.Tester;


+ 1
- 1
tests/src/test/java/org/sonarqube/tests/serverSystem/SystemInfoTest.java View File

@@ -27,7 +27,7 @@ import org.apache.commons.io.FileUtils;
import org.junit.ClassRule;
import org.junit.Rule;
import org.junit.Test;
import org.sonarqube.pageobjects.SystemInfoPage;
import org.sonarqube.qa.util.pageobjects.SystemInfoPage;
import org.sonarqube.tests.Category4Suite;
import org.sonarqube.tests.Tester;
import org.sonarqube.ws.client.GetRequest;

+ 2
- 2
tests/src/test/java/org/sonarqube/tests/settings/PropertySetsTest.java View File

@@ -34,8 +34,8 @@ import org.sonarqube.ws.Settings;
import org.sonarqube.ws.client.setting.SetRequest;
import org.sonarqube.ws.client.setting.SettingsService;
import org.sonarqube.ws.client.setting.ValuesRequest;
import org.sonarqube.pageobjects.Navigation;
import org.sonarqube.pageobjects.settings.SettingsPage;
import org.sonarqube.qa.util.pageobjects.Navigation;
import org.sonarqube.qa.util.pageobjects.settings.SettingsPage;
import util.user.UserRule;

import static com.google.common.collect.Lists.newArrayList;

+ 2
- 2
tests/src/test/java/org/sonarqube/tests/settings/SettingsTestRestartingOrchestrator.java View File

@@ -27,8 +27,8 @@ import org.junit.After;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.sonarqube.pageobjects.EncryptionPage;
import org.sonarqube.pageobjects.Navigation;
import org.sonarqube.qa.util.pageobjects.EncryptionPage;
import org.sonarqube.qa.util.pageobjects.Navigation;
import util.user.UserRule;

import static com.codeborne.selenide.Condition.visible;

+ 1
- 1
tests/src/test/java/org/sonarqube/tests/ui/SourceViewerTest.java View File

@@ -25,7 +25,7 @@ import org.sonarqube.tests.Category4Suite;
import org.junit.BeforeClass;
import org.junit.ClassRule;
import org.junit.Test;
import org.sonarqube.pageobjects.Navigation;
import org.sonarqube.qa.util.pageobjects.Navigation;

import static com.codeborne.selenide.Condition.exist;
import static com.codeborne.selenide.Selenide.$;

+ 1
- 1
tests/src/test/java/org/sonarqube/tests/ui/UiTest.java View File

@@ -29,7 +29,7 @@ import org.junit.ClassRule;
import org.junit.Test;
import org.sonarqube.ws.client.GetRequest;
import org.sonarqube.ws.client.WsResponse;
import org.sonarqube.pageobjects.Navigation;
import org.sonarqube.qa.util.pageobjects.Navigation;
import util.ItUtils;

import static com.codeborne.selenide.Condition.exist;

+ 2
- 2
tests/src/test/java/org/sonarqube/tests/user/BaseIdentityProviderTest.java View File

@@ -22,7 +22,6 @@ package org.sonarqube.tests.user;
import com.google.common.base.Joiner;
import com.google.common.base.Optional;
import com.sonar.orchestrator.Orchestrator;
import org.sonarqube.tests.Category4Suite;
import java.io.File;
import org.apache.commons.io.FileUtils;
import org.junit.After;
@@ -30,10 +29,11 @@ import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.ClassRule;
import org.junit.Test;
import org.sonarqube.qa.util.pageobjects.Navigation;
import org.sonarqube.tests.Category4Suite;
import org.sonarqube.ws.client.GetRequest;
import org.sonarqube.ws.client.WsClient;
import org.sonarqube.ws.client.user.CreateRequest;
import org.sonarqube.pageobjects.Navigation;
import util.user.UserRule;
import util.user.Users;


+ 1
- 1
tests/src/test/java/org/sonarqube/tests/user/ForceAuthenticationTest.java View File

@@ -34,7 +34,7 @@ import org.sonarqube.ws.client.WsClient;
import org.sonarqube.ws.client.WsConnector;
import org.sonarqube.ws.client.WsRequest;
import org.sonarqube.ws.client.WsResponse;
import org.sonarqube.pageobjects.Navigation;
import org.sonarqube.qa.util.pageobjects.Navigation;

import static org.assertj.core.api.Assertions.assertThat;
import static org.sonarqube.ws.client.WsRequest.Method.GET;

+ 2
- 2
tests/src/test/java/org/sonarqube/tests/user/LocalAuthenticationTest.java View File

@@ -26,8 +26,8 @@ import org.junit.After;
import org.junit.ClassRule;
import org.junit.Rule;
import org.junit.Test;
import org.sonarqube.pageobjects.LoginPage;
import org.sonarqube.pageobjects.Navigation;
import org.sonarqube.qa.util.pageobjects.LoginPage;
import org.sonarqube.qa.util.pageobjects.Navigation;
import org.sonarqube.tests.Category4Suite;
import org.sonarqube.tests.Tester;
import org.sonarqube.ws.WsUserTokens;

+ 2
- 2
tests/src/test/java/org/sonarqube/tests/user/MyAccountPageTest.java View File

@@ -21,15 +21,15 @@ package org.sonarqube.tests.user;

import com.sonar.orchestrator.Orchestrator;
import com.sonar.orchestrator.build.SonarScanner;
import org.sonarqube.tests.Category4Suite;
import org.junit.Before;
import org.junit.ClassRule;
import org.junit.Rule;
import org.junit.Test;
import org.sonarqube.qa.util.pageobjects.Navigation;
import org.sonarqube.tests.Category4Suite;
import org.sonarqube.tests.Tester;
import org.sonarqube.ws.WsUsers.CreateWsResponse.User;
import org.sonarqube.ws.client.PostRequest;
import org.sonarqube.pageobjects.Navigation;

import static com.codeborne.selenide.Condition.text;
import static com.codeborne.selenide.Condition.visible;

+ 1
- 1
tests/src/test/java/org/sonarqube/tests/user/OAuth2IdentityProviderTest.java View File

@@ -32,7 +32,7 @@ import org.junit.Before;
import org.junit.ClassRule;
import org.junit.Rule;
import org.junit.Test;
import org.sonarqube.pageobjects.Navigation;
import org.sonarqube.qa.util.pageobjects.Navigation;
import org.sonarqube.tests.Category4Suite;
import org.sonarqube.tests.Tester;
import org.sonarqube.ws.WsUsers.SearchWsResponse.User;

+ 1
- 1
tests/src/test/java/org/sonarqube/tests/user/RealmAuthenticationTest.java View File

@@ -36,7 +36,7 @@ import org.sonar.wsclient.base.HttpException;
import org.sonar.wsclient.connectors.HttpClient4Connector;
import org.sonar.wsclient.services.AuthenticationQuery;
import org.sonar.wsclient.user.UserParameters;
import org.sonarqube.pageobjects.SystemInfoPage;
import org.sonarqube.qa.util.pageobjects.SystemInfoPage;
import org.sonarqube.tests.Tester;
import org.sonarqube.ws.client.GetRequest;
import org.sonarqube.ws.client.WsResponse;

+ 1
- 1
tests/src/test/java/util/selenium/SeleneseRunner.java View File

@@ -39,7 +39,7 @@ import org.openqa.selenium.WebElement;
import org.openqa.selenium.logging.LogEntries;
import org.openqa.selenium.logging.LogEntry;
import org.openqa.selenium.logging.LogType;
import org.sonarqube.pageobjects.SelenideConfig;
import org.sonarqube.qa.util.SelenideConfig;

import static java.nio.charset.StandardCharsets.UTF_8;
import static java.util.Objects.requireNonNull;

Loading…
Cancel
Save