You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ProjectBulkDeletionPageTest.java 2.9KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. /*
  2. * SonarQube
  3. * Copyright (C) 2009-2018 SonarSource SA
  4. * mailto:info AT sonarsource DOT com
  5. *
  6. * This program is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU Lesser General Public
  8. * License as published by the Free Software Foundation; either
  9. * version 3 of the License, or (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. * Lesser General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU Lesser General Public License
  17. * along with this program; if not, write to the Free Software Foundation,
  18. * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  19. */
  20. package org.sonarqube.tests.project;
  21. import com.sonar.orchestrator.Orchestrator;
  22. import org.junit.Before;
  23. import org.junit.ClassRule;
  24. import org.junit.Rule;
  25. import org.junit.Test;
  26. import org.sonarqube.qa.util.Tester;
  27. import org.sonarqube.ws.Projects.CreateWsResponse.Project;
  28. import org.sonarqube.ws.client.components.SearchProjectsRequest;
  29. import static com.codeborne.selenide.Condition.text;
  30. import static com.codeborne.selenide.Condition.visible;
  31. import static com.codeborne.selenide.Selenide.$;
  32. import static org.assertj.core.api.Assertions.assertThat;
  33. public class ProjectBulkDeletionPageTest {
  34. @ClassRule
  35. public static Orchestrator orchestrator = ProjectSuite.ORCHESTRATOR;
  36. @Rule
  37. public Tester tester = new Tester(orchestrator);
  38. private String sysAdminLogin;
  39. @Before
  40. public void setUp() {
  41. sysAdminLogin = tester.users().generateAdministratorOnDefaultOrganization().getLogin();
  42. }
  43. /**
  44. * SONAR-2614, SONAR-3805
  45. */
  46. @Test
  47. public void bulk_deletion_on_selected_projects() {
  48. Project project1 = tester.projects().provision(p -> p.setName("Foo"));
  49. Project project2 = tester.projects().provision(p -> p.setName("Bar"));
  50. Project project3 = tester.projects().provision(p -> p.setName("FooQux"));
  51. tester.openBrowser().logIn().submitCredentials(sysAdminLogin).open("/organizations/default-organization/projects_management");
  52. $("#projects-management-page").shouldHave(text(project1.getName())).shouldHave(text(project2.getName())).shouldHave(text(project3.getName()));
  53. $("#projects-management-page .search-box-input").val("foo").pressEnter();
  54. $("#projects-management-page").shouldNotHave(text(project2.getName())).shouldHave(text(project1.getName())).shouldHave(text(project3.getName()));
  55. $("#projects-management-page .js-delete").click();
  56. $(".modal").shouldBe(visible);
  57. $(".modal button").click();
  58. $("#projects-management-page").shouldNotHave(text(project1.getName())).shouldNotHave(text(project3.getName()));
  59. assertThat(tester.wsClient().components().searchProjects(new SearchProjectsRequest())
  60. .getComponentsCount()).isEqualTo(1);
  61. }
  62. }