aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGrégoire Aubert <gregoire.aubert@sonarsource.com>2017-04-03 08:35:37 +0200
committerGrégoire Aubert <gregaubert@users.noreply.github.com>2017-04-03 12:03:21 +0200
commit1856d055923715759ed71a42ab1ff0deabf809f9 (patch)
tree69460dee9a2e054f8329bbaa88e08b7cfd0ca142
parent2c890d852dd6c355a64679e1d603c17bfac29bc5 (diff)
downloadsonarqube-1856d055923715759ed71a42ab1ff0deabf809f9.tar.gz
sonarqube-1856d055923715759ed71a42ab1ff0deabf809f9.zip
Fix issues integration tests
-rw-r--r--it/it-tests/src/test/java/it/organization/IssueAssignTest.java2
-rw-r--r--it/it-tests/src/test/java/it/organization/OrganizationMembershipTest.java16
-rw-r--r--it/it-tests/src/test/java/pageobjects/issues/Issue.java3
-rw-r--r--it/it-tests/src/test/java/pageobjects/issues/IssuesPage.java6
-rw-r--r--server/sonar-web/src/main/js/helpers/testUtils.js14
5 files changed, 18 insertions, 23 deletions
diff --git a/it/it-tests/src/test/java/it/organization/IssueAssignTest.java b/it/it-tests/src/test/java/it/organization/IssueAssignTest.java
index 0f1388c3b02..6b53b7c1fdd 100644
--- a/it/it-tests/src/test/java/it/organization/IssueAssignTest.java
+++ b/it/it-tests/src/test/java/it/organization/IssueAssignTest.java
@@ -194,7 +194,7 @@ public class IssueAssignTest {
}
@Test
- public void bulk_assign_search_all_users_of_in_global_issues() {
+ public void bulk_assign_search_all_users_in_global_issues() {
createOrganization(OTHER_ORGANIZATION_KEY);
userRule.createUser(ASSIGNEE_LOGIN, ASSIGNEE_LOGIN);
adminClient.organizations().addMember(ORGANIZATION_KEY, ASSIGNEE_LOGIN);
diff --git a/it/it-tests/src/test/java/it/organization/OrganizationMembershipTest.java b/it/it-tests/src/test/java/it/organization/OrganizationMembershipTest.java
index efc78a946cb..7f91c3c686f 100644
--- a/it/it-tests/src/test/java/it/organization/OrganizationMembershipTest.java
+++ b/it/it-tests/src/test/java/it/organization/OrganizationMembershipTest.java
@@ -190,11 +190,11 @@ public class OrganizationMembershipTest {
@Test
public void admin_can_remove_members() {
String orgKey = createOrganization();
- String user1 = createUser();
- String user2 = createUser();
+ userRule.createUser("foo", "pwd");
+ userRule.createUser("bar", "pwd");
- adminClient.organizations().addMember(orgKey, user1);
- adminClient.organizations().addMember(orgKey, user2);
+ adminClient.organizations().addMember(orgKey, "foo");
+ adminClient.organizations().addMember(orgKey, "bar");
MembersPage page = nav.logIn().asAdmin().openOrganizationMembers(orgKey);
page.shouldHaveTotal(3)
@@ -205,9 +205,9 @@ public class OrganizationMembershipTest {
@Test
public void admin_can_manage_groups() {
String orgKey = createOrganization();
- String user1 = createUser();
+ userRule.createUser("foo", "pwd");
- adminClient.organizations().addMember(orgKey, user1);
+ adminClient.organizations().addMember(orgKey, "foo");
MembersPage page = nav.logIn().asAdmin().openOrganizationMembers(orgKey);
page.getMembersByIdx(1)
@@ -225,11 +225,11 @@ public class OrganizationMembershipTest {
@Test
public void groups_count_should_be_updated_when_a_member_was_just_added() {
String orgKey = createOrganization();
- String user1 = createUser();
+ userRule.createUser("foo", "pwd");
MembersPage page = nav.logIn().asAdmin().openOrganizationMembers(orgKey);
page
- .addMember(user1)
+ .addMember("foo")
.getMembersByIdx(1)
.shouldHaveGroups(0)
.manageGroupsOpen()
diff --git a/it/it-tests/src/test/java/pageobjects/issues/Issue.java b/it/it-tests/src/test/java/pageobjects/issues/Issue.java
index 42bb575d58a..0781ae0c021 100644
--- a/it/it-tests/src/test/java/pageobjects/issues/Issue.java
+++ b/it/it-tests/src/test/java/pageobjects/issues/Issue.java
@@ -24,7 +24,6 @@ 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.$;
-import static org.assertj.core.api.Assertions.assertThat;
public class Issue {
@@ -60,7 +59,7 @@ public class Issue {
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);
- assertThat(popupMenu.$$("li").size()).isEqualTo(count);
+ popupMenu.$$("li").shouldHaveSize(count);
assignLink.click();
return this;
}
diff --git a/it/it-tests/src/test/java/pageobjects/issues/IssuesPage.java b/it/it-tests/src/test/java/pageobjects/issues/IssuesPage.java
index ae303ea7218..801c24a9b0b 100644
--- a/it/it-tests/src/test/java/pageobjects/issues/IssuesPage.java
+++ b/it/it-tests/src/test/java/pageobjects/issues/IssuesPage.java
@@ -19,6 +19,7 @@
*/
package pageobjects.issues;
+import com.codeborne.selenide.CollectionCondition;
import com.codeborne.selenide.ElementsCollection;
import com.codeborne.selenide.SelenideElement;
import java.util.List;
@@ -29,7 +30,6 @@ import static com.codeborne.selenide.Condition.exist;
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 IssuesPage {
@@ -55,7 +55,7 @@ public class IssuesPage {
public IssuesPage bulkChangeOpen() {
$("#issues-bulk-change").shouldBe(visible).click();
- $("a.js-bulk-change").shouldBe(visible).click();
+ $("a.js-bulk-change").click();
$("#bulk-change-form").shouldBe(visible);
return this;
}
@@ -68,10 +68,10 @@ public class IssuesPage {
input.val("").sendKeys(query);
if (count > 0) {
$(".select2-drop-active .select2-results li.select2-result").shouldBe(visible);
- assertThat($$(".select2-drop-active .select2-results li.select2-result").size()).isEqualTo(count);
} else {
$(".select2-drop-active .select2-results li.select2-no-results").shouldBe(visible);
}
+ $$(".select2-drop-active .select2-results li.select2-result").shouldHaveSize(count);
return this;
}
}
diff --git a/server/sonar-web/src/main/js/helpers/testUtils.js b/server/sonar-web/src/main/js/helpers/testUtils.js
index b426403453f..05104c5482a 100644
--- a/server/sonar-web/src/main/js/helpers/testUtils.js
+++ b/server/sonar-web/src/main/js/helpers/testUtils.js
@@ -24,19 +24,15 @@ export const mockEvent = {
stopPropagation() {}
};
-export const click = element => {
- return element.simulate('click', mockEvent);
-};
+export const click = element => element.simulate('click', mockEvent);
-export const submit = element => {
- return element.simulate('submit', {
+export const submit = element =>
+ element.simulate('submit', {
preventDefault() {}
});
-};
-export const change = (element, value) => {
- return element.simulate('change', {
+export const change = (element, value) =>
+ element.simulate('change', {
target: { value },
currentTarget: { value }
});
-};