]> source.dussan.org Git - sonarqube.git/commitdiff
Fix unstable IT bulk_apply_permission_template
authorGrégoire Aubert <gregoire.aubert@sonarsource.com>
Mon, 24 Jul 2017 07:56:31 +0000 (09:56 +0200)
committerGrégoire Aubert <gregoire.aubert@sonarsource.com>
Mon, 24 Jul 2017 09:00:57 +0000 (11:00 +0200)
tests/src/test/java/org/sonarqube/pageobjects/ProjectsManagementPage.java
tests/src/test/java/org/sonarqube/tests/projectAdministration/ProjectAdministrationTest.java

index eded1c27bfc5db58886f38485a96fba29a80c7ac..f359ed761d502a1a8e6412d32092601e12cfa42e 100644 (file)
@@ -58,6 +58,7 @@ public class ProjectsManagementPage {
       .shouldHave(CollectionCondition.sizeGreaterThan(0))
       .findBy(text("foo-template")).should(exist).click();
     $(".modal .js-apply").should(exist).click();
+    $(".modal-body .alert-success").should(exist);
     return this;
   }
 }
index 89598145a91d211169bdcc608071bc950aa18a4e..0cd466e725ba713466382ee11e24bb57c2c0c3f5 100644 (file)
@@ -42,6 +42,7 @@ import org.sonar.wsclient.user.UserParameters;
 import org.sonarqube.pageobjects.Navigation;
 import org.sonarqube.pageobjects.settings.SettingsPage;
 import org.sonarqube.tests.Tester;
+import org.sonarqube.ws.WsPermissions;
 import org.sonarqube.ws.client.permission.AddUserToTemplateWsRequest;
 import org.sonarqube.ws.client.permission.CreateTemplateWsRequest;
 import org.sonarqube.ws.client.permission.UsersWsRequest;
@@ -214,10 +215,12 @@ public class ProjectAdministrationTest {
     ProjectsManagementPage page = nav.logIn().submitCredentials(adminUser).openProjectsManagement();
     page.shouldHaveProject(project);
     page.bulkApplyPermissionTemplate("foo-template");
-    assertThat(tester.wsClient().permissions().users(new UsersWsRequest()
+    WsPermissions.UsersWsResponse usersResponse = tester.wsClient().permissions().users(new UsersWsRequest()
       .setProjectKey(project)
       .setPermission("admin")
-    ).getUsers(0).getLogin()).isEqualTo(user);
+    );
+    assertThat(usersResponse.getUsersCount()).isEqualTo(1);
+    assertThat(usersResponse.getUsers(0).getLogin()).isEqualTo(user);
   }
 
   private void scanSampleWithDate(String date) {