diff options
author | Stas Vilchik <vilchiks@gmail.com> | 2016-06-09 14:49:05 +0200 |
---|---|---|
committer | Stas Vilchik <vilchiks@gmail.com> | 2016-06-09 14:49:05 +0200 |
commit | 9ddbcb00f8f3a6b6a85d4e1bf68d0edea0d45df5 (patch) | |
tree | 2e188bff86ed45b3a31b3c414b9862a90dc1d8e0 /it/it-tests | |
parent | 6b35da5b5dc82f89d62109a2556ffdc520e7e08e (diff) | |
download | sonarqube-9ddbcb00f8f3a6b6a85d4e1bf68d0edea0d45df5.tar.gz sonarqube-9ddbcb00f8f3a6b6a85d4e1bf68d0edea0d45df5.zip |
refactor permission templates page (#1025)
Diffstat (limited to 'it/it-tests')
3 files changed, 233 insertions, 0 deletions
diff --git a/it/it-tests/src/test/java/it/authorisation/PermissionTemplatesPageTest.java b/it/it-tests/src/test/java/it/authorisation/PermissionTemplatesPageTest.java new file mode 100644 index 00000000000..d7761ffd017 --- /dev/null +++ b/it/it-tests/src/test/java/it/authorisation/PermissionTemplatesPageTest.java @@ -0,0 +1,45 @@ +/* + * SonarQube + * Copyright (C) 2009-2016 SonarSource SA + * mailto:contact 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. + */ +package it.authorisation; + +import com.sonar.orchestrator.Orchestrator; +import com.sonar.orchestrator.selenium.Selenese; +import it.Category1Suite; +import org.junit.ClassRule; +import org.junit.Test; +import org.junit.experimental.categories.Category; +import util.QaOnly; +import util.selenium.SeleneseTest; + +@Category(QaOnly.class) +public class PermissionTemplatesPageTest { + + @ClassRule + public static Orchestrator orchestrator = Category1Suite.ORCHESTRATOR; + + @Test + public void should_display_page() throws Exception { + Selenese selenese = Selenese.builder().setHtmlTestsInClasspath("should_display_page", + "/authorisation/PermissionTemplatesPageTest/should_display_page.html", + "/authorisation/PermissionTemplatesPageTest/should_create.html" + ).build(); + new SeleneseTest(selenese).runOn(orchestrator); + } +} diff --git a/it/it-tests/src/test/resources/authorisation/PermissionTemplatesPageTest/should_create.html b/it/it-tests/src/test/resources/authorisation/PermissionTemplatesPageTest/should_create.html new file mode 100644 index 00000000000..5ea5a7e5814 --- /dev/null +++ b/it/it-tests/src/test/resources/authorisation/PermissionTemplatesPageTest/should_create.html @@ -0,0 +1,99 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> +<head profile="http://selenium-ide.openqa.org/profiles/test-case"> + <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> + <title>should_create</title> +</head> +<body> +<table cellpadding="1" cellspacing="1" border="1"> + <tbody> + <tr> + <td>open</td> + <td>/sessions/logout</td> + <td></td> +</tr> +<tr> + <td>open</td> + <td>/sessions/new</td> + <td></td> +</tr> +<tr> + <td>type</td> + <td>id=login</td> + <td>admin</td> +</tr> +<tr> + <td>type</td> + <td>id=password</td> + <td>admin</td> +</tr> +<tr> + <td>clickAndWait</td> + <td>name=commit</td> + <td></td> +</tr> +<tr> + <td>open</td> + <td>/permission_templates</td> + <td></td> +</tr> +<tr> + <td>waitForElementPresent</td> + <td>css=.page-actions button</td> + <td></td> +</tr> +<tr> + <td>click</td> + <td>css=.page-actions button</td> + <td></td> +</tr> +<tr> + <td>waitForElementPresent</td> + <td>css=#permission-template-name</td> + <td></td> +</tr> +<tr> + <td>type</td> + <td>css=#permission-template-name</td> + <td>Custom</td> +</tr> +<tr> + <td>type</td> + <td>css=#permission-template-description</td> + <td>Description</td> +</tr> +<tr> + <td>type</td> + <td>css=#permission-template-project-key-pattern</td> + <td>.*</td> +</tr> +<tr> + <td>click</td> + <td>css=#permission-template-submit</td> + <td></td> +</tr> +<tr> + <td>waitForElementPresent</td> + <td>css=tr[data-name="Custom"]</td> + <td></td> +</tr> +<tr> + <td>assertText</td> + <td>css=tr[data-name="Custom"] .js-name</td> + <td>*Custom*</td> +</tr> +<tr> + <td>assertText</td> + <td>css=tr[data-name="Custom"] .js-description</td> + <td>*Description*</td> +</tr> +<tr> + <td>assertText</td> + <td>css=tr[data-name="Custom"] .js-project-key-pattern</td> + <td>*.*</td> +</tr> +</tbody> +</table> +</body> +</html> diff --git a/it/it-tests/src/test/resources/authorisation/PermissionTemplatesPageTest/should_display_page.html b/it/it-tests/src/test/resources/authorisation/PermissionTemplatesPageTest/should_display_page.html new file mode 100644 index 00000000000..34ec0d429a0 --- /dev/null +++ b/it/it-tests/src/test/resources/authorisation/PermissionTemplatesPageTest/should_display_page.html @@ -0,0 +1,89 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> +<head profile="http://selenium-ide.openqa.org/profiles/test-case"> + <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> + <title>should_display_page</title> +</head> +<body> +<table cellpadding="1" cellspacing="1" border="1"> + <tbody> + <tr> + <td>open</td> + <td>/sessions/logout</td> + <td></td> +</tr> +<tr> + <td>open</td> + <td>/sessions/new</td> + <td></td> +</tr> +<tr> + <td>type</td> + <td>id=login</td> + <td>admin</td> +</tr> +<tr> + <td>type</td> + <td>id=password</td> + <td>admin</td> +</tr> +<tr> + <td>clickAndWait</td> + <td>name=commit</td> + <td></td> +</tr> +<tr> + <td>open</td> + <td>/permission_templates</td> + <td></td> +</tr> +<tr> + <td>waitForElementPresent</td> + <td>css=tr[data-id="default_template"]</td> + <td></td> +</tr> +<tr> + <td>assertText</td> + <td>css=tr[data-id="default_template"] .js-name</td> + <td>*Default template*</td> +</tr> +<tr> + <td>assertText</td> + <td>css=tr[data-id="default_template"] .js-defaults</td> + <td>*Projects*</td> +</tr> +<tr> + <td>assertText</td> + <td>css=tr[data-id="default_template"] .js-description</td> + <td>*This permission template will be used*</td> +</tr> +<tr> + <td>assertElementPresent</td> + <td>css=td[data-permission="user"]</td> + <td></td> +</tr> +<tr> + <td>assertElementPresent</td> + <td>css=td[data-permission="codeviewer"]</td> + <td></td> +</tr> +<tr> + <td>assertElementPresent</td> + <td>css=td[data-permission="issueadmin"]</td> + <td></td> +</tr> +<tr> + <td>assertElementPresent</td> + <td>css=td[data-permission="admin"]</td> + <td></td> +</tr> +<tr> + <td>assertElementPresent</td> + <td>css=td[data-permission="scan"]</td> + <td></td> +</tr> +</tbody> +</table> +</body> +</html> |