@@ -15,6 +15,11 @@ | |||
</properties> | |||
<dependencies> | |||
<dependency> | |||
<groupId>org.sonarsource.sonarqube</groupId> | |||
<artifactId>sonar-ws</artifactId> | |||
<version>${project.version}</version> | |||
</dependency> | |||
<dependency> | |||
<groupId>com.codeborne</groupId> | |||
<artifactId>selenide</artifactId> |
@@ -17,8 +17,9 @@ | |||
* along with this program; if not, write to the Free Software Foundation, | |||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |||
*/ | |||
package org.sonarqube.tests; | |||
package org.sonarqube.qa.util; | |||
import java.io.IOException; | |||
import java.net.InetAddress; | |||
import okhttp3.MediaType; | |||
import okhttp3.OkHttpClient; | |||
@@ -43,7 +44,7 @@ public class Elasticsearch { | |||
/** | |||
* Forbid indexing requests on the specified index. Index becomes read-only. | |||
*/ | |||
public void lockWrites(String index) throws Exception { | |||
public void lockWrites(String index) throws IOException { | |||
putIndexSetting(httpPort, index, "blocks.write", "true"); | |||
} | |||
@@ -51,19 +52,19 @@ public class Elasticsearch { | |||
* Enable indexing requests on the specified index. | |||
* @see #lockWrites(String) | |||
*/ | |||
public void unlockWrites(String index) throws Exception { | |||
public void unlockWrites(String index) throws IOException { | |||
putIndexSetting(httpPort, index, "blocks.write", "false"); | |||
} | |||
public void makeYellow() throws Exception { | |||
public void makeYellow() throws IOException { | |||
putIndexSetting(httpPort, "issues", "number_of_replicas", "5"); | |||
} | |||
public void makeGreen() throws Exception { | |||
public void makeGreen() throws IOException { | |||
putIndexSetting(httpPort, "issues", "number_of_replicas", "0"); | |||
} | |||
private void putIndexSetting(int searchHttpPort, String index, String key, String value) throws Exception { | |||
private static void putIndexSetting(int searchHttpPort, String index, String key, String value) throws IOException { | |||
Request.Builder request = new Request.Builder() | |||
.url(baseUrl(searchHttpPort) + index + "/_settings") | |||
.put(RequestBody.create(MediaType.parse("application/json"), "{" + | |||
@@ -76,7 +77,7 @@ public class Elasticsearch { | |||
assertThat(response.isSuccessful()).isTrue(); | |||
} | |||
private String baseUrl(int searchHttpPort) { | |||
private static String baseUrl(int searchHttpPort) { | |||
return "http://" + InetAddress.getLoopbackAddress().getHostAddress() + ":" + searchHttpPort + "/"; | |||
} | |||
} |
@@ -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.tests; | |||
package org.sonarqube.qa.util; | |||
import java.util.List; | |||
import java.util.Set; | |||
@@ -40,9 +40,9 @@ public class GroupTester { | |||
private static final AtomicInteger ID_GENERATOR = new AtomicInteger(); | |||
private final Session session; | |||
private final TesterSession session; | |||
GroupTester(Session session) { | |||
GroupTester(TesterSession session) { | |||
this.session = session; | |||
} | |||
@@ -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.tests; | |||
package org.sonarqube.qa.util; | |||
import java.io.File; | |||
import java.util.ArrayList; | |||
@@ -134,9 +134,9 @@ public class LogsTailer implements AutoCloseable { | |||
private Watch(String expectedText) { | |||
this.expectedText = requireNonNull(expectedText); | |||
this.consumer = log -> { | |||
if (log.contains(this.expectedText)) { | |||
this.log = log; | |||
this.consumer = l -> { | |||
if (l.contains(this.expectedText)) { | |||
this.log = l; | |||
foundSignal.countDown(); | |||
} | |||
}; |
@@ -17,12 +17,13 @@ | |||
* along with this program; if not, write to the Free Software Foundation, | |||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |||
*/ | |||
package org.sonarqube.tests; | |||
package org.sonarqube.qa.util; | |||
import java.util.List; | |||
import java.util.concurrent.atomic.AtomicInteger; | |||
import java.util.function.Consumer; | |||
import javax.annotation.Nullable; | |||
import org.assertj.core.api.Assertions; | |||
import org.sonarqube.ws.Organizations; | |||
import org.sonarqube.ws.WsUsers; | |||
import org.sonarqube.ws.client.HttpException; | |||
@@ -40,9 +41,9 @@ public class OrganizationTester { | |||
private static final AtomicInteger ID_GENERATOR = new AtomicInteger(); | |||
private final Session session; | |||
private final TesterSession session; | |||
OrganizationTester(Session session) { | |||
OrganizationTester(TesterSession session) { | |||
this.session = session; | |||
} | |||
@@ -84,7 +85,7 @@ public class OrganizationTester { | |||
public OrganizationTester assertThatOrganizationDoesNotExist(String organizationKey) { | |||
SearchWsRequest request = new SearchWsRequest.Builder().setOrganizations(organizationKey).build(); | |||
Organizations.SearchWsResponse searchWsResponse = service().search(request); | |||
assertThat(searchWsResponse.getOrganizationsList()).isEmpty(); | |||
Assertions.assertThat(searchWsResponse.getOrganizationsList()).isEmpty(); | |||
return this; | |||
} | |||
@@ -121,7 +122,7 @@ public class OrganizationTester { | |||
.setSelected("selected") | |||
.setOrganization(organization != null ? organization.getKey() : null)) | |||
.getUsersList(); | |||
assertThat(users).hasSize(isMember ? 1 : 0); | |||
Assertions.assertThat(users).hasSize(isMember ? 1 : 0); | |||
} | |||
private void verifyMembersGroupMembership(String userLogin, @Nullable Organizations.Organization organization, boolean isMember) { | |||
@@ -132,7 +133,7 @@ public class OrganizationTester { | |||
.setSelected("selected") | |||
.build()) | |||
.getGroupsList(); | |||
assertThat(groups).hasSize(isMember ? 1 : 0); | |||
Assertions.assertThat(groups).hasSize(isMember ? 1 : 0); | |||
} | |||
public OrganizationService service() { |
@@ -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.tests; | |||
package org.sonarqube.qa.util; | |||
import java.util.concurrent.atomic.AtomicInteger; | |||
import java.util.function.Consumer; | |||
@@ -36,17 +36,16 @@ public class ProjectTester { | |||
private static final AtomicInteger ID_GENERATOR = new AtomicInteger(); | |||
private final Session session; | |||
private final TesterSession session; | |||
ProjectTester(Session session) { | |||
ProjectTester(TesterSession session) { | |||
this.session = session; | |||
} | |||
void deleteAll() { | |||
ProjectsService service = session.wsClient().projects(); | |||
service.search(SearchWsRequest.builder().setQualifiers(singletonList("TRK")).build()).getComponentsList().forEach(p -> { | |||
service.delete(DeleteRequest.builder().setKey(p.getKey()).build()); | |||
}); | |||
service.search(SearchWsRequest.builder().setQualifiers(singletonList("TRK")).build()).getComponentsList().forEach(p -> | |||
service.delete(DeleteRequest.builder().setKey(p.getKey()).build())); | |||
} | |||
@SafeVarargs |
@@ -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.tests; | |||
package org.sonarqube.qa.util; | |||
import com.google.gson.Gson; | |||
import com.google.gson.annotations.SerializedName; | |||
@@ -34,9 +34,9 @@ import org.sonarqube.ws.client.qualitygate.SelectWsRequest; | |||
public class QGateTester { | |||
private static final AtomicInteger ID_GENERATOR = new AtomicInteger(); | |||
private final Session session; | |||
private final TesterSession session; | |||
QGateTester(Session session) { | |||
QGateTester(TesterSession session) { | |||
this.session = session; | |||
} | |||
@@ -17,11 +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.tests; | |||
package org.sonarqube.qa.util; | |||
import java.util.List; | |||
import java.util.concurrent.atomic.AtomicInteger; | |||
import java.util.function.Consumer; | |||
import org.assertj.core.api.Assertions; | |||
import org.sonarqube.ws.Common; | |||
import org.sonarqube.ws.Organizations.Organization; | |||
import org.sonarqube.ws.QualityProfiles.CreateWsResponse.QualityProfile; | |||
@@ -42,9 +43,9 @@ import static org.assertj.core.api.Assertions.assertThat; | |||
public class QProfileTester { | |||
private static final AtomicInteger ID_GENERATOR = new AtomicInteger(); | |||
private final Session session; | |||
private final TesterSession session; | |||
QProfileTester(Session session) { | |||
QProfileTester(TesterSession session) { | |||
this.session = session; | |||
} | |||
@@ -104,12 +105,12 @@ public class QProfileTester { | |||
Rules.SearchResponse response = session.wsClient().rules().search(request); | |||
// assume that expectedActiveRules fits in first page of results | |||
assertThat(response.getRulesCount()).isEqualTo(expectedActiveRules); | |||
assertThat(response.getTotal()).isEqualTo(expectedActiveRules); | |||
assertThat(response.getActives().getActives()).as(response.toString()).hasSize(expectedActiveRules); | |||
Assertions.assertThat(response.getRulesCount()).isEqualTo(expectedActiveRules); | |||
Assertions.assertThat(response.getTotal()).isEqualTo(expectedActiveRules); | |||
Assertions.assertThat(response.getActives().getActives()).as(response.toString()).hasSize(expectedActiveRules); | |||
// verify facets | |||
assertThat(response.getFacets().getFacetsCount()).isEqualTo(facetIds.size()); | |||
Assertions.assertThat(response.getFacets().getFacetsCount()).isEqualTo(facetIds.size()); | |||
response.getFacets().getFacetsList().forEach(facet -> { | |||
long total = facet.getValuesList().stream() | |||
.mapToLong(Common.FacetValue::getCount) |
@@ -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.tests; | |||
package org.sonarqube.qa.util; | |||
import com.google.common.collect.ImmutableSet; | |||
import java.util.List; | |||
@@ -31,16 +31,14 @@ import org.sonarqube.ws.client.setting.ResetRequest; | |||
import org.sonarqube.ws.client.setting.SetRequest; | |||
import org.sonarqube.ws.client.setting.SettingsService; | |||
import static org.sonarqube.ws.Settings.Type.LICENSE; | |||
public class SettingTester { | |||
private static final Set<String> EMAIL_SETTINGS = ImmutableSet.of("email.smtp_host.secured", "email.smtp_port.secured", "email.smtp_secure_connection.secured", | |||
"email.smtp_username.secured", "email.smtp_password.secured", "email.from", "email.prefix"); | |||
private final Session session; | |||
private final TesterSession session; | |||
SettingTester(Session session) { | |||
SettingTester(TesterSession session) { | |||
this.session = session; | |||
} | |||
@@ -52,7 +50,7 @@ public class SettingTester { | |||
List<String> settingKeys = Stream.concat( | |||
session.wsClient().settings().listDefinitions(ListDefinitionsRequest.builder().build()).getDefinitionsList() | |||
.stream() | |||
.filter(def -> def.getType() != LICENSE) | |||
.filter(def -> def.getType() != Settings.Type.LICENSE) | |||
.map(Settings.Definition::getKey), | |||
EMAIL_SETTINGS.stream()) | |||
.collect(Collectors.toList()); |
@@ -17,18 +17,19 @@ | |||
* along with this program; if not, write to the Free Software Foundation, | |||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |||
*/ | |||
package org.sonarqube.tests; | |||
package org.sonarqube.qa.util; | |||
import com.sonar.orchestrator.Orchestrator; | |||
import com.sonar.orchestrator.container.Server; | |||
import javax.annotation.Nullable; | |||
import org.apache.commons.lang.StringUtils; | |||
import org.junit.rules.ExternalResource; | |||
import org.sonarqube.qa.util.pageobjects.Navigation; | |||
import org.sonarqube.ws.client.HttpConnector; | |||
import org.sonarqube.ws.client.WsClient; | |||
import util.selenium.Selenese; | |||
import org.sonarqube.ws.client.WsClientFactories; | |||
import static java.util.Objects.requireNonNull; | |||
import static util.ItUtils.newUserWsClient; | |||
/** | |||
* This JUnit rule wraps an {@link Orchestrator} instance and provides : | |||
@@ -45,7 +46,7 @@ import static util.ItUtils.newUserWsClient; | |||
* {@code @ClassRule} must be used through a {@link org.junit.rules.RuleChain} | |||
* around {@link Orchestrator}. | |||
*/ | |||
public class Tester extends ExternalResource implements Session { | |||
public class Tester extends ExternalResource implements TesterSession { | |||
private final Orchestrator orchestrator; | |||
@@ -55,7 +56,7 @@ public class Tester extends ExternalResource implements Session { | |||
// initialized in #before() | |||
private boolean beforeCalled = false; | |||
private Session rootSession; | |||
private TesterSession rootSession; | |||
public Tester(Orchestrator orchestrator) { | |||
this.orchestrator = orchestrator; | |||
@@ -73,7 +74,7 @@ public class Tester extends ExternalResource implements Session { | |||
/** | |||
* Enables Elasticsearch debugging, see {@link #elasticsearch()}. | |||
* | |||
* <p> | |||
* The property "sonar.search.httpPort" must be defined before | |||
* starting SonarQube server. | |||
*/ | |||
@@ -86,7 +87,7 @@ public class Tester extends ExternalResource implements Session { | |||
@Override | |||
public void before() { | |||
verifyNotStarted(); | |||
rootSession = new SessionImpl(orchestrator, "admin", "admin"); | |||
rootSession = new TesterSessionImpl(orchestrator, "admin", "admin"); | |||
if (!disableOrganizations) { | |||
organizations().enableSupport(); | |||
@@ -106,17 +107,17 @@ public class Tester extends ExternalResource implements Session { | |||
qGates().deleteAll(); | |||
} | |||
public Session asAnonymous() { | |||
public TesterSession asAnonymous() { | |||
return as(null, null); | |||
} | |||
public Session as(String login) { | |||
public TesterSession as(String login) { | |||
return as(login, login); | |||
} | |||
public Session as(String login, String password) { | |||
public TesterSession as(String login, String password) { | |||
verifyStarted(); | |||
return new SessionImpl(orchestrator, login, password); | |||
return new TesterSessionImpl(orchestrator, login, password); | |||
} | |||
public Elasticsearch elasticsearch() { | |||
@@ -131,15 +132,6 @@ public class Tester extends ExternalResource implements Session { | |||
return Navigation.create(orchestrator); | |||
} | |||
/** | |||
* @deprecated use Selenide tests with {@link #openBrowser()} | |||
*/ | |||
@Deprecated | |||
public Tester runHtmlTests(String... htmlTests) { | |||
Selenese.runSelenese(orchestrator, htmlTests); | |||
return this; | |||
} | |||
private void verifyNotStarted() { | |||
if (beforeCalled) { | |||
throw new IllegalStateException("Orchestrator should not be already started"); | |||
@@ -196,11 +188,15 @@ public class Tester extends ExternalResource implements Session { | |||
return rootSession.qGates(); | |||
} | |||
private static class SessionImpl implements Session { | |||
private static class TesterSessionImpl implements TesterSession { | |||
private final WsClient client; | |||
private SessionImpl(Orchestrator orchestrator, @Nullable String login, @Nullable String password) { | |||
this.client = newUserWsClient(orchestrator, login, password); | |||
private TesterSessionImpl(Orchestrator orchestrator, @Nullable String login, @Nullable String password) { | |||
Server server = orchestrator.getServer(); | |||
this.client = WsClientFactories.getDefault().newClient(HttpConnector.newBuilder() | |||
.url(server.getUrl()) | |||
.credentials(login, password) | |||
.build()); | |||
} | |||
@Override |
@@ -17,11 +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.tests; | |||
package org.sonarqube.qa.util; | |||
import org.sonarqube.ws.client.WsClient; | |||
public interface Session { | |||
public interface TesterSession { | |||
WsClient wsClient(); | |||
@@ -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.tests; | |||
package org.sonarqube.qa.util; | |||
import java.util.List; | |||
import java.util.Optional; | |||
@@ -38,9 +38,9 @@ public class UserTester { | |||
private static final AtomicInteger ID_GENERATOR = new AtomicInteger(); | |||
private final Session session; | |||
private final TesterSession session; | |||
UserTester(Session session) { | |||
UserTester(TesterSession session) { | |||
this.session = session; | |||
} | |||
@@ -71,7 +71,7 @@ public class UserTester { | |||
public final User generateAdministrator(Consumer<CreateRequest.Builder>... populators) { | |||
User user = generate(populators); | |||
session.wsClient().permissions().addUser(new org.sonarqube.ws.client.permission.AddUserWsRequest().setLogin(user.getLogin()).setPermission("admin")); | |||
session.wsClient().userGroups().addUser(org.sonarqube.ws.client.usergroup.AddUserWsRequest.builder().setLogin(user.getLogin()).setName("sonar-administrators").build()); | |||
session.wsClient().userGroups().addUser(AddUserWsRequest.builder().setLogin(user.getLogin()).setName("sonar-administrators").build()); | |||
return user; | |||
} | |||
@@ -48,7 +48,7 @@ public class BackgroundTaskItem { | |||
} | |||
public BackgroundTaskItem assertScannerContextContains(String text) { | |||
Selenide.$(".js-task-scanner-context").should(Condition.hasText(text)); | |||
Selenide.$(".js-task-scanner-context").should(Condition.text(text)); | |||
return this; | |||
} | |||
@@ -59,7 +59,7 @@ public class BackgroundTaskItem { | |||
} | |||
public BackgroundTaskItem assertErrorStacktraceContains(String text) { | |||
Selenide.$(".js-task-stacktrace").should(Condition.hasText(text)); | |||
Selenide.$(".js-task-stacktrace").should(Condition.text(text)); | |||
return this; | |||
} | |||
} |
@@ -54,7 +54,7 @@ public class LoginPage { | |||
return Selenide.$(".process-spinner-failed"); | |||
} | |||
private <T> T submitCredentials(String login, String password, Class<T> expectedResultPage) { | |||
private static <T> T submitCredentials(String login, String password, Class<T> expectedResultPage) { | |||
Selenide.$("#login").val(login); | |||
Selenide.$("#password").val(password); | |||
Selenide.$(By.name("commit")).click(); |
@@ -54,7 +54,7 @@ public class MarketplacePage { | |||
return this; | |||
} | |||
private SelenideElement getPlugin(String name) { | |||
private static SelenideElement getPlugin(String name) { | |||
return Selenide.$$(".js-plugin-name").findBy(Condition.text(name)).should(Condition.exist).parent().parent().parent(); | |||
} | |||
} |
@@ -164,7 +164,7 @@ public class Navigation { | |||
} | |||
public SettingsPage openSettings(@Nullable String projectKey) throws UnsupportedEncodingException { | |||
String url = projectKey != null ? "/project/settings?id=" + URLEncoder.encode(projectKey, "UTF-8") : "/settings"; | |||
String url = projectKey != null ? ("/project/settings?id=" + URLEncoder.encode(projectKey, "UTF-8")) : "/settings"; | |||
return open(url, SettingsPage.class); | |||
} | |||
@@ -249,11 +249,11 @@ public class Navigation { | |||
return Selenide.$("#error"); | |||
} | |||
private SelenideElement logInLink() { | |||
private static SelenideElement logInLink() { | |||
return Selenide.$(By.linkText("Log in")); | |||
} | |||
private SelenideElement loggedInDropdown() { | |||
private static SelenideElement loggedInDropdown() { | |||
return Selenide.$(".js-user-authenticated"); | |||
} | |||
@@ -24,7 +24,7 @@ import com.codeborne.selenide.Selenide; | |||
public class NotificationsPage extends Navigation { | |||
private final String EMAIL = "EmailNotificationChannel"; | |||
private static final String EMAIL = "EmailNotificationChannel"; | |||
public NotificationsPage() { | |||
Selenide.$("#account-page").shouldHave(Condition.text("Overall notifications")); | |||
@@ -90,11 +90,11 @@ public class NotificationsPage extends Navigation { | |||
return this; | |||
} | |||
private String globalCheckboxSelector(String type, String channel) { | |||
private static String globalCheckboxSelector(String type, String channel) { | |||
return "#global-notification-" + type + "-" + channel; | |||
} | |||
private String projectCheckboxSelector(String project, String type, String channel) { | |||
private static String projectCheckboxSelector(String project, String type, String channel) { | |||
return "#project-notification-" + project + "-" + type + "-" + channel; | |||
} | |||
@@ -112,7 +112,7 @@ public class NotificationsPage extends Navigation { | |||
return this; | |||
} | |||
private void toggleCheckbox(String selector) { | |||
private static void toggleCheckbox(String selector) { | |||
Selenide.$(selector).click(); | |||
} | |||
} |
@@ -54,7 +54,7 @@ public class ProjectActivityPage { | |||
Selenide.$("#project-activity") | |||
.find(".project-activity-day[data-day=\"" + day + "\"]") | |||
.find(".project-activity-analysis") | |||
.should(Condition.hasText(text)); | |||
.should(Condition.text(text)); | |||
return this; | |||
} | |||
} |
@@ -24,9 +24,6 @@ import com.codeborne.selenide.Selenide; | |||
public class ProjectCodePage { | |||
public ProjectCodePage() { | |||
} | |||
public ProjectCodePage openFirstComponent() { | |||
Selenide.$$(".code-name-cell a").first().click(); | |||
return this; |
@@ -49,11 +49,10 @@ public class ProjectDashboardPage { | |||
public SelenideElement getOverviewMeasure(String measure) { | |||
ElementsCollection measures = Selenide.$$(".overview-domain-measure"); | |||
SelenideElement element = measures.find(Condition.text(measure)).shouldBe(Condition.visible); | |||
return element; | |||
return measures.find(Condition.text(measure)).shouldBe(Condition.visible); | |||
} | |||
private SelenideElement getTagsMeta() { | |||
private static SelenideElement getTagsMeta() { | |||
SelenideElement element = Selenide.$(".overview-meta-tags"); | |||
element.shouldBe(Condition.visible); | |||
return element; | |||
@@ -61,38 +60,38 @@ public class ProjectDashboardPage { | |||
public ProjectDashboardPage shouldHaveTags(String... tags) { | |||
String tagsList = String.join(", ", Arrays.asList(tags)); | |||
this.getTagsMeta().$(".tags-list > span").should(Condition.hasText(tagsList)); | |||
getTagsMeta().$(".tags-list > span").should(Condition.text(tagsList)); | |||
return this; | |||
} | |||
public ProjectDashboardPage shouldNotBeEditable() { | |||
SelenideElement tagsElem = this.getTagsMeta(); | |||
SelenideElement tagsElem = getTagsMeta(); | |||
tagsElem.$("button").shouldNot(Condition.exist); | |||
tagsElem.$("div.multi-select").shouldNot(Condition.exist); | |||
return this; | |||
} | |||
public ProjectDashboardPage shouldBeEditable() { | |||
SelenideElement tagsElem = this.getTagsMeta(); | |||
SelenideElement tagsElem = getTagsMeta(); | |||
tagsElem.$("button").shouldBe(Condition.visible); | |||
return this; | |||
} | |||
public ProjectDashboardPage openTagEditor() { | |||
SelenideElement tagsElem = this.getTagsMeta(); | |||
SelenideElement tagsElem = getTagsMeta(); | |||
tagsElem.$("button").shouldBe(Condition.visible).click(); | |||
tagsElem.$("div.multi-select").shouldBe(Condition.visible); | |||
return this; | |||
} | |||
public SelenideElement getTagAtIdx(Integer idx) { | |||
SelenideElement tagsElem = this.getTagsMeta(); | |||
SelenideElement tagsElem = getTagsMeta(); | |||
tagsElem.$("div.multi-select").shouldBe(Condition.visible); | |||
return tagsElem.$$("ul.menu a").get(idx); | |||
} | |||
public ProjectDashboardPage sendKeysToTagsInput(CharSequence... charSequences) { | |||
SelenideElement tagsInput = this.getTagsMeta().find("input"); | |||
SelenideElement tagsInput = getTagsMeta().find("input"); | |||
tagsInput.sendKeys(charSequences); | |||
return this; | |||
} |
@@ -77,8 +77,8 @@ public class ProjectKeyPage { | |||
public ProjectKeyPage assertBulkChangeSimulationResult(String oldKey, String 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)); | |||
row.$(".js-old-key").should(Condition.text(oldKey)); | |||
row.$(".js-new-key").should(Condition.text(newKey)); | |||
return this; | |||
} | |||
@@ -26,8 +26,8 @@ public class SystemInfoPageItem { | |||
private final SelenideElement elt; | |||
public SystemInfoPageItem(SelenideElement elt) { | |||
this.elt = elt; | |||
} | |||
this.elt = elt; | |||
} | |||
public SystemInfoPageItem shouldHaveHealth() { | |||
elt.$(".system-info-health-info .status-indicator").should(Condition.exist); | |||
@@ -72,7 +72,7 @@ public class SystemInfoPageItem { | |||
} | |||
public SystemInfoPageItem ensureOpen() { | |||
if(!isOpen()) { | |||
if (!isOpen()) { | |||
elt.click(); | |||
elt.$(".boxed-group-inner").should(Condition.exist); | |||
} |
@@ -32,14 +32,6 @@ public class IssuesPage { | |||
Selenide.$(".issues").should(Condition.exist); | |||
} | |||
private ElementsCollection getIssuesElements() { | |||
return Selenide.$$(".issues .issue"); | |||
} | |||
private ElementsCollection getIssuesPathComponents() { | |||
return Selenide.$$(".issues-workspace-list-component"); | |||
} | |||
public List<Issue> getIssues() { | |||
return getIssuesElements() | |||
.stream() | |||
@@ -48,7 +40,7 @@ public class IssuesPage { | |||
} | |||
public IssuesPage issuesCount(Integer count) { | |||
this.getIssuesElements().shouldHaveSize(count); | |||
getIssuesElements().shouldHaveSize(count); | |||
return this; | |||
} | |||
@@ -58,12 +50,12 @@ public class IssuesPage { | |||
} | |||
public IssuesPage componentsShouldContain(String path) { | |||
this.getIssuesPathComponents().forEach(element -> element.shouldHave(Condition.text(path))); | |||
getIssuesPathComponents().forEach(element -> element.shouldHave(Condition.text(path))); | |||
return this; | |||
} | |||
public IssuesPage componentsShouldNotContain(String path) { | |||
this.getIssuesPathComponents().forEach(element -> element.shouldNotHave(Condition.text(path))); | |||
getIssuesPathComponents().forEach(element -> element.shouldNotHave(Condition.text(path))); | |||
return this; | |||
} | |||
@@ -79,4 +71,12 @@ public class IssuesPage { | |||
Selenide.$("#issues-bulk-change-assignee .Select-input input").pressEscape(); | |||
return this; | |||
} | |||
private static ElementsCollection getIssuesElements() { | |||
return Selenide.$$(".issues .issue"); | |||
} | |||
private static ElementsCollection getIssuesPathComponents() { | |||
return Selenide.$$(".issues-workspace-list-component"); | |||
} | |||
} |
@@ -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.issues; | |||
import javax.annotation.ParametersAreNonnullByDefault; |
@@ -37,14 +37,14 @@ public class MeasuresPage { | |||
} | |||
public MeasuresPage measureHasValue(String measure, Integer value) { | |||
SelenideElement sidebar = this.getSideBar(); | |||
SelenideElement sidebar = getSideBar(); | |||
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(); | |||
SelenideElement sidebar = getSideBar(); | |||
sidebar.$("#measure-" + measure + "-name").should(Condition.exist); | |||
sidebar.$("#measure-" + measure + "-leak").should(Condition.exist).shouldHave(Condition.text(value.toString())); | |||
return this; | |||
@@ -83,7 +83,7 @@ public class MeasuresPage { | |||
} | |||
public MeasureContent openMeasureContent(String measure) { | |||
SelenideElement sidebar = this.getSideBar(); | |||
SelenideElement sidebar = getSideBar(); | |||
SelenideElement facetItem = sidebar.$("#measure-" + measure + "-name"); | |||
facetItem.click(); | |||
MeasureContent content = new MeasureContent(Selenide.$("#component-measures .measure-details-content").should(Condition.exist)); | |||
@@ -91,7 +91,7 @@ public class MeasuresPage { | |||
return content; | |||
} | |||
private SelenideElement getSideBar() { | |||
private static SelenideElement getSideBar() { | |||
return Selenide.$("#component-measures .layout-page-side").should(Condition.exist); | |||
} | |||
} |
@@ -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.measures; | |||
import javax.annotation.ParametersAreNonnullByDefault; |
@@ -85,7 +85,7 @@ public class MemberItem { | |||
return this; | |||
} | |||
private SelenideElement getModal(String title) { | |||
private static SelenideElement getModal(String title) { | |||
Selenide.$(".modal-head").should(Condition.exist).shouldHave(Condition.text(title)); | |||
SelenideElement form = Selenide.$(".ReactModalPortal form"); | |||
form.should(Condition.exist); |
@@ -63,7 +63,7 @@ public class MembersPage { | |||
this.canAddMember(); | |||
Selenide.$(".page-actions button").click(); | |||
SelenideElement modal = this.getModal("Add user"); | |||
SelenideElement modal = getModal("Add user"); | |||
SelenideElement input = modal.$(".Select-input input"); | |||
input.val(login); | |||
modal.$("div.Select-option.is-focused").should(Condition.exist); | |||
@@ -72,7 +72,7 @@ public class MembersPage { | |||
return this; | |||
} | |||
private SelenideElement getModal(String title) { | |||
private static SelenideElement getModal(String title) { | |||
Selenide.$(".modal-head").should(Condition.exist).shouldHave(Condition.text(title)); | |||
SelenideElement form = Selenide.$(".ReactModalPortal form"); | |||
form.should(Condition.exist); |
@@ -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.organization; | |||
import javax.annotation.ParametersAreNonnullByDefault; |
@@ -110,7 +110,7 @@ public class ProjectsPage { | |||
return this; | |||
} | |||
private SelenideElement getOpenTopBar() { | |||
private static SelenideElement getOpenTopBar() { | |||
return Selenide.$(".projects-topbar-items").should(Condition.exist); | |||
} | |||
} |
@@ -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.projects; | |||
import javax.annotation.ParametersAreNonnullByDefault; |
@@ -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.settings; | |||
import javax.annotation.ParametersAreNonnullByDefault; |
@@ -36,7 +36,7 @@ import org.junit.ClassRule; | |||
import org.junit.Rule; | |||
import org.junit.Test; | |||
import org.sonarqube.tests.Byteman; | |||
import org.sonarqube.tests.Tester; | |||
import org.sonarqube.qa.util.Tester; | |||
import org.sonarqube.ws.Common; | |||
import org.sonarqube.ws.Issues; | |||
import org.sonarqube.ws.Organizations.Organization; |
@@ -36,7 +36,7 @@ import org.junit.ClassRule; | |||
import org.junit.Test; | |||
import org.junit.rules.RuleChain; | |||
import org.sonarqube.tests.Category3Suite; | |||
import org.sonarqube.tests.Tester; | |||
import org.sonarqube.qa.util.Tester; | |||
import util.ItUtils; | |||
import static org.assertj.core.api.Assertions.assertThat; |
@@ -30,7 +30,7 @@ import org.junit.rules.DisableOnDebug; | |||
import org.junit.rules.TestRule; | |||
import org.junit.rules.Timeout; | |||
import org.sonarqube.tests.Category6Suite; | |||
import org.sonarqube.tests.Tester; | |||
import org.sonarqube.qa.util.Tester; | |||
import org.sonarqube.ws.Organizations.Organization; | |||
import org.sonarqube.ws.WsPermissions; | |||
import org.sonarqube.ws.WsPermissions.CreateTemplateWsResponse; |
@@ -24,9 +24,10 @@ import org.junit.ClassRule; | |||
import org.junit.Rule; | |||
import org.junit.Test; | |||
import org.sonarqube.tests.Category1Suite; | |||
import org.sonarqube.tests.Tester; | |||
import org.sonarqube.qa.util.Tester; | |||
import org.sonarqube.ws.client.permission.AddUserWsRequest; | |||
import org.sonarqube.ws.client.qualityprofile.CreateRequest; | |||
import util.selenium.Selenese; | |||
import static util.ItUtils.runProjectAnalysis; | |||
@@ -50,7 +51,7 @@ public class QualityProfileAdminPermissionTest { | |||
tester.wsClient().permissions().addUser(new AddUserWsRequest().setLogin("profileadm").setPermission("profileadmin")); | |||
createProfile("xoo", "foo"); | |||
tester.runHtmlTests( | |||
Selenese.runSelenese(orchestrator, | |||
// Verify normal user is not allowed to do any modification | |||
"/authorisation/QualityProfileAdminPermissionTest/normal-user.html", | |||
// Verify profile admin is allowed to do modifications |
@@ -25,7 +25,7 @@ import org.junit.AfterClass; | |||
import org.junit.BeforeClass; | |||
import org.junit.Rule; | |||
import org.junit.Test; | |||
import org.sonarqube.tests.Tester; | |||
import org.sonarqube.qa.util.Tester; | |||
import org.sonarqube.ws.client.GetRequest; | |||
import org.sonarqube.ws.client.WsRequest; | |||
import org.sonarqube.ws.client.WsResponse; |
@@ -27,7 +27,7 @@ import org.junit.ClassRule; | |||
import org.junit.Rule; | |||
import org.junit.Test; | |||
import org.sonarqube.tests.Category2Suite; | |||
import org.sonarqube.tests.Tester; | |||
import org.sonarqube.qa.util.Tester; | |||
import org.sonarqube.ws.Common; | |||
import org.sonarqube.ws.WsBranches; | |||
import org.sonarqube.ws.client.GetRequest; |
@@ -32,7 +32,7 @@ import org.junit.rules.DisableOnDebug; | |||
import org.junit.rules.TemporaryFolder; | |||
import org.junit.rules.TestRule; | |||
import org.junit.rules.Timeout; | |||
import org.sonarqube.tests.LogsTailer; | |||
import org.sonarqube.qa.util.LogsTailer; | |||
import org.sonarqube.ws.client.WsClient; | |||
import org.sonarqube.ws.client.ce.ActivityStatusWsRequest; | |||
import util.ItUtils; |
@@ -42,7 +42,7 @@ import org.junit.ClassRule; | |||
import org.junit.Rule; | |||
import org.junit.Test; | |||
import org.sonarqube.tests.Category6Suite; | |||
import org.sonarqube.tests.Tester; | |||
import org.sonarqube.qa.util.Tester; | |||
import org.sonarqube.ws.Organizations; | |||
import org.sonarqube.ws.WsProjects; | |||
import org.sonarqube.ws.WsUsers; |
@@ -35,7 +35,7 @@ import org.junit.Rule; | |||
import org.junit.Test; | |||
import org.junit.rules.ErrorCollector; | |||
import org.sonarqube.tests.Category4Suite; | |||
import org.sonarqube.tests.Tester; | |||
import org.sonarqube.qa.util.Tester; | |||
import org.sonarqube.ws.ProjectAnalyses; | |||
import org.sonarqube.ws.WsMeasures; | |||
import org.sonarqube.ws.WsMeasures.SearchHistoryResponse.HistoryValue; |
@@ -37,7 +37,7 @@ import org.junit.Rule; | |||
import org.junit.Test; | |||
import org.sonar.wsclient.issue.Issue; | |||
import org.sonar.wsclient.issue.IssueQuery; | |||
import org.sonarqube.tests.Tester; | |||
import org.sonarqube.qa.util.Tester; | |||
import org.sonarqube.ws.client.PostRequest; | |||
import org.sonarqube.ws.client.WsClient; | |||
import org.subethamail.wiser.Wiser; |
@@ -40,7 +40,7 @@ import org.junit.runners.Parameterized; | |||
import org.junit.runners.Parameterized.Parameter; | |||
import org.junit.runners.Parameterized.Parameters; | |||
import org.sonarqube.tests.Category6Suite; | |||
import org.sonarqube.tests.Tester; | |||
import org.sonarqube.qa.util.Tester; | |||
import org.sonarqube.ws.Issues.Issue; | |||
import org.sonarqube.ws.Issues.SearchWsResponse; | |||
import org.sonarqube.ws.Organizations.Organization; |
@@ -29,7 +29,7 @@ import org.junit.Before; | |||
import org.junit.ClassRule; | |||
import org.junit.Rule; | |||
import org.junit.Test; | |||
import org.sonarqube.tests.Tester; | |||
import org.sonarqube.qa.util.Tester; | |||
import org.sonarqube.ws.Organizations.Organization; | |||
import org.sonarqube.ws.WsUsers.CreateWsResponse.User; | |||
import org.sonarqube.ws.client.issue.SearchWsRequest; |
@@ -28,7 +28,7 @@ import org.junit.Before; | |||
import org.junit.ClassRule; | |||
import org.junit.Rule; | |||
import org.junit.Test; | |||
import org.sonarqube.tests.Tester; | |||
import org.sonarqube.qa.util.Tester; | |||
import org.sonarqube.ws.Issues; | |||
import org.sonarqube.ws.Issues.Issue; | |||
import org.sonarqube.ws.Organizations; |
@@ -27,7 +27,7 @@ import org.junit.Rule; | |||
import org.junit.Test; | |||
import org.sonarqube.qa.util.pageobjects.Navigation; | |||
import org.sonarqube.tests.Category6Suite; | |||
import org.sonarqube.tests.Tester; | |||
import org.sonarqube.qa.util.Tester; | |||
import org.sonarqube.ws.Organizations; | |||
import org.sonarqube.ws.WsUsers; | |||
import util.issue.IssueRule; |
@@ -24,7 +24,7 @@ import org.junit.BeforeClass; | |||
import org.junit.ClassRule; | |||
import org.junit.Test; | |||
import org.junit.rules.RuleChain; | |||
import org.sonarqube.tests.Tester; | |||
import org.sonarqube.qa.util.Tester; | |||
import org.sonarqube.ws.Issues; | |||
import org.sonarqube.ws.WsComponents; | |||
import org.sonarqube.ws.WsMeasures; |
@@ -29,7 +29,7 @@ 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; | |||
import org.sonarqube.qa.util.Tester; | |||
import static com.codeborne.selenide.Condition.visible; | |||
import static com.codeborne.selenide.Selenide.$; |
@@ -28,7 +28,7 @@ import org.junit.Before; | |||
import org.junit.ClassRule; | |||
import org.junit.Rule; | |||
import org.junit.Test; | |||
import org.sonarqube.tests.Tester; | |||
import org.sonarqube.qa.util.Tester; | |||
import org.sonarqube.ws.Organizations; | |||
import org.sonarqube.ws.WsUsers.CreateWsResponse.User; | |||
import org.sonarqube.ws.client.GetRequest; |
@@ -28,7 +28,7 @@ import org.junit.ClassRule; | |||
import org.junit.Rule; | |||
import org.junit.Test; | |||
import org.junit.rules.ExpectedException; | |||
import org.sonarqube.tests.Tester; | |||
import org.sonarqube.qa.util.Tester; | |||
import org.sonarqube.ws.Organizations.Organization; | |||
import org.sonarqube.ws.WsUsers.CreateWsResponse.User; | |||
import org.sonarqube.ws.client.HttpException; |
@@ -28,7 +28,7 @@ import org.junit.Rule; | |||
import org.junit.Test; | |||
import org.sonarqube.qa.util.pageobjects.organization.MembersPage; | |||
import org.sonarqube.tests.Category6Suite; | |||
import org.sonarqube.tests.Tester; | |||
import org.sonarqube.qa.util.Tester; | |||
import org.sonarqube.ws.Organizations.Organization; | |||
import org.sonarqube.ws.WsUsers.CreateWsResponse.User; | |||
@@ -29,8 +29,8 @@ import org.junit.ClassRule; | |||
import org.junit.Rule; | |||
import org.junit.Test; | |||
import org.junit.rules.ExpectedException; | |||
import org.sonarqube.tests.OrganizationTester; | |||
import org.sonarqube.tests.Tester; | |||
import org.sonarqube.qa.util.OrganizationTester; | |||
import org.sonarqube.qa.util.Tester; | |||
import org.sonarqube.ws.Organizations.Organization; | |||
import org.sonarqube.ws.QualityProfiles; | |||
import org.sonarqube.ws.Rules; |
@@ -28,7 +28,7 @@ import org.junit.Before; | |||
import org.junit.ClassRule; | |||
import org.junit.Rule; | |||
import org.junit.Test; | |||
import org.sonarqube.tests.Tester; | |||
import org.sonarqube.qa.util.Tester; | |||
import org.sonarqube.ws.Organizations; | |||
import org.sonarqube.ws.WsUsers; | |||
import org.sonarqube.ws.client.organization.SearchWsRequest; |
@@ -25,8 +25,8 @@ import java.sql.SQLException; | |||
import org.junit.ClassRule; | |||
import org.junit.Rule; | |||
import org.junit.Test; | |||
import org.sonarqube.tests.Session; | |||
import org.sonarqube.tests.Tester; | |||
import org.sonarqube.qa.util.TesterSession; | |||
import org.sonarqube.qa.util.Tester; | |||
import org.sonarqube.ws.WsRoot; | |||
import org.sonarqube.ws.WsUsers; | |||
import util.user.UserRule; | |||
@@ -69,8 +69,8 @@ public class RootUserOnOrganizationTest { | |||
public void root_can_be_set_and_unset_via_web_services() { | |||
WsUsers.CreateWsResponse.User user1 = tester.users().generate(); | |||
WsUsers.CreateWsResponse.User user2 = tester.users().generate(); | |||
Session user1Session = tester.as(user1.getLogin()); | |||
Session user2Session = tester.as(user2.getLogin()); | |||
TesterSession user1Session = tester.as(user1.getLogin()); | |||
TesterSession user2Session = tester.as(user2.getLogin()); | |||
// non root can not set or unset root another user not itself | |||
expectForbiddenError(() -> user1Session.wsClient().roots().setRoot(user2.getLogin())); |
@@ -24,7 +24,7 @@ import org.sonarqube.tests.Category4Suite; | |||
import org.junit.ClassRule; | |||
import org.junit.Rule; | |||
import org.junit.Test; | |||
import org.sonarqube.tests.Tester; | |||
import org.sonarqube.qa.util.Tester; | |||
import static util.ItUtils.expectForbiddenError; | |||
@@ -42,7 +42,7 @@ 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.qa.util.Tester; | |||
import org.sonarqube.ws.WsPermissions; | |||
import org.sonarqube.ws.client.permission.AddUserToTemplateWsRequest; | |||
import org.sonarqube.ws.client.permission.CreateTemplateWsRequest; |
@@ -27,7 +27,7 @@ import org.junit.ClassRule; | |||
import org.junit.Rule; | |||
import org.junit.Test; | |||
import org.sonarqube.tests.Category6Suite; | |||
import org.sonarqube.tests.Tester; | |||
import org.sonarqube.qa.util.Tester; | |||
import org.sonarqube.ws.Organizations; | |||
import org.sonarqube.ws.WsProjects.CreateWsResponse; | |||
import org.sonarqube.ws.WsProjects.SearchWsResponse.Component; |
@@ -25,7 +25,7 @@ import org.junit.ClassRule; | |||
import org.junit.Rule; | |||
import org.junit.Test; | |||
import org.sonarqube.tests.Category1Suite; | |||
import org.sonarqube.tests.Tester; | |||
import org.sonarqube.qa.util.Tester; | |||
import org.sonarqube.ws.WsProjects.CreateWsResponse.Project; | |||
import org.sonarqube.ws.client.component.SearchProjectsRequest; | |||
@@ -31,7 +31,7 @@ import org.junit.rules.DisableOnDebug; | |||
import org.junit.rules.TestRule; | |||
import org.junit.rules.Timeout; | |||
import org.sonarqube.tests.Category6Suite; | |||
import org.sonarqube.tests.Tester; | |||
import org.sonarqube.qa.util.Tester; | |||
import org.sonarqube.ws.Organizations; | |||
import org.sonarqube.ws.WsComponents; | |||
import org.sonarqube.ws.WsProjects; |
@@ -34,7 +34,7 @@ import org.junit.rules.DisableOnDebug; | |||
import org.junit.rules.TestRule; | |||
import org.junit.rules.Timeout; | |||
import org.sonarqube.tests.Category6Suite; | |||
import org.sonarqube.tests.Tester; | |||
import org.sonarqube.qa.util.Tester; | |||
import org.sonarqube.ws.Organizations; | |||
import org.sonarqube.ws.WsComponents; | |||
import org.sonarqube.ws.WsProjects; |
@@ -29,7 +29,7 @@ import org.junit.rules.DisableOnDebug; | |||
import org.junit.rules.TestRule; | |||
import org.junit.rules.Timeout; | |||
import org.sonarqube.tests.Category6Suite; | |||
import org.sonarqube.tests.Tester; | |||
import org.sonarqube.qa.util.Tester; | |||
import org.sonarqube.ws.Organizations; | |||
import org.sonarqube.ws.WsComponents; | |||
import org.sonarqube.ws.WsProjects; |
@@ -69,8 +69,8 @@ public class ProjectQualityGatePageTest { | |||
try { | |||
ProjectQualityGatePage page = openPage(); | |||
SelenideElement selectedQualityGate = page.getSelectedQualityGate(); | |||
selectedQualityGate.should(Condition.hasText("Default")); | |||
selectedQualityGate.should(Condition.hasText(customQualityGate.name())); | |||
selectedQualityGate.should(Condition.text("Default")); | |||
selectedQualityGate.should(Condition.text(customQualityGate.name())); | |||
} finally { | |||
qualityGateClient().unsetDefault(); | |||
qualityGateClient().destroy(customQualityGate.id()); | |||
@@ -84,8 +84,8 @@ public class ProjectQualityGatePageTest { | |||
ProjectQualityGatePage page = openPage(); | |||
SelenideElement selectedQualityGate = page.getSelectedQualityGate(); | |||
selectedQualityGate.shouldNot(Condition.hasText("Default")); | |||
selectedQualityGate.should(Condition.hasText(customQualityGate.name())); | |||
selectedQualityGate.shouldNot(Condition.text("Default")); | |||
selectedQualityGate.should(Condition.text(customQualityGate.name())); | |||
} | |||
@Test | |||
@@ -104,7 +104,7 @@ public class ProjectQualityGatePageTest { | |||
page.setQualityGate(customQualityGate.name()); | |||
SelenideElement selectedQualityGate = page.getSelectedQualityGate(); | |||
selectedQualityGate.should(Condition.hasText(customQualityGate.name())); | |||
selectedQualityGate.should(Condition.text(customQualityGate.name())); | |||
} | |||
@Test | |||
@@ -117,8 +117,8 @@ public class ProjectQualityGatePageTest { | |||
page.setQualityGate(customQualityGate.name()); | |||
SelenideElement selectedQualityGate = page.getSelectedQualityGate(); | |||
selectedQualityGate.should(Condition.hasText("Default")); | |||
selectedQualityGate.should(Condition.hasText(customQualityGate.name())); | |||
selectedQualityGate.should(Condition.text("Default")); | |||
selectedQualityGate.should(Condition.text(customQualityGate.name())); | |||
} finally { | |||
qualityGateClient().unsetDefault(); | |||
qualityGateClient().destroy(customQualityGate.id()); |
@@ -27,7 +27,7 @@ import org.junit.ClassRule; | |||
import org.junit.Rule; | |||
import org.junit.Test; | |||
import org.sonarqube.tests.Category6Suite; | |||
import org.sonarqube.tests.Tester; | |||
import org.sonarqube.qa.util.Tester; | |||
import org.sonarqube.ws.Organizations; | |||
import org.sonarqube.ws.WsProjects.CreateWsResponse; | |||
import org.sonarqube.ws.WsProjects.SearchWsResponse; |
@@ -31,7 +31,7 @@ import org.junit.BeforeClass; | |||
import org.junit.ClassRule; | |||
import org.junit.Rule; | |||
import org.junit.Test; | |||
import org.sonarqube.tests.Tester; | |||
import org.sonarqube.qa.util.Tester; | |||
import org.sonarqube.ws.Organizations.Organization; | |||
import org.sonarqube.qa.util.pageobjects.projects.ProjectsPage; | |||
@@ -30,7 +30,7 @@ import org.junit.rules.RuleChain; | |||
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.qa.util.Tester; | |||
import org.sonarqube.ws.WsUsers; | |||
import org.sonarqube.ws.client.PostRequest; | |||
import org.sonarqube.ws.client.WsClient; |
@@ -30,7 +30,7 @@ import org.junit.Before; | |||
import org.junit.ClassRule; | |||
import org.junit.Rule; | |||
import org.junit.Test; | |||
import org.sonarqube.tests.Tester; | |||
import org.sonarqube.qa.util.Tester; | |||
import org.sonarqube.ws.Common; | |||
import org.sonarqube.ws.Organizations.Organization; | |||
import org.sonarqube.ws.WsComponents.Component; |
@@ -30,7 +30,7 @@ import org.openqa.selenium.By; | |||
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.qa.util.Tester; | |||
import org.sonarqube.ws.Organizations; | |||
import org.sonarqube.ws.WsUsers; | |||
import util.issue.IssueRule; |
@@ -31,7 +31,7 @@ import org.junit.ClassRule; | |||
import org.junit.Rule; | |||
import org.junit.Test; | |||
import org.sonarqube.tests.Category6Suite; | |||
import org.sonarqube.tests.Tester; | |||
import org.sonarqube.qa.util.Tester; | |||
import org.sonarqube.ws.MediaTypes; | |||
import org.sonarqube.ws.Organizations; | |||
import org.sonarqube.ws.WsCe; |
@@ -29,7 +29,7 @@ import org.junit.ClassRule; | |||
import org.junit.Rule; | |||
import org.junit.Test; | |||
import org.sonarqube.tests.Category1Suite; | |||
import org.sonarqube.tests.Tester; | |||
import org.sonarqube.qa.util.Tester; | |||
import org.sonarqube.ws.WsProjects.CreateWsResponse.Project; | |||
import org.sonarqube.ws.WsQualityGates; | |||
import org.sonarqube.ws.client.PostRequest; |
@@ -24,7 +24,7 @@ import org.junit.ClassRule; | |||
import org.junit.Rule; | |||
import org.junit.Test; | |||
import org.sonarqube.tests.Category1Suite; | |||
import org.sonarqube.tests.Tester; | |||
import org.sonarqube.qa.util.Tester; | |||
import org.sonarqube.ws.WsMeasures; | |||
import org.sonarqube.ws.WsProjects.CreateWsResponse.Project; | |||
import org.sonarqube.ws.WsQualityGates; |
@@ -43,8 +43,8 @@ import org.sonar.wsclient.qualitygate.NewCondition; | |||
import org.sonar.wsclient.qualitygate.QualityGate; | |||
import org.sonar.wsclient.qualitygate.QualityGateClient; | |||
import org.sonarqube.tests.Category1Suite; | |||
import org.sonarqube.tests.Session; | |||
import org.sonarqube.tests.Tester; | |||
import org.sonarqube.qa.util.TesterSession; | |||
import org.sonarqube.qa.util.Tester; | |||
import org.sonarqube.ws.MediaTypes; | |||
import org.sonarqube.ws.Organizations.Organization; | |||
import org.sonarqube.ws.WsCe; | |||
@@ -293,7 +293,7 @@ public class QualityGateTest { | |||
Organization organization = tester.organizations().getDefaultOrganization(); | |||
WsUsers.CreateWsResponse.User user = tester.users().generateMember(organization); | |||
tester.wsClient().permissions().addUser(new AddUserWsRequest().setLogin(user.getLogin()).setPermission("gateadmin").setOrganization(organization.getKey())); | |||
Session qGateAdminTester = tester.as(user.getLogin()); | |||
TesterSession qGateAdminTester = tester.as(user.getLogin()); | |||
QualityGatesService qGateService = qGateAdminTester.qGates().service(); | |||
// perform administration operations | |||
WsQualityGates.CreateWsResponse qualityGate = qGateAdminTester.qGates().generate(); |
@@ -34,7 +34,7 @@ import org.openqa.selenium.By; | |||
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.qa.util.Tester; | |||
import org.sonarqube.ws.WsProjects.CreateWsResponse.Project; | |||
import org.sonarqube.ws.WsQualityGates; | |||
import org.sonarqube.ws.client.qualitygate.CreateConditionRequest; |
@@ -26,7 +26,7 @@ import org.junit.ClassRule; | |||
import org.junit.Rule; | |||
import org.junit.Test; | |||
import org.sonarqube.tests.Category6Suite; | |||
import org.sonarqube.tests.Tester; | |||
import org.sonarqube.qa.util.Tester; | |||
import org.sonarqube.ws.Organizations.Organization; | |||
import org.sonarqube.ws.WsProjects.CreateWsResponse.Project; | |||
import org.sonarqube.ws.WsQualityGates.CreateWsResponse; |
@@ -30,7 +30,7 @@ import org.junit.rules.DisableOnDebug; | |||
import org.junit.rules.TestRule; | |||
import org.junit.rules.Timeout; | |||
import org.sonarqube.tests.Byteman; | |||
import org.sonarqube.tests.Tester; | |||
import org.sonarqube.qa.util.Tester; | |||
import org.sonarqube.ws.Organizations; | |||
import org.sonarqube.ws.QualityProfiles; | |||
import org.sonarqube.ws.client.rule.SearchWsRequest; |
@@ -25,8 +25,8 @@ import org.junit.ClassRule; | |||
import org.junit.Rule; | |||
import org.junit.Test; | |||
import org.sonarqube.tests.Category6Suite; | |||
import org.sonarqube.tests.Session; | |||
import org.sonarqube.tests.Tester; | |||
import org.sonarqube.qa.util.TesterSession; | |||
import org.sonarqube.qa.util.Tester; | |||
import org.sonarqube.ws.Organizations.Organization; | |||
import org.sonarqube.ws.QualityProfiles; | |||
import org.sonarqube.ws.QualityProfiles.CreateWsResponse; | |||
@@ -110,7 +110,7 @@ public class BuiltInQualityProfilesTest { | |||
Organization org = tester.organizations().generate(); | |||
User administrator = tester.users().generateAdministrator(org); | |||
QualityProfile builtInProfile = getProfile(org, p -> p.getIsBuiltIn() && "Basic".equals(p.getName()) && "xoo".equals(p.getLanguage())); | |||
Session adminSession = tester.as(administrator.getLogin()); | |||
TesterSession adminSession = tester.as(administrator.getLogin()); | |||
QualityProfiles.CopyWsResponse copyResponse = adminSession.qProfiles().service().copy(new CopyRequest(builtInProfile.getKey(), "My copy")); | |||
@@ -132,7 +132,7 @@ public class BuiltInQualityProfilesTest { | |||
Organization org = tester.organizations().generate(); | |||
User administrator = tester.users().generateAdministrator(org); | |||
QualityProfile builtInProfile = getProfile(org, p -> p.getIsBuiltIn() && "Basic".equals(p.getName()) && "xoo".equals(p.getLanguage())); | |||
Session adminSession = tester.as(administrator.getLogin()); | |||
TesterSession adminSession = tester.as(administrator.getLogin()); | |||
QualityProfiles.CopyWsResponse copyResponse = adminSession.qProfiles().service().copy(new CopyRequest(builtInProfile.getKey(), "My copy")); | |||
adminSession.qProfiles().service().changeParent( |
@@ -28,9 +28,9 @@ import java.util.function.Predicate; | |||
import org.junit.ClassRule; | |||
import org.junit.Rule; | |||
import org.junit.Test; | |||
import org.sonarqube.tests.QProfileTester; | |||
import org.sonarqube.tests.Session; | |||
import org.sonarqube.tests.Tester; | |||
import org.sonarqube.qa.util.QProfileTester; | |||
import org.sonarqube.qa.util.TesterSession; | |||
import org.sonarqube.qa.util.Tester; | |||
import org.sonarqube.ws.Organizations.Organization; | |||
import org.sonarqube.ws.QualityProfiles; | |||
import org.sonarqube.ws.QualityProfiles.CreateWsResponse.QualityProfile; | |||
@@ -188,7 +188,7 @@ public class CustomQualityProfilesTest { | |||
Organization org = tester.organizations().generate(); | |||
QualityProfile profile = tester.qProfiles().createXooProfile(org); | |||
Session anonymousSession = tester.asAnonymous(); | |||
TesterSession anonymousSession = tester.asAnonymous(); | |||
expectUnauthorizedError(() -> anonymousSession.qProfiles().createXooProfile(org)); | |||
expectUnauthorizedError(() -> anonymousSession.qProfiles().service().delete(profile.getKey())); | |||
@@ -201,7 +201,7 @@ public class CustomQualityProfilesTest { | |||
Organization org = tester.organizations().generate(); | |||
User orgAdmin = tester.users().generateAdministrator(org); | |||
Session adminSession = tester.as(orgAdmin.getLogin()); | |||
TesterSession adminSession = tester.as(orgAdmin.getLogin()); | |||
QualityProfile profile = adminSession.qProfiles().createXooProfile(org); | |||
// root can activate rule and delete the profile | |||
@@ -217,7 +217,7 @@ public class CustomQualityProfilesTest { | |||
Organization org = tester.organizations().generate(); | |||
User user = tester.users().generateAdministrator(org); | |||
Session adminSession = tester.as(user.getLogin()); | |||
TesterSession adminSession = tester.as(user.getLogin()); | |||
QualityProfile parentProfile = adminSession.qProfiles().createXooProfile(org); | |||
QualityProfile inheritedProfile = adminSession.qProfiles().service().create( | |||
CreateRequest.builder() | |||
@@ -250,7 +250,7 @@ public class CustomQualityProfilesTest { | |||
Organization org = tester.organizations().generate(); | |||
User admin = tester.users().generateAdministrator(org); | |||
Session adminSession = tester.as(admin.getLogin()); | |||
TesterSession adminSession = tester.as(admin.getLogin()); | |||
String projectKey = randomAlphanumeric(10); | |||
String projectName = randomAlphanumeric(10); | |||
@@ -286,7 +286,7 @@ public class CustomQualityProfilesTest { | |||
User admin = tester.users().generateAdministrator(org); | |||
String projectKey = randomAlphanumeric(10); | |||
String projectName = randomAlphanumeric(10); | |||
Session adminSession = tester.as(admin.getLogin()); | |||
TesterSession adminSession = tester.as(admin.getLogin()); | |||
QualityProfile newXooProfile = adminSession.qProfiles().createXooProfile(org); | |||
adminSession.wsClient().wsConnector().call(new PostRequest("api/projects/create") |
@@ -27,17 +27,18 @@ import org.junit.ClassRule; | |||
import org.junit.Ignore; | |||
import org.junit.Rule; | |||
import org.junit.Test; | |||
import org.sonarqube.qa.util.Tester; | |||
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; | |||
import org.sonarqube.ws.QualityProfiles; | |||
import org.sonarqube.ws.WsUsers.CreateWsResponse.User; | |||
import org.sonarqube.ws.client.PostRequest; | |||
import org.sonarqube.ws.client.qualityprofile.AddProjectRequest; | |||
import org.sonarqube.ws.client.qualityprofile.ChangeParentRequest; | |||
import util.selenium.Selenese; | |||
import static com.codeborne.selenide.Selenide.$; | |||
import static util.ItUtils.projectDir; | |||
@@ -73,7 +74,7 @@ public class OrganizationQualityProfilesUiTest { | |||
@Test | |||
public void testHomePage() { | |||
tester.runHtmlTests( | |||
Selenese.runSelenese(orchestrator, | |||
"/organization/OrganizationQualityProfilesUiTest/should_display_list.html", | |||
"/organization/OrganizationQualityProfilesUiTest/should_open_from_list.html", | |||
"/organization/OrganizationQualityProfilesUiTest/should_filter_by_language.html"); | |||
@@ -81,7 +82,7 @@ public class OrganizationQualityProfilesUiTest { | |||
@Test | |||
public void testProfilePage() { | |||
tester.runHtmlTests( | |||
Selenese.runSelenese(orchestrator, | |||
"/organization/OrganizationQualityProfilesUiTest/should_display_profile_rules.html", | |||
"/organization/OrganizationQualityProfilesUiTest/should_display_profile_inheritance.html", | |||
"/organization/OrganizationQualityProfilesUiTest/should_display_profile_exporters.html"); | |||
@@ -104,46 +105,46 @@ public class OrganizationQualityProfilesUiTest { | |||
@Test | |||
public void testProfileChangelog() { | |||
tester.runHtmlTests( | |||
Selenese.runSelenese(orchestrator, | |||
"/organization/OrganizationQualityProfilesUiTest/should_display_changelog.html"); | |||
} | |||
@Ignore("to be replaced by selenide test in order to inject profile key") | |||
@Test | |||
public void testComparison() { | |||
tester.runHtmlTests("/organization/OrganizationQualityProfilesUiTest/should_compare.html"); | |||
Selenese.runSelenese(orchestrator, "/organization/OrganizationQualityProfilesUiTest/should_compare.html"); | |||
} | |||
@Test | |||
public void testCreation() { | |||
tester.runHtmlTests("/organization/OrganizationQualityProfilesUiTest/should_create.html"); | |||
Selenese.runSelenese(orchestrator, "/organization/OrganizationQualityProfilesUiTest/should_create.html"); | |||
} | |||
@Test | |||
public void testDeletion() { | |||
tester.runHtmlTests("/organization/OrganizationQualityProfilesUiTest/should_delete.html"); | |||
Selenese.runSelenese(orchestrator, "/organization/OrganizationQualityProfilesUiTest/should_delete.html"); | |||
} | |||
@Test | |||
public void testCopying() { | |||
tester.runHtmlTests("/organization/OrganizationQualityProfilesUiTest/should_copy.html"); | |||
Selenese.runSelenese(orchestrator, "/organization/OrganizationQualityProfilesUiTest/should_copy.html"); | |||
} | |||
@Test | |||
public void testRenaming() { | |||
tester.runHtmlTests("/organization/OrganizationQualityProfilesUiTest/should_rename.html"); | |||
Selenese.runSelenese(orchestrator, "/organization/OrganizationQualityProfilesUiTest/should_rename.html"); | |||
} | |||
@Test | |||
public void testSettingDefault() { | |||
tester.runHtmlTests("/organization/OrganizationQualityProfilesUiTest/should_set_default.html"); | |||
Selenese.runSelenese(orchestrator, "/organization/OrganizationQualityProfilesUiTest/should_set_default.html"); | |||
} | |||
@Test | |||
public void testRestoration() { | |||
deleteProfile("xoo", "empty"); | |||
tester.runHtmlTests("/organization/OrganizationQualityProfilesUiTest/should_restore.html"); | |||
Selenese.runSelenese(orchestrator, "/organization/OrganizationQualityProfilesUiTest/should_restore.html"); | |||
} | |||
@Test |
@@ -25,7 +25,7 @@ import org.junit.ClassRule; | |||
import org.junit.Rule; | |||
import org.junit.Test; | |||
import org.sonarqube.tests.Category6Suite; | |||
import org.sonarqube.tests.Tester; | |||
import org.sonarqube.qa.util.Tester; | |||
import org.sonarqube.ws.Common; | |||
import org.sonarqube.ws.Organizations.Organization; | |||
import org.sonarqube.ws.QualityProfiles.CreateWsResponse; |
@@ -28,13 +28,14 @@ import org.junit.ClassRule; | |||
import org.junit.Ignore; | |||
import org.junit.Rule; | |||
import org.junit.Test; | |||
import org.sonarqube.qa.util.Tester; | |||
import org.sonarqube.qa.util.pageobjects.Navigation; | |||
import org.sonarqube.tests.Category4Suite; | |||
import org.sonarqube.tests.Tester; | |||
import org.sonarqube.ws.client.PostRequest; | |||
import org.sonarqube.ws.client.qualityprofile.AddProjectRequest; | |||
import org.sonarqube.ws.client.qualityprofile.ChangeParentRequest; | |||
import org.sonarqube.ws.client.qualityprofile.CreateRequest; | |||
import util.selenium.Selenese; | |||
import util.user.UserRule; | |||
import static com.codeborne.selenide.Selenide.$; | |||
@@ -80,7 +81,7 @@ public class QualityProfilesUiTest { | |||
@Test | |||
public void testHomePage() { | |||
tester.runHtmlTests( | |||
Selenese.runSelenese(orchestrator, | |||
"/qualityProfile/QualityProfilesUiTest/should_display_list.html", | |||
"/qualityProfile/QualityProfilesUiTest/should_open_from_list.html", | |||
"/qualityProfile/QualityProfilesUiTest/should_filter_by_language.html"); | |||
@@ -88,7 +89,7 @@ public class QualityProfilesUiTest { | |||
@Test | |||
public void testProfilePage() { | |||
tester.runHtmlTests( | |||
Selenese.runSelenese(orchestrator, | |||
"/qualityProfile/QualityProfilesUiTest/should_display_profile_rules.html", | |||
"/qualityProfile/QualityProfilesUiTest/should_display_profile_inheritance.html", | |||
"/qualityProfile/QualityProfilesUiTest/should_display_profile_projects.html", | |||
@@ -108,46 +109,46 @@ public class QualityProfilesUiTest { | |||
@Test | |||
public void testProfileChangelog() { | |||
tester.runHtmlTests( | |||
Selenese.runSelenese(orchestrator, | |||
"/qualityProfile/QualityProfilesUiTest/should_display_changelog.html"); | |||
} | |||
@Ignore("find a way to know profile key inside selenium tests") | |||
@Test | |||
public void testComparison() { | |||
tester.runHtmlTests("/qualityProfile/QualityProfilesUiTest/should_compare.html"); | |||
Selenese.runSelenese(orchestrator, "/qualityProfile/QualityProfilesUiTest/should_compare.html"); | |||
} | |||
@Test | |||
public void testCreation() { | |||
tester.runHtmlTests("/qualityProfile/QualityProfilesUiTest/should_create.html"); | |||
Selenese.runSelenese(orchestrator, "/qualityProfile/QualityProfilesUiTest/should_create.html"); | |||
} | |||
@Test | |||
public void testDeletion() { | |||
tester.runHtmlTests("/qualityProfile/QualityProfilesUiTest/should_delete.html"); | |||
Selenese.runSelenese(orchestrator, "/qualityProfile/QualityProfilesUiTest/should_delete.html"); | |||
} | |||
@Test | |||
public void testCopying() { | |||
tester.runHtmlTests("/qualityProfile/QualityProfilesUiTest/should_copy.html"); | |||
Selenese.runSelenese(orchestrator, "/qualityProfile/QualityProfilesUiTest/should_copy.html"); | |||
} | |||
@Test | |||
public void testRenaming() { | |||
tester.runHtmlTests("/qualityProfile/QualityProfilesUiTest/should_rename.html"); | |||
Selenese.runSelenese(orchestrator, "/qualityProfile/QualityProfilesUiTest/should_rename.html"); | |||
} | |||
@Test | |||
public void testSettingDefault() { | |||
tester.runHtmlTests("/qualityProfile/QualityProfilesUiTest/should_set_default.html"); | |||
Selenese.runSelenese(orchestrator, "/qualityProfile/QualityProfilesUiTest/should_set_default.html"); | |||
} | |||
@Test | |||
public void testRestore() { | |||
deleteProfile("xoo", "empty"); | |||
tester.runHtmlTests("/qualityProfile/QualityProfilesUiTest/should_restore.html"); | |||
Selenese.runSelenese(orchestrator, "/qualityProfile/QualityProfilesUiTest/should_restore.html"); | |||
} | |||
private void createProfile(String language, String name) { |
@@ -28,7 +28,7 @@ import org.junit.Test; | |||
import org.skyscreamer.jsonassert.JSONAssert; | |||
import org.skyscreamer.jsonassert.JSONCompareMode; | |||
import org.sonarqube.tests.Category6Suite; | |||
import org.sonarqube.tests.Tester; | |||
import org.sonarqube.qa.util.Tester; | |||
import org.sonarqube.ws.Organizations.Organization; | |||
import org.sonarqube.ws.QualityProfiles.CreateWsResponse; | |||
import org.sonarqube.ws.QualityProfiles.SearchWsResponse; |
@@ -30,7 +30,7 @@ import org.junit.rules.DisableOnDebug; | |||
import org.junit.rules.TestRule; | |||
import org.junit.rules.Timeout; | |||
import org.sonarqube.tests.Byteman; | |||
import org.sonarqube.tests.Tester; | |||
import org.sonarqube.qa.util.Tester; | |||
import org.sonarqube.ws.client.rule.CreateWsRequest; | |||
import org.sonarqube.ws.client.rule.SearchWsRequest; | |||
import util.ItUtils; |
@@ -27,7 +27,7 @@ import org.junit.ClassRule; | |||
import org.junit.Test; | |||
import org.junit.rules.RuleChain; | |||
import org.junit.rules.TestRule; | |||
import org.sonarqube.tests.Tester; | |||
import org.sonarqube.qa.util.Tester; | |||
import org.sonarqube.ws.Organizations; | |||
import org.sonarqube.ws.client.PostRequest; | |||
import util.ItUtils; |
@@ -25,7 +25,7 @@ import org.junit.Rule; | |||
import org.junit.Test; | |||
import org.sonarqube.qa.util.pageobjects.RulesPage; | |||
import org.sonarqube.tests.Category2Suite; | |||
import org.sonarqube.tests.Tester; | |||
import org.sonarqube.qa.util.Tester; | |||
public class RulesPageTest { | |||
@ClassRule |
@@ -26,7 +26,7 @@ import org.junit.ClassRule; | |||
import org.junit.Rule; | |||
import org.junit.Test; | |||
import org.sonarqube.tests.Category6Suite; | |||
import org.sonarqube.tests.Tester; | |||
import org.sonarqube.qa.util.Tester; | |||
import org.sonarqube.ws.Organizations.Organization; | |||
import org.sonarqube.ws.QualityProfiles.CreateWsResponse; | |||
import org.sonarqube.ws.QualityProfiles.SearchWsResponse; |
@@ -31,9 +31,10 @@ import org.junit.ClassRule; | |||
import org.junit.Rule; | |||
import org.junit.Test; | |||
import org.sonarqube.tests.Category4Suite; | |||
import org.sonarqube.tests.Tester; | |||
import org.sonarqube.qa.util.Tester; | |||
import org.sonarqube.ws.WsSystem; | |||
import util.ItUtils; | |||
import util.selenium.Selenese; | |||
import static org.apache.commons.lang.StringUtils.startsWithAny; | |||
import static org.assertj.core.api.Assertions.assertThat; | |||
@@ -72,7 +73,7 @@ public class ServerSystemTest { | |||
public void display_warnings_when_using_h2() { | |||
String dialect = orchestrator.getConfiguration().getString("sonar.jdbc.dialect"); | |||
if (dialect == null || dialect.equals("h2") || dialect.equals("embedded")) { | |||
tester.runHtmlTests("/serverSystem/ServerSystemTest/derby-warning.html"); | |||
Selenese.runSelenese(orchestrator, "/serverSystem/ServerSystemTest/derby-warning.html"); | |||
} | |||
} | |||
@@ -81,7 +82,7 @@ public class ServerSystemTest { | |||
*/ | |||
@Test | |||
public void hide_jdbc_settings_to_non_admin() { | |||
tester.runHtmlTests("/serverSystem/ServerSystemTest/hide-jdbc-settings.html"); | |||
Selenese.runSelenese(orchestrator, "/serverSystem/ServerSystemTest/hide-jdbc-settings.html"); | |||
} | |||
@Test | |||
@@ -104,7 +105,7 @@ public class ServerSystemTest { | |||
orchestrator.executeBuild(SonarScanner.create(ItUtils.projectDir("shared/xoo-sample")) | |||
.setProperty("sonar.projectKey", "myproject.jsp")); | |||
// Access dashboard | |||
tester.runHtmlTests("/serverSystem/ServerSystemTest/url_ending_by_jsp.html"); | |||
Selenese.runSelenese(orchestrator, "/serverSystem/ServerSystemTest/url_ending_by_jsp.html"); | |||
} | |||
/** |
@@ -29,7 +29,7 @@ import org.junit.Rule; | |||
import org.junit.Test; | |||
import org.sonarqube.qa.util.pageobjects.SystemInfoPage; | |||
import org.sonarqube.tests.Category4Suite; | |||
import org.sonarqube.tests.Tester; | |||
import org.sonarqube.qa.util.Tester; | |||
import org.sonarqube.ws.client.GetRequest; | |||
import org.sonarqube.ws.client.WsResponse; | |||
import util.ItUtils; |
@@ -35,7 +35,7 @@ import org.junit.rules.DisableOnDebug; | |||
import org.junit.rules.TemporaryFolder; | |||
import org.junit.rules.TestRule; | |||
import org.junit.rules.Timeout; | |||
import org.sonarqube.tests.Elasticsearch; | |||
import org.sonarqube.qa.util.Elasticsearch; | |||
import org.sonarqube.ws.WsSystem; | |||
import org.sonarqube.ws.client.WsClient; | |||
@@ -32,7 +32,7 @@ import org.junit.ClassRule; | |||
import org.junit.Rule; | |||
import org.junit.Test; | |||
import org.sonarqube.tests.Category1Suite; | |||
import org.sonarqube.tests.Tester; | |||
import org.sonarqube.qa.util.Tester; | |||
import org.sonarqube.ws.Settings; | |||
import org.sonarqube.ws.client.PostRequest; | |||
import org.sonarqube.ws.client.setting.ValuesRequest; |
@@ -24,7 +24,8 @@ import org.sonarqube.tests.Category1Suite; | |||
import org.junit.ClassRule; | |||
import org.junit.Rule; | |||
import org.junit.Test; | |||
import org.sonarqube.tests.Tester; | |||
import org.sonarqube.qa.util.Tester; | |||
import util.selenium.Selenese; | |||
import static util.ItUtils.runProjectAnalysis; | |||
@@ -40,6 +41,6 @@ public class EncodingTest { | |||
public void support_japanese_charset() { | |||
runProjectAnalysis(orchestrator, "sourceCode/japanese-charset", "sonar.sourceEncoding", "Shift_JIS"); | |||
tester.runHtmlTests("/sourceCode/EncodingTest/japanese_sources.html"); | |||
Selenese.runSelenese(orchestrator, "/sourceCode/EncodingTest/japanese_sources.html"); | |||
} | |||
} |
@@ -20,11 +20,12 @@ | |||
package org.sonarqube.tests.sourceCode; | |||
import com.sonar.orchestrator.Orchestrator; | |||
import org.sonarqube.tests.Category1Suite; | |||
import org.junit.ClassRule; | |||
import org.junit.Rule; | |||
import org.junit.Test; | |||
import org.sonarqube.tests.Tester; | |||
import org.sonarqube.qa.util.Tester; | |||
import org.sonarqube.tests.Category1Suite; | |||
import util.selenium.Selenese; | |||
import static util.ItUtils.runProjectAnalysis; | |||
@@ -41,10 +42,10 @@ public class HighlightingTest { | |||
runProjectAnalysis(orchestrator, "highlighting/xoo-sample-with-highlighting-v2"); | |||
// SONAR-3893 & SONAR-4247 | |||
tester.runHtmlTests("/sourceCode/HighlightingTest/syntax-highlighting.html"); | |||
Selenese.runSelenese(orchestrator, "/sourceCode/HighlightingTest/syntax-highlighting.html"); | |||
// SONAR-4249 & SONAR-4250 | |||
tester.runHtmlTests("/sourceCode/HighlightingTest/symbol-usages-highlighting.html"); | |||
Selenese.runSelenese(orchestrator, "/sourceCode/HighlightingTest/symbol-usages-highlighting.html"); | |||
} | |||
// Check that E/S index is updated when file content is unchanged but plugin generates different syntax/symbol highlighting | |||
@@ -52,11 +53,11 @@ public class HighlightingTest { | |||
public void update_highlighting_even_when_code_unchanged() { | |||
runProjectAnalysis(orchestrator, "highlighting/xoo-sample-with-highlighting-v1"); | |||
tester.runHtmlTests("/sourceCode/HighlightingTest/syntax-highlighting-v1.html"); | |||
Selenese.runSelenese(orchestrator, "/sourceCode/HighlightingTest/syntax-highlighting-v1.html"); | |||
runProjectAnalysis(orchestrator, "highlighting/xoo-sample-with-highlighting-v2"); | |||
tester.runHtmlTests("/sourceCode/HighlightingTest/syntax-highlighting-v2.html"); | |||
tester.runHtmlTests("/sourceCode/HighlightingTest/symbol-usages-highlighting.html"); | |||
Selenese.runSelenese(orchestrator, "/sourceCode/HighlightingTest/syntax-highlighting-v2.html"); | |||
Selenese.runSelenese(orchestrator, "/sourceCode/HighlightingTest/symbol-usages-highlighting.html"); | |||
} | |||
} |
@@ -25,7 +25,7 @@ import org.junit.ClassRule; | |||
import org.junit.Rule; | |||
import org.junit.Test; | |||
import org.sonarqube.tests.Category1Suite; | |||
import org.sonarqube.tests.Tester; | |||
import org.sonarqube.qa.util.Tester; | |||
import org.sonarqube.ws.WsProjects.CreateWsResponse.Project; | |||
import static util.ItUtils.projectDir; |
@@ -33,8 +33,8 @@ import org.junit.rules.DisableOnDebug; | |||
import org.junit.rules.TemporaryFolder; | |||
import org.junit.rules.TestRule; | |||
import org.junit.rules.Timeout; | |||
import org.sonarqube.tests.LogsTailer; | |||
import org.sonarqube.tests.Tester; | |||
import org.sonarqube.qa.util.LogsTailer; | |||
import org.sonarqube.qa.util.Tester; | |||
import org.sonarqube.ws.WsUsers; | |||
import org.sonarqube.ws.client.user.SearchRequest; | |||
@@ -28,7 +28,7 @@ import org.junit.BeforeClass; | |||
import org.junit.ClassRule; | |||
import org.junit.Test; | |||
import org.junit.rules.RuleChain; | |||
import org.sonarqube.tests.Tester; | |||
import org.sonarqube.qa.util.Tester; | |||
import org.sonarqube.ws.client.GetRequest; | |||
import static org.assertj.core.api.Assertions.assertThat; |
@@ -32,7 +32,7 @@ import org.junit.ClassRule; | |||
import org.junit.Rule; | |||
import org.junit.Test; | |||
import org.skyscreamer.jsonassert.JSONAssert; | |||
import org.sonarqube.tests.Tester; | |||
import org.sonarqube.qa.util.Tester; | |||
import static org.assertj.core.api.Assertions.assertThat; | |||
import static util.ItUtils.getMeasuresAsDoubleByMetricKey; |
@@ -29,7 +29,7 @@ import org.junit.ClassRule; | |||
import org.junit.Rule; | |||
import org.junit.Test; | |||
import org.skyscreamer.jsonassert.JSONAssert; | |||
import org.sonarqube.tests.Tester; | |||
import org.sonarqube.qa.util.Tester; | |||
import static util.ItUtils.projectDir; | |||
@@ -26,7 +26,7 @@ import org.junit.ClassRule; | |||
import org.junit.Rule; | |||
import org.junit.Test; | |||
import org.openqa.selenium.By; | |||
import org.sonarqube.tests.Tester; | |||
import org.sonarqube.qa.util.Tester; | |||
import org.sonarqube.ws.Organizations.Organization; | |||
import org.sonarqube.ws.WsUsers.CreateWsResponse.User; | |||
@@ -25,11 +25,12 @@ import org.junit.ClassRule; | |||
import org.junit.Rule; | |||
import org.junit.Test; | |||
import org.openqa.selenium.By; | |||
import org.sonarqube.tests.Tester; | |||
import org.sonarqube.qa.util.Tester; | |||
import org.sonarqube.ws.WsProjects; | |||
import org.sonarqube.ws.WsUsers.CreateWsResponse.User; | |||
import org.sonarqube.ws.client.project.CreateRequest; | |||
import util.ItUtils; | |||
import util.selenium.Selenese; | |||
import static com.codeborne.selenide.Condition.text; | |||
import static com.codeborne.selenide.Selenide.$; | |||
@@ -46,7 +47,7 @@ public class UiExtensionsTest { | |||
@Test | |||
public void test_static_files() { | |||
tester.runHtmlTests("/ui/UiExtensionsTest/static-files.html"); | |||
Selenese.runSelenese(orchestrator, "/ui/UiExtensionsTest/static-files.html"); | |||
} | |||
@Test |
@@ -26,7 +26,7 @@ import org.junit.Before; | |||
import org.junit.ClassRule; | |||
import org.junit.Rule; | |||
import org.junit.Test; | |||
import org.sonarqube.tests.Tester; | |||
import org.sonarqube.qa.util.Tester; | |||
import org.sonarqube.ws.WsUsers.CreateWsResponse.User; | |||
import org.sonarqube.ws.client.GetRequest; | |||
import org.sonarqube.ws.client.PostRequest; |
@@ -26,10 +26,10 @@ import org.junit.After; | |||
import org.junit.ClassRule; | |||
import org.junit.Rule; | |||
import org.junit.Test; | |||
import org.sonarqube.qa.util.Tester; | |||
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; | |||
import org.sonarqube.ws.WsUsers; | |||
import org.sonarqube.ws.WsUsers.CreateWsResponse.User; | |||
@@ -44,6 +44,7 @@ import org.sonarqube.ws.client.usertoken.GenerateWsRequest; | |||
import org.sonarqube.ws.client.usertoken.RevokeWsRequest; | |||
import org.sonarqube.ws.client.usertoken.SearchWsRequest; | |||
import org.sonarqube.ws.client.usertoken.UserTokensService; | |||
import util.selenium.Selenese; | |||
import static java.lang.String.format; | |||
import static java.util.Arrays.asList; | |||
@@ -162,7 +163,7 @@ public class LocalAuthenticationTest { | |||
public void test_authentication_in_ui() { | |||
tester.users().generate(u -> u.setLogin("simple-user").setPassword("password")); | |||
tester.users().generateAdministrator(u -> u.setLogin("admin-user").setPassword("admin-user")); | |||
tester.runHtmlTests( | |||
Selenese.runSelenese(orchestrator, | |||
"/user/LocalAuthenticationTest/login_successful.html", | |||
"/user/LocalAuthenticationTest/login_wrong_password.html", | |||
"/user/LocalAuthenticationTest/should_not_be_unlogged_when_going_to_login_page.html"); | |||
@@ -172,8 +173,8 @@ public class LocalAuthenticationTest { | |||
public void test_authentication_redirects_in_ui() { | |||
tester.users().generate(u -> u.setLogin("simple-user").setPassword("password")); | |||
tester.users().generateAdministrator(u -> u.setLogin("admin-user").setPassword("admin-user")); | |||
tester.runHtmlTests( | |||
"/user/LocalAuthenticationTest/redirect_to_login_when_not_enough_privilege.html", | |||
Selenese.runSelenese(orchestrator, | |||
"/user/LocalAuthenticationTest/redirect_to_login_when_not_enough_privilege.html", | |||
// SONAR-2132 | |||
"/user/LocalAuthenticationTest/redirect_to_original_url_after_direct_login.html", | |||
"/user/LocalAuthenticationTest/redirect_to_original_url_with_parameters_after_direct_login.html", | |||
@@ -187,7 +188,7 @@ public class LocalAuthenticationTest { | |||
tester.users().generateAdministrator(u -> u.setLogin("admin-user").setPassword("admin-user")); | |||
setServerProperty(orchestrator, "sonar.forceAuthentication", "true"); | |||
tester.runHtmlTests( | |||
Selenese.runSelenese(orchestrator, | |||
// SONAR-3473 | |||
"/user/LocalAuthenticationTest/force-authentication.html"); | |||
} |