diff options
Diffstat (limited to 'it/it-tests')
175 files changed, 3163 insertions, 542 deletions
diff --git a/it/it-tests/pom.xml b/it/it-tests/pom.xml index 8bbba5a3c4f..fb7418301cf 100644 --- a/it/it-tests/pom.xml +++ b/it/it-tests/pom.xml @@ -6,7 +6,7 @@ <parent> <groupId>org.sonarsource.sonarqube</groupId> <artifactId>it</artifactId> - <version>5.6.1-SNAPSHOT</version> + <version>6.0-SNAPSHOT</version> </parent> <artifactId>it-tests</artifactId> <name>SonarQube Integration Tests :: Tests</name> @@ -93,9 +93,9 @@ <version>1.8.3</version> </dependency> <dependency> - <groupId>com.squareup.okhttp</groupId> + <groupId>com.squareup.okhttp3</groupId> <artifactId>mockwebserver</artifactId> - <version>2.6.0</version> + <version>3.3.1</version> </dependency> <!-- Email notifications --> diff --git a/it/it-tests/src/test/java/it/Category2Suite.java b/it/it-tests/src/test/java/it/Category2Suite.java index ad57842de3f..e30b9d043f6 100644 --- a/it/it-tests/src/test/java/it/Category2Suite.java +++ b/it/it-tests/src/test/java/it/Category2Suite.java @@ -36,6 +36,7 @@ import it.issue.IssuePurgeTest; import it.issue.IssueSearchTest; import it.issue.IssueTrackingTest; import it.issue.IssueWorkflowTest; +import it.issue.IssuesPageTest; import it.issue.NewIssuesMeasureTest; import it.qualityModel.MaintainabilityMeasureTest; import it.qualityModel.MaintainabilityRatingMeasureTest; @@ -84,6 +85,7 @@ import static util.ItUtils.xooPlugin; IssueSearchTest.class, IssueTrackingTest.class, IssueWorkflowTest.class, + IssuesPageTest.class, NewIssuesMeasureTest.class, // debt MaintainabilityMeasureTest.class, diff --git a/it/it-tests/src/test/java/it/Category4Suite.java b/it/it-tests/src/test/java/it/Category4Suite.java index a12a4f39779..3596a72be42 100644 --- a/it/it-tests/src/test/java/it/Category4Suite.java +++ b/it/it-tests/src/test/java/it/Category4Suite.java @@ -33,6 +33,7 @@ import it.duplication.DuplicationsTest; import it.http.HttpHeadersTest; import it.projectComparison.ProjectComparisonTest; import it.projectEvent.EventTest; +import it.qualityProfile.QualityProfilesPageTest; import it.serverSystem.ServerSystemTest; import it.ui.UiTest; import it.uiExtension.UiExtensionsTest; @@ -90,7 +91,9 @@ import static util.ItUtils.xooPlugin; // ui extensions UiExtensionsTest.class, WsLocalCallTest.class, - WsTest.class + WsTest.class, + // quality profiles + QualityProfilesPageTest.class }) public class Category4Suite { @@ -106,7 +109,6 @@ public class Category4Suite { // Used in DashboardTest .addPlugin(pluginArtifact("dashboard-plugin")) - .addPlugin(pluginArtifact("required-measures-widgets-plugin")) // Used in UiExtensionsTest .addPlugin(pluginArtifact("ui-extensions-plugin")) diff --git a/it/it-tests/src/test/java/it/analysis/BatchTest.java b/it/it-tests/src/test/java/it/analysis/BatchTest.java index 57d5084f8a9..006fdca305b 100644 --- a/it/it-tests/src/test/java/it/analysis/BatchTest.java +++ b/it/it-tests/src/test/java/it/analysis/BatchTest.java @@ -21,7 +21,7 @@ package it.analysis; import com.sonar.orchestrator.Orchestrator; import com.sonar.orchestrator.build.BuildResult; -import com.sonar.orchestrator.build.SonarRunner; +import com.sonar.orchestrator.build.SonarScanner; import com.sonar.orchestrator.locator.FileLocation; import it.Category3Suite; import java.io.File; @@ -199,7 +199,7 @@ public class BatchTest { orchestrator.getServer().provisionProject("sample", "xoo-sample"); orchestrator.getServer().associateProjectToQualityProfile("sample", "xoo", "one-issue-per-line"); - SonarRunner runner = configureRunner("shared/xoo-sample", + SonarScanner runner = configureScanner("shared/xoo-sample", "sonar.verbose", "true"); runner.setEnvironmentVariable("SONAR_USER_HOME", "/dev/null"); BuildResult buildResult = orchestrator.executeBuildQuietly(runner); @@ -443,7 +443,7 @@ public class BatchTest { long before = new Date().getTime() - 2000l; orchestrator.getServer().provisionProject("sample", "xoo-sample"); orchestrator.getServer().associateProjectToQualityProfile("sample", "xoo", "one-issue-per-line"); - orchestrator.executeBuild(SonarRunner.create(ItUtils.projectDir("shared/xoo-sample"))); + orchestrator.executeBuild(SonarScanner.create(ItUtils.projectDir("shared/xoo-sample"))); long after = new Date().getTime() + 2000l; Resource xooSample = orchestrator.getServer().getWsClient().find(new ResourceQuery().setResourceKeyOrId("sample")); assertThat(xooSample.getCreationDate().getTime()).isGreaterThan(before).isLessThan(after); @@ -457,7 +457,7 @@ public class BatchTest { public void fail_if_project_date_is_older_than_latest_snapshot() { orchestrator.getServer().provisionProject("sample", "xoo-sample"); orchestrator.getServer().associateProjectToQualityProfile("sample", "xoo", "one-issue-per-line"); - SonarRunner analysis = SonarRunner.create(ItUtils.projectDir("shared/xoo-sample")); + SonarScanner analysis = SonarScanner.create(ItUtils.projectDir("shared/xoo-sample")); analysis.setProperty("sonar.projectDate", "2014-01-01"); orchestrator.executeBuild(analysis); @@ -475,19 +475,19 @@ public class BatchTest { } private BuildResult scan(String projectPath, String... props) { - SonarRunner runner = configureRunner(projectPath, props); + SonarScanner runner = configureScanner(projectPath, props); return orchestrator.executeBuild(runner); } private BuildResult scanQuietly(String projectPath, String... props) { - SonarRunner runner = configureRunner(projectPath, props); + SonarScanner runner = configureScanner(projectPath, props); return orchestrator.executeBuildQuietly(runner); } - private SonarRunner configureRunner(String projectPath, String... props) { - SonarRunner runner = SonarRunner.create(ItUtils.projectDir(projectPath)) + private SonarScanner configureScanner(String projectPath, String... props) { + SonarScanner scanner = SonarScanner.create(ItUtils.projectDir(projectPath)) .setProperties(props); - return runner; + return scanner; } } diff --git a/it/it-tests/src/test/java/it/analysis/IssueJsonReportTest.java b/it/it-tests/src/test/java/it/analysis/IssueJsonReportTest.java index fe0f657ac3b..cca24d3ab0e 100644 --- a/it/it-tests/src/test/java/it/analysis/IssueJsonReportTest.java +++ b/it/it-tests/src/test/java/it/analysis/IssueJsonReportTest.java @@ -21,7 +21,7 @@ package it.analysis; import com.sonar.orchestrator.Orchestrator; import com.sonar.orchestrator.build.BuildResult; -import com.sonar.orchestrator.build.SonarRunner; +import com.sonar.orchestrator.build.SonarScanner; import com.sonar.orchestrator.locator.FileLocation; import com.sonar.orchestrator.locator.ResourceLocation; import it.Category3Suite; @@ -67,7 +67,7 @@ public class IssueJsonReportTest { orchestrator.getServer().associateProjectToQualityProfile("sample", "xoo", "one-issue-per-line"); File projectDir = ItUtils.projectDir("shared/xoo-sample"); - SonarRunner runner = SonarRunner.create(projectDir, + SonarScanner runner = SonarScanner.create(projectDir, "sonar.analysis.mode", "issues", "sonar.verbose", "true", "sonar.report.export.path", "sonar-report.json"); @@ -101,7 +101,7 @@ public class IssueJsonReportTest { orchestrator.getServer().associateProjectToQualityProfile("sample-multiline", "xoo", "multiline"); File projectDir = ItUtils.projectDir("shared/xoo-precise-issues"); - SonarRunner runner = SonarRunner.create(projectDir, + SonarScanner runner = SonarScanner.create(projectDir, "sonar.analysis.mode", "issues", "sonar.verbose", "true", "sonar.report.export.path", "sonar-report.json"); @@ -135,7 +135,7 @@ public class IssueJsonReportTest { orchestrator.getServer().associateProjectToQualityProfile("sample", "xoo", "one-issue-per-line"); File projectDir = ItUtils.projectDir("analysis/tracking/v1"); - SonarRunner issuesModeScan = SonarRunner.create(projectDir) + SonarScanner issuesModeScan = SonarScanner.create(projectDir) .setProperty("sonar.analysis.mode", "issues") .setProperty("sonar.userHome", temp.newFolder().getAbsolutePath()) .setProperty("sonar.report.export.path", "sonar-report.json") @@ -156,13 +156,13 @@ public class IssueJsonReportTest { orchestrator.getServer().provisionProject("sample", "tracking"); orchestrator.getServer().associateProjectToQualityProfile("sample", "xoo", "one-issue-per-line"); - SonarRunner scan = SonarRunner.create(ItUtils.projectDir("analysis/tracking/v1")) + SonarScanner scan = SonarScanner.create(ItUtils.projectDir("analysis/tracking/v1")) .setProperty("sonar.projectDate", "2013-05-01"); orchestrator.executeBuild(scan); // Issues mode scan -> 2 new issues and 13 existing issues File projectDir = ItUtils.projectDir("analysis/tracking/v2"); - SonarRunner issuesModeScan = SonarRunner.create(projectDir) + SonarScanner issuesModeScan = SonarScanner.create(projectDir) .setProperty("sonar.analysis.mode", "issues") .setProperty("sonar.userHome", temp.newFolder().getAbsolutePath()) .setProperty("sonar.report.export.path", "sonar-report.json") @@ -183,14 +183,14 @@ public class IssueJsonReportTest { orchestrator.getServer().provisionProject("sample:mybranch", "Sample"); orchestrator.getServer().associateProjectToQualityProfile("sample:mybranch", "xoo", "one-issue-per-line"); - SonarRunner scan = SonarRunner.create(ItUtils.projectDir("analysis/tracking/v1")) + SonarScanner scan = SonarScanner.create(ItUtils.projectDir("analysis/tracking/v1")) .setProperty("sonar.projectDate", "2013-05-01") .setProperty("sonar.branch", "mybranch"); orchestrator.executeBuild(scan); // issues mode scan -> 2 new issues and 13 existing issues File projectDir = ItUtils.projectDir("analysis/tracking/v2"); - SonarRunner issuesModeScan = SonarRunner.create(projectDir) + SonarScanner issuesModeScan = SonarScanner.create(projectDir) .setProperty("sonar.analysis.mode", "issues") .setProperty("sonar.userHome", temp.newFolder().getAbsolutePath()) .setProperty("sonar.report.export.path", "sonar-report.json") @@ -218,13 +218,13 @@ public class IssueJsonReportTest { orchestrator.getServer().associateProjectToQualityProfile("com.sonarsource.it.samples:multi-modules-sample", "xoo", "one-issue-per-line"); File rootDir = ItUtils.projectDir("shared/xoo-multi-modules-sample"); - SonarRunner scan = SonarRunner.create(rootDir) + SonarScanner scan = SonarScanner.create(rootDir) .setProperty("sonar.projectDate", "2013-05-01"); orchestrator.executeBuild(scan); // Issues mode scan on a module -> no new issues File moduleDir = ItUtils.projectDir("shared/xoo-multi-modules-sample/module_a/module_a1"); - SonarRunner issuesModeScan = SonarRunner.create(moduleDir) + SonarScanner issuesModeScan = SonarScanner.create(moduleDir) .setProperty("sonar.projectKey", "com.sonarsource.it.samples:multi-modules-sample:module_a:module_a1") .setProperty("sonar.projectVersion", "1.0-SNAPSHOT") .setProperty("sonar.projectName", "ModuleA1") @@ -255,12 +255,12 @@ public class IssueJsonReportTest { orchestrator.getServer().associateProjectToQualityProfile("com.sonarsource.it.samples:multi-modules-sample", "xoo", "one-issue-per-line"); File rootDir = ItUtils.projectDir("shared/xoo-multi-modules-sample"); - SonarRunner scan = SonarRunner.create(rootDir) + SonarScanner scan = SonarScanner.create(rootDir) .setProperty("sonar.projectDate", "2013-05-01"); orchestrator.executeBuild(scan); // issues mode scan -> no new issues - SonarRunner issuesModeScan = SonarRunner.create(rootDir) + SonarScanner issuesModeScan = SonarScanner.create(rootDir) .setProperty("sonar.analysis.mode", "issues") .setProperty("sonar.userHome", temp.newFolder().getAbsolutePath()) .setProperty("sonar.report.export.path", "sonar-report.json") diff --git a/it/it-tests/src/test/java/it/analysis/IssuesModeTest.java b/it/it-tests/src/test/java/it/analysis/IssuesModeTest.java index 5817eed3030..8b1e7bd799b 100644 --- a/it/it-tests/src/test/java/it/analysis/IssuesModeTest.java +++ b/it/it-tests/src/test/java/it/analysis/IssuesModeTest.java @@ -23,7 +23,6 @@ import com.google.common.collect.Maps; import com.sonar.orchestrator.Orchestrator; import com.sonar.orchestrator.build.BuildFailureException; import com.sonar.orchestrator.build.BuildResult; -import com.sonar.orchestrator.build.SonarRunner; import com.sonar.orchestrator.build.SonarScanner; import com.sonar.orchestrator.build.SonarScannerInstaller; import com.sonar.orchestrator.config.FileSystem; @@ -86,7 +85,7 @@ public class IssuesModeTest { restoreProfile("one-issue-per-line.xml"); orchestrator.getServer().provisionProject("sample", "xoo-sample"); orchestrator.getServer().associateProjectToQualityProfile("sample", "xoo", "one-issue-per-line"); - SonarRunner runner = configureRunnerIssues("shared/xoo-sample", null, "sonar.verbose", "true"); + SonarScanner runner = configureRunnerIssues("shared/xoo-sample", null, "sonar.verbose", "true"); BuildResult result = orchestrator.executeBuild(runner); assertThat(ItUtils.countIssuesInJsonReport(result, true)).isEqualTo(17); } @@ -96,7 +95,7 @@ public class IssuesModeTest { restoreProfile("one-issue-per-line.xml"); orchestrator.getServer().provisionProject("sample", "xoo-sample"); orchestrator.getServer().associateProjectToQualityProfile("sample", "xoo", "one-issue-per-line"); - SonarRunner runner = configureRunner("shared/xoo-sample"); + SonarScanner runner = configureRunner("shared/xoo-sample"); runner.setProperty("sonar.analysis.mode", "incremental"); thrown.expect(BuildFailureException.class); @@ -110,7 +109,7 @@ public class IssuesModeTest { restoreProfile("one-issue-per-line.xml"); setDefaultQualityProfile("xoo", "one-issue-per-line"); - SonarRunner runner = configureRunner("shared/xoo-sample"); + SonarScanner runner = configureRunner("shared/xoo-sample"); runner.setProjectKey("sample/project"); runner.setProperty("sonar.analysis.mode", "issues"); BuildResult result = orchestrator.executeBuild(runner); @@ -124,7 +123,7 @@ public class IssuesModeTest { orchestrator.getServer().provisionProject("sample", "xoo-sample"); orchestrator.getServer().associateProjectToQualityProfile("sample", "xoo", "one-issue-per-line"); - SonarRunner runner = configureRunner("shared/xoo-sample", "sonar.verbose", "true"); + SonarScanner runner = configureRunner("shared/xoo-sample", "sonar.verbose", "true"); BuildResult result = orchestrator.executeBuild(runner); List<Issue> serverIssues = ItUtils.getAllServerIssues(orchestrator); for (Issue i : serverIssues) { @@ -152,7 +151,7 @@ public class IssuesModeTest { orchestrator.getServer().provisionProject("sample", "xoo-sample"); orchestrator.getServer().associateProjectToQualityProfile("sample", "xoo", "one-issue-per-line"); - SonarRunner runner = configureRunner("shared/xoo-sample", "sonar.verbose", "true"); + SonarScanner runner = configureRunner("shared/xoo-sample", "sonar.verbose", "true"); BuildResult result = orchestrator.executeBuild(runner); List<Issue> serverIssues = ItUtils.getAllServerIssues(orchestrator); for (Issue i : serverIssues) { @@ -181,7 +180,7 @@ public class IssuesModeTest { orchestrator.getServer().provisionProject("sample", "xoo-sample"); orchestrator.getServer().associateProjectToQualityProfile("sample", "xoo", "one-issue-per-line"); - SonarRunner runner = configureRunner("shared/xoo-sample", "sonar.verbose", "true"); + SonarScanner runner = configureRunner("shared/xoo-sample", "sonar.verbose", "true"); BuildResult result = orchestrator.executeBuild(runner); // change QP @@ -195,7 +194,7 @@ public class IssuesModeTest { FileUtils.write(srcFile, "\n", StandardCharsets.UTF_8, true); // scan again, with different QP - runner = SonarRunner.create(tmpProjectDir, + runner = SonarScanner.create(tmpProjectDir, "sonar.working.directory", temp.newFolder().getAbsolutePath(), "sonar.analysis.mode", "issues", "sonar.report.export.path", "sonar-report.json", @@ -215,7 +214,7 @@ public class IssuesModeTest { orchestrator.getServer().provisionProject("sample", "xoo-sample-with-spaces"); orchestrator.getServer().associateProjectToQualityProfile("sample", "xoo", "with-many-rules"); - SonarRunner runner = configureRunner("analysis/xoo-sample-with-spaces/v2"); + SonarScanner runner = configureRunner("analysis/xoo-sample-with-spaces/v2"); BuildResult result = orchestrator.executeBuild(runner); assertThat(getResource("sample:my sources/main/xoo/sample/My Sample.xoo")).isNotNull(); @@ -235,7 +234,7 @@ public class IssuesModeTest { orchestrator.getServer().associateProjectToQualityProfile("sample", "xoo", "with-many-rules"); // First real scan with source - SonarRunner runner = configureRunner("shared/xoo-history-v2"); + SonarScanner runner = configureRunner("shared/xoo-history-v2"); BuildResult result = orchestrator.executeBuild(runner); assertThat(getResource("sample:src/main/xoo/sample/ClassAdded.xoo")).isNotNull(); @@ -256,7 +255,7 @@ public class IssuesModeTest { @Test public void should_fail_if_plugin_access_secured_properties() throws IOException { // Test access from task (ie BatchSettings) - SonarRunner runner = configureRunnerIssues("shared/xoo-sample", null, + SonarScanner runner = configureRunnerIssues("shared/xoo-sample", null, "accessSecuredFromTask", "true"); BuildResult result = orchestrator.executeBuildQuietly(runner); @@ -278,7 +277,7 @@ public class IssuesModeTest { File homeDir = runFirstAnalysisAndFlagIssueAsWontFix(); // Second issues mode using same cache dir but cache disabled by default - SonarRunner runner = configureRunnerIssues("shared/xoo-sample", homeDir); + SonarScanner runner = configureRunnerIssues("shared/xoo-sample", homeDir); BuildResult result = orchestrator.executeBuild(runner); // False positive is not returned @@ -291,7 +290,7 @@ public class IssuesModeTest { orchestrator.getServer().associateProjectToQualityProfile("sample", "xoo", "one-issue-per-line"); // First run (publish mode) - SonarRunner runner = configureRunner("shared/xoo-sample"); + SonarScanner runner = configureRunner("shared/xoo-sample"); orchestrator.executeBuild(runner); // First issues mode @@ -317,7 +316,7 @@ public class IssuesModeTest { orchestrator.getServer().associateProjectToQualityProfile("sample", "xoo", "one-issue-per-line"); // First run (publish mode) - SonarRunner runner = configureRunner("shared/xoo-sample"); + SonarScanner runner = configureRunner("shared/xoo-sample"); orchestrator.executeBuild(runner); SonarClient client = orchestrator.getServer().adminWsClient(); @@ -367,7 +366,7 @@ public class IssuesModeTest { // use same working dir, because lock file is in it String workDirPath = temp.newFolder().getAbsolutePath(); - SonarRunner runner = configureRunner("shared/xoo-sample", + SonarScanner runner = configureRunner("shared/xoo-sample", "sonar.working.directory", workDirPath); orchestrator.executeBuild(runner); @@ -436,8 +435,8 @@ public class IssuesModeTest { return scanner; } - private SonarRunner configureRunner(String projectDir, String... props) throws IOException { - SonarRunner runner = SonarRunner.create(ItUtils.projectDir(projectDir), + private SonarScanner configureRunner(String projectDir, String... props) throws IOException { + SonarScanner runner = SonarScanner.create(ItUtils.projectDir(projectDir), "sonar.working.directory", temp.newFolder().getAbsolutePath(), "sonar.report.export.path", "sonar-report.json", "sonar.userHome", temp.newFolder().getAbsolutePath()); diff --git a/it/it-tests/src/test/java/it/analysis/LinksTest.java b/it/it-tests/src/test/java/it/analysis/LinksTest.java index 4a84614ae48..adcd89ce550 100644 --- a/it/it-tests/src/test/java/it/analysis/LinksTest.java +++ b/it/it-tests/src/test/java/it/analysis/LinksTest.java @@ -22,7 +22,7 @@ package it.analysis; import com.google.common.collect.Lists; import com.sonar.orchestrator.Orchestrator; import com.sonar.orchestrator.build.MavenBuild; -import com.sonar.orchestrator.build.SonarRunner; +import com.sonar.orchestrator.build.SonarScanner; import com.sonar.orchestrator.db.Database; import it.Category3Suite; import java.util.Collection; @@ -64,7 +64,7 @@ public class LinksTest { */ @Test public void shouldUseLinkProperties() { - SonarRunner runner = SonarRunner.create(ItUtils.projectDir("analysis/links-project")) + SonarScanner runner = SonarScanner.create(ItUtils.projectDir("analysis/links-project")) .setProperty("sonar.scm.disabled", "true"); orchestrator.executeBuild(runner); diff --git a/it/it-tests/src/test/java/it/analysis/MultiLanguageTest.java b/it/it-tests/src/test/java/it/analysis/MultiLanguageTest.java index 4d2f0d34836..9442fc8ab69 100644 --- a/it/it-tests/src/test/java/it/analysis/MultiLanguageTest.java +++ b/it/it-tests/src/test/java/it/analysis/MultiLanguageTest.java @@ -21,7 +21,7 @@ package it.analysis; import com.sonar.orchestrator.Orchestrator; import com.sonar.orchestrator.build.BuildResult; -import com.sonar.orchestrator.build.SonarRunner; +import com.sonar.orchestrator.build.SonarScanner; import com.sonar.orchestrator.locator.FileLocation; import it.Category3Suite; import org.junit.After; @@ -57,7 +57,7 @@ public class MultiLanguageTest { orchestrator.getServer().associateProjectToQualityProfile("multi-language-sample", "xoo", "one-issue-per-line"); orchestrator.getServer().associateProjectToQualityProfile("multi-language-sample","xoo2", "one-issue-per-line-xoo2"); - SonarRunner build = SonarRunner.create().setProjectDir(ItUtils.projectDir("analysis/xoo-multi-languages")); + SonarScanner build = SonarScanner.create().setProjectDir(ItUtils.projectDir("analysis/xoo-multi-languages")); BuildResult result = orchestrator.executeBuild(build); assertThat(result.getLogs()).contains("2 files indexed"); diff --git a/it/it-tests/src/test/java/it/analysis/ProjectProvisioningTest.java b/it/it-tests/src/test/java/it/analysis/ProjectProvisioningTest.java index 8fd84acf842..21fdf4e9a60 100644 --- a/it/it-tests/src/test/java/it/analysis/ProjectProvisioningTest.java +++ b/it/it-tests/src/test/java/it/analysis/ProjectProvisioningTest.java @@ -21,7 +21,7 @@ package it.analysis; import com.sonar.orchestrator.Orchestrator; import com.sonar.orchestrator.build.BuildResult; -import com.sonar.orchestrator.build.SonarRunner; +import com.sonar.orchestrator.build.SonarScanner; import it.Category3Suite; import org.junit.AfterClass; import org.junit.Before; @@ -46,7 +46,7 @@ public class ProjectProvisioningTest { public static void init() { orchestrator.resetData(); orchestrator.executeBuild( - SonarRunner.create(ItUtils.projectDir("shared/xoo-sample")) + SonarScanner.create(ItUtils.projectDir("shared/xoo-sample")) ); } @@ -154,7 +154,7 @@ public class ProjectProvisioningTest { private static BuildResult scan(String projectPath, String... propertiesKeyValues) { return orchestrator.executeBuildQuietly( - SonarRunner.create(ItUtils.projectDir(projectPath)).setProperties(propertiesKeyValues)); + SonarScanner.create(ItUtils.projectDir(projectPath)).setProperties(propertiesKeyValues)); } private static void setProperty(String key, String value) { diff --git a/it/it-tests/src/test/java/it/analysis/ReportDumpTest.java b/it/it-tests/src/test/java/it/analysis/ReportDumpTest.java index b12ed30ca54..2232dfba897 100644 --- a/it/it-tests/src/test/java/it/analysis/ReportDumpTest.java +++ b/it/it-tests/src/test/java/it/analysis/ReportDumpTest.java @@ -20,11 +20,11 @@ package it.analysis; import com.sonar.orchestrator.Orchestrator; -import com.sonar.orchestrator.build.SonarRunner; -import com.squareup.okhttp.HttpUrl; -import com.squareup.okhttp.OkHttpClient; -import com.squareup.okhttp.Request; -import com.squareup.okhttp.Response; +import com.sonar.orchestrator.build.SonarScanner; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; import it.Category3Suite; import org.apache.commons.io.FileUtils; import org.junit.ClassRule; @@ -50,7 +50,7 @@ public class ReportDumpTest { @Test public void dump_metadata_of_uploaded_report() throws Exception { File projectDir = ItUtils.projectDir("shared/xoo-sample"); - orchestrator.executeBuild(SonarRunner.create(projectDir, "sonar.projectKey", "dump_metadata_of_uploaded_report", "sonar.projectName", "dump_metadata_of_uploaded_report")); + orchestrator.executeBuild(SonarScanner.create(projectDir, "sonar.projectKey", "dump_metadata_of_uploaded_report", "sonar.projectName", "dump_metadata_of_uploaded_report")); File metadata = new File(projectDir, ".sonar/report-task.txt"); assertThat(metadata).exists().isFile(); diff --git a/it/it-tests/src/test/java/it/analysis/SettingsEncryptionTest.java b/it/it-tests/src/test/java/it/analysis/SettingsEncryptionTest.java index 48a594e5d89..f994212ec7e 100644 --- a/it/it-tests/src/test/java/it/analysis/SettingsEncryptionTest.java +++ b/it/it-tests/src/test/java/it/analysis/SettingsEncryptionTest.java @@ -22,7 +22,7 @@ package it.analysis; import com.sonar.orchestrator.Orchestrator; import com.sonar.orchestrator.build.BuildFailureException; import com.sonar.orchestrator.build.BuildResult; -import com.sonar.orchestrator.build.SonarRunner; +import com.sonar.orchestrator.build.SonarScanner; import it.Category3Suite; import java.io.File; import java.net.URL; @@ -46,7 +46,7 @@ public class SettingsEncryptionTest { */ @Test public void testEncryptedProperty() throws Exception { - SonarRunner build = SonarRunner.create(ItUtils.projectDir("shared/xoo-sample")) + SonarScanner build = SonarScanner.create(ItUtils.projectDir("shared/xoo-sample")) .setProperty("sonar.secretKeyPath", pathToValidSecretKey()) .setProperty("sonar.login", "admin") // wrong password @@ -57,7 +57,7 @@ public class SettingsEncryptionTest { assertThat(result.getStatus()).isNotEqualTo(0); assertThat(result.getLogs()).contains("Fail to decrypt the property sonar.password. Please check your secret key"); - build = SonarRunner.create(ItUtils.projectDir("shared/xoo-sample")) + build = SonarScanner.create(ItUtils.projectDir("shared/xoo-sample")) .setProperty("sonar.secretKeyPath", pathToValidSecretKey()) // "admin" encrypted with the above secret key .setProperty("sonar.login", "{aes}evRHXHsEyPr5RjEuxUJcHA==") @@ -74,7 +74,7 @@ public class SettingsEncryptionTest { @Test(expected = BuildFailureException.class) public void failIfEncryptedPropertyButNoSecretKey() throws Exception { // path to secret key is missing - SonarRunner build = SonarRunner.create(ItUtils.projectDir("shared/xoo-sample")) + SonarScanner build = SonarScanner.create(ItUtils.projectDir("shared/xoo-sample")) .setProperty("encryptedProperty", "{aes}9mx5Zq4JVyjeChTcVjEide4kWCwusFl7P2dSVXtg9IY="); orchestrator.executeBuild(build); } diff --git a/it/it-tests/src/test/java/it/analysis/TempFolderTest.java b/it/it-tests/src/test/java/it/analysis/TempFolderTest.java index 8d58c1ff4e3..52289594b05 100644 --- a/it/it-tests/src/test/java/it/analysis/TempFolderTest.java +++ b/it/it-tests/src/test/java/it/analysis/TempFolderTest.java @@ -21,7 +21,7 @@ package it.analysis; import com.sonar.orchestrator.Orchestrator; import com.sonar.orchestrator.build.BuildResult; -import com.sonar.orchestrator.build.SonarRunner; +import com.sonar.orchestrator.build.SonarScanner; import com.sonar.orchestrator.locator.FileLocation; import it.Category3Suite; import java.io.File; @@ -83,7 +83,7 @@ public class TempFolderTest { File tmp = temp.newFolder(); assertThat(tmp.list()).isEmpty(); - SonarRunner runner = configureRunner() + SonarScanner runner = configureScanner() .setEnvironmentVariable("SONAR_RUNNER_OPTS", "-Djava.io.tmpdir=" + tmp.getAbsolutePath()); orchestrator.executeBuild(runner); @@ -96,12 +96,12 @@ public class TempFolderTest { } private BuildResult scan(String... props) { - SonarRunner runner = configureRunner(props); + SonarScanner runner = configureScanner(props); return orchestrator.executeBuild(runner); } - private SonarRunner configureRunner(String... props) { - return SonarRunner.create(ItUtils.projectDir("shared/xoo-sample")) + private SonarScanner configureScanner(String... props) { + return SonarScanner.create(ItUtils.projectDir("shared/xoo-sample")) .setProperties(props); } diff --git a/it/it-tests/src/test/java/it/analysisExclusion/FileExclusionsTest.java b/it/it-tests/src/test/java/it/analysisExclusion/FileExclusionsTest.java index 8b77aa168a9..4612bad12a2 100644 --- a/it/it-tests/src/test/java/it/analysisExclusion/FileExclusionsTest.java +++ b/it/it-tests/src/test/java/it/analysisExclusion/FileExclusionsTest.java @@ -20,7 +20,7 @@ package it.analysisExclusion; import com.sonar.orchestrator.Orchestrator; -import com.sonar.orchestrator.build.SonarRunner; +import com.sonar.orchestrator.build.SonarScanner; import it.Category4Suite; import java.util.List; import org.junit.Before; @@ -134,7 +134,7 @@ public class FileExclusionsTest { } private void scan(String... properties) { - SonarRunner build = SonarRunner + SonarScanner build = SonarScanner .create(ItUtils.projectDir("exclusions/exclusions")) .setProperties(properties); orchestrator.executeBuild(build); diff --git a/it/it-tests/src/test/java/it/analysisExclusion/IssueExclusionsTest.java b/it/it-tests/src/test/java/it/analysisExclusion/IssueExclusionsTest.java index 7cb51d18b6a..408ad2a2d18 100644 --- a/it/it-tests/src/test/java/it/analysisExclusion/IssueExclusionsTest.java +++ b/it/it-tests/src/test/java/it/analysisExclusion/IssueExclusionsTest.java @@ -21,7 +21,7 @@ package it.analysisExclusion; import com.sonar.orchestrator.Orchestrator; import com.sonar.orchestrator.build.BuildResult; -import com.sonar.orchestrator.build.SonarRunner; +import com.sonar.orchestrator.build.SonarScanner; import com.sonar.orchestrator.locator.FileLocation; import it.Category4Suite; import org.junit.Before; @@ -238,7 +238,7 @@ public class IssueExclusionsTest { "Sonar :: Integration Tests :: Multi-modules With Exclusions"); orchestrator.getServer().associateProjectToQualityProfile("com.sonarsource.it.samples:multi-modules-exclusions", "xoo", "with-many-rules"); - SonarRunner scan = SonarRunner.create(ItUtils.projectDir(PROJECT_DIR)) + SonarScanner scan = SonarScanner.create(ItUtils.projectDir(PROJECT_DIR)) .setProperties("sonar.cpd.skip", "true") .setProperties(properties) .setProperties("sonar.verbose", "true"); diff --git a/it/it-tests/src/test/java/it/authorisation/ExecuteAnalysisPermissionTest.java b/it/it-tests/src/test/java/it/authorisation/ExecuteAnalysisPermissionTest.java index 3c942025097..92cc2e473cc 100644 --- a/it/it-tests/src/test/java/it/authorisation/ExecuteAnalysisPermissionTest.java +++ b/it/it-tests/src/test/java/it/authorisation/ExecuteAnalysisPermissionTest.java @@ -29,10 +29,15 @@ import org.junit.Test; import org.junit.experimental.categories.Category; import org.sonar.wsclient.SonarClient; import org.sonar.wsclient.user.UserParameters; +import org.sonarqube.ws.client.WsClient; +import org.sonarqube.ws.client.permission.AddGroupWsRequest; +import org.sonarqube.ws.client.permission.AddProjectCreatorToTemplateWsRequest; +import org.sonarqube.ws.client.permission.RemoveGroupWsRequest; import util.QaOnly; import static org.assertj.core.api.Assertions.assertThat; import static org.junit.Assert.fail; +import static util.ItUtils.newAdminWsClient; import static util.ItUtils.runProjectAnalysis; /** @@ -48,20 +53,22 @@ public class ExecuteAnalysisPermissionTest { private final static String USER_PASSWORD = "thewhite"; private final static String PROJECT_KEY = "sample"; - private static SonarClient adminClient; + private static WsClient adminWsClient; + private static SonarClient oldAdminWsClient; @Before public void setUp() { orchestrator.resetData(); - adminClient = orchestrator.getServer().adminWsClient(); - adminClient.userClient().create(UserParameters.create().login(USER_LOGIN).name(USER_LOGIN).password(USER_PASSWORD).passwordConfirmation(USER_PASSWORD)); + oldAdminWsClient = orchestrator.getServer().adminWsClient(); + oldAdminWsClient.userClient().create(UserParameters.create().login(USER_LOGIN).name(USER_LOGIN).password(USER_PASSWORD).passwordConfirmation(USER_PASSWORD)); orchestrator.getServer().provisionProject(PROJECT_KEY, "Sample"); + adminWsClient = newAdminWsClient(orchestrator); } @After public void tearDown() { addGlobalPermission("anyone", "scan"); - adminClient.userClient().deactivate(USER_LOGIN); + oldAdminWsClient.userClient().deactivate(USER_LOGIN); } @Test @@ -70,7 +77,7 @@ public class ExecuteAnalysisPermissionTest { removeGlobalPermission("anyone", "scan"); try { - // Execute logged analysis, but without the "Execute Anaylsis" permission + // Execute logged analysis, but without the "Execute Analysis" permission executeLoggedAnalysis(); fail(); } catch (BuildFailureException e) { @@ -80,7 +87,8 @@ public class ExecuteAnalysisPermissionTest { try { // Execute anonymous analysis - executeAnonymousAnalysis();; + executeAnonymousAnalysis(); + ; fail(); } catch (BuildFailureException e) { assertThat(e.getResult().getLogs()).contains( @@ -108,37 +116,38 @@ public class ExecuteAnalysisPermissionTest { executeLoggedAnalysis(); } + @Test + public void execute_analysis_with_scan_on_default_template() { + removeGlobalPermission("anyone", "scan"); + adminWsClient.permissions().addProjectCreatorToTemplate(AddProjectCreatorToTemplateWsRequest.builder() + .setPermission("scan") + .setTemplateId("default_template") + .build()); + + runProjectAnalysis(orchestrator, "shared/xoo-sample", "sonar.login", USER_LOGIN, "sonar.password", USER_PASSWORD, "sonar.projectKey", "ANOTHER_PROJECT_KEY"); + } + private static void addProjectPermission(String groupName, String projectKey, String permission) { - adminClient.post("api/permissions/add_group", - "groupName", groupName, - "projectKey", projectKey, - "permission", permission); + adminWsClient.permissions().addGroup(new AddGroupWsRequest().setGroupName(groupName).setProjectKey(projectKey).setPermission(permission)); } private static void addGlobalPermission(String groupName, String permission) { - adminClient.post("api/permissions/add_group", - "groupName", groupName, - "permission", permission); + adminWsClient.permissions().addGroup(new AddGroupWsRequest().setGroupName(groupName).setPermission(permission)); } private static void removeProjectPermission(String groupName, String projectKey, String permission) { - adminClient.post("api/permissions/remove_group", - "groupName", groupName, - "projectKey", projectKey, - "permission", permission); + adminWsClient.permissions().removeGroup(new RemoveGroupWsRequest().setGroupName(groupName).setProjectKey(projectKey).setPermission(permission)); } private static void removeGlobalPermission(String groupName, String permission) { - adminClient.post("api/permissions/remove_group", - "groupName", groupName, - "permission", permission); + adminWsClient.permissions().removeGroup(new RemoveGroupWsRequest().setGroupName(groupName).setPermission(permission)); } - private static void executeLoggedAnalysis(){ + private static void executeLoggedAnalysis() { runProjectAnalysis(orchestrator, "shared/xoo-sample", "sonar.login", USER_LOGIN, "sonar.password", USER_PASSWORD); } - private static void executeAnonymousAnalysis(){ + private static void executeAnonymousAnalysis() { runProjectAnalysis(orchestrator, "shared/xoo-sample"); } } diff --git a/it/it-tests/src/test/java/it/authorisation/IssuePermissionTest.java b/it/it-tests/src/test/java/it/authorisation/IssuePermissionTest.java index 2c1a857c594..87b1631a657 100644 --- a/it/it-tests/src/test/java/it/authorisation/IssuePermissionTest.java +++ b/it/it-tests/src/test/java/it/authorisation/IssuePermissionTest.java @@ -20,7 +20,7 @@ package it.authorisation; import com.sonar.orchestrator.Orchestrator; -import com.sonar.orchestrator.build.SonarRunner; +import com.sonar.orchestrator.build.SonarScanner; import com.sonar.orchestrator.locator.FileLocation; import it.Category1Suite; import org.junit.Before; @@ -59,12 +59,12 @@ public class IssuePermissionTest { orchestrator.getServer().provisionProject("sample", "Sample"); orchestrator.getServer().associateProjectToQualityProfile("sample", "xoo", "one-issue-per-line"); - SonarRunner sampleProject = SonarRunner.create(projectDir("shared/xoo-sample")); + SonarScanner sampleProject = SonarScanner.create(projectDir("shared/xoo-sample")); orchestrator.executeBuild(sampleProject); orchestrator.getServer().provisionProject("sample2", "Sample2"); orchestrator.getServer().associateProjectToQualityProfile("sample2", "xoo", "one-issue-per-line"); - SonarRunner sampleProject2 = SonarRunner.create(projectDir("shared/xoo-sample")) + SonarScanner sampleProject2 = SonarScanner.create(projectDir("shared/xoo-sample")) .setProperty("sonar.projectKey", "sample2") .setProperty("sonar.projectName", "Sample2"); orchestrator.executeBuild(sampleProject2); diff --git a/it/it-tests/src/test/java/it/authorisation/PermissionSearchTest.java b/it/it-tests/src/test/java/it/authorisation/PermissionSearchTest.java index d0303175b7d..7f9fb8c7b61 100644 --- a/it/it-tests/src/test/java/it/authorisation/PermissionSearchTest.java +++ b/it/it-tests/src/test/java/it/authorisation/PermissionSearchTest.java @@ -20,7 +20,7 @@ package it.authorisation; import com.sonar.orchestrator.Orchestrator; -import com.sonar.orchestrator.build.SonarRunner; +import com.sonar.orchestrator.build.SonarScanner; import com.sonar.orchestrator.locator.FileLocation; import it.Category1Suite; import org.junit.AfterClass; @@ -29,23 +29,27 @@ import org.junit.ClassRule; import org.junit.Test; import org.junit.experimental.categories.Category; import org.sonarqube.ws.WsPermissions; +import org.sonarqube.ws.WsPermissions.Permission; import org.sonarqube.ws.WsPermissions.SearchTemplatesWsResponse; import org.sonarqube.ws.client.PostRequest; import org.sonarqube.ws.client.WsClient; import org.sonarqube.ws.client.permission.AddGroupToTemplateWsRequest; import org.sonarqube.ws.client.permission.AddGroupWsRequest; +import org.sonarqube.ws.client.permission.AddProjectCreatorToTemplateWsRequest; import org.sonarqube.ws.client.permission.AddUserToTemplateWsRequest; import org.sonarqube.ws.client.permission.AddUserWsRequest; import org.sonarqube.ws.client.permission.CreateTemplateWsRequest; import org.sonarqube.ws.client.permission.GroupsWsRequest; import org.sonarqube.ws.client.permission.PermissionsService; import org.sonarqube.ws.client.permission.RemoveGroupFromTemplateWsRequest; +import org.sonarqube.ws.client.permission.RemoveProjectCreatorFromTemplateWsRequest; import org.sonarqube.ws.client.permission.RemoveUserFromTemplateWsRequest; import org.sonarqube.ws.client.permission.SearchTemplatesWsRequest; import org.sonarqube.ws.client.permission.UsersWsRequest; import util.QaOnly; import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.tuple; import static util.ItUtils.newAdminWsClient; import static util.ItUtils.projectDir; @@ -68,7 +72,7 @@ public class PermissionSearchTest { orchestrator.getServer().provisionProject(PROJECT_KEY, "Sample"); orchestrator.getServer().associateProjectToQualityProfile("sample", "xoo", "one-issue-per-line"); - SonarRunner sampleProject = SonarRunner.create(projectDir("shared/xoo-sample")); + SonarScanner sampleProject = SonarScanner.create(projectDir("shared/xoo-sample")); orchestrator.executeBuild(sampleProject); adminWsClient = newAdminWsClient(orchestrator); @@ -102,8 +106,7 @@ public class PermissionSearchTest { assertThat(searchGlobalPermissionsWsResponse.getPermissionsList().get(0).getGroupsCount()).isEqualTo(2); WsPermissions.UsersWsResponse users = permissionsWsClient - .users(new UsersWsRequest() - .setPermission("admin")); + .users(new UsersWsRequest().setPermission("admin")); assertThat(users.getUsersList()).extracting("login").contains(LOGIN); WsPermissions.WsGroupsResponse groupsResponse = permissionsWsClient @@ -132,6 +135,12 @@ public class PermissionSearchTest { .setTemplateName("my-new-template") .setGroupName(GROUP_NAME)); + permissionsWsClient.addProjectCreatorToTemplate( + AddProjectCreatorToTemplateWsRequest.builder() + .setPermission("admin") + .setTemplateName("my-new-template") + .build()); + SearchTemplatesWsResponse searchTemplatesWsResponse = permissionsWsClient.searchTemplates( new SearchTemplatesWsRequest() .setQuery("my-new-template")); @@ -139,6 +148,7 @@ public class PermissionSearchTest { assertThat(searchTemplatesWsResponse.getPermissionTemplates(0).getPermissions(0).getKey()).isEqualTo("admin"); assertThat(searchTemplatesWsResponse.getPermissionTemplates(0).getPermissions(0).getUsersCount()).isEqualTo(1); assertThat(searchTemplatesWsResponse.getPermissionTemplates(0).getPermissions(0).getGroupsCount()).isEqualTo(1); + assertThat(searchTemplatesWsResponse.getPermissionTemplates(0).getPermissions(0).getWithProjectCreator()).isTrue(); permissionsWsClient.removeGroupFromTemplate( new RemoveGroupFromTemplateWsRequest() @@ -152,10 +162,20 @@ public class PermissionSearchTest { .setTemplateName("my-new-template") .setLogin(LOGIN)); + permissionsWsClient.removeProjectCreatorFromTemplate( + RemoveProjectCreatorFromTemplateWsRequest.builder() + .setPermission("admin") + .setTemplateName("my-new-template") + .build() + ); + SearchTemplatesWsResponse clearedSearchTemplatesWsResponse = permissionsWsClient.searchTemplates( new SearchTemplatesWsRequest() .setQuery("my-new-template")); - assertThat(clearedSearchTemplatesWsResponse.getPermissionTemplates(0).getPermissionsList()).isEmpty(); + assertThat(clearedSearchTemplatesWsResponse.getPermissionTemplates(0).getPermissionsList()) + .extracting(Permission::getUsersCount, Permission::getGroupsCount, Permission::getWithProjectCreator) + .hasSize(5) + .containsOnly(tuple(0, 0, false)); } private static void createUser(String login, String name) { 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..f924fd307c3 --- /dev/null +++ b/it/it-tests/src/test/java/it/authorisation/PermissionTemplatesPageTest.java @@ -0,0 +1,53 @@ +/* + * 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); + } + + @Test + public void should_manage_project_creators() throws Exception { + Selenese selenese = Selenese.builder().setHtmlTestsInClasspath("should_manage_project_creators", + "/authorisation/PermissionTemplatesPageTest/should_manage_project_creators.html" + ).build(); + new SeleneseTest(selenese).runOn(orchestrator); + } +} diff --git a/it/it-tests/src/test/java/it/authorisation/ProvisioningPermissionTest.java b/it/it-tests/src/test/java/it/authorisation/ProvisioningPermissionTest.java index 27a621ac910..8666a1c09a6 100644 --- a/it/it-tests/src/test/java/it/authorisation/ProvisioningPermissionTest.java +++ b/it/it-tests/src/test/java/it/authorisation/ProvisioningPermissionTest.java @@ -39,6 +39,7 @@ import org.sonarqube.ws.client.permission.PermissionsService; import org.sonarqube.ws.client.permission.RemoveGroupWsRequest; import org.sonarqube.ws.client.permission.RemoveUserWsRequest; import util.QaOnly; +import util.selenium.SeleneseTest; import util.user.UserRule; import static org.assertj.core.api.Assertions.assertThat; @@ -98,11 +99,9 @@ public class ProvisioningPermissionTest { * SONAR-4709 */ @Test - public void should_not_be_able_to_provision_projec() { - Selenese selenese = Selenese.builder().setHtmlTestsInClasspath("should-not-be-able-to-provision-project", - "/authorisation/ProvisioningPermissionTest/should-not-be-able-to-provision-project.html" - ).build(); - orchestrator.executeSelenese(selenese); + public void should_not_be_able_to_provision_project() { + new SeleneseTest(Selenese.builder().setHtmlTestsInClasspath("should-not-be-able-to-provision-project", + "/authorisation/ProvisioningPermissionTest/should-not-be-able-to-provision-project.html").build()).runOn(orchestrator); } /** @@ -111,10 +110,8 @@ public class ProvisioningPermissionTest { */ @Test public void should_be_able_to_provision_project() { - Selenese selenese = Selenese.builder().setHtmlTestsInClasspath("should-be-able-to-provision-project", - "/authorisation/ProvisioningPermissionTest/should-be-able-to-provision-project.html" - ).build(); - orchestrator.executeSelenese(selenese); + new SeleneseTest(Selenese.builder().setHtmlTestsInClasspath("should-be-able-to-provision-project", + "/authorisation/ProvisioningPermissionTest/should-be-able-to-provision-project.html").build()).runOn(orchestrator); } /** diff --git a/it/it-tests/src/test/java/it/ce/CeWsTest.java b/it/it-tests/src/test/java/it/ce/CeWsTest.java index 98fd04a1a38..717d0f2b725 100644 --- a/it/it-tests/src/test/java/it/ce/CeWsTest.java +++ b/it/it-tests/src/test/java/it/ce/CeWsTest.java @@ -21,7 +21,7 @@ package it.ce; import com.sonar.orchestrator.Orchestrator; -import com.sonar.orchestrator.build.SonarRunner; +import com.sonar.orchestrator.build.SonarScanner; import it.Category4Suite; import org.junit.Before; import org.junit.ClassRule; @@ -46,7 +46,7 @@ public class CeWsTest { @Before public void inspectProject() { orchestrator.resetData(); - orchestrator.executeBuild(SonarRunner.create(projectDir("shared/xoo-sample"))); + orchestrator.executeBuild(SonarScanner.create(projectDir("shared/xoo-sample"))); wsClient = ItUtils.newAdminWsClient(orchestrator); } diff --git a/it/it-tests/src/test/java/it/component/ComponentsWsTest.java b/it/it-tests/src/test/java/it/component/ComponentsWsTest.java index a4cac2e039a..4f8593d2646 100644 --- a/it/it-tests/src/test/java/it/component/ComponentsWsTest.java +++ b/it/it-tests/src/test/java/it/component/ComponentsWsTest.java @@ -20,7 +20,7 @@ package it.component; import com.sonar.orchestrator.Orchestrator; -import com.sonar.orchestrator.build.SonarRunner; +import com.sonar.orchestrator.build.SonarScanner; import it.Category4Suite; import org.junit.Before; import org.junit.ClassRule; @@ -44,7 +44,7 @@ public class ComponentsWsTest { @Before public void inspectProject() { orchestrator.resetData(); - orchestrator.executeBuild(SonarRunner.create(projectDir("shared/xoo-sample"))); + orchestrator.executeBuild(SonarScanner.create(projectDir("shared/xoo-sample"))); wsClient = ItUtils.newAdminWsClient(orchestrator); } diff --git a/it/it-tests/src/test/java/it/component/ProjectSearchTest.java b/it/it-tests/src/test/java/it/component/ProjectSearchTest.java index 0bd21727022..204952655d0 100644 --- a/it/it-tests/src/test/java/it/component/ProjectSearchTest.java +++ b/it/it-tests/src/test/java/it/component/ProjectSearchTest.java @@ -20,7 +20,7 @@ package it.component; import com.sonar.orchestrator.Orchestrator; -import com.sonar.orchestrator.build.SonarRunner; +import com.sonar.orchestrator.build.SonarScanner; import it.Category4Suite; import java.io.IOException; import org.apache.commons.io.IOUtils; @@ -47,7 +47,7 @@ public class ProjectSearchTest { @Before public void inspectProject() { orchestrator.resetData(); - orchestrator.executeBuild(SonarRunner.create(projectDir("shared/xoo-sample"))); + orchestrator.executeBuild(SonarScanner.create(projectDir("shared/xoo-sample"))); } /** @@ -55,10 +55,10 @@ public class ProjectSearchTest { */ @Test public void projects_web_service() throws IOException { - SonarRunner build = SonarRunner.create(projectDir("shared/xoo-sample")); + SonarScanner build = SonarScanner.create(projectDir("shared/xoo-sample")); orchestrator.executeBuild(build); - String url = orchestrator.getServer().getUrl() + "/api/projects?key=sample&versions=true"; + String url = orchestrator.getServer().getUrl() + "/api/projects/index?key=sample&versions=true"; HttpClient httpclient = new DefaultHttpClient(); try { HttpGet get = new HttpGet(url); diff --git a/it/it-tests/src/test/java/it/componentDashboard/DashboardTest.java b/it/it-tests/src/test/java/it/componentDashboard/DashboardTest.java index 3c2bc9c0419..2bfb96b6007 100644 --- a/it/it-tests/src/test/java/it/componentDashboard/DashboardTest.java +++ b/it/it-tests/src/test/java/it/componentDashboard/DashboardTest.java @@ -50,8 +50,6 @@ public class DashboardTest { seleniumSuite("dashboard_extension", "/componentDashboard/DashboardTest/dashboard_extension/dashboard-should-be-registered.html", "/componentDashboard/DashboardTest/dashboard_extension/test-location-of-widgets.html", - // SONAR-3323 - "/componentDashboard/DashboardTest/dashboard_extension/display-widgets-according-to-required-measures.html", // SSF-19 "/componentDashboard/DashboardTest/dashboard_extension/xss.html"); diff --git a/it/it-tests/src/test/java/it/componentSearch/AllProjectsTest.java b/it/it-tests/src/test/java/it/componentSearch/AllProjectsTest.java index b9038e12626..0eed7d04647 100644 --- a/it/it-tests/src/test/java/it/componentSearch/AllProjectsTest.java +++ b/it/it-tests/src/test/java/it/componentSearch/AllProjectsTest.java @@ -20,7 +20,7 @@ package it.componentSearch; import com.sonar.orchestrator.Orchestrator; -import com.sonar.orchestrator.build.SonarRunner; +import com.sonar.orchestrator.build.SonarScanner; import com.sonar.orchestrator.selenium.Selenese; import it.Category4Suite; import org.junit.BeforeClass; @@ -41,7 +41,7 @@ public class AllProjectsTest { @BeforeClass public static void inspectProject() { orchestrator.executeBuild( - SonarRunner.create(projectDir("shared/xoo-sample")) + SonarScanner.create(projectDir("shared/xoo-sample")) .setProjectKey("all-project-test-project") .setProjectName("AllProjectsTest Project") ); diff --git a/it/it-tests/src/test/java/it/customMeasure/CustomMeasuresTest.java b/it/it-tests/src/test/java/it/customMeasure/CustomMeasuresTest.java index 275cf495ad9..907290ce25d 100644 --- a/it/it-tests/src/test/java/it/customMeasure/CustomMeasuresTest.java +++ b/it/it-tests/src/test/java/it/customMeasure/CustomMeasuresTest.java @@ -20,7 +20,7 @@ package it.customMeasure; import com.sonar.orchestrator.Orchestrator; -import com.sonar.orchestrator.build.SonarRunner; +import com.sonar.orchestrator.build.SonarScanner; import it.Category1Suite; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -88,7 +88,7 @@ public class CustomMeasuresTest { } private void analyzeProject() { - orchestrator.executeBuild(SonarRunner.create(projectDir("shared/xoo-sample"))); + orchestrator.executeBuild(SonarScanner.create(projectDir("shared/xoo-sample"))); } private void setTeamSize(int i) { diff --git a/it/it-tests/src/test/java/it/dbCleaner/PurgeTest.java b/it/it-tests/src/test/java/it/dbCleaner/PurgeTest.java index b49a6c9a7f3..8aee97c9286 100644 --- a/it/it-tests/src/test/java/it/dbCleaner/PurgeTest.java +++ b/it/it-tests/src/test/java/it/dbCleaner/PurgeTest.java @@ -49,8 +49,10 @@ import static util.ItUtils.setServerProperty; public class PurgeTest { - static final String PROJECT_KEY = "com.sonarsource.it.samples:multi-modules-sample"; - static final String PROJECT_SAMPLE_PATH = "dbCleaner/xoo-multi-modules-sample"; + private static final String COUNT_FILE_MEASURES = "project_measures pm, projects p where p.uuid = pm.component_uuid and p.scope='FIL'"; + private static final String COUNT_DIR_MEASURES = "project_measures pm, projects p where p.uuid = pm.component_uuid and p.scope='DIR'"; + private static final String PROJECT_KEY = "com.sonarsource.it.samples:multi-modules-sample"; + private static final String PROJECT_SAMPLE_PATH = "dbCleaner/xoo-multi-modules-sample"; @ClassRule public static final Orchestrator orchestrator = Category4Suite.ORCHESTRATOR; @@ -146,7 +148,7 @@ public class PurgeTest { // analyse twice scan(PROJECT_SAMPLE_PATH); // and check we have 2 snapshots - assertThat(count("snapshots s where s.project_id=(select p.id from projects p where p.kee='com.sonarsource.it.samples:multi-modules-sample')")).isEqualTo(2); + assertThat(count("snapshots s where s.component_uuid=(select p.uuid from projects p where p.kee='com.sonarsource.it.samples:multi-modules-sample')")).isEqualTo(2); } /** @@ -156,13 +158,13 @@ public class PurgeTest { public void should_keep_only_one_snapshot_per_day() { scan(PROJECT_SAMPLE_PATH); - int snapshotsCount = count("snapshots where qualifier<>'LIB'"); + int snapshotsCount = count("snapshots"); int measuresCount = count("project_measures"); // Using the "sonar.dbcleaner.hoursBeforeKeepingOnlyOneSnapshotByDay" property set to '0' is the way // to keep only 1 snapshot per day setServerProperty(orchestrator, "sonar.dbcleaner.hoursBeforeKeepingOnlyOneSnapshotByDay", "0"); scan(PROJECT_SAMPLE_PATH); - assertThat(count("snapshots where qualifier<>'LIB'")).as("Different number of snapshots").isEqualTo(snapshotsCount); + assertThat(count("snapshots")).as("Different number of snapshots").isEqualTo(snapshotsCount); int measureOnNewMetrics = count("project_measures, metrics where metrics.id = project_measures.metric_id and metrics.name like 'new_%'"); // Number of measures should be the same as previous, with the measures on new metrics @@ -216,16 +218,16 @@ public class PurgeTest { @Test public void should_delete_removed_modules() { scan("dbCleaner/modules/before"); - assertSingleSnapshot("com.sonarsource.it.samples:multi-modules-sample:module_b"); - assertSingleSnapshot("com.sonarsource.it.samples:multi-modules-sample:module_b:module_b1"); + assertExists("com.sonarsource.it.samples:multi-modules-sample:module_b"); + assertExists("com.sonarsource.it.samples:multi-modules-sample:module_b:module_b1"); // we want the previous snapshot to be purged setServerProperty(orchestrator, "sonar.dbcleaner.hoursBeforeKeepingOnlyOneSnapshotByDay", "0"); scan("dbCleaner/modules/after"); - assertDeleted("com.sonarsource.it.samples:multi-modules-sample:module_b"); - assertDeleted("com.sonarsource.it.samples:multi-modules-sample:module_b:module_b1"); - assertSingleSnapshot("com.sonarsource.it.samples:multi-modules-sample:module_c:module_c1"); + assertDisabled("com.sonarsource.it.samples:multi-modules-sample:module_b"); + assertDisabled("com.sonarsource.it.samples:multi-modules-sample:module_b:module_b1"); + assertExists("com.sonarsource.it.samples:multi-modules-sample:module_c:module_c1"); } /** @@ -233,12 +235,13 @@ public class PurgeTest { */ @Test public void should_delete_removed_files() { + String fileKey = "com.sonarsource.it.samples:multi-modules-sample:module_a:module_a1:src/main/xoo/com/sonar/it/samples/modules/a1/HelloA1.xoo"; scan("dbCleaner/files/before"); - assertSingleSnapshot("com.sonarsource.it.samples:multi-modules-sample:module_a:module_a1:src/main/xoo/com/sonar/it/samples/modules/a1/HelloA1.xoo"); + assertExists(fileKey); scan("dbCleaner/files/after"); - assertDeleted("src/main/xoo/com/sonar/it/samples/modules/a1/HelloA1.xoo"); - assertSingleSnapshot("com.sonarsource.it.samples:multi-modules-sample:module_a:module_a1:src/main/xoo/com/sonar/it/samples/modules/a1/NewHelloA1.xoo"); + assertDisabled(fileKey); + assertExists("com.sonarsource.it.samples:multi-modules-sample:module_a:module_a1:src/main/xoo/com/sonar/it/samples/modules/a1/NewHelloA1.xoo"); } /** @@ -247,11 +250,14 @@ public class PurgeTest { @Test public void should_delete_historical_data_of_directories_by_default() { scan(PROJECT_SAMPLE_PATH, "2012-01-01"); - String select = "snapshots where scope='DIR'"; - int directorySnapshots = count(select); + + int fileMeasures = count(COUNT_FILE_MEASURES); + int dirMeasures = count(COUNT_DIR_MEASURES); scan(PROJECT_SAMPLE_PATH, "2012-02-02"); - assertThat(count(select)).isEqualTo(directorySnapshots); + + assertThat(count(COUNT_FILE_MEASURES)).isEqualTo(fileMeasures); + assertThat(count(COUNT_DIR_MEASURES)).isLessThan(2 * dirMeasures); // second analysis as NEW_* metrics } /** @@ -261,14 +267,15 @@ public class PurgeTest { public void should_not_delete_historical_data_of_directories() { scan(PROJECT_SAMPLE_PATH, "2012-01-01"); - String select = "snapshots where scope='DIR'"; - int directorySnapshots = count(select); + int fileMeasures = count(COUNT_FILE_MEASURES); + int dirMeasures = count(COUNT_DIR_MEASURES); setServerProperty(orchestrator, "sonar.dbcleaner.cleanDirectory", "false"); scan(PROJECT_SAMPLE_PATH, "2012-02-02"); - assertThat(count(select)).isEqualTo(2 * directorySnapshots); + assertThat(count(COUNT_FILE_MEASURES)).isEqualTo(fileMeasures); + assertThat(count(COUNT_DIR_MEASURES)).isGreaterThan(2 * dirMeasures); // second analysis as NEW_* metrics } /** @@ -289,14 +296,33 @@ public class PurgeTest { assertThat(count(selectComplexityInClasses)).isEqualTo(complexitInClassesCount); } - private void assertDeleted(String key) { - assertThat(count("snapshots s where s.project_id=(select p.id from projects p where p.kee='" + key + "')")).isZero(); - assertThat(count("resource_index ri where ri.resource_id=(select p.id from projects p where p.kee='" + key + "')")).isZero(); + private void assertDisabled(String key) { + assertThat(enabledStatusOfComponent(key)).isFalse(); + assertThat(count("resource_index ri where ri.component_uuid=(select p.uuid from projects p where p.kee='" + key + "')")).isZero(); + } + + private void assertExists(String key) { + assertThat(enabledStatusOfComponent(key)).isTrue(); + assertThat(count("resource_index ri where ri.component_uuid=(select p.uuid from projects p where p.kee='" + key + "')")).isGreaterThan(1); } - private void assertSingleSnapshot(String key) { - assertThat(count("snapshots s where s.project_id=(select p.id from projects p where p.kee='" + key + "')")).isEqualTo(1); - assertThat(count("resource_index ri where ri.resource_id=(select p.id from projects p where p.kee='" + key + "')")).isGreaterThan(1); + private Boolean enabledStatusOfComponent(String key) { + return orchestrator.getDatabase().executeSql("select enabled from projects p where p.kee='" + key + "'") + .stream() + .findFirst() + .map(PurgeTest::toBoolean) + .orElse(null); + } + + private static Boolean toBoolean(Map<String, String> s) { + String value = s.get("ENABLED"); + if (value.equalsIgnoreCase("true") || value.equals("1")) { + return true; + } + if (value.equalsIgnoreCase("false") || value.equals("0")) { + return false; + } + throw new IllegalArgumentException("Unsupported value can not be converted to boolean " + value); } private BuildResult scan(String path, String date) { @@ -326,12 +352,12 @@ public class PurgeTest { } private int countMeasures(String qualifier) { - String sql = "SELECT count(1) FROM project_measures pm, snapshots s, metrics m where pm.snapshot_id=s.id and pm.metric_id=m.id and s.qualifier='" + qualifier + "'"; + String sql = "SELECT count(1) FROM project_measures pm, projects p, metrics m where p.uuid=pm.component_uuid and pm.metric_id=m.id and p.qualifier='" + qualifier + "'"; return orchestrator.getDatabase().countSql(sql); } private void logMeasures(String title, String qualifier) { - String sql = "SELECT m.name as metricName, pm.value as value, pm.text_value as textValue, pm.variation_value_1, pm.variation_value_2, pm.variation_value_3, pm.rule_id " + String sql = "SELECT m.name as metricName, pm.value as value, pm.text_value as textValue, pm.variation_value_1, pm.variation_value_2, pm.variation_value_3 " + "FROM project_measures pm, snapshots s, metrics m " + "WHERE pm.snapshot_id=s.id and pm.metric_id=m.id and s.qualifier='" diff --git a/it/it-tests/src/test/java/it/duplication/CrossModuleDuplicationsTest.java b/it/it-tests/src/test/java/it/duplication/CrossModuleDuplicationsTest.java index c96b3333ca9..30ecf4ee641 100644 --- a/it/it-tests/src/test/java/it/duplication/CrossModuleDuplicationsTest.java +++ b/it/it-tests/src/test/java/it/duplication/CrossModuleDuplicationsTest.java @@ -21,7 +21,7 @@ package it.duplication; import com.google.common.collect.ImmutableMap; import com.sonar.orchestrator.Orchestrator; -import com.sonar.orchestrator.build.SonarRunner; +import com.sonar.orchestrator.build.SonarScanner; import com.sonar.orchestrator.locator.FileLocation; import it.Category4Suite; import org.apache.commons.io.FileUtils; @@ -121,19 +121,19 @@ public class CrossModuleDuplicationsTest { verifyDuplicationMeasures(PROJECT_KEY + ":module2", 0, 0, 0, 0); } - private static SonarRunner analyzeProject(File projectDir, String projectKey, boolean create, String... additionalProperties) { + private static SonarScanner analyzeProject(File projectDir, String projectKey, boolean create, String... additionalProperties) { if (create) { orchestrator.getServer().provisionProject(projectKey, projectKey); orchestrator.getServer().associateProjectToQualityProfile(projectKey, "xoo", "xoo-duplication-profile"); } - SonarRunner sonarRunner = SonarRunner.create(projectDir); + SonarScanner sonarRunner = SonarScanner.create(projectDir); ImmutableMap.Builder<String, String> builder = ImmutableMap.builder(); for (int i = 0; i < additionalProperties.length; i += 2) { builder.put(additionalProperties[i], additionalProperties[i + 1]); } - SonarRunner scan = sonarRunner.setDebugLogs(true).setProperties(builder.build()); + SonarScanner scan = sonarRunner.setDebugLogs(true).setProperties(builder.build()); orchestrator.executeBuild(scan); return scan; } diff --git a/it/it-tests/src/test/java/it/http/HttpHeadersTest.java b/it/it-tests/src/test/java/it/http/HttpHeadersTest.java index c03ab8536cf..d578717da30 100644 --- a/it/it-tests/src/test/java/it/http/HttpHeadersTest.java +++ b/it/it-tests/src/test/java/it/http/HttpHeadersTest.java @@ -22,10 +22,10 @@ package it.http; import com.google.common.base.Throwables; import com.sonar.orchestrator.Orchestrator; -import com.squareup.okhttp.CacheControl; -import com.squareup.okhttp.OkHttpClient; -import com.squareup.okhttp.Request; -import com.squareup.okhttp.Response; +import okhttp3.CacheControl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; import it.Category4Suite; import java.io.IOException; import org.junit.ClassRule; diff --git a/it/it-tests/src/test/java/it/i18n/I18nTest.java b/it/it-tests/src/test/java/it/i18n/I18nTest.java index 793d78069dd..837968b443f 100644 --- a/it/it-tests/src/test/java/it/i18n/I18nTest.java +++ b/it/it-tests/src/test/java/it/i18n/I18nTest.java @@ -20,7 +20,7 @@ package it.i18n; import com.sonar.orchestrator.Orchestrator; -import com.sonar.orchestrator.build.SonarRunner; +import com.sonar.orchestrator.build.SonarScanner; import com.sonar.orchestrator.selenium.Selenese; import it.Category1Suite; import org.junit.Before; @@ -52,7 +52,7 @@ public class I18nTest { @Test @Ignore public void test_localization() { - orchestrator.executeBuild(SonarRunner.create(projectDir("shared/xoo-sample"))); + orchestrator.executeBuild(SonarScanner.create(projectDir("shared/xoo-sample"))); Selenese selenese = Selenese.builder().setHtmlTestsInClasspath("ui-i18n", "/i18n/default-locale-is-english.html", diff --git a/it/it-tests/src/test/java/it/issue/IssueSearchTest.java b/it/it-tests/src/test/java/it/issue/IssueSearchTest.java index 59b509effe6..12ceaa1ac3b 100644 --- a/it/it-tests/src/test/java/it/issue/IssueSearchTest.java +++ b/it/it-tests/src/test/java/it/issue/IssueSearchTest.java @@ -19,9 +19,6 @@ */ package it.issue; -import com.google.common.base.Joiner; -import com.google.common.base.Predicate; -import com.google.common.collect.ImmutableMap; import com.google.common.collect.Iterables; import com.sonar.orchestrator.locator.FileLocation; import com.sonar.orchestrator.selenium.Selenese; @@ -42,12 +39,13 @@ import org.sonar.wsclient.issue.Issue; import org.sonar.wsclient.issue.IssueQuery; import org.sonar.wsclient.issue.Issues; import org.sonarqube.ws.Common; -import org.sonarqube.ws.MediaTypes; -import org.sonarqube.ws.client.GetRequest; -import org.sonarqube.ws.client.WsResponse; +import org.sonarqube.ws.client.issue.SearchWsRequest; +import static java.util.Arrays.asList; +import static java.util.Collections.singletonList; import static org.assertj.core.api.Assertions.assertThat; import static org.junit.Assert.fail; +import static org.sonarqube.ws.Issues.SearchWsResponse; import static util.ItUtils.newAdminWsClient; import static util.ItUtils.runProjectAnalysis; import static util.ItUtils.setServerProperty; @@ -305,30 +303,23 @@ public class IssueSearchTest extends AbstractIssueTest { assertThat(issue.getType()).isEqualTo(Common.RuleType.CODE_SMELL); } + @Test + public void search_issues_by_types() throws IOException { + assertThat(searchIssues(new SearchWsRequest().setTypes(singletonList("CODE_SMELL"))).getPaging().getTotal()).isEqualTo(142); + assertThat(searchIssues(new SearchWsRequest().setTypes(singletonList("BUG"))).getPaging().getTotal()).isEqualTo(122); + assertThat(searchIssues(new SearchWsRequest().setTypes(singletonList("VULNERABILITY"))).getPaging().getTotal()).isEqualTo(8); + } + private List<org.sonarqube.ws.Issues.Issue> searchByRuleKey(String... ruleKey) throws IOException { - WsResponse response = newAdminWsClient(ORCHESTRATOR) - .wsConnector() - .call(new GetRequest("api/issues/search") - .setParam("rules", Joiner.on(",").join(ruleKey)) - .setMediaType(MediaTypes.PROTOBUF)); - org.sonarqube.ws.Issues.SearchWsResponse searchWsResponse = org.sonarqube.ws.Issues.SearchWsResponse.parseFrom(response.contentStream()); - return searchWsResponse.getIssuesList(); + return searchIssues(new SearchWsRequest().setRules(asList(ruleKey))).getIssuesList(); } - private static Component findComponent(Collection<Component> components, final String key) { - return Iterables.find(components, new Predicate<Component>() { - @Override - public boolean apply(Component input) { - return key.equals(input.key()); - } - }); + private SearchWsResponse searchIssues(SearchWsRequest request) throws IOException { + return newAdminWsClient(ORCHESTRATOR).issues().search(request); } - private static void createManualRule() { - ORCHESTRATOR.getServer().adminWsClient().post("/api/rules/create", ImmutableMap.<String, Object>of( - "manual_key", "invalidclassname", - "name", "InvalidClassName", - "markdown_description", "Invalid class name")); + private static Component findComponent(Collection<Component> components, final String key) { + return Iterables.find(components, input -> key.equals(input.key())); } } diff --git a/it/it-tests/src/test/java/it/issue/IssueTrackingTest.java b/it/it-tests/src/test/java/it/issue/IssueTrackingTest.java index f7c368b48f0..e1632d185e7 100644 --- a/it/it-tests/src/test/java/it/issue/IssueTrackingTest.java +++ b/it/it-tests/src/test/java/it/issue/IssueTrackingTest.java @@ -19,13 +19,12 @@ */ package it.issue; -import com.google.common.base.Objects; -import com.google.common.base.Predicate; import com.google.common.collect.Iterables; import com.sonar.orchestrator.locator.FileLocation; import java.text.SimpleDateFormat; import java.util.Date; import java.util.List; +import java.util.Objects; import org.junit.Before; import org.junit.Test; import org.sonar.wsclient.issue.Issue; @@ -39,7 +38,8 @@ public class IssueTrackingTest extends AbstractIssueTest { private static final String SAMPLE_PROJECT_KEY = "sample"; private static final String OLD_DATE = "2014-03-01"; - private static final String NEW_DATE = new SimpleDateFormat("yyyy-MM-dd").format(new Date()); + private static final Date NEW_DATE = new Date(); + private static final String NEW_DATE_STR = new SimpleDateFormat("yyyy-MM-dd").format(NEW_DATE); @Before public void prepareData() { @@ -62,7 +62,7 @@ public class IssueTrackingTest extends AbstractIssueTest { // version 2 runProjectAnalysis(ORCHESTRATOR, "issue/xoo-tracking-v1", - "sonar.projectDate", NEW_DATE, + "sonar.projectDate", NEW_DATE_STR, "sonar.exclusions", "**/*.xoo"); issues = searchIssuesByProject("sample"); @@ -89,7 +89,7 @@ public class IssueTrackingTest extends AbstractIssueTest { // version 2 runProjectAnalysis(ORCHESTRATOR, "issue/xoo-tracking-v2", - "sonar.projectDate", NEW_DATE); + "sonar.projectDate", NEW_DATE_STR); issues = searchUnresolvedIssuesByComponent("sample:src/main/xoo/sample/Sample.xoo"); assertThat(issues).hasSize(3); @@ -159,13 +159,37 @@ public class IssueTrackingTest extends AbstractIssueTest { } } + @Test + public void track_file_moves_based_on_identical_content() { + ORCHESTRATOR.getServer().associateProjectToQualityProfile(SAMPLE_PROJECT_KEY, "xoo", "issue-on-tag-foobar"); + + // version 1 + runProjectAnalysis(ORCHESTRATOR, "issue/xoo-tracking-v1", + "sonar.projectDate", OLD_DATE); + + List<Issue> issues = searchUnresolvedIssuesByComponent("sample:src/main/xoo/sample/Sample.xoo"); + assertThat(issues).hasSize(1); + Issue issueOnSample = issues.iterator().next(); + + // version 2 + runProjectAnalysis(ORCHESTRATOR, "issue/xoo-tracking-v3", + "sonar.projectDate", NEW_DATE_STR); + + assertThat(searchUnresolvedIssuesByComponent("sample:src/main/xoo/sample/Sample.xoo")).isEmpty(); + + issues = searchUnresolvedIssuesByComponent("sample:src/main/xoo/sample/Sample2.xoo"); + assertThat(issues).hasSize(1); + Issue issueOnSample2 = issues.get(0); + assertThat(issueOnSample2.key()).isEqualTo(issueOnSample.key()); + assertThat(issueOnSample2.creationDate()).isEqualTo(issueOnSample.creationDate()); + assertThat(issueOnSample2.updateDate()).isNotEqualTo(issueOnSample.updateDate()); + assertThat(issueOnSample2.status()).isEqualTo("OPEN"); + } + private Issue getIssueOnLine(final Integer line, final String repoKey, final String ruleKey, List<Issue> issues) { - return Iterables.find(issues, new Predicate<Issue>() { - public boolean apply(Issue issue) { - return Objects.equal(issue.line(), line) && - Objects.equal(issue.ruleKey(), repoKey + ":" + ruleKey); - } - }); + return Iterables.find( + issues, + issue -> Objects.equals(issue.line(), line) && Objects.equals(issue.ruleKey(), repoKey + ":" + ruleKey)); } private List<Issue> searchUnresolvedIssuesByComponent(String componentKey) { diff --git a/it/it-tests/src/test/java/it/qualityProfile/ToDoTest.java b/it/it-tests/src/test/java/it/issue/IssuesPageTest.java index 1823f9779be..b44df9ce131 100644 --- a/it/it-tests/src/test/java/it/qualityProfile/ToDoTest.java +++ b/it/it-tests/src/test/java/it/issue/IssuesPageTest.java @@ -17,7 +17,28 @@ * 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.qualityProfile; +package it.issue; -public class ToDoTest { +import com.sonar.orchestrator.Orchestrator; +import com.sonar.orchestrator.selenium.Selenese; +import it.Category2Suite; +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 IssuesPageTest { + + @ClassRule + public static Orchestrator orchestrator = Category2Suite.ORCHESTRATOR; + + @Test + public void save_new_issue_filter() throws Exception { + Selenese selenese = Selenese.builder().setHtmlTestsInClasspath("save_new_issue_filter", + "/issue/IssuesPageTest/save_new_issue_filter.html" + ).build(); + new SeleneseTest(selenese).runOn(orchestrator); + } } diff --git a/it/it-tests/src/test/java/it/issue/NewIssuesMeasureTest.java b/it/it-tests/src/test/java/it/issue/NewIssuesMeasureTest.java index 6798fd27f42..39c4985a940 100644 --- a/it/it-tests/src/test/java/it/issue/NewIssuesMeasureTest.java +++ b/it/it-tests/src/test/java/it/issue/NewIssuesMeasureTest.java @@ -19,7 +19,7 @@ */ package it.issue; -import com.sonar.orchestrator.build.SonarRunner; +import com.sonar.orchestrator.build.SonarScanner; import com.sonar.orchestrator.locator.FileLocation; import java.util.List; import org.junit.AfterClass; @@ -64,12 +64,12 @@ public class NewIssuesMeasureTest extends AbstractIssueTest { // Execute an analysis in the past with no issue to have a past snapshot ORCHESTRATOR.getServer().associateProjectToQualityProfile("sample", "xoo", "empty"); - ORCHESTRATOR.executeBuild(SonarRunner.create(projectDir("shared/xoo-sample")).setProperty("sonar.projectDate", "2013-01-01")); + ORCHESTRATOR.executeBuild(SonarScanner.create(projectDir("shared/xoo-sample")).setProperty("sonar.projectDate", "2013-01-01")); // Execute a analysis now with some issues ORCHESTRATOR.getServer().restoreProfile(FileLocation.ofClasspath("/issue/one-issue-per-line-profile.xml")); ORCHESTRATOR.getServer().associateProjectToQualityProfile("sample", "xoo", "one-issue-per-line-profile"); - ORCHESTRATOR.executeBuild(SonarRunner.create(projectDir("shared/xoo-sample"))); + ORCHESTRATOR.executeBuild(SonarScanner.create(projectDir("shared/xoo-sample"))); assertThat(ORCHESTRATOR.getServer().wsClient().issueClient().find(IssueQuery.create()).list()).isNotEmpty(); Resource newIssues = ORCHESTRATOR.getServer().getWsClient() @@ -79,7 +79,7 @@ public class NewIssuesMeasureTest extends AbstractIssueTest { assertThat(measures.get(0).getVariation2().intValue()).isEqualTo(17); // second analysis, with exactly the same profile -> no new issues - ORCHESTRATOR.executeBuild(SonarRunner.create(projectDir("shared/xoo-sample"))); + ORCHESTRATOR.executeBuild(SonarScanner.create(projectDir("shared/xoo-sample"))); assertThat(ORCHESTRATOR.getServer().wsClient().issueClient().find(IssueQuery.create()).list()).isNotEmpty(); newIssues = ORCHESTRATOR.getServer().getWsClient().find(ResourceQuery.createForMetrics("sample:src/main/xoo/sample/Sample.xoo", "new_violations").setIncludeTrends(true)); @@ -93,10 +93,10 @@ public class NewIssuesMeasureTest extends AbstractIssueTest { ORCHESTRATOR.getServer().restoreProfile(FileLocation.ofClasspath("/issue/one-issue-per-line-profile.xml")); ORCHESTRATOR.getServer().associateProjectToQualityProfile("sample", "xoo", "one-issue-per-line-profile"); - ORCHESTRATOR.executeBuild(SonarRunner.create(projectDir("shared/xoo-sample")) + ORCHESTRATOR.executeBuild(SonarScanner.create(projectDir("shared/xoo-sample")) // Analyse a project in the past, with a date older than 30 last days (second period) .setProperty("sonar.projectDate", "2013-01-01")); - ORCHESTRATOR.executeBuild(SonarRunner.create(projectDir("shared/xoo-sample"))); + ORCHESTRATOR.executeBuild(SonarScanner.create(projectDir("shared/xoo-sample"))); // new issues measures should be to 0 on project on 2 periods as new issues has been created Resource file = ORCHESTRATOR.getServer().getWsClient().find(ResourceQuery.createForMetrics("sample", "new_violations").setIncludeTrends(true)); @@ -117,10 +117,10 @@ public class NewIssuesMeasureTest extends AbstractIssueTest { // Execute an analysis in the past to have a past snapshot // version 1 - ORCHESTRATOR.executeBuilds(SonarRunner.create(projectDir("shared/xoo-history-v1"))); + ORCHESTRATOR.executeBuilds(SonarScanner.create(projectDir("shared/xoo-history-v1"))); // version 2 with 2 new violations and 3 more ncloc - ORCHESTRATOR.executeBuilds(SonarRunner.create(projectDir("shared/xoo-history-v2"))); + ORCHESTRATOR.executeBuilds(SonarScanner.create(projectDir("shared/xoo-history-v2"))); assertThat(ORCHESTRATOR.getServer().wsClient().issueClient().find(IssueQuery.create()).list()).isNotEmpty(); Resource file = ORCHESTRATOR.getServer().getWsClient().find(ResourceQuery.createForMetrics("sample", "new_violations", "violations", "ncloc").setIncludeTrends(true)); @@ -147,13 +147,13 @@ public class NewIssuesMeasureTest extends AbstractIssueTest { // First analysis without module b ORCHESTRATOR.getServer().restoreProfile(FileLocation.ofClasspath("/issue/NewIssuesMeasureTest/profile1.xml")); ORCHESTRATOR.getServer().associateProjectToQualityProfile("com.sonarsource.it.samples:multi-modules-sample", "xoo", "profile1"); - ORCHESTRATOR.executeBuild(SonarRunner.create(projectDir("shared/xoo-multi-modules-sample")) + ORCHESTRATOR.executeBuild(SonarScanner.create(projectDir("shared/xoo-multi-modules-sample")) .setProperties("sonar.modules", "module_a")); // Second analysis with module b and with a new rule activated to have new issues on module a since last analysis ORCHESTRATOR.getServer().restoreProfile(FileLocation.ofClasspath("/issue/NewIssuesMeasureTest/profile2.xml")); ORCHESTRATOR.getServer().associateProjectToQualityProfile("com.sonarsource.it.samples:multi-modules-sample", "xoo", "profile2"); - ORCHESTRATOR.executeBuild(SonarRunner.create(projectDir("shared/xoo-multi-modules-sample"))); + ORCHESTRATOR.executeBuild(SonarScanner.create(projectDir("shared/xoo-multi-modules-sample"))); Resource project = ORCHESTRATOR.getServer().getWsClient() .find(ResourceQuery.createForMetrics("com.sonarsource.it.samples:multi-modules-sample", "new_violations", "violations").setIncludeTrends(true)); diff --git a/it/it-tests/src/test/java/it/measure/MeasuresWsTest.java b/it/it-tests/src/test/java/it/measure/MeasuresWsTest.java index 42f513aa795..038dd0294cd 100644 --- a/it/it-tests/src/test/java/it/measure/MeasuresWsTest.java +++ b/it/it-tests/src/test/java/it/measure/MeasuresWsTest.java @@ -20,7 +20,7 @@ package it.measure; import com.sonar.orchestrator.Orchestrator; -import com.sonar.orchestrator.build.SonarRunner; +import com.sonar.orchestrator.build.SonarScanner; import it.Category1Suite; import java.util.List; import org.junit.AfterClass; @@ -63,7 +63,7 @@ public class MeasuresWsTest { @Before public void inspectProject() { orchestrator.resetData(); - orchestrator.executeBuild(SonarRunner.create(projectDir("shared/xoo-sample"))); + orchestrator.executeBuild(SonarScanner.create(projectDir("shared/xoo-sample"))); wsClient = ItUtils.newAdminWsClient(orchestrator); } diff --git a/it/it-tests/src/test/java/it/measure/ProjectOverviewTest.java b/it/it-tests/src/test/java/it/measure/ProjectOverviewTest.java index c585f6afbfb..cdcf92f1e1c 100644 --- a/it/it-tests/src/test/java/it/measure/ProjectOverviewTest.java +++ b/it/it-tests/src/test/java/it/measure/ProjectOverviewTest.java @@ -20,7 +20,7 @@ package it.measure; import com.sonar.orchestrator.Orchestrator; -import com.sonar.orchestrator.build.SonarRunner; +import com.sonar.orchestrator.build.SonarScanner; import com.sonar.orchestrator.selenium.Selenese; import it.Category1Suite; import org.junit.Before; @@ -59,7 +59,7 @@ public class ProjectOverviewTest { private void executeBuild(String projectLocation, String projectKey, String projectName) { orchestrator.executeBuild( - SonarRunner.create(projectDir(projectLocation)) + SonarScanner.create(projectDir(projectLocation)) .setProjectKey(projectKey) .setProjectName(projectName) ); diff --git a/it/it-tests/src/test/java/it/measure/ProjectWidgetsTest.java b/it/it-tests/src/test/java/it/measure/ProjectWidgetsTest.java index c6fa73a8255..25406fc47ea 100644 --- a/it/it-tests/src/test/java/it/measure/ProjectWidgetsTest.java +++ b/it/it-tests/src/test/java/it/measure/ProjectWidgetsTest.java @@ -20,7 +20,7 @@ package it.measure; import com.sonar.orchestrator.Orchestrator; -import com.sonar.orchestrator.build.SonarRunner; +import com.sonar.orchestrator.build.SonarScanner; import com.sonar.orchestrator.selenium.Selenese; import it.Category1Suite; import org.junit.BeforeClass; @@ -43,7 +43,7 @@ public class ProjectWidgetsTest { @BeforeClass public static void inspectProject() { orchestrator.executeBuild( - SonarRunner.create(projectDir("shared/xoo-sample")) + SonarScanner.create(projectDir("shared/xoo-sample")) .setProjectKey("project-widgets-test-project") .setProjectName("ProjectWidgetsTest Project") ); diff --git a/it/it-tests/src/test/java/it/measureFilter/MeasureFiltersTest.java b/it/it-tests/src/test/java/it/measureFilter/MeasureFiltersTest.java index 2cb3c19215a..014b6dbd6a4 100644 --- a/it/it-tests/src/test/java/it/measureFilter/MeasureFiltersTest.java +++ b/it/it-tests/src/test/java/it/measureFilter/MeasureFiltersTest.java @@ -20,7 +20,7 @@ package it.measureFilter; import com.sonar.orchestrator.Orchestrator; -import com.sonar.orchestrator.build.SonarRunner; +import com.sonar.orchestrator.build.SonarScanner; import com.sonar.orchestrator.selenium.Selenese; import it.Category1Suite; import org.junit.AfterClass; @@ -48,7 +48,7 @@ public class MeasureFiltersTest { @BeforeClass public static void scanStruts() { orchestrator.resetData(); - orchestrator.executeBuild(SonarRunner.create(projectDir("shared/xoo-multi-modules-sample"))); + orchestrator.executeBuild(SonarScanner.create(projectDir("shared/xoo-multi-modules-sample"))); adminWsClient = newAdminWsClient(orchestrator); createUser("user-measure-filters", "User Measure Filters"); diff --git a/it/it-tests/src/test/java/it/measureHistory/HistoryUiTest.java b/it/it-tests/src/test/java/it/measureHistory/HistoryUiTest.java index 747e91f94a8..066028fc82b 100644 --- a/it/it-tests/src/test/java/it/measureHistory/HistoryUiTest.java +++ b/it/it-tests/src/test/java/it/measureHistory/HistoryUiTest.java @@ -20,7 +20,7 @@ package it.measureHistory; import com.sonar.orchestrator.Orchestrator; -import com.sonar.orchestrator.build.SonarRunner; +import com.sonar.orchestrator.build.SonarScanner; import com.sonar.orchestrator.locator.FileLocation; import com.sonar.orchestrator.selenium.Selenese; import it.Category1Suite; @@ -50,7 +50,7 @@ public class HistoryUiTest { } private static void analyzeProject(String path, String date) { - orchestrator.executeBuild(SonarRunner.create(projectDir(path)) + orchestrator.executeBuild(SonarScanner.create(projectDir(path)) .setProperties("sonar.projectDate", date)); } diff --git a/it/it-tests/src/test/java/it/measureHistory/SincePreviousVersionHistoryTest.java b/it/it-tests/src/test/java/it/measureHistory/SincePreviousVersionHistoryTest.java index 05fa389d17e..5f504a1fcaf 100644 --- a/it/it-tests/src/test/java/it/measureHistory/SincePreviousVersionHistoryTest.java +++ b/it/it-tests/src/test/java/it/measureHistory/SincePreviousVersionHistoryTest.java @@ -20,7 +20,7 @@ package it.measureHistory; import com.sonar.orchestrator.Orchestrator; -import com.sonar.orchestrator.build.SonarRunner; +import com.sonar.orchestrator.build.SonarScanner; import it.Category1Suite; import java.text.SimpleDateFormat; import java.util.Date; @@ -74,7 +74,7 @@ public class SincePreviousVersionHistoryTest { } private static void analyzeProject(String version, @Nullable String exclusions, @Nullable String date) { - SonarRunner build = SonarRunner.create(projectDir("shared/xoo-multi-modules-sample")) + SonarScanner build = SonarScanner.create(projectDir("shared/xoo-multi-modules-sample")) .setProperties("sonar.projectVersion", version); if (exclusions != null) { build.setProperties("sonar.exclusions", exclusions); diff --git a/it/it-tests/src/test/java/it/measureHistory/TimeMachineTest.java b/it/it-tests/src/test/java/it/measureHistory/TimeMachineTest.java index 9c3585c369c..f2d803ebdcd 100644 --- a/it/it-tests/src/test/java/it/measureHistory/TimeMachineTest.java +++ b/it/it-tests/src/test/java/it/measureHistory/TimeMachineTest.java @@ -21,7 +21,7 @@ package it.measureHistory; import com.sonar.orchestrator.Orchestrator; import com.sonar.orchestrator.build.BuildResult; -import com.sonar.orchestrator.build.SonarRunner; +import com.sonar.orchestrator.build.SonarScanner; import com.sonar.orchestrator.locator.FileLocation; import it.Category1Suite; import java.util.Date; @@ -73,7 +73,7 @@ public class TimeMachineTest { } private static BuildResult analyzeProject(String path, String date) { - return orchestrator.executeBuild(SonarRunner.create(projectDir(path), "sonar.projectDate", date)); + return orchestrator.executeBuild(SonarScanner.create(projectDir(path), "sonar.projectDate", date)); } @Test diff --git a/it/it-tests/src/test/java/it/plugins/PluginsTest.java b/it/it-tests/src/test/java/it/plugins/PluginsTest.java index 814fa6d6670..53743d2fc15 100644 --- a/it/it-tests/src/test/java/it/plugins/PluginsTest.java +++ b/it/it-tests/src/test/java/it/plugins/PluginsTest.java @@ -26,10 +26,8 @@ import com.sonar.orchestrator.OrchestratorBuilder; import com.sonar.orchestrator.build.BuildResult; import com.sonar.orchestrator.build.SonarScanner; import it.plugins.checks.AbapCheck; -import it.plugins.checks.CCheck; import it.plugins.checks.Check; import it.plugins.checks.CobolCheck; -import it.plugins.checks.CppCheck; import it.plugins.checks.CssCheck; import it.plugins.checks.FlexCheck; import it.plugins.checks.GroovyCheck; @@ -40,7 +38,6 @@ import it.plugins.checks.PythonCheck; import it.plugins.checks.RpgCheck; import it.plugins.checks.SwiftCheck; import it.plugins.checks.Validation; -import it.plugins.checks.VbCheck; import it.plugins.checks.WebCheck; import java.util.Arrays; import java.util.List; @@ -69,9 +66,8 @@ public class PluginsTest { "lits", "citymodel", - // status 1.0 is built for Java 8 so it is temporarily disabled - "status", - // temporary incompatibility with cobol 3.1 java.lang.NoClassDefFoundError: com/sonarsource/cobol/api/pp/EnterPreprocessorEvent + // temporary incompatibility with cobol 3.1 + // https://jira.sonarsource.com/browse/MAIF-213 "maifcobolplugin", // SONAR-7770 Realm plugins cannot be installed as no external configuration is used @@ -90,9 +86,14 @@ public class PluginsTest { "scmstats"); // TODO new PliCheck() is temporarily disabled as PLI plugin does not support multi-language feature. See sonar-project.properties - static final List<Check> CHECKS = Arrays.asList((Check) new AbapCheck(), new CCheck(), new CppCheck(), new CobolCheck(), new CssCheck(), + // TODO CCheck, CppCheck, VbCheck temporarily disabled as not compatible with 6.0 + static final List<Check> CHECKS = Arrays.asList((Check) new AbapCheck(), + // new CCheck(), new CppCheck(), + new CobolCheck(), new CssCheck(), new FlexCheck(), new GroovyCheck(), new JavaCheck(), new JavascriptCheck(), new PhpCheck(), new RpgCheck(), - new PythonCheck(), new SwiftCheck(), new VbCheck(), new WebCheck()); + new PythonCheck(), new SwiftCheck(), + // new VbCheck(), + new WebCheck()); static Orchestrator orchestrator; diff --git a/it/it-tests/src/test/java/it/projectAdministration/BackgroundTasksTest.java b/it/it-tests/src/test/java/it/projectAdministration/BackgroundTasksTest.java index 4a09fc455b1..9e895ff444a 100644 --- a/it/it-tests/src/test/java/it/projectAdministration/BackgroundTasksTest.java +++ b/it/it-tests/src/test/java/it/projectAdministration/BackgroundTasksTest.java @@ -20,7 +20,7 @@ package it.projectAdministration; import com.sonar.orchestrator.Orchestrator; -import com.sonar.orchestrator.build.SonarRunner; +import com.sonar.orchestrator.build.SonarScanner; import com.sonar.orchestrator.selenium.Selenese; import it.Category1Suite; import org.junit.ClassRule; @@ -47,7 +47,7 @@ public class BackgroundTasksTest { private void executeBuild(String projectKey, String projectName) { orchestrator.executeBuild( - SonarRunner.create(projectDir("shared/xoo-sample")) + SonarScanner.create(projectDir("shared/xoo-sample")) .setProjectKey(projectKey) .setProjectName(projectName) ); diff --git a/it/it-tests/src/test/java/it/projectAdministration/BulkDeletionTest.java b/it/it-tests/src/test/java/it/projectAdministration/BulkDeletionTest.java index c23d74f5882..cbc06eccdfa 100644 --- a/it/it-tests/src/test/java/it/projectAdministration/BulkDeletionTest.java +++ b/it/it-tests/src/test/java/it/projectAdministration/BulkDeletionTest.java @@ -20,7 +20,7 @@ package it.projectAdministration; import com.sonar.orchestrator.Orchestrator; -import com.sonar.orchestrator.build.SonarRunner; +import com.sonar.orchestrator.build.SonarScanner; import com.sonar.orchestrator.selenium.Selenese; import it.Category1Suite; import org.junit.Before; @@ -61,7 +61,7 @@ public class BulkDeletionTest { private void executeBuild(String projectKey, String projectName) { orchestrator.executeBuild( - SonarRunner.create(projectDir("shared/xoo-sample")) + SonarScanner.create(projectDir("shared/xoo-sample")) .setProjectKey(projectKey) .setProjectName(projectName) ); diff --git a/it/it-tests/src/test/java/it/projectAdministration/ProjectAdministrationTest.java b/it/it-tests/src/test/java/it/projectAdministration/ProjectAdministrationTest.java index dcf73a48154..d542196840d 100644 --- a/it/it-tests/src/test/java/it/projectAdministration/ProjectAdministrationTest.java +++ b/it/it-tests/src/test/java/it/projectAdministration/ProjectAdministrationTest.java @@ -140,7 +140,7 @@ public class ProjectAdministrationTest { orchestrator.executeBuild(build); // There are 7 modules - assertThat(count("events where category='Version'")).as("Different number of events").isEqualTo(7); + assertThat(count("events where category='Version'")).as("Different number of events").isEqualTo(1); Selenese selenese = Selenese.builder() .setHtmlTestsInClasspath("modify_version_of_multimodule_project", @@ -148,7 +148,7 @@ public class ProjectAdministrationTest { ).build(); new SeleneseTest(selenese).runOn(orchestrator); - assertThat(count("events where category='Version'")).as("Different number of events").isEqualTo(14); + assertThat(count("events where category='Version'")).as("Different number of events").isEqualTo(2); selenese = Selenese.builder() .setHtmlTestsInClasspath("delete_version_of_multimodule_project", @@ -156,7 +156,7 @@ public class ProjectAdministrationTest { ).build(); new SeleneseTest(selenese).runOn(orchestrator); - assertThat(count("events where category='Version'")).as("Different number of events").isEqualTo(7); + assertThat(count("events where category='Version'")).as("Different number of events").isEqualTo(1); } /** @@ -174,8 +174,13 @@ public class ProjectAdministrationTest { ).build(); new SeleneseTest(selenese).runOn(orchestrator); + // GET /api/properties/sonar.exclusions?resource=sample assertThat(orchestrator.getServer().getAdminWsClient().find(PropertyQuery.createForResource("sonar.exclusions", "sample")).getValue()) .isEqualTo("my-exclusions"); + + // GET /api/properties?resource=sample + // Note that this WS is used by SonarLint + assertThat(orchestrator.getServer().getAdminWsClient().findAll(PropertyQuery.createForResource(null, "sample"))).isNotEmpty(); } /** diff --git a/it/it-tests/src/test/java/it/projectAdministration/ProjectPermissionsTest.java b/it/it-tests/src/test/java/it/projectAdministration/ProjectPermissionsTest.java index fc6fecc4470..accb2962162 100644 --- a/it/it-tests/src/test/java/it/projectAdministration/ProjectPermissionsTest.java +++ b/it/it-tests/src/test/java/it/projectAdministration/ProjectPermissionsTest.java @@ -20,7 +20,7 @@ package it.projectAdministration; import com.sonar.orchestrator.Orchestrator; -import com.sonar.orchestrator.build.SonarRunner; +import com.sonar.orchestrator.build.SonarScanner; import com.sonar.orchestrator.selenium.Selenese; import it.Category1Suite; import org.junit.ClassRule; @@ -50,7 +50,7 @@ public class ProjectPermissionsTest { private void executeBuild(String projectKey, String projectName) { orchestrator.executeBuild( - SonarRunner.create(projectDir("shared/xoo-sample")) + SonarScanner.create(projectDir("shared/xoo-sample")) .setProjectKey(projectKey) .setProjectName(projectName) ); diff --git a/it/it-tests/src/test/java/it/projectComparison/ProjectComparisonTest.java b/it/it-tests/src/test/java/it/projectComparison/ProjectComparisonTest.java index 4a459dcd071..ac0987a94d4 100644 --- a/it/it-tests/src/test/java/it/projectComparison/ProjectComparisonTest.java +++ b/it/it-tests/src/test/java/it/projectComparison/ProjectComparisonTest.java @@ -20,7 +20,7 @@ package it.projectComparison; import com.sonar.orchestrator.Orchestrator; -import com.sonar.orchestrator.build.SonarRunner; +import com.sonar.orchestrator.build.SonarScanner; import com.sonar.orchestrator.selenium.Selenese; import it.Category4Suite; import org.junit.BeforeClass; @@ -42,7 +42,7 @@ public class ProjectComparisonTest { @BeforeClass public static void inspectProject() { orchestrator.executeBuild( - SonarRunner.create(projectDir("shared/xoo-sample")) + SonarScanner.create(projectDir("shared/xoo-sample")) .setProjectKey("project-comparison-test-project") .setProjectName("ProjectComparisonTest Project") ); diff --git a/it/it-tests/src/test/java/it/projectEvent/EventTest.java b/it/it-tests/src/test/java/it/projectEvent/EventTest.java index 16b41beca67..554b69f50ef 100644 --- a/it/it-tests/src/test/java/it/projectEvent/EventTest.java +++ b/it/it-tests/src/test/java/it/projectEvent/EventTest.java @@ -32,12 +32,14 @@ import org.junit.Test; import org.junit.experimental.categories.Category; import org.sonar.wsclient.services.Event; import org.sonar.wsclient.services.EventQuery; +import org.sonarqube.ws.client.PostRequest; +import org.sonarqube.ws.client.WsConnector; +import org.sonarqube.ws.client.WsResponse; +import util.ItUtils; import util.QaOnly; import util.selenium.SeleneseTest; -import static org.hamcrest.Matchers.hasItems; -import static org.hamcrest.Matchers.is; -import static org.junit.Assert.assertThat; +import static org.assertj.core.api.Assertions.assertThat; import static util.ItUtils.projectDir; @Category(QaOnly.class) @@ -59,9 +61,29 @@ public class EventTest { orchestrator.executeSelenese( Selenese.builder().setHtmlTestsInClasspath("events", "/projectEvent/EventTest/create_event_with_special_character.html", - "/projectEvent/EventTest/no_events_widget_on_dir.html" - ).build() - ); + "/projectEvent/EventTest/no_events_widget_on_dir.html") + .build()); + } + + @Test + public void old_ws_events_does_not_allow_creating_events_on_modules() { + SonarScanner sampleProject = SonarScanner.create(projectDir("shared/xoo-multi-modules-sample")); + orchestrator.executeBuild(sampleProject); + + WsConnector wsConnector = ItUtils.newAdminWsClient(orchestrator).wsConnector(); + WsResponse response = wsConnector.call(newCreateEventRequest("com.sonarsource.it.samples:multi-modules-sample", "bar")); + assertThat(response.code()) + .isEqualTo(200); + + assertThat(wsConnector.call(newCreateEventRequest("com.sonarsource.it.samples:multi-modules-sample:module_a", "bar")).code()) + .isEqualTo(400); + } + + private static PostRequest newCreateEventRequest(String componentKey, String eventName) { + return new PostRequest("/api/events") + .setParam("resource", componentKey) + .setParam("name", eventName) + .setParam("category", "Foo"); } @Test @@ -70,8 +92,7 @@ public class EventTest { new SeleneseTest( Selenese.builder().setHtmlTestsInClasspath("delete-event", - "/projectEvent/EventTest/create_delete_standard_event.html" - ).build()).runOn(orchestrator); + "/projectEvent/EventTest/create_delete_standard_event.html").build()).runOn(orchestrator); } @Test @@ -84,9 +105,7 @@ public class EventTest { orchestrator.executeSelenese( Selenese.builder().setHtmlTestsInClasspath("event-widget", - "/projectEvent/EventTest/show_events_using_filters.html" - ).build() - ); + "/projectEvent/EventTest/show_events_using_filters.html").build()); } /** @@ -104,9 +123,9 @@ public class EventTest { // there should be only 1 "0.1-SNAPSHOT" event and only 1 "0.1" event List<Event> events = orchestrator.getServer().getWsClient().findAll(new EventQuery().setResourceKey("sample")); - assertThat(events.size(), is(2)); + assertThat(events.size()).isEqualTo(2); List<String> eventNames = Lists.newArrayList(events.get(0).getName(), events.get(1).getName()); - assertThat(eventNames, hasItems("1.0", "1.0-SNAPSHOT")); + assertThat(eventNames).contains("1.0", "1.0-SNAPSHOT"); } private static void executeAnalysis(String... properties) { diff --git a/it/it-tests/src/test/java/it/qualityGate/QualityGateNotificationTest.java b/it/it-tests/src/test/java/it/qualityGate/QualityGateNotificationTest.java index 55a4b0551fb..e8e91e7e9ad 100644 --- a/it/it-tests/src/test/java/it/qualityGate/QualityGateNotificationTest.java +++ b/it/it-tests/src/test/java/it/qualityGate/QualityGateNotificationTest.java @@ -20,7 +20,7 @@ package it.qualityGate; import com.sonar.orchestrator.Orchestrator; -import com.sonar.orchestrator.build.SonarRunner; +import com.sonar.orchestrator.build.SonarScanner; import com.sonar.orchestrator.selenium.Selenese; import it.Category1Suite; import java.util.Iterator; @@ -102,7 +102,7 @@ public class QualityGateNotificationTest { qgClient().setDefault(simple.id()); qgClient().createCondition(NewCondition.create(simple.id()).metricKey("ncloc").period(1).operator("EQ").warningThreshold("0")); - SonarRunner analysis = SonarRunner.create(projectDir("qualitygate/xoo-sample")); + SonarScanner analysis = SonarScanner.create(projectDir("qualitygate/xoo-sample")); orchestrator.executeBuild(analysis); assertThat(fetchGateStatus().getData()).isEqualTo("OK"); diff --git a/it/it-tests/src/test/java/it/qualityGate/QualityGateUiTest.java b/it/it-tests/src/test/java/it/qualityGate/QualityGateUiTest.java index d81c6d2ee3c..8bf30e4e9e3 100644 --- a/it/it-tests/src/test/java/it/qualityGate/QualityGateUiTest.java +++ b/it/it-tests/src/test/java/it/qualityGate/QualityGateUiTest.java @@ -20,7 +20,7 @@ package it.qualityGate; import com.sonar.orchestrator.Orchestrator; -import com.sonar.orchestrator.build.SonarRunner; +import com.sonar.orchestrator.build.SonarScanner; import com.sonar.orchestrator.selenium.Selenese; import it.Category1Suite; import javax.annotation.Nullable; @@ -137,7 +137,7 @@ public class QualityGateUiTest { } private void scanSample(@Nullable String date, @Nullable String profile) { - SonarRunner scan = SonarRunner.create(projectDir("shared/xoo-sample")) + SonarScanner scan = SonarScanner.create(projectDir("shared/xoo-sample")) .setProperties("sonar.cpd.skip", "true"); if (date != null) { scan.setProperty("sonar.projectDate", date); diff --git a/it/it-tests/src/test/java/it/qualityModel/MaintainabilityRatingMeasureTest.java b/it/it-tests/src/test/java/it/qualityModel/MaintainabilityRatingMeasureTest.java index 89e861b1941..aed422800cc 100644 --- a/it/it-tests/src/test/java/it/qualityModel/MaintainabilityRatingMeasureTest.java +++ b/it/it-tests/src/test/java/it/qualityModel/MaintainabilityRatingMeasureTest.java @@ -20,7 +20,7 @@ package it.qualityModel; import com.sonar.orchestrator.Orchestrator; -import com.sonar.orchestrator.build.SonarRunner; +import com.sonar.orchestrator.build.SonarScanner; import com.sonar.orchestrator.locator.FileLocation; import it.Category2Suite; import javax.annotation.CheckForNull; @@ -66,7 +66,7 @@ public class MaintainabilityRatingMeasureTest { orchestrator.getServer().provisionProject(PROJECT, PROJECT); orchestrator.getServer().associateProjectToQualityProfile(PROJECT, "xoo", "with-many-rules"); - orchestrator.executeBuild(SonarRunner.create(projectDir("shared/xoo-multi-modules-sample"))); + orchestrator.executeBuild(SonarScanner.create(projectDir("shared/xoo-multi-modules-sample"))); assertThat(getMeasure(PROJECT, "sqale_rating").getIntValue()).isEqualTo(3); assertThat(getMeasure(PROJECT, "sqale_rating").getData()).isEqualTo("C"); @@ -90,7 +90,7 @@ public class MaintainabilityRatingMeasureTest { orchestrator.getServer().provisionProject(PROJECT, PROJECT); orchestrator.getServer().associateProjectToQualityProfile(PROJECT, "xoo", "with-many-rules"); - orchestrator.executeBuild(SonarRunner.create(projectDir("shared/xoo-multi-modules-sample"))); + orchestrator.executeBuild(SonarScanner.create(projectDir("shared/xoo-multi-modules-sample"))); assertThat(getMeasure(PROJECT, "sqale_debt_ratio").getValue()).isEqualTo(29.1d); assertThat(getMeasure(MODULE, "sqale_debt_ratio").getValue()).isEqualTo(28.5d); @@ -105,14 +105,14 @@ public class MaintainabilityRatingMeasureTest { orchestrator.getServer().provisionProject("sample", "sample"); orchestrator.getServer().associateProjectToQualityProfile("sample", "xoo", "one-issue-per-line"); - orchestrator.executeBuild(SonarRunner.create(projectDir("shared/xoo-sample"))); + orchestrator.executeBuild(SonarScanner.create(projectDir("shared/xoo-sample"))); Measure rating = getMeasure("sample", "sqale_rating"); assertThat(rating.getIntValue()).isEqualTo(1); assertThat(rating.getData()).isEqualTo("A"); debtConfiguration.updateDevelopmentCost(2); - orchestrator.executeBuild(SonarRunner.create(projectDir("shared/xoo-sample"))); + orchestrator.executeBuild(SonarScanner.create(projectDir("shared/xoo-sample"))); rating = getMeasure("sample", "sqale_rating"); assertThat(rating.getIntValue()).isEqualTo(4); @@ -125,7 +125,7 @@ public class MaintainabilityRatingMeasureTest { orchestrator.getServer().provisionProject(PROJECT, PROJECT); orchestrator.getServer().associateProjectToQualityProfile(PROJECT, "xoo", "one-issue-per-line"); - orchestrator.executeBuild(SonarRunner.create(projectDir("shared/xoo-multi-modules-sample"))); + orchestrator.executeBuild(SonarScanner.create(projectDir("shared/xoo-multi-modules-sample"))); Measure rating = getMeasure(PROJECT, "sqale_rating"); assertThat(rating.getIntValue()).isEqualTo(1); @@ -133,7 +133,7 @@ public class MaintainabilityRatingMeasureTest { debtConfiguration.updateLanguageDevelopmentCost("xoo", 1); orchestrator.executeBuild( - SonarRunner.create(projectDir("shared/xoo-multi-modules-sample")) + SonarScanner.create(projectDir("shared/xoo-multi-modules-sample")) .setProfile("one-issue-per-line")); rating = getMeasure(PROJECT, "sqale_rating"); @@ -147,14 +147,14 @@ public class MaintainabilityRatingMeasureTest { orchestrator.getServer().provisionProject("sample", "sample"); orchestrator.getServer().associateProjectToQualityProfile("sample", "xoo", "one-issue-per-line"); - orchestrator.executeBuild(SonarRunner.create(projectDir("shared/xoo-sample"))); + orchestrator.executeBuild(SonarScanner.create(projectDir("shared/xoo-sample"))); Measure rating = getMeasure("sample", "sqale_rating"); assertThat(rating.getIntValue()).isEqualTo(1); assertThat(rating.getData()).isEqualTo("A"); debtConfiguration.updateRatingGrid(0.001d, 0.005d, 0.01d, 0.015d); - orchestrator.executeBuild(SonarRunner.create(projectDir("shared/xoo-sample"))); + orchestrator.executeBuild(SonarScanner.create(projectDir("shared/xoo-sample"))); rating = getMeasure("sample", "sqale_rating"); assertThat(rating.getIntValue()).isEqualTo(5); @@ -167,7 +167,7 @@ public class MaintainabilityRatingMeasureTest { orchestrator.getServer().provisionProject(PROJECT, PROJECT); orchestrator.getServer().associateProjectToQualityProfile(PROJECT, "xoo", "with-many-rules"); - orchestrator.executeBuild(SonarRunner.create(projectDir("shared/xoo-multi-modules-sample"))); + orchestrator.executeBuild(SonarScanner.create(projectDir("shared/xoo-multi-modules-sample"))); assertThat(getMeasure(PROJECT, "sqale_rating").getData()).isEqualTo("C"); assertThat(getMeasure(PROJECT, "effort_to_reach_maintainability_rating_a").getIntValue()).isEqualTo(292); diff --git a/it/it-tests/src/test/java/it/qualityModel/TechnicalDebtInIssueChangelogTest.java b/it/it-tests/src/test/java/it/qualityModel/TechnicalDebtInIssueChangelogTest.java index a1584523c31..ef92d86270f 100644 --- a/it/it-tests/src/test/java/it/qualityModel/TechnicalDebtInIssueChangelogTest.java +++ b/it/it-tests/src/test/java/it/qualityModel/TechnicalDebtInIssueChangelogTest.java @@ -20,7 +20,7 @@ package it.qualityModel; import com.sonar.orchestrator.Orchestrator; -import com.sonar.orchestrator.build.SonarRunner; +import com.sonar.orchestrator.build.SonarScanner; import com.sonar.orchestrator.locator.FileLocation; import it.Category2Suite; import java.util.List; @@ -66,10 +66,10 @@ public class TechnicalDebtInIssueChangelogTest { orchestrator.getServer().associateProjectToQualityProfile("sample", "xoo", "one-issue-per-file"); // Execute a first analysis to have a past snapshot - orchestrator.executeBuild(SonarRunner.create(projectDir("shared/xoo-sample"))); + orchestrator.executeBuild(SonarScanner.create(projectDir("shared/xoo-sample"))); // Second analysis, existing issues on OneIssuePerFile will have their technical debt updated with the effort to fix - orchestrator.executeBuild(SonarRunner.create(projectDir("shared/xoo-sample")) + orchestrator.executeBuild(SonarScanner.create(projectDir("shared/xoo-sample")) .setProperties("sonar.oneIssuePerFile.effortToFix", "10")); IssueClient issueClient = orchestrator.getServer().wsClient().issueClient(); @@ -93,12 +93,12 @@ public class TechnicalDebtInIssueChangelogTest { orchestrator.getServer().associateProjectToQualityProfile("sample", "xoo", "one-issue-per-file"); // Execute a first analysis to have a past snapshot - orchestrator.executeBuild(SonarRunner.create(projectDir("shared/xoo-sample"))); + orchestrator.executeBuild(SonarScanner.create(projectDir("shared/xoo-sample"))); // One day -> 10 hours debtConfiguration.updateHoursInDay(10); - orchestrator.executeBuild(SonarRunner.create(projectDir("shared/xoo-sample")) + orchestrator.executeBuild(SonarScanner.create(projectDir("shared/xoo-sample")) // As OneIssuePerFile has a debt of 10 minutes, we multiply it by 72 to have 1 day and 2 hours of technical debtn .setProperties("sonar.oneIssuePerFile.effortToFix", "72") ); diff --git a/it/it-tests/src/test/java/it/qualityModel/TechnicalDebtTest.java b/it/it-tests/src/test/java/it/qualityModel/TechnicalDebtTest.java index 0acb73e58b2..f4ba792a436 100644 --- a/it/it-tests/src/test/java/it/qualityModel/TechnicalDebtTest.java +++ b/it/it-tests/src/test/java/it/qualityModel/TechnicalDebtTest.java @@ -20,7 +20,7 @@ package it.qualityModel; import com.sonar.orchestrator.Orchestrator; -import com.sonar.orchestrator.build.SonarRunner; +import com.sonar.orchestrator.build.SonarScanner; import com.sonar.orchestrator.locator.FileLocation; import it.Category2Suite; import java.util.List; @@ -61,7 +61,7 @@ public class TechnicalDebtTest { orchestrator.getServer().associateProjectToQualityProfile("sample", "xoo", "one-issue-per-line"); // Generate some issues - orchestrator.executeBuild(SonarRunner.create(projectDir("shared/xoo-sample"))); + orchestrator.executeBuild(SonarScanner.create(projectDir("shared/xoo-sample"))); // All the issues should have a technical debt List<Issue> issues = orchestrator.getServer().wsClient().issueClient().find(IssueQuery.create()).list(); @@ -80,7 +80,7 @@ public class TechnicalDebtTest { // One day -> 10 hours debtConfiguration.updateHoursInDay(10); - orchestrator.executeBuild(SonarRunner.create(projectDir("shared/xoo-sample")) + orchestrator.executeBuild(SonarScanner.create(projectDir("shared/xoo-sample")) // As OneIssuePerFile has a debt of 10 minutes, we multiply it by 72 to have 1 day and 2 hours of technical debt .setProperties("sonar.oneIssuePerFile.effortToFix", "72") ); @@ -100,7 +100,7 @@ public class TechnicalDebtTest { // One day -> 10 hours : debt will be stored as 360.000 seconds (1 day * 10 hours per day * 60 * 60) debtConfiguration.updateHoursInDay(10); - orchestrator.executeBuild(SonarRunner.create(projectDir("shared/xoo-sample"))); + orchestrator.executeBuild(SonarScanner.create(projectDir("shared/xoo-sample"))); // Issue debt was 1 day during analysis but will be displayed as 1 day and 2 hours (hours in day property was set // to 10 during analysis but is now 8) diff --git a/it/it-tests/src/test/java/it/qualityModel/TechnicalDebtWidgetTest.java b/it/it-tests/src/test/java/it/qualityModel/TechnicalDebtWidgetTest.java index 7350325bff8..00dc2354bf2 100644 --- a/it/it-tests/src/test/java/it/qualityModel/TechnicalDebtWidgetTest.java +++ b/it/it-tests/src/test/java/it/qualityModel/TechnicalDebtWidgetTest.java @@ -20,7 +20,7 @@ package it.qualityModel; import com.sonar.orchestrator.Orchestrator; -import com.sonar.orchestrator.build.SonarRunner; +import com.sonar.orchestrator.build.SonarScanner; import com.sonar.orchestrator.locator.FileLocation; import com.sonar.orchestrator.selenium.Selenese; import it.Category2Suite; @@ -64,7 +64,7 @@ public class TechnicalDebtWidgetTest { } private static void scanProject(String date, String excludes) { - SonarRunner scan = SonarRunner.create(projectDir("shared/xoo-multi-modules-sample")) + SonarScanner scan = SonarScanner.create(projectDir("shared/xoo-multi-modules-sample")) .setProperties("sonar.projectDate", date, "sonar.exclusions", excludes); orchestrator.executeBuild(scan); } diff --git a/it/it-tests/src/test/java/it/qualityProfile/QualityProfilesPageTest.java b/it/it-tests/src/test/java/it/qualityProfile/QualityProfilesPageTest.java new file mode 100644 index 00000000000..8a74c2ba8fa --- /dev/null +++ b/it/it-tests/src/test/java/it/qualityProfile/QualityProfilesPageTest.java @@ -0,0 +1,200 @@ +/* + * 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.qualityProfile; + +import com.sonar.orchestrator.Orchestrator; +import com.sonar.orchestrator.build.SonarScanner; +import com.sonar.orchestrator.selenium.Selenese; +import it.Category4Suite; +import org.junit.*; +import org.junit.experimental.categories.Category; +import org.sonarqube.ws.client.PostRequest; +import org.sonarqube.ws.client.WsClient; +import util.QaOnly; +import util.selenium.SeleneseTest; + +import static util.ItUtils.newAdminWsClient; +import static util.ItUtils.projectDir; + +@Category(QaOnly.class) +public class QualityProfilesPageTest { + + @ClassRule + public static Orchestrator orchestrator = Category4Suite.ORCHESTRATOR; + private static WsClient adminWsClient; + + @BeforeClass + public static void setUp() { + adminWsClient = newAdminWsClient(orchestrator); + orchestrator.resetData(); + } + + @Before + public void createSampleProfile() { + createProfile("xoo", "sample"); + inheritProfile("xoo", "sample", "Basic"); + analyzeProject("shared/xoo-sample"); + addProfileToProject("xoo", "sample", "sample"); + } + + @After + public void deleteSampleProfile() { + setDefault("xoo", "Basic"); + deleteProfile("xoo", "sample"); + deleteProfile("xoo", "new name"); + } + + @Test + public void testHomePage() throws Exception { + Selenese selenese = Selenese.builder().setHtmlTestsInClasspath("test_home_page", + "/qualityProfile/QualityProfilesPageTest/should_display_list.html", + "/qualityProfile/QualityProfilesPageTest/should_open_from_list.html", + "/qualityProfile/QualityProfilesPageTest/should_filter_by_language.html" + ).build(); + new SeleneseTest(selenese).runOn(orchestrator); + } + + @Test + public void testProfilePage() throws Exception { + Selenese selenese = Selenese.builder().setHtmlTestsInClasspath("test_profile_page", + "/qualityProfile/QualityProfilesPageTest/should_display_profile_rules.html", + "/qualityProfile/QualityProfilesPageTest/should_display_profile_inheritance.html", + "/qualityProfile/QualityProfilesPageTest/should_display_profile_projects.html", + "/qualityProfile/QualityProfilesPageTest/should_display_profile_exporters.html" + ).build(); + new SeleneseTest(selenese).runOn(orchestrator); + } + + @Test + public void testNotFound() { + Selenese selenese = Selenese.builder().setHtmlTestsInClasspath("test_not_found", + "/qualityProfile/QualityProfilesPageTest/not_found.html").build(); + orchestrator.executeSelenese(selenese); + } + + @Test + public void testProfileChangelog() throws Exception { + Selenese selenese = Selenese.builder().setHtmlTestsInClasspath("test_profile_changelog", + "/qualityProfile/QualityProfilesPageTest/should_display_changelog.html" + ).build(); + new SeleneseTest(selenese).runOn(orchestrator); + } + + @Ignore("find a way to know profile key inside selenium tests") + @Test + public void testComparison() throws Exception { + Selenese selenese = Selenese.builder().setHtmlTestsInClasspath("test_comparison", + "/qualityProfile/QualityProfilesPageTest/should_compare.html" + ).build(); + new SeleneseTest(selenese).runOn(orchestrator); + } + + @Test + public void testCreation() throws Exception { + Selenese selenese = Selenese.builder().setHtmlTestsInClasspath("test_creation", + "/qualityProfile/QualityProfilesPageTest/should_create.html" + ).build(); + new SeleneseTest(selenese).runOn(orchestrator); + } + + @Test + public void testDeletion() throws Exception { + Selenese selenese = Selenese.builder().setHtmlTestsInClasspath("test_deletion", + "/qualityProfile/QualityProfilesPageTest/should_delete.html" + ).build(); + new SeleneseTest(selenese).runOn(orchestrator); + } + + @Test + public void testCopying() throws Exception { + Selenese selenese = Selenese.builder().setHtmlTestsInClasspath("test_copying", + "/qualityProfile/QualityProfilesPageTest/should_copy.html" + ).build(); + new SeleneseTest(selenese).runOn(orchestrator); + } + + @Test + public void testRenaming() throws Exception { + Selenese selenese = Selenese.builder().setHtmlTestsInClasspath("test_renaming", + "/qualityProfile/QualityProfilesPageTest/should_rename.html" + ).build(); + new SeleneseTest(selenese).runOn(orchestrator); + } + + @Test + public void testSettingDefault() throws Exception { + Selenese selenese = Selenese.builder().setHtmlTestsInClasspath("test_setting_default", + "/qualityProfile/QualityProfilesPageTest/should_set_default.html" + ).build(); + new SeleneseTest(selenese).runOn(orchestrator); + } + + @Test + public void testRestoration() throws Exception { + deleteProfile("xoo", "empty"); + + Selenese selenese = Selenese.builder().setHtmlTestsInClasspath("test_restoration", + "/qualityProfile/QualityProfilesPageTest/should_restore.html", + "/qualityProfile/QualityProfilesPageTest/should_restore_built_in.html" + ).build(); + new SeleneseTest(selenese).runOn(orchestrator); + } + + private static void createProfile(String language, String name) { + adminWsClient.wsConnector().call( + new PostRequest("api/qualityprofiles/create") + .setParam("language", language) + .setParam("name", name)); + } + + private static void inheritProfile(String language, String name, String parentName) { + adminWsClient.wsConnector().call( + new PostRequest("api/qualityprofiles/change_parent") + .setParam("language", language) + .setParam("profileName", name) + .setParam("parentName", parentName)); + } + + private static void analyzeProject(String path) { + orchestrator.executeBuild(SonarScanner.create(projectDir(path))); + } + + private static void addProfileToProject(String language, String profileName, String projectKey) { + adminWsClient.wsConnector().call( + new PostRequest("api/qualityprofiles/add_project") + .setParam("language", language) + .setParam("profileName", profileName) + .setParam("projectKey", projectKey)); + } + + private static void deleteProfile(String language, String name) { + adminWsClient.wsConnector().call( + new PostRequest("api/qualityprofiles/delete") + .setParam("language", language) + .setParam("profileName", name)); + } + + private static void setDefault(String language, String name) { + adminWsClient.wsConnector().call( + new PostRequest("api/qualityprofiles/set_default") + .setParam("language", language) + .setParam("profileName", name)); + } +} diff --git a/it/it-tests/src/test/java/it/serverSystem/ServerSystemRestartingOrchestrator.java b/it/it-tests/src/test/java/it/serverSystem/ServerSystemRestartingOrchestrator.java index 4869e31fe52..088f782834b 100644 --- a/it/it-tests/src/test/java/it/serverSystem/ServerSystemRestartingOrchestrator.java +++ b/it/it-tests/src/test/java/it/serverSystem/ServerSystemRestartingOrchestrator.java @@ -67,7 +67,7 @@ public class ServerSystemRestartingOrchestrator { fail(); } catch (Exception e) { assertThat(FileUtils.readFileToString(orchestrator.getServer().getLogs())).contains( - "Plugin incompatible-plugin [incompatibleplugin] requires at least SonarQube 5.9"); + "Plugin incompatible-plugin [incompatibleplugin] requires at least SonarQube 100"); } } diff --git a/it/it-tests/src/test/java/it/serverSystem/ServerSystemTest.java b/it/it-tests/src/test/java/it/serverSystem/ServerSystemTest.java index 8981379e179..24fd65151a6 100644 --- a/it/it-tests/src/test/java/it/serverSystem/ServerSystemTest.java +++ b/it/it-tests/src/test/java/it/serverSystem/ServerSystemTest.java @@ -20,7 +20,7 @@ package it.serverSystem; import com.sonar.orchestrator.Orchestrator; -import com.sonar.orchestrator.build.SonarRunner; +import com.sonar.orchestrator.build.SonarScanner; import com.sonar.orchestrator.selenium.Selenese; import it.Category4Suite; import java.io.File; @@ -176,7 +176,7 @@ public class ServerSystemTest { // TODO should be moved elsewhere @Test public void not_fail_with_url_ending_by_jsp() { - orchestrator.executeBuild(SonarRunner.create(ItUtils.projectDir("shared/xoo-sample")) + orchestrator.executeBuild(SonarScanner.create(ItUtils.projectDir("shared/xoo-sample")) .setProperty("sonar.projectKey", "myproject.jsp")); // Access dashboard Selenese selenese = Selenese.builder().setHtmlTestsInClasspath("url_ending_by_jsp", diff --git a/it/it-tests/src/test/java/it/settings/SettingsTestRestartingOrchestrator.java b/it/it-tests/src/test/java/it/settings/SettingsTestRestartingOrchestrator.java index f0ebfe4816d..4472da3a92a 100644 --- a/it/it-tests/src/test/java/it/settings/SettingsTestRestartingOrchestrator.java +++ b/it/it-tests/src/test/java/it/settings/SettingsTestRestartingOrchestrator.java @@ -20,7 +20,7 @@ package it.settings; import com.sonar.orchestrator.Orchestrator; -import com.sonar.orchestrator.build.SonarRunner; +import com.sonar.orchestrator.build.SonarScanner; import com.sonar.orchestrator.selenium.Selenese; import java.net.URL; import org.junit.After; @@ -97,9 +97,9 @@ public class SettingsTestRestartingOrchestrator { .build(); orchestrator.start(); - SonarRunner withDeprecatedKey = SonarRunner.create(projectDir("shared/xoo-sample")) + SonarScanner withDeprecatedKey = SonarScanner.create(projectDir("shared/xoo-sample")) .setProperty("sonar.deprecatedKey", "true"); - SonarRunner withNewKey = SonarRunner.create(projectDir("shared/xoo-sample")) + SonarScanner withNewKey = SonarScanner.create(projectDir("shared/xoo-sample")) .setProperty("sonar.newKey", "true"); // should not fail orchestrator.executeBuilds(withDeprecatedKey, withNewKey); diff --git a/it/it-tests/src/test/java/it/settings/SubCategoriesTest.java b/it/it-tests/src/test/java/it/settings/SubCategoriesTest.java index 3c87d7c97f2..73378604579 100644 --- a/it/it-tests/src/test/java/it/settings/SubCategoriesTest.java +++ b/it/it-tests/src/test/java/it/settings/SubCategoriesTest.java @@ -20,7 +20,7 @@ package it.settings; import com.sonar.orchestrator.Orchestrator; -import com.sonar.orchestrator.build.SonarRunner; +import com.sonar.orchestrator.build.SonarScanner; import com.sonar.orchestrator.selenium.Selenese; import it.Category1Suite; import org.junit.ClassRule; @@ -58,7 +58,7 @@ public class SubCategoriesTest { */ @Test public void should_support_project_subcategories() { - orchestrator.executeBuild(SonarRunner.create(projectDir("shared/xoo-sample"))); + orchestrator.executeBuild(SonarScanner.create(projectDir("shared/xoo-sample"))); Selenese selenese = Selenese.builder().setHtmlTestsInClasspath("subcategories", "/settings/subcategories/project-subcategories.html", diff --git a/it/it-tests/src/test/java/it/sourceCode/ProjectCodeTest.java b/it/it-tests/src/test/java/it/sourceCode/ProjectCodeTest.java index bd794bf6682..7135aa77f30 100644 --- a/it/it-tests/src/test/java/it/sourceCode/ProjectCodeTest.java +++ b/it/it-tests/src/test/java/it/sourceCode/ProjectCodeTest.java @@ -20,7 +20,7 @@ package it.sourceCode; import com.sonar.orchestrator.Orchestrator; -import com.sonar.orchestrator.build.SonarRunner; +import com.sonar.orchestrator.build.SonarScanner; import com.sonar.orchestrator.selenium.Selenese; import it.Category1Suite; import org.junit.ClassRule; @@ -39,7 +39,9 @@ public class ProjectCodeTest { executeBuild("shared/xoo-sample", "project-for-code", "Project For Code"); Selenese selenese = Selenese.builder().setHtmlTestsInClasspath("test_project_code_page", - "/sourceCode/ProjectCodeTest/test_project_code_page.html" + "/sourceCode/ProjectCodeTest/test_project_code_page.html", + "/sourceCode/ProjectCodeTest/search.html", + "/sourceCode/ProjectCodeTest/permalink.html" ).build(); new SeleneseTest(selenese).runOn(orchestrator); } @@ -56,7 +58,7 @@ public class ProjectCodeTest { private void executeBuild(String projectLocation, String projectKey, String projectName) { orchestrator.executeBuild( - SonarRunner.create(projectDir(projectLocation)) + SonarScanner.create(projectDir(projectLocation)) .setProjectKey(projectKey) .setProjectName(projectName) ); diff --git a/it/it-tests/src/test/java/it/test/CoverageTest.java b/it/it-tests/src/test/java/it/test/CoverageTest.java index a76ba175497..106cd9ffbce 100644 --- a/it/it-tests/src/test/java/it/test/CoverageTest.java +++ b/it/it-tests/src/test/java/it/test/CoverageTest.java @@ -20,7 +20,7 @@ package it.test; import com.sonar.orchestrator.Orchestrator; -import com.sonar.orchestrator.build.SonarRunner; +import com.sonar.orchestrator.build.SonarScanner; import it.Category2Suite; import java.io.File; import org.apache.commons.io.FileUtils; @@ -56,7 +56,7 @@ public class CoverageTest { @Test public void unit_test_coverage() throws Exception { - orchestrator.executeBuilds(SonarRunner.create(projectDir("testing/xoo-sample-ut-coverage"))); + orchestrator.executeBuilds(SonarScanner.create(projectDir("testing/xoo-sample-ut-coverage"))); Resource project = orchestrator.getServer().getWsClient().find(ResourceQuery.createForMetrics("sample-ut-coverage", ALL_COVERAGE_METRICS)); assertThat(project.getMeasureValue("line_coverage")).isEqualTo(50.0); @@ -87,7 +87,7 @@ public class CoverageTest { @Test public void unit_test_coverage_no_condition() throws Exception { - orchestrator.executeBuilds(SonarRunner.create(projectDir("testing/xoo-sample-ut-coverage-no-condition"))); + orchestrator.executeBuilds(SonarScanner.create(projectDir("testing/xoo-sample-ut-coverage-no-condition"))); Resource project = orchestrator.getServer().getWsClient().find(ResourceQuery.createForMetrics("sample-ut-coverage", ALL_COVERAGE_METRICS)); assertThat(project.getMeasureValue("line_coverage")).isEqualTo(50.0); @@ -112,7 +112,7 @@ public class CoverageTest { @Test public void it_coverage() throws Exception { - orchestrator.executeBuilds(SonarRunner.create(projectDir("testing/xoo-sample-it-coverage"))); + orchestrator.executeBuilds(SonarScanner.create(projectDir("testing/xoo-sample-it-coverage"))); Resource project = orchestrator.getServer().getWsClient().find(ResourceQuery.createForMetrics("sample-it-coverage", ALL_COVERAGE_METRICS)); assertThat(project.getMeasureValue("coverage")).isNull(); @@ -136,7 +136,7 @@ public class CoverageTest { @Test public void ut_and_it_coverage() throws Exception { - orchestrator.executeBuilds(SonarRunner.create(projectDir("testing/xoo-sample-overall-coverage"))); + orchestrator.executeBuilds(SonarScanner.create(projectDir("testing/xoo-sample-overall-coverage"))); Resource project = orchestrator.getServer().getWsClient().find(ResourceQuery.createForMetrics("sample-overall-coverage", ALL_COVERAGE_METRICS)); assertThat(project.getMeasureValue("line_coverage")).isEqualTo(50.0); @@ -175,7 +175,7 @@ public class CoverageTest { */ @Test public void should_compute_coverage_on_project() { - orchestrator.executeBuilds(SonarRunner.create(projectDir("testing/xoo-half-covered"))); + orchestrator.executeBuilds(SonarScanner.create(projectDir("testing/xoo-half-covered"))); Resource project = orchestrator.getServer().getWsClient().find(ResourceQuery.createForMetrics("xoo-half-covered", ALL_COVERAGE_METRICS)); assertThat(project.getMeasureValue("coverage")).isEqualTo(50.0); @@ -188,7 +188,7 @@ public class CoverageTest { */ @Test public void should_ignore_coverage_on_full_path() { - orchestrator.executeBuilds(SonarRunner.create(projectDir("testing/xoo-half-covered")) + orchestrator.executeBuilds(SonarScanner.create(projectDir("testing/xoo-half-covered")) .setProperty("sonar.coverage.exclusions", "src/main/xoo/org/sonar/tests/halfcovered/UnCovered.xoo")); Resource project = orchestrator.getServer().getWsClient().find(ResourceQuery.createForMetrics("xoo-half-covered", ALL_COVERAGE_METRICS)); @@ -202,7 +202,7 @@ public class CoverageTest { */ @Test public void should_ignore_coverage_on_pattern() { - orchestrator.executeBuilds(SonarRunner.create(projectDir("testing/xoo-half-covered")) + orchestrator.executeBuilds(SonarScanner.create(projectDir("testing/xoo-half-covered")) .setProperty("sonar.coverage.exclusions", "**/UnCovered*")); Resource project = orchestrator.getServer().getWsClient().find(ResourceQuery.createForMetrics("xoo-half-covered", ALL_COVERAGE_METRICS)); @@ -216,7 +216,7 @@ public class CoverageTest { */ @Test public void should_not_have_coverage_at_all() { - orchestrator.executeBuilds(SonarRunner.create(projectDir("testing/xoo-half-covered")) + orchestrator.executeBuilds(SonarScanner.create(projectDir("testing/xoo-half-covered")) .setProperty("sonar.coverage.exclusions", "**/*")); Resource project = orchestrator.getServer().getWsClient().find(ResourceQuery.createForMetrics("xoo-half-covered", ALL_COVERAGE_METRICS)); diff --git a/it/it-tests/src/test/java/it/test/CoverageTrackingTest.java b/it/it-tests/src/test/java/it/test/CoverageTrackingTest.java index 656f8de6a00..c6ebc56b30b 100644 --- a/it/it-tests/src/test/java/it/test/CoverageTrackingTest.java +++ b/it/it-tests/src/test/java/it/test/CoverageTrackingTest.java @@ -20,7 +20,7 @@ package it.test; import com.sonar.orchestrator.Orchestrator; -import com.sonar.orchestrator.build.SonarRunner; +import com.sonar.orchestrator.build.SonarScanner; import it.Category2Suite; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -47,7 +47,7 @@ public class CoverageTrackingTest { @Test public void test_coverage_per_test() throws Exception { - orchestrator.executeBuilds(SonarRunner.create(projectDir("testing/xoo-sample-with-coverage-per-test"))); + orchestrator.executeBuilds(SonarScanner.create(projectDir("testing/xoo-sample-with-coverage-per-test"))); String tests = orchestrator.getServer().adminWsClient().get("api/tests/list", "testFileKey", "sample-with-tests:src/test/xoo/sample/SampleTest.xoo"); JSONAssert.assertEquals(IOUtils.toString(this.getClass().getResourceAsStream("/test/CoverageTrackingTest/tests-expected.json"), "UTF-8"), tests, false); diff --git a/it/it-tests/src/test/java/it/test/NewCoverageTest.java b/it/it-tests/src/test/java/it/test/NewCoverageTest.java index 07cbdb082e6..9d14a1f05c3 100644 --- a/it/it-tests/src/test/java/it/test/NewCoverageTest.java +++ b/it/it-tests/src/test/java/it/test/NewCoverageTest.java @@ -20,7 +20,7 @@ package it.test; import com.sonar.orchestrator.Orchestrator; -import com.sonar.orchestrator.build.SonarRunner; +import com.sonar.orchestrator.build.SonarScanner; import it.Category2Suite; import org.assertj.core.data.Offset; import org.junit.BeforeClass; @@ -51,11 +51,11 @@ public class NewCoverageTest { public static void analyze_project() { orchestrator.resetData(); - orchestrator.executeBuilds(SonarRunner.create(projectDir("testing/xoo-sample-new-coverage-v1")) + orchestrator.executeBuilds(SonarScanner.create(projectDir("testing/xoo-sample-new-coverage-v1")) .setProperty("sonar.projectDate", "2015-02-01") .setProperty("sonar.scm.disabled", "false") ); - orchestrator.executeBuilds(SonarRunner.create(projectDir("testing/xoo-sample-new-coverage-v2")) + orchestrator.executeBuilds(SonarScanner.create(projectDir("testing/xoo-sample-new-coverage-v2")) .setProperty("sonar.scm.disabled", "false")); } diff --git a/it/it-tests/src/test/java/it/test/TestExecutionTest.java b/it/it-tests/src/test/java/it/test/TestExecutionTest.java index dc0ec63afca..f0d11de0533 100644 --- a/it/it-tests/src/test/java/it/test/TestExecutionTest.java +++ b/it/it-tests/src/test/java/it/test/TestExecutionTest.java @@ -20,7 +20,7 @@ package it.test; import com.sonar.orchestrator.Orchestrator; -import com.sonar.orchestrator.build.SonarRunner; +import com.sonar.orchestrator.build.SonarScanner; import it.Category2Suite; import org.apache.commons.io.IOUtils; import org.junit.Before; @@ -45,7 +45,7 @@ public class TestExecutionTest { @Test public void test_execution() throws Exception { - orchestrator.executeBuilds(SonarRunner.create(projectDir("testing/xoo-sample-with-tests-execution"))); + orchestrator.executeBuilds(SonarScanner.create(projectDir("testing/xoo-sample-with-tests-execution"))); Resource project = orchestrator.getServer().getWsClient() .find(ResourceQuery.createForMetrics("sample-with-tests", "test_success_density", "test_failures", "test_errors", "tests", "skipped_tests", "test_execution_time")); diff --git a/it/it-tests/src/test/java/it/ui/UiTest.java b/it/it-tests/src/test/java/it/ui/UiTest.java index 5bebfc5cb00..66a90fbc6d6 100644 --- a/it/it-tests/src/test/java/it/ui/UiTest.java +++ b/it/it-tests/src/test/java/it/ui/UiTest.java @@ -23,7 +23,6 @@ import com.sonar.orchestrator.Orchestrator; import com.sonar.orchestrator.selenium.Selenese; import it.Category4Suite; import org.junit.ClassRule; -import org.junit.Ignore; import org.junit.Test; import org.junit.experimental.categories.Category; import util.QaOnly; @@ -36,7 +35,6 @@ public class UiTest { public static Orchestrator orchestrator = Category4Suite.ORCHESTRATOR; @Test - @Ignore("Temporary disable to allow 5.6-RC1 to be released") public void test_footer() { new SeleneseTest( Selenese.builder().setHtmlTestsInClasspath("ui-footer", diff --git a/it/it-tests/src/test/java/it/user/FavouriteTest.java b/it/it-tests/src/test/java/it/user/FavouriteTest.java index 46e18f07e3a..a97d6aad437 100644 --- a/it/it-tests/src/test/java/it/user/FavouriteTest.java +++ b/it/it-tests/src/test/java/it/user/FavouriteTest.java @@ -22,7 +22,7 @@ package it.user; import com.google.common.base.Function; import com.google.common.collect.Iterables; import com.sonar.orchestrator.Orchestrator; -import com.sonar.orchestrator.build.SonarRunner; +import com.sonar.orchestrator.build.SonarScanner; import it.Category4Suite; import java.util.List; import org.junit.Before; @@ -52,7 +52,7 @@ public class FavouriteTest { @Before public void inspectProject() { orchestrator.resetData(); - orchestrator.executeBuild(SonarRunner.create(projectDir("shared/xoo-sample"))); + orchestrator.executeBuild(SonarScanner.create(projectDir("shared/xoo-sample"))); } @Test diff --git a/it/it-tests/src/test/java/it/user/LocalAuthenticationTest.java b/it/it-tests/src/test/java/it/user/LocalAuthenticationTest.java index 07a6ec4830a..83019aecd2f 100644 --- a/it/it-tests/src/test/java/it/user/LocalAuthenticationTest.java +++ b/it/it-tests/src/test/java/it/user/LocalAuthenticationTest.java @@ -21,7 +21,7 @@ package it.user; import com.sonar.orchestrator.Orchestrator; import com.sonar.orchestrator.build.BuildResult; -import com.sonar.orchestrator.build.SonarRunner; +import com.sonar.orchestrator.build.SonarScanner; import com.sonar.orchestrator.locator.FileLocation; import com.sonar.orchestrator.selenium.Selenese; import it.Category4Suite; @@ -147,7 +147,7 @@ public class LocalAuthenticationTest { WsUserTokens.GenerateWsResponse generateWsResponse = userTokensWsClient.generate(new GenerateWsRequest() .setLogin(LOGIN) .setName(tokenName)); - SonarRunner sampleProject = SonarRunner.create(projectDir("shared/xoo-sample")); + SonarScanner sampleProject = SonarScanner.create(projectDir("shared/xoo-sample")); sampleProject.setProperties( "sonar.login", generateWsResponse.getToken(), "sonar.password", ""); @@ -160,7 +160,7 @@ public class LocalAuthenticationTest { @Test public void run_analysis_with_incorrect_token() { - SonarRunner sampleProject = SonarRunner.create(projectDir("shared/xoo-sample")); + SonarScanner sampleProject = SonarScanner.create(projectDir("shared/xoo-sample")); sampleProject.setProperties( "sonar.login", "unknown-token", "sonar.password", ""); diff --git a/it/it-tests/src/test/java/it/user/MyAccountPageTest.java b/it/it-tests/src/test/java/it/user/MyAccountPageTest.java index 02bb82a41ec..d532af28a8f 100644 --- a/it/it-tests/src/test/java/it/user/MyAccountPageTest.java +++ b/it/it-tests/src/test/java/it/user/MyAccountPageTest.java @@ -20,13 +20,10 @@ package it.user; import com.sonar.orchestrator.Orchestrator; +import com.sonar.orchestrator.build.SonarScanner; import com.sonar.orchestrator.selenium.Selenese; import it.Category4Suite; -import org.junit.After; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.ClassRule; -import org.junit.Test; +import org.junit.*; import org.junit.experimental.categories.Category; import org.sonarqube.ws.client.PostRequest; import org.sonarqube.ws.client.WsClient; @@ -34,6 +31,7 @@ import util.QaOnly; import util.selenium.SeleneseTest; import static util.ItUtils.newAdminWsClient; +import static util.ItUtils.projectDir; @Category(QaOnly.class) public class MyAccountPageTest { @@ -44,6 +42,7 @@ public class MyAccountPageTest { @BeforeClass public static void setUp() { + orchestrator.resetData(); adminWsClient = newAdminWsClient(orchestrator); } @@ -81,6 +80,24 @@ public class MyAccountPageTest { new SeleneseTest(selenese).runOn(orchestrator); } + @Test + public void should_display_projects() throws Exception { + // first, try on empty instance + Selenese selenese = Selenese.builder().setHtmlTestsInClasspath("should_display_projects", + "/user/MyAccountPageTest/should_display_no_projects.html" + ).build(); + new SeleneseTest(selenese).runOn(orchestrator); + + // then, analyze a project + analyzeProject("sample"); + grantAdminPermission("account-user", "sample"); + + selenese = Selenese.builder().setHtmlTestsInClasspath("should_display_projects", + "/user/MyAccountPageTest/should_display_projects.html" + ).build(); + new SeleneseTest(selenese).runOn(orchestrator); + } + private static void createUser(String login, String name, String email) { adminWsClient.wsConnector().call( new PostRequest("api/users/create") @@ -96,4 +113,19 @@ public class MyAccountPageTest { .setParam("login", login)); } + private static void analyzeProject(String projectKey) { + SonarScanner build = SonarScanner.create(projectDir("qualitygate/xoo-sample")) + .setProjectKey(projectKey) + .setProperty("sonar.projectDescription", "Description of a project") + .setProperty("sonar.links.homepage", "http://example.com"); + orchestrator.executeBuild(build); + } + + private static void grantAdminPermission(String login, String projectKey) { + adminWsClient.wsConnector().call( + new PostRequest("api/permissions/add_user") + .setParam("login", login) + .setParam("projectKey", projectKey) + .setParam("permission", "admin")); + } } diff --git a/it/it-tests/src/test/java/it/user/OAuth2IdentityProviderTest.java b/it/it-tests/src/test/java/it/user/OAuth2IdentityProviderTest.java index 7ca114f194c..c7645ef00b0 100644 --- a/it/it-tests/src/test/java/it/user/OAuth2IdentityProviderTest.java +++ b/it/it-tests/src/test/java/it/user/OAuth2IdentityProviderTest.java @@ -20,8 +20,8 @@ package it.user; import com.sonar.orchestrator.Orchestrator; -import com.squareup.okhttp.mockwebserver.MockResponse; -import com.squareup.okhttp.mockwebserver.MockWebServer; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; import it.Category4Suite; import java.net.HttpURLConnection; import org.junit.After; diff --git a/it/it-tests/src/test/java/it/user/RailsExternalAuthenticationTest.java b/it/it-tests/src/test/java/it/user/RailsExternalAuthenticationTest.java index fd7280fef4d..048eb41037f 100644 --- a/it/it-tests/src/test/java/it/user/RailsExternalAuthenticationTest.java +++ b/it/it-tests/src/test/java/it/user/RailsExternalAuthenticationTest.java @@ -19,17 +19,23 @@ */ package it.user; -import com.google.common.base.Objects; +import static java.net.HttpURLConnection.HTTP_OK; +import static java.net.HttpURLConnection.HTTP_UNAUTHORIZED; +import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.Assert.fail; +import static util.ItUtils.pluginArtifact; +import static util.ItUtils.setServerProperty; + import com.google.common.collect.ImmutableMap; import com.google.common.collect.Maps; import com.sonar.orchestrator.Orchestrator; import com.sonar.orchestrator.selenium.Selenese; import java.util.Map; +import java.util.Objects; import org.apache.commons.lang.RandomStringUtils; import org.junit.After; import org.junit.Before; import org.junit.ClassRule; -import org.junit.Ignore; import org.junit.Rule; import org.junit.Test; import org.junit.experimental.categories.Category; @@ -51,13 +57,6 @@ import org.sonarqube.ws.client.WsResponse; import util.QaOnly; import util.selenium.SeleneseTest; -import static java.net.HttpURLConnection.HTTP_OK; -import static java.net.HttpURLConnection.HTTP_UNAUTHORIZED; -import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.Assert.fail; -import static util.ItUtils.pluginArtifact; -import static util.ItUtils.setServerProperty; - /** * Test deprecated authentication done by Rails. It's kept has every features has not bee migrated to java yet. * @@ -90,7 +89,6 @@ public class RailsExternalAuthenticationTest { public void resetData() throws Exception { setServerProperty(orchestrator, USERS_PROPERTY, null); setServerProperty(orchestrator, "sonar.security.updateUserAttributes", null); - setServerProperty(orchestrator, "sonar.security.savePassword", null); setServerProperty(orchestrator, "sonar.authenticator.createUsers", null); resetUsers(USER_LOGIN, TECH_USER); } @@ -177,44 +175,6 @@ public class RailsExternalAuthenticationTest { * SONAR-3138 */ @Test - @Ignore("Fail because sonar.security.savePassword is only read at startup => this test should start its own server") - public void shouldFallback() { - // Given clean Sonar installation and no users in external system - setServerProperty(orchestrator, "sonar.security.savePassword", "true"); - String login = USER_LOGIN; - String oldPassword = "1234567"; - Map<String, String> users = Maps.newHashMap(); - - // When user created in external system - users.put(login + ".password", oldPassword); - updateUsersInExtAuth(users); - // Then - assertThat(loginAttempt(login, oldPassword)).isEqualTo(AUTHORIZED); - - // When new external password was set - String newPassword = "7654321"; - users.put(login + ".password", newPassword); - updateUsersInExtAuth(users); - // Then - assertThat(loginAttempt(login, newPassword)).isEqualTo(AUTHORIZED); - - assertThat(loginAttempt(login, oldPassword)).isEqualTo(NOT_AUTHORIZED); - - assertThat(loginAttempt(login, "wrong")).isEqualTo(NOT_AUTHORIZED); - - // When external system does not work - users.remove(login + ".password"); - updateUsersInExtAuth(users); - // Then - assertThat(loginAttempt(login, newPassword)).isEqualTo(AUTHORIZED); - assertThat(loginAttempt(login, oldPassword)).isEqualTo(NOT_AUTHORIZED); - assertThat(loginAttempt(login, "wrong")).isEqualTo(NOT_AUTHORIZED); - } - - /** - * SONAR-3138 - */ - @Test public void shouldNotFallback() { // Given clean Sonar installation and no users in external system String login = USER_LOGIN; @@ -240,7 +200,6 @@ public class RailsExternalAuthenticationTest { @Test public void adminIsLocalAccountByDefault() { // Given clean Sonar installation and no users in external system - setServerProperty(orchestrator, "sonar.security.savePassword", "false"); String login = "admin"; String localPassword = "admin"; String remotePassword = "nimda"; @@ -401,7 +360,7 @@ public class RailsExternalAuthenticationTest { } try { String value = wsClient.find(new UserPropertyQuery("auth")).getValue(); - if (!Objects.equal(value, expectedValue)) { + if (!Objects.equals(value, expectedValue)) { // exceptional case - update+retrieval were successful, but value doesn't match throw new IllegalStateException("Expected " + expectedValue + " , but got " + value); } diff --git a/it/it-tests/src/test/java/util/selenium/SeleneseTest.java b/it/it-tests/src/test/java/util/selenium/SeleneseTest.java index 14b87375398..bf84e6416d7 100644 --- a/it/it-tests/src/test/java/util/selenium/SeleneseTest.java +++ b/it/it-tests/src/test/java/util/selenium/SeleneseTest.java @@ -162,6 +162,9 @@ public class SeleneseTest { case "waitForElementPresent": waitForElementPresent(param1, param2); return this; + case "waitForElementNotPresent": + waitForElementNotPresent(param1, param2); + return this; case "waitForVisible": waitForVisible(param1); return this; @@ -388,6 +391,14 @@ public class SeleneseTest { } } + private void waitForElementNotPresent(String selector, String text) { + if (Strings.isNullOrEmpty(text)) { + find(selector).should().not().exist(); + } else { + find(selector).withText(text).should().not().exist(); + } + } + private void waitForVisible(String selector) { find(selector).should().beDisplayed(); } diff --git a/it/it-tests/src/test/resources/administration/UsersPageTest/admin_should_change_its_own_password.html b/it/it-tests/src/test/resources/administration/UsersPageTest/admin_should_change_its_own_password.html index 78bbdd81b58..6152139f9d5 100644 --- a/it/it-tests/src/test/resources/administration/UsersPageTest/admin_should_change_its_own_password.html +++ b/it/it-tests/src/test/resources/administration/UsersPageTest/admin_should_change_its_own_password.html @@ -35,6 +35,11 @@ <td></td> </tr> <tr> + <td>waitForElementPresent</td> + <td>css=.js-user-authenticated</td> + <td></td> +</tr> +<tr> <td>open</td> <td>/users</td> <td></td> diff --git a/it/it-tests/src/test/resources/administration/UsersPageTest/generate_and_revoke_user_token.html b/it/it-tests/src/test/resources/administration/UsersPageTest/generate_and_revoke_user_token.html index aeb8df593f6..005b6546d03 100644 --- a/it/it-tests/src/test/resources/administration/UsersPageTest/generate_and_revoke_user_token.html +++ b/it/it-tests/src/test/resources/administration/UsersPageTest/generate_and_revoke_user_token.html @@ -40,6 +40,11 @@ <td></td> </tr> <tr> + <td>waitForElementPresent</td> + <td>css=.js-user-authenticated</td> + <td></td> +</tr> +<tr> <td>open</td> <td>/users</td> <td></td> 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> diff --git a/it/it-tests/src/test/resources/authorisation/PermissionTemplatesPageTest/should_manage_project_creators.html b/it/it-tests/src/test/resources/authorisation/PermissionTemplatesPageTest/should_manage_project_creators.html new file mode 100644 index 00000000000..e8a576509aa --- /dev/null +++ b/it/it-tests/src/test/resources/authorisation/PermissionTemplatesPageTest/should_manage_project_creators.html @@ -0,0 +1,109 @@ +<?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_manage_project_creators</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=td[data-permission="user"]</td> + <td></td> +</tr> +<tr> + <td>click</td> + <td>css=td[data-permission="user"] .js-update-users</td> + <td></td> +</tr> +<tr> + <td>waitForElementPresent</td> + <td>css=#grant-to-project-creators</td> + <td></td> +</tr> +<tr> + <td>assertElementPresent</td> + <td>css=#grant-to-project-creators:not(:checked)</td> + <td></td> +</tr> +<tr> + <td>click</td> + <td>css=#grant-to-project-creators</td> + <td></td> +</tr> +<tr> + <td>click</td> + <td>css=.js-modal-close</td> + <td></td> +</tr> +<tr> + <td>waitForElementPresent</td> + <td>css=td[data-permission="user"] .js-project-creators</td> + <td></td> +</tr> +<tr> + <td>click</td> + <td>css=td[data-permission="user"] .js-update-users</td> + <td></td> +</tr> +<tr> + <td>waitForElementPresent</td> + <td>css=#grant-to-project-creators</td> + <td></td> +</tr> +<tr> + <td>assertElementPresent</td> + <td>css=#grant-to-project-creators:checked</td> + <td></td> +</tr> +<tr> + <td>click</td> + <td>css=#grant-to-project-creators</td> + <td></td> +</tr> +<tr> + <td>click</td> + <td>css=.js-modal-close</td> + <td></td> +</tr> +<tr> + <td>waitForElementNotPresent</td> + <td>css=td[data-permission="user"] .js-project-creators</td> + <td></td> +</tr> +</tbody> +</table> +</body> +</html> diff --git a/it/it-tests/src/test/resources/authorisation/ProvisioningPermissionTest/should-be-able-to-provision-project.html b/it/it-tests/src/test/resources/authorisation/ProvisioningPermissionTest/should-be-able-to-provision-project.html index d88d5f532de..e968d015676 100644 --- a/it/it-tests/src/test/resources/authorisation/ProvisioningPermissionTest/should-be-able-to-provision-project.html +++ b/it/it-tests/src/test/resources/authorisation/ProvisioningPermissionTest/should-be-able-to-provision-project.html @@ -34,6 +34,11 @@ <td></td> </tr> <tr> + <td>waitForElementPresent</td> + <td>css=.js-user-authenticated</td> + <td></td> + </tr> + <tr> <td>open</td> <td>/projects</td> <td></td> @@ -44,9 +49,9 @@ <td></td> </tr> <tr> - <td>assertElementPresent</td> + <td>assertText</td> <td>css=.page-actions button</td> - <td></td> + <td>*Create Project*</td> </tr> </tbody> </table> diff --git a/it/it-tests/src/test/resources/authorisation/ProvisioningPermissionTest/should-not-be-able-to-provision-project.html b/it/it-tests/src/test/resources/authorisation/ProvisioningPermissionTest/should-not-be-able-to-provision-project.html index 2a114a66173..428cf851541 100644 --- a/it/it-tests/src/test/resources/authorisation/ProvisioningPermissionTest/should-not-be-able-to-provision-project.html +++ b/it/it-tests/src/test/resources/authorisation/ProvisioningPermissionTest/should-not-be-able-to-provision-project.html @@ -34,6 +34,11 @@ <td></td> </tr> <tr> + <td>waitForElementPresent</td> + <td>css=.js-user-authenticated</td> + <td></td> + </tr> + <tr> <td>open</td> <td>/projects</td> <td></td> @@ -44,9 +49,9 @@ <td></td> </tr> <tr> - <td>assertElementNotPresent</td> + <td>assertNotText</td> <td>css=.page-actions button</td> - <td></td> + <td>*Create Project*</td> </tr> </tbody> </table> diff --git a/it/it-tests/src/test/resources/authorisation/QualityProfileAdminPermissionTest/normal-user.html b/it/it-tests/src/test/resources/authorisation/QualityProfileAdminPermissionTest/normal-user.html index ef778363fc3..1d1fb924396 100644 --- a/it/it-tests/src/test/resources/authorisation/QualityProfileAdminPermissionTest/normal-user.html +++ b/it/it-tests/src/test/resources/authorisation/QualityProfileAdminPermissionTest/normal-user.html @@ -34,44 +34,34 @@ <td></td> </tr> <tr> - <td>open</td> - <td>/profiles</td> + <td>waitForElementPresent</td> + <td>css=.js-user-authenticated</td> <td></td> </tr> <tr> - <td>waitForText</td> - <td>css=.quality-profiles-results</td> - <td>*Basic*</td> - </tr> - <tr> - <td>assertNotText</td> - <td>css=.search-navigator-filters</td> - <td>*Create*</td> - </tr> - <tr> - <td>assertNotText</td> - <td>css=.search-navigator-filters</td> - <td>*Restore Profile*</td> + <td>open</td> + <td>/profiles</td> + <td></td> </tr> <tr> - <td>assertNotText</td> - <td>css=.search-navigator-filters</td> - <td>*Restore Built-in Profiles*</td> + <td>waitForElementPresent</td> + <td>css=.quality-profiles-table-row[data-name="Basic"]</td> + <td></td> </tr> <tr> - <td>open</td> - <td>/project/profile/sample</td> + <td>click</td> + <td>css=.quality-profiles-table-row[data-name="Basic"] .quality-profiles-table-name a</td> <td></td> </tr> <tr> <td>waitForText</td> - <td>id=content</td> - <td>*Log In to SonarQube*</td> + <td>css=.quality-profile-header</td> + <td>*Basic*</td> </tr> <tr> - <td>waitForText</td> - <td>id=login_form</td> - <td>glob:*You are not authorized to access this page*</td> + <td>assertElementNotPresent</td> + <td>css=.js-change-parent</td> + <td></td> </tr> </tbody> </table> diff --git a/it/it-tests/src/test/resources/authorisation/QualityProfileAdminPermissionTest/profile-admin.html b/it/it-tests/src/test/resources/authorisation/QualityProfileAdminPermissionTest/profile-admin.html index af19a0a1da2..083c7539e19 100644 --- a/it/it-tests/src/test/resources/authorisation/QualityProfileAdminPermissionTest/profile-admin.html +++ b/it/it-tests/src/test/resources/authorisation/QualityProfileAdminPermissionTest/profile-admin.html @@ -34,44 +34,49 @@ <td></td> </tr> <tr> + <td>waitForElementPresent</td> + <td>css=.js-user-authenticated</td> + <td></td> +</tr> +<tr> <td>open</td> <td>/profiles</td> <td></td> </tr> <tr> - <td>waitForText</td> - <td>css=.quality-profiles-results</td> - <td>*Basic*</td> + <td>waitForElementPresent</td> + <td>css=.quality-profiles-table-row[data-name="Basic"]</td> + <td></td> </tr> <tr> - <td>waitForText</td> - <td>css=.search-navigator-filters</td> - <td>*Create*</td> + <td>click</td> + <td>css=.quality-profiles-table-row[data-name="Basic"] .quality-profiles-table-name a</td> + <td></td> </tr> <tr> - <td>waitForText</td> - <td>css=.search-navigator-filters</td> - <td>*Restore Profile*</td> + <td>waitForText</td> + <td>css=.quality-profile-header</td> + <td>*Basic*</td> </tr> <tr> - <td>waitForText</td> - <td>css=.search-navigator-filters</td> - <td>*Restore Built-in Profiles*</td> + <td>assertElementPresent</td> + <td>css=.js-change-parent</td> + <td></td> </tr> <tr> - <td>open</td> - <td>/project/profile/sample</td> - <td></td> + <td>open</td> + <td>/project/profile/sample</td> + <td></td> </tr> <tr> - <td>waitForText</td> - <td>id=content</td> - <td>*Quality Profiles*</td> + <td>waitForText</td> + <td>id=content</td> + <td>*Quality Profiles*</td> </tr> <tr> - <td>assertValue</td> - <td>id=submit-xoo</td> - <td>glob:*Update*</td> + <td>assertValue</td> + <td>id=submit-xoo</td> + <td>glob:*Update*</td> </tr> </tbody> </table> diff --git a/it/it-tests/src/test/resources/issue/IssueNotificationsTest/email_configuration.html b/it/it-tests/src/test/resources/issue/IssueNotificationsTest/email_configuration.html index e79ce04527e..578817a1c43 100644 --- a/it/it-tests/src/test/resources/issue/IssueNotificationsTest/email_configuration.html +++ b/it/it-tests/src/test/resources/issue/IssueNotificationsTest/email_configuration.html @@ -34,6 +34,11 @@ <td></td> </tr> <tr> + <td>waitForElementPresent</td> + <td>css=.js-user-authenticated</td> + <td></td> + </tr> + <tr> <td>open</td> <td>/email_configuration</td> <td></td> diff --git a/it/it-tests/src/test/resources/issue/IssueNotificationsTest/user_notifications_settings.html b/it/it-tests/src/test/resources/issue/IssueNotificationsTest/user_notifications_settings.html index 0bd235376ec..ba82e3ac356 100644 --- a/it/it-tests/src/test/resources/issue/IssueNotificationsTest/user_notifications_settings.html +++ b/it/it-tests/src/test/resources/issue/IssueNotificationsTest/user_notifications_settings.html @@ -34,6 +34,11 @@ <td></td> </tr> <tr> + <td>waitForElementPresent</td> + <td>css=.js-user-authenticated</td> + <td></td> + </tr> + <tr> <td>open</td> <td>/account/notifications</td> <td></td> diff --git a/it/it-tests/src/test/resources/issue/IssueSearchTest/redirect_to_search_url_after_wrong_login.html b/it/it-tests/src/test/resources/issue/IssueSearchTest/redirect_to_search_url_after_wrong_login.html index 4390d4b8c0e..edd297e5b43 100644 --- a/it/it-tests/src/test/resources/issue/IssueSearchTest/redirect_to_search_url_after_wrong_login.html +++ b/it/it-tests/src/test/resources/issue/IssueSearchTest/redirect_to_search_url_after_wrong_login.html @@ -8,61 +8,66 @@ <table cellpadding="1" cellspacing="1" border="1"> <tbody> <tr> - <td>open</td> - <td>/sessions/logout</td> - <td></td> - </tr> - <tr> - <td>open</td> - <td>/issues/search#resolved=true|statuses=OPEN</td> - <td></td> - </tr> - <tr> - <td>assertLocation</td> - <td>*/sessions/new*</td> - <td></td> - </tr> - <tr> - <td>assertElementPresent</td> - <td>login_form</td> - <td></td> - </tr> - <tr> - <td>type</td> - <td>id=login</td> - <td>wrong login</td> - </tr> - <tr> - <td>type</td> - <td>id=password</td> - <td>wrong password</td> - </tr> - <tr> - <td>clickAndWait</td> - <td>commit</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>commit</td> - <td></td> - </tr> - <tr> - <td>assertLocation</td> - <td>*#resolved=true|statuses=OPEN*</td> - <td></td> - </tr> - </tbody> + <td>open</td> + <td>/sessions/logout</td> + <td></td> +</tr> +<tr> + <td>open</td> + <td>/issues/search#resolved=true|statuses=OPEN</td> + <td></td> +</tr> +<tr> + <td>assertLocation</td> + <td>*/sessions/new*</td> + <td></td> +</tr> +<tr> + <td>assertElementPresent</td> + <td>login_form</td> + <td></td> +</tr> +<tr> + <td>type</td> + <td>id=login</td> + <td>wrong login</td> +</tr> +<tr> + <td>type</td> + <td>id=password</td> + <td>wrong password</td> +</tr> +<tr> + <td>click</td> + <td>commit</td> + <td></td> +</tr> +<tr> + <td>waitForText</td> + <td>css=.alert</td> + <td>*Authentication failed*</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>commit</td> + <td></td> +</tr> +<tr> + <td>assertLocation</td> + <td>*#resolved=true|statuses=OPEN*</td> + <td></td> +</tr> +</tbody> </table> </body> </html> diff --git a/it/it-tests/src/test/resources/issue/IssuesPageTest/save_new_issue_filter.html b/it/it-tests/src/test/resources/issue/IssuesPageTest/save_new_issue_filter.html new file mode 100644 index 00000000000..a7686cb8c58 --- /dev/null +++ b/it/it-tests/src/test/resources/issue/IssuesPageTest/save_new_issue_filter.html @@ -0,0 +1,105 @@ +<?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"/> + <link rel="selenium.base" href="http://localhost:49506"/> + <title>save_new_issue_filter</title> +</head> +<body> +<table cellpadding="1" cellspacing="1" border="1"> + <thead> + <tr> + <td rowspan="1" colspan="3">save_new_issue_filter</td> + </tr> + </thead> + <tbody> + <tr> + <td>open</td> + <td>/sessions/login</td> + <td></td> +</tr> +<tr> + <td>type</td> + <td>login</td> + <td>admin</td> +</tr> +<tr> + <td>type</td> + <td>password</td> + <td>admin</td> +</tr> +<tr> + <td>clickAndWait</td> + <td>commit</td> + <td></td> +</tr> +<tr> + <td>waitForElementPresent</td> + <td>css=.js-user-authenticated</td> + <td></td> +</tr> +<tr> + <td>open</td> + <td>/issues/search</td> + <td></td> +</tr> +<tr> + <td>waitForElementPresent</td> + <td>css=.js-facet[data-value="BUG"]</td> + <td></td> +</tr> +<tr> + <td>click</td> + <td>css=.js-facet[data-value="BUG"]</td> + <td></td> +</tr> +<tr> + <td>waitForElementPresent</td> + <td>css=.js-facet.active[data-value="BUG"]</td> + <td></td> +</tr> +<tr> + <td>click</td> + <td>css=.js-filter-save-as</td> + <td></td> +</tr> +<tr> + <td>waitForElementPresent</td> + <td>css=input[name="name"]</td> + <td></td> +</tr> +<tr> + <td>type</td> + <td>name</td> + <td>test</td> +</tr> +<tr> + <td>type</td> + <td>description</td> + <td>super filter</td> +</tr> +<tr> + <td>click</td> + <td>css=#save-as-submit</td> + <td></td> +</tr> +<tr> + <td>waitForText</td> + <td>css=.issues-filters-name</td> + <td>*test*</td> +</tr> +<tr> + <td>waitForText</td> + <td>css=.search-navigator-filters-description</td> + <td>*super filter*</td> +</tr> +<tr> + <td>waitForElementPresent</td> + <td>css=.js-facet.active[data-value="BUG"]</td> + <td></td> +</tr> +</tbody> +</table> +</body> +</html> diff --git a/it/it-tests/src/test/resources/measure/ProjectOverviewTest/test_project_overview_after_first_analysis.html b/it/it-tests/src/test/resources/measure/ProjectOverviewTest/test_project_overview_after_first_analysis.html index d9ba349bae6..071c91eb3bd 100644 --- a/it/it-tests/src/test/resources/measure/ProjectOverviewTest/test_project_overview_after_first_analysis.html +++ b/it/it-tests/src/test/resources/measure/ProjectOverviewTest/test_project_overview_after_first_analysis.html @@ -26,8 +26,8 @@ </tr> <tr> <td>waitForText</td> - <td>id=content</td> - <td>*0*A*Code Smells*0*Debt*</td> + <td>id=overview-code-smells</td> + <td>*0*A*Debt*0*Code Smells*</td> </tr> <tr> <td>waitForText</td> diff --git a/it/it-tests/src/test/resources/measureFilter/MeasureFiltersTest/copy_measure_filter.html b/it/it-tests/src/test/resources/measureFilter/MeasureFiltersTest/copy_measure_filter.html index 559a0d2e9d3..e88d2a374c5 100644 --- a/it/it-tests/src/test/resources/measureFilter/MeasureFiltersTest/copy_measure_filter.html +++ b/it/it-tests/src/test/resources/measureFilter/MeasureFiltersTest/copy_measure_filter.html @@ -39,6 +39,11 @@ <td></td> </tr> <tr> + <td>waitForElementPresent</td> + <td>css=.js-user-authenticated</td> + <td></td> +</tr> +<tr> <td>open</td> <td>/measures</td> <td></td> diff --git a/it/it-tests/src/test/resources/measureFilter/MeasureFiltersTest/copy_uniqueness_of_name.html b/it/it-tests/src/test/resources/measureFilter/MeasureFiltersTest/copy_uniqueness_of_name.html index 4cdff2a7a6f..33c575f7dc2 100644 --- a/it/it-tests/src/test/resources/measureFilter/MeasureFiltersTest/copy_uniqueness_of_name.html +++ b/it/it-tests/src/test/resources/measureFilter/MeasureFiltersTest/copy_uniqueness_of_name.html @@ -39,6 +39,11 @@ <td></td> </tr> <tr> + <td>waitForElementPresent</td> + <td>css=.js-user-authenticated</td> + <td></td> +</tr> +<tr> <td>open</td> <td>/measures</td> <td></td> diff --git a/it/it-tests/src/test/resources/measureFilter/MeasureFiltersTest/list_change_columns.html b/it/it-tests/src/test/resources/measureFilter/MeasureFiltersTest/list_change_columns.html index d7b3f886a06..2e7b51c505c 100644 --- a/it/it-tests/src/test/resources/measureFilter/MeasureFiltersTest/list_change_columns.html +++ b/it/it-tests/src/test/resources/measureFilter/MeasureFiltersTest/list_change_columns.html @@ -34,6 +34,11 @@ <td></td> </tr> <tr> + <td>waitForElementPresent</td> + <td>css=.js-user-authenticated</td> + <td></td> + </tr> + <tr> <td>open</td> <td>/measures</td> <td></td> diff --git a/it/it-tests/src/test/resources/measureFilter/MeasureFiltersTest/list_sort_by_descending_name.html b/it/it-tests/src/test/resources/measureFilter/MeasureFiltersTest/list_sort_by_descending_name.html index e9a6405b438..e7fb0df8579 100644 --- a/it/it-tests/src/test/resources/measureFilter/MeasureFiltersTest/list_sort_by_descending_name.html +++ b/it/it-tests/src/test/resources/measureFilter/MeasureFiltersTest/list_sort_by_descending_name.html @@ -55,7 +55,7 @@ </tr> <tr> <td>clickAndWait</td> - <td>link=NAME</td> + <td>link=Name</td> <td></td> </tr> <tr> diff --git a/it/it-tests/src/test/resources/measureFilter/MeasureFiltersTest/list_widget.html b/it/it-tests/src/test/resources/measureFilter/MeasureFiltersTest/list_widget.html index acbbc61e350..dd38f5d361f 100644 --- a/it/it-tests/src/test/resources/measureFilter/MeasureFiltersTest/list_widget.html +++ b/it/it-tests/src/test/resources/measureFilter/MeasureFiltersTest/list_widget.html @@ -34,6 +34,11 @@ <td></td> </tr> <tr> + <td>waitForElementPresent</td> + <td>css=.js-user-authenticated</td> + <td></td> +</tr> +<tr> <td>clickAndWait</td> <td>xpath=(//table[contains(@id, 'shared-filters')]//a[contains(text(),'Projects')])</td> <td></td> diff --git a/it/it-tests/src/test/resources/measureFilter/MeasureFiltersTest/list_widget_sort.html b/it/it-tests/src/test/resources/measureFilter/MeasureFiltersTest/list_widget_sort.html index 2b4b072cde6..ab4dda0d92a 100644 --- a/it/it-tests/src/test/resources/measureFilter/MeasureFiltersTest/list_widget_sort.html +++ b/it/it-tests/src/test/resources/measureFilter/MeasureFiltersTest/list_widget_sort.html @@ -39,6 +39,11 @@ <td></td> </tr> <tr> + <td>waitForElementPresent</td> + <td>css=.js-user-authenticated</td> + <td></td> +</tr> +<tr> <td>open</td> <td>/measures</td> <td></td> diff --git a/it/it-tests/src/test/resources/measureFilter/MeasureFiltersTest/save_with_special_characters.html b/it/it-tests/src/test/resources/measureFilter/MeasureFiltersTest/save_with_special_characters.html index ea6b998299b..a757677af9d 100644 --- a/it/it-tests/src/test/resources/measureFilter/MeasureFiltersTest/save_with_special_characters.html +++ b/it/it-tests/src/test/resources/measureFilter/MeasureFiltersTest/save_with_special_characters.html @@ -35,6 +35,11 @@ <td></td> </tr> <tr> + <td>waitForElementPresent</td> + <td>css=.js-user-authenticated</td> + <td></td> + </tr> + <tr> <td>open</td> <td>/measures</td> <td></td> diff --git a/it/it-tests/src/test/resources/measureFilter/MeasureFiltersTest/should-not-share-filter-when-user-have-no-sharing-permissions.html b/it/it-tests/src/test/resources/measureFilter/MeasureFiltersTest/should-not-share-filter-when-user-have-no-sharing-permissions.html index cbcc3685da8..fe75c78c0b5 100644 --- a/it/it-tests/src/test/resources/measureFilter/MeasureFiltersTest/should-not-share-filter-when-user-have-no-sharing-permissions.html +++ b/it/it-tests/src/test/resources/measureFilter/MeasureFiltersTest/should-not-share-filter-when-user-have-no-sharing-permissions.html @@ -39,6 +39,11 @@ <td></td> </tr> <tr> + <td>waitForElementPresent</td> + <td>css=.js-user-authenticated</td> + <td></td> +</tr> +<tr> <td>open</td> <td>/measures</td> <td></td> diff --git a/it/it-tests/src/test/resources/measureFilter/MeasureFiltersTest/should-unshare-filter-remove-other-filters-favourite.html b/it/it-tests/src/test/resources/measureFilter/MeasureFiltersTest/should-unshare-filter-remove-other-filters-favourite.html index dd5f99b68ff..885412059bb 100644 --- a/it/it-tests/src/test/resources/measureFilter/MeasureFiltersTest/should-unshare-filter-remove-other-filters-favourite.html +++ b/it/it-tests/src/test/resources/measureFilter/MeasureFiltersTest/should-unshare-filter-remove-other-filters-favourite.html @@ -39,6 +39,11 @@ <td></td> </tr> <tr> + <td>waitForElementPresent</td> + <td>css=.js-user-authenticated</td> + <td></td> +</tr> +<tr> <td>open</td> <td>/measures</td> <td></td> @@ -114,6 +119,11 @@ <td></td> </tr> <tr> + <td>waitForElementPresent</td> + <td>css=.js-user-authenticated</td> + <td></td> +</tr> +<tr> <td>open</td> <td>/measures/manage</td> <td></td> @@ -159,6 +169,11 @@ <td></td> </tr> <tr> + <td>waitForElementPresent</td> + <td>css=.js-user-authenticated</td> + <td></td> +</tr> +<tr> <td>open</td> <td>/measures</td> <td></td> @@ -229,6 +244,11 @@ <td></td> </tr> <tr> + <td>waitForElementPresent</td> + <td>css=.js-user-authenticated</td> + <td></td> +</tr> +<tr> <td>open</td> <td>/measures/manage</td> <td></td> diff --git a/it/it-tests/src/test/resources/measureHistory/HistoryUiTest/history-timeline-widget/should-display-even-if-one-missing-metric.html b/it/it-tests/src/test/resources/measureHistory/HistoryUiTest/history-timeline-widget/should-display-even-if-one-missing-metric.html index 44615acc462..1b23ceab818 100644 --- a/it/it-tests/src/test/resources/measureHistory/HistoryUiTest/history-timeline-widget/should-display-even-if-one-missing-metric.html +++ b/it/it-tests/src/test/resources/measureHistory/HistoryUiTest/history-timeline-widget/should-display-even-if-one-missing-metric.html @@ -10,13 +10,13 @@ <thead> <tr><td rowspan="1" colspan="3">timeline</td></tr> </thead><tbody> - <tr> +<tr> <td>open</td> - <td>/widget?id=timeline&resource=sample&metric1=complexity&metric2=commits</td> - <td></td> + <td>/widget?id=timeline&resource=sample&metric1=complexity&metric2=commits</td> + <td></td> </tr> <tr> - <td>assertElementPresent</td> + <td>waitForElementPresent</td> <td>timeline-chart-1</td> <td></td> </tr> diff --git a/it/it-tests/src/test/resources/projectAdministration/BackgroundTasksTest/should_not_display_failing_and_search_and_filter_elements_on_project_level_page.html b/it/it-tests/src/test/resources/projectAdministration/BackgroundTasksTest/should_not_display_failing_and_search_and_filter_elements_on_project_level_page.html index 92e83f2859e..375340060e7 100644 --- a/it/it-tests/src/test/resources/projectAdministration/BackgroundTasksTest/should_not_display_failing_and_search_and_filter_elements_on_project_level_page.html +++ b/it/it-tests/src/test/resources/projectAdministration/BackgroundTasksTest/should_not_display_failing_and_search_and_filter_elements_on_project_level_page.html @@ -35,11 +35,16 @@ <td>admin</td> </tr> <tr> - <td>clickAndWait</td> + <td>click</td> <td>commit</td> <td></td> </tr> <tr> + <td>waitForElementPresent</td> + <td>css=.js-user-authenticated</td> + <td></td> +</tr> +<tr> <td>open</td> <td>/project/background_tasks?id=test-project</td> <td></td> diff --git a/it/it-tests/src/test/resources/projectAdministration/BulkDeletionTest/bulk-delete-filter-projects.html b/it/it-tests/src/test/resources/projectAdministration/BulkDeletionTest/bulk-delete-filter-projects.html index a2335a7916c..b1a78ffe504 100644 --- a/it/it-tests/src/test/resources/projectAdministration/BulkDeletionTest/bulk-delete-filter-projects.html +++ b/it/it-tests/src/test/resources/projectAdministration/BulkDeletionTest/bulk-delete-filter-projects.html @@ -34,6 +34,11 @@ <td></td> </tr> <tr> + <td>waitForElementPresent</td> + <td>css=.js-user-authenticated</td> + <td></td> +</tr> +<tr> <td>open</td> <td>/projects</td> <td></td> diff --git a/it/it-tests/src/test/resources/projectAdministration/ProjectAdministrationTest/project-administration/multimodule-project-delete-version.html b/it/it-tests/src/test/resources/projectAdministration/ProjectAdministrationTest/project-administration/multimodule-project-delete-version.html index 891986cbc9f..e253d793207 100644 --- a/it/it-tests/src/test/resources/projectAdministration/ProjectAdministrationTest/project-administration/multimodule-project-delete-version.html +++ b/it/it-tests/src/test/resources/projectAdministration/ProjectAdministrationTest/project-administration/multimodule-project-delete-version.html @@ -1,23 +1,4 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- - ~ SonarQube, open source software quality management tool. - ~ Copyright (C) 2008-2014 SonarSource - ~ mailto:contact AT sonarsource DOT com - ~ - ~ SonarQube 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. - ~ - ~ SonarQube 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. - --> <!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"> @@ -59,6 +40,11 @@ <td></td> </tr> <tr> + <td>waitForElementPresent</td> + <td>css=.js-user-authenticated</td> + <td></td> + </tr> + <tr> <td>open</td> <td>/project/history/com.sonarsource.it.samples:multi-modules-sample</td> <td></td> @@ -76,7 +62,7 @@ <tr> <td>waitForText</td> <td>infomsg</td> - <td>glob:*Version "RELEASE" was removed from current project and all its sub-projects*</td> + <td>glob:*Version "RELEASE" was removed from current project*</td> </tr> <tr> <td>assertNotText</td> diff --git a/it/it-tests/src/test/resources/projectAdministration/ProjectAdministrationTest/project-administration/multimodule-project-modify-version.html b/it/it-tests/src/test/resources/projectAdministration/ProjectAdministrationTest/project-administration/multimodule-project-modify-version.html index a1d31f93d3a..56f9bc81169 100644 --- a/it/it-tests/src/test/resources/projectAdministration/ProjectAdministrationTest/project-administration/multimodule-project-modify-version.html +++ b/it/it-tests/src/test/resources/projectAdministration/ProjectAdministrationTest/project-administration/multimodule-project-modify-version.html @@ -1,24 +1,4 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- - ~ SonarQube, open source software quality management tool. - ~ Copyright (C) 2008-2014 SonarSource - ~ mailto:contact AT sonarsource DOT com - ~ - ~ SonarQube 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. - ~ - ~ SonarQube 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. - --> - <!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"> @@ -54,11 +34,16 @@ <td>admin</td> </tr> <tr> - <td>clickAndWait</td> + <td>click</td> <td>commit</td> <td></td> </tr> <tr> + <td>waitForElementPresent</td> + <td>css=.js-user-authenticated</td> + <td></td> + </tr> + <tr> <td>open</td> <td>/project/history/com.sonarsource.it.samples:multi-modules-sample</td> <td></td> @@ -91,7 +76,7 @@ <tr> <td>waitForText</td> <td>infomsg</td> - <td>Version "RELEASE" was created for current project and all its sub-projects.</td> + <td>Version "RELEASE" was created for current project.</td> </tr> <tr> <td>waitForText</td> diff --git a/it/it-tests/src/test/resources/projectAdministration/ProjectAdministrationTest/project-deletion/project-deletion.html b/it/it-tests/src/test/resources/projectAdministration/ProjectAdministrationTest/project-deletion/project-deletion.html index d67d7b7d800..16a057b896a 100644 --- a/it/it-tests/src/test/resources/projectAdministration/ProjectAdministrationTest/project-deletion/project-deletion.html +++ b/it/it-tests/src/test/resources/projectAdministration/ProjectAdministrationTest/project-deletion/project-deletion.html @@ -39,6 +39,11 @@ <td></td> </tr> <tr> + <td>waitForElementPresent</td> + <td>css=.js-user-authenticated</td> + <td></td> +</tr> +<tr> <td>open</td> <td>/</td> <td></td> diff --git a/it/it-tests/src/test/resources/projectAdministration/ProjectAdministrationTest/project-settings/only-on-project-settings.html b/it/it-tests/src/test/resources/projectAdministration/ProjectAdministrationTest/project-settings/only-on-project-settings.html index e06e83d52ce..9197fa9c348 100644 --- a/it/it-tests/src/test/resources/projectAdministration/ProjectAdministrationTest/project-settings/only-on-project-settings.html +++ b/it/it-tests/src/test/resources/projectAdministration/ProjectAdministrationTest/project-settings/only-on-project-settings.html @@ -39,6 +39,11 @@ <td></td> </tr> <tr> + <td>waitForElementPresent</td> + <td>css=.js-user-authenticated</td> + <td></td> + </tr> + <tr> <td>type</td> <td>id=input_prop_only_on_project</td> <td>foo</td> diff --git a/it/it-tests/src/test/resources/projectAdministration/ProjectAdministrationTest/project-settings/override-global-settings.html b/it/it-tests/src/test/resources/projectAdministration/ProjectAdministrationTest/project-settings/override-global-settings.html index f9ab41f50b3..a73b2ca1475 100644 --- a/it/it-tests/src/test/resources/projectAdministration/ProjectAdministrationTest/project-settings/override-global-settings.html +++ b/it/it-tests/src/test/resources/projectAdministration/ProjectAdministrationTest/project-settings/override-global-settings.html @@ -39,6 +39,11 @@ <td></td> </tr> <tr> + <td>waitForElementPresent</td> + <td>css=.js-user-authenticated</td> + <td></td> +</tr> +<tr> <td>type</td> <td>id=input_sonar.exclusions</td> <td>my-exclusions</td> diff --git a/it/it-tests/src/test/resources/projectAdministration/ProjectAdministrationTest/project-update-keys/bulk-update-impossible-because-duplicate-keys.html b/it/it-tests/src/test/resources/projectAdministration/ProjectAdministrationTest/project-update-keys/bulk-update-impossible-because-duplicate-keys.html index 3a80a92df24..dcffc75a5a2 100644 --- a/it/it-tests/src/test/resources/projectAdministration/ProjectAdministrationTest/project-update-keys/bulk-update-impossible-because-duplicate-keys.html +++ b/it/it-tests/src/test/resources/projectAdministration/ProjectAdministrationTest/project-update-keys/bulk-update-impossible-because-duplicate-keys.html @@ -34,6 +34,11 @@ <td></td> </tr> <tr> + <td>waitForElementPresent</td> + <td>css=.js-user-authenticated</td> + <td></td> +</tr> +<tr> <td>open</td> <td>/dashboard/index/com.sonarsource.it.samples:multi-modules-sample</td> <td></td> diff --git a/it/it-tests/src/test/resources/projectAdministration/ProjectAdministrationTest/project-update-keys/bulk-update-impossible-because-no-match.html b/it/it-tests/src/test/resources/projectAdministration/ProjectAdministrationTest/project-update-keys/bulk-update-impossible-because-no-match.html index 2e667543a15..f4e01d07dba 100644 --- a/it/it-tests/src/test/resources/projectAdministration/ProjectAdministrationTest/project-update-keys/bulk-update-impossible-because-no-match.html +++ b/it/it-tests/src/test/resources/projectAdministration/ProjectAdministrationTest/project-update-keys/bulk-update-impossible-because-no-match.html @@ -34,6 +34,11 @@ <td></td> </tr> <tr> + <td>waitForElementPresent</td> + <td>css=.js-user-authenticated</td> + <td></td> + </tr> + <tr> <td>open</td> <td>/dashboard/index/com.sonarsource.it.samples:multi-modules-sample</td> <td></td> diff --git a/it/it-tests/src/test/resources/projectAdministration/ProjectAdministrationTest/project-update-keys/bulk-update-success.html b/it/it-tests/src/test/resources/projectAdministration/ProjectAdministrationTest/project-update-keys/bulk-update-success.html index 88a5ea62b34..e75663989ca 100644 --- a/it/it-tests/src/test/resources/projectAdministration/ProjectAdministrationTest/project-update-keys/bulk-update-success.html +++ b/it/it-tests/src/test/resources/projectAdministration/ProjectAdministrationTest/project-update-keys/bulk-update-success.html @@ -34,6 +34,11 @@ <td></td> </tr> <tr> + <td>waitForElementPresent</td> + <td>css=.js-user-authenticated</td> + <td></td> +</tr> +<tr> <td>open</td> <td>/dashboard/index/com.sonarsource.it.samples:multi-modules-sample</td> <td></td> diff --git a/it/it-tests/src/test/resources/projectAdministration/ProjectAdministrationTest/project-update-keys/fine-grained-update-impossible.html b/it/it-tests/src/test/resources/projectAdministration/ProjectAdministrationTest/project-update-keys/fine-grained-update-impossible.html index c143353b823..d074667d223 100644 --- a/it/it-tests/src/test/resources/projectAdministration/ProjectAdministrationTest/project-update-keys/fine-grained-update-impossible.html +++ b/it/it-tests/src/test/resources/projectAdministration/ProjectAdministrationTest/project-update-keys/fine-grained-update-impossible.html @@ -34,6 +34,11 @@ <td></td> </tr> <tr> + <td>waitForElementPresent</td> + <td>css=.js-user-authenticated</td> + <td></td> + </tr> + <tr> <td>open</td> <td>/dashboard/index/com.sonarsource.it.samples:multi-modules-sample</td> <td></td> diff --git a/it/it-tests/src/test/resources/projectAdministration/ProjectAdministrationTest/project-update-keys/fine-grained-update-success.html b/it/it-tests/src/test/resources/projectAdministration/ProjectAdministrationTest/project-update-keys/fine-grained-update-success.html index fc2eaedd1ef..4f2d9d597eb 100644 --- a/it/it-tests/src/test/resources/projectAdministration/ProjectAdministrationTest/project-update-keys/fine-grained-update-success.html +++ b/it/it-tests/src/test/resources/projectAdministration/ProjectAdministrationTest/project-update-keys/fine-grained-update-success.html @@ -34,6 +34,11 @@ <td></td> </tr> <tr> + <td>waitForElementPresent</td> + <td>css=.js-user-authenticated</td> + <td></td> + </tr> + <tr> <td>open</td> <td>/dashboard/index/com.sonarsource.it.samples:multi-modules-sample</td> <td></td> diff --git a/it/it-tests/src/test/resources/projectAdministration/ProjectPermissionsTest/test_project_permissions_page_shows_only_single_project.html b/it/it-tests/src/test/resources/projectAdministration/ProjectPermissionsTest/test_project_permissions_page_shows_only_single_project.html index 8062527e3e0..cbb6595ff20 100644 --- a/it/it-tests/src/test/resources/projectAdministration/ProjectPermissionsTest/test_project_permissions_page_shows_only_single_project.html +++ b/it/it-tests/src/test/resources/projectAdministration/ProjectPermissionsTest/test_project_permissions_page_shows_only_single_project.html @@ -40,6 +40,11 @@ <td></td> </tr> <tr> + <td>waitForElementPresent</td> + <td>css=.js-user-authenticated</td> + <td></td> + </tr> + <tr> <td>open</td> <td>/project_roles?id=project-permissions-project</td> <td></td> diff --git a/it/it-tests/src/test/resources/projectEvent/EventTest/create_delete_standard_event.html b/it/it-tests/src/test/resources/projectEvent/EventTest/create_delete_standard_event.html index f004a1f29a9..b94fadf8d65 100644 --- a/it/it-tests/src/test/resources/projectEvent/EventTest/create_delete_standard_event.html +++ b/it/it-tests/src/test/resources/projectEvent/EventTest/create_delete_standard_event.html @@ -39,6 +39,11 @@ <td></td> </tr> <tr> + <td>waitForElementPresent</td> + <td>css=.js-user-authenticated</td> + <td></td> +</tr> +<tr> <td>open</td> <td>/project/history?id=sample</td> <td></td> diff --git a/it/it-tests/src/test/resources/projectEvent/EventTest/create_event_with_special_character.html b/it/it-tests/src/test/resources/projectEvent/EventTest/create_event_with_special_character.html index 8df480d22a7..c191a260a07 100644 --- a/it/it-tests/src/test/resources/projectEvent/EventTest/create_event_with_special_character.html +++ b/it/it-tests/src/test/resources/projectEvent/EventTest/create_event_with_special_character.html @@ -39,6 +39,11 @@ <td></td> </tr> <tr> + <td>waitForElementPresent</td> + <td>css=.js-user-authenticated</td> + <td></td> +</tr> +<tr> <td>open</td> <td>/project/history?id=sample</td> <td></td> diff --git a/it/it-tests/src/test/resources/projectEvent/EventTest/show_events_using_filters.html b/it/it-tests/src/test/resources/projectEvent/EventTest/show_events_using_filters.html index 4ee440a0833..ca90b8077fc 100644 --- a/it/it-tests/src/test/resources/projectEvent/EventTest/show_events_using_filters.html +++ b/it/it-tests/src/test/resources/projectEvent/EventTest/show_events_using_filters.html @@ -39,6 +39,11 @@ <td></td> </tr> <tr> + <td>waitForElementPresent</td> + <td>css=.js-user-authenticated</td> + <td></td> +</tr> +<tr> <td>open</td> <td>/project/history?id=sample</td> <td></td> diff --git a/it/it-tests/src/test/resources/qualityGate/QualityGateUiTest/should-display-alerts-correctly-history-page.html b/it/it-tests/src/test/resources/qualityGate/QualityGateUiTest/should-display-alerts-correctly-history-page.html index 8a0c160497f..3038a8931cb 100644 --- a/it/it-tests/src/test/resources/qualityGate/QualityGateUiTest/should-display-alerts-correctly-history-page.html +++ b/it/it-tests/src/test/resources/qualityGate/QualityGateUiTest/should-display-alerts-correctly-history-page.html @@ -54,6 +54,11 @@ <td></td> </tr> <tr> + <td>waitForElementPresent</td> + <td>css=.js-user-authenticated</td> + <td></td> + </tr> + <tr> <td>open</td> <td>/dashboard/index/sample</td> <td></td> diff --git a/it/it-tests/src/test/resources/qualityGate/QualityGateUiTest/should-display-period-alerts-correctly.html b/it/it-tests/src/test/resources/qualityGate/QualityGateUiTest/should-display-period-alerts-correctly.html index 573cbbd9ff3..3a1f8699e13 100644 --- a/it/it-tests/src/test/resources/qualityGate/QualityGateUiTest/should-display-period-alerts-correctly.html +++ b/it/it-tests/src/test/resources/qualityGate/QualityGateUiTest/should-display-period-alerts-correctly.html @@ -54,6 +54,11 @@ <td></td> </tr> <tr> + <td>waitForElementPresent</td> + <td>css=.js-user-authenticated</td> + <td></td> + </tr> + <tr> <td>open</td> <td>/widget?id=alerts&resource=sample</td> <td></td> diff --git a/it/it-tests/src/test/resources/qualityGate/notifications/activate_notification_channels.html b/it/it-tests/src/test/resources/qualityGate/notifications/activate_notification_channels.html index fc1b770918e..40de82c178a 100644 --- a/it/it-tests/src/test/resources/qualityGate/notifications/activate_notification_channels.html +++ b/it/it-tests/src/test/resources/qualityGate/notifications/activate_notification_channels.html @@ -34,6 +34,11 @@ <td></td> </tr> <tr> + <td>waitForElementPresent</td> + <td>css=.js-user-authenticated</td> + <td></td> +</tr> +<tr> <td>open</td> <td>/sonar/account/notifications</td> <td></td> diff --git a/it/it-tests/src/test/resources/qualityGate/notifications/email_configuration.html b/it/it-tests/src/test/resources/qualityGate/notifications/email_configuration.html index dace0c5d07e..7b43cf8ee03 100644 --- a/it/it-tests/src/test/resources/qualityGate/notifications/email_configuration.html +++ b/it/it-tests/src/test/resources/qualityGate/notifications/email_configuration.html @@ -34,6 +34,11 @@ <td></td> </tr> <tr> + <td>waitForElementPresent</td> + <td>css=.js-user-authenticated</td> + <td></td> + </tr> + <tr> <td>open</td> <td>/email_configuration</td> <td></td> diff --git a/it/it-tests/src/test/resources/qualityProfile/QualityProfilesPageTest/not_found.html b/it/it-tests/src/test/resources/qualityProfile/QualityProfilesPageTest/not_found.html new file mode 100644 index 00000000000..220d39856d6 --- /dev/null +++ b/it/it-tests/src/test/resources/qualityProfile/QualityProfilesPageTest/not_found.html @@ -0,0 +1,24 @@ +<?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>not_found</title> +</head> +<body> +<table cellpadding="1" cellspacing="1" border="1"> + <tbody> + <tr> + <td>open</td> + <td>/profiles/show?key=unknown</td> + <td></td> + </tr> + <tr> + <td>waitForElementPresent</td> + <td>css=.quality-profile-not-found</td> + <td></td> + </tr> + </tbody> +</table> +</body> +</html>
\ No newline at end of file diff --git a/it/it-tests/src/test/resources/qualityProfile/QualityProfilesPageTest/should_compare.html b/it/it-tests/src/test/resources/qualityProfile/QualityProfilesPageTest/should_compare.html new file mode 100644 index 00000000000..c2339d690f6 --- /dev/null +++ b/it/it-tests/src/test/resources/qualityProfile/QualityProfilesPageTest/should_compare.html @@ -0,0 +1,60 @@ +<?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"/> + <link rel="selenium.base" href="http://localhost:49506"/> + <title>should_display_changelog</title> +</head> +<body> +<table cellpadding="1" cellspacing="1" border="1"> +<thead> +<tr> +<td rowspan="1" colspan="3">should_display_changelog</td> +</tr> +</thead> +<tbody> +<tr> + <td>open</td> + <td>/profiles</td> + <td></td> +</tr> +<tr> + <td>waitForElementPresent</td> + <td>css=.quality-profiles-table-name a[href^="/profiles/show?key=xoo-sample"]</td> + <td></td> +</tr> +<tr> + <td>click</td> + <td>css=.quality-profiles-table-name a[href^="/profiles/show?key=xoo-sample"]</td> + <td></td> +</tr> +<tr> + <td>waitForElementPresent</td> + <td>css=.quality-profile-header .dropdown-toggle</td> + <td></td> +</tr> +<tr> + <td>click</td> + <td>css=.quality-profile-header .dropdown-toggle</td> + <td></td> +</tr> +<tr> + <td>click</td> + <td>css=#quality-profile-compare</td> + <td></td> +</tr> +<tr> + <td>waitForElementPresent</td> + <td>css=.js-profile-comparison .Select</td> + <td></td> +</tr> +<tr> + <td>click</td> + <td>css=.js-profile-comparison .Select-control</td> + <td></td> +</tr> +</tbody> +</table> +</body> +</html> diff --git a/it/it-tests/src/test/resources/qualityProfile/QualityProfilesPageTest/should_copy.html b/it/it-tests/src/test/resources/qualityProfile/QualityProfilesPageTest/should_copy.html new file mode 100644 index 00000000000..16812ddbb28 --- /dev/null +++ b/it/it-tests/src/test/resources/qualityProfile/QualityProfilesPageTest/should_copy.html @@ -0,0 +1,110 @@ +<?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"/> + <link rel="selenium.base" href="http://localhost:49506"/> + <title>should_create</title> +</head> +<body> +<table cellpadding="1" cellspacing="1" border="1"> +<thead> +<tr> +<td rowspan="1" colspan="3">should_create</td> +</tr> +</thead> +<tbody> +<tr> + <td>open</td> + <td>/sessions/logout</td> + <td></td> +</tr> +<tr> + <td>open</td> + <td>/sessions/login</td> + <td></td> +</tr> +<tr> + <td>type</td> + <td>id=password</td> + <td>admin</td> +</tr> +<tr> + <td>type</td> + <td>id=login</td> + <td>admin</td> +</tr> +<tr> + <td>clickAndWait</td> + <td>name=commit</td> + <td></td> +</tr> +<tr> + <td>waitForElementPresent</td> + <td>css=.js-user-authenticated</td> + <td></td> +</tr> +<tr> + <td>open</td> + <td>/profiles</td> + <td></td> +</tr> +<tr> + <td>waitForElementPresent</td> + <td>css=.quality-profiles-table-name a[href^="/profiles/show?key=xoo-sample"]</td> + <td></td> +</tr> +<tr> + <td>click</td> + <td>css=.quality-profiles-table-name a[href^="/profiles/show?key=xoo-sample"]</td> + <td></td> +</tr> +<tr> + <td>waitForElementPresent</td> + <td>css=.quality-profile-header .dropdown-toggle</td> + <td></td> +</tr> +<tr> + <td>click</td> + <td>css=.quality-profile-header .dropdown-toggle</td> + <td></td> +</tr> +<tr> + <td>click</td> + <td>css=#quality-profile-copy</td> + <td></td> +</tr> +<tr> + <td>type</td> + <td>css=#copy-profile-name</td> + <td>copied</td> +</tr> +<tr> + <td>click</td> + <td>css=#copy-profile-submit</td> + <td></td> +</tr> +<tr> + <td>waitForText</td> + <td>css=.quality-profile-header</td> + <td>*copied*</td> +</tr> +<tr> + <td>waitForText</td> + <td>css=.quality-profile-rules</td> + <td>*1*Bugs*0*Vulnerabilities*0*Code Smells*1*</td> +</tr> +<tr> + <td>open</td> + <td>/profiles</td> + <td></td> +</tr> +<tr> + <td>waitForElementPresent</td> + <td>css=.quality-profiles-table-row[data-name="copied"]</td> + <td></td> +</tr> +</tbody> +</table> +</body> +</html> diff --git a/it/it-tests/src/test/resources/qualityProfile/QualityProfilesPageTest/should_create.html b/it/it-tests/src/test/resources/qualityProfile/QualityProfilesPageTest/should_create.html new file mode 100644 index 00000000000..f2c5fae2aa8 --- /dev/null +++ b/it/it-tests/src/test/resources/qualityProfile/QualityProfilesPageTest/should_create.html @@ -0,0 +1,110 @@ +<?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"/> + <link rel="selenium.base" href="http://localhost:49506"/> + <title>should_create</title> +</head> +<body> +<table cellpadding="1" cellspacing="1" border="1"> +<thead> +<tr> +<td rowspan="1" colspan="3">should_create</td> +</tr> +</thead> +<tbody> +<tr> + <td>open</td> + <td>/sessions/logout</td> + <td></td> +</tr> +<tr> + <td>open</td> + <td>/sessions/login</td> + <td></td> +</tr> +<tr> + <td>type</td> + <td>id=password</td> + <td>admin</td> +</tr> +<tr> + <td>type</td> + <td>id=login</td> + <td>admin</td> +</tr> +<tr> + <td>clickAndWait</td> + <td>name=commit</td> + <td></td> +</tr> +<tr> + <td>waitForElementPresent</td> + <td>css=.js-user-authenticated</td> + <td></td> +</tr> +<tr> + <td>open</td> + <td>/profiles</td> + <td></td> +</tr> +<tr> + <td>waitForElementPresent</td> + <td>css=#quality-profiles-create</td> + <td></td> +</tr> +<tr> + <td>click</td> + <td>css=#quality-profiles-create</td> + <td></td> +</tr> +<tr> + <td>waitForElementPresent</td> + <td>css=#create-profile-name</td> + <td></td> +</tr> +<tr> + <td>assertElementPresent</td> + <td>css=#create-profile-form-backup-XooProfileImporter</td> + <td></td> +</tr> +<tr> + <td>type</td> + <td>css=#create-profile-name</td> + <td>test</td> +</tr> +<tr> + <td>click</td> + <td>css=#create-profile-submit</td> + <td></td> +</tr> +<tr> + <td>waitForElementPresent</td> + <td>css=.quality-profile-header</td> + <td></td> +</tr> +<tr> + <td>waitForText</td> + <td>css=.quality-profile-header</td> + <td>*test*</td> +</tr> +<tr> + <td>waitForText</td> + <td>css=.quality-profile-rules</td> + <td>*Bugs*0*Vulnerabilities*0*Code Smells*0*</td> +</tr> +<tr> + <td>open</td> + <td>/profiles</td> + <td></td> +</tr> +<tr> + <td>waitForElementPresent</td> + <td>css=.quality-profiles-table-row[data-name="test"]</td> + <td></td> +</tr> +</tbody> +</table> +</body> +</html> diff --git a/it/it-tests/src/test/resources/qualityProfile/QualityProfilesPageTest/should_delete.html b/it/it-tests/src/test/resources/qualityProfile/QualityProfilesPageTest/should_delete.html new file mode 100644 index 00000000000..c83aa07fdfc --- /dev/null +++ b/it/it-tests/src/test/resources/qualityProfile/QualityProfilesPageTest/should_delete.html @@ -0,0 +1,115 @@ +<?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"/> + <link rel="selenium.base" href="http://localhost:49506"/> + <title>should_create</title> +</head> +<body> +<table cellpadding="1" cellspacing="1" border="1"> +<thead> +<tr> +<td rowspan="1" colspan="3">should_create</td> +</tr> +</thead> +<tbody> +<tr> + <td>open</td> + <td>/sessions/logout</td> + <td></td> +</tr> +<tr> + <td>open</td> + <td>/sessions/login</td> + <td></td> +</tr> +<tr> + <td>type</td> + <td>id=password</td> + <td>admin</td> +</tr> +<tr> + <td>type</td> + <td>id=login</td> + <td>admin</td> +</tr> +<tr> + <td>clickAndWait</td> + <td>name=commit</td> + <td></td> +</tr> +<tr> + <td>waitForElementPresent</td> + <td>css=.js-user-authenticated</td> + <td></td> +</tr> +<tr> + <td>open</td> + <td>/profiles</td> + <td></td> +</tr> +<tr> + <td>waitForElementPresent</td> + <td>css=.quality-profiles-table-name a[href^="/profiles/show?key=xoo-sample"]</td> + <td></td> +</tr> +<tr> + <td>click</td> + <td>css=.quality-profiles-table-name a[href^="/profiles/show?key=xoo-sample"]</td> + <td></td> +</tr> +<tr> + <td>waitForElementPresent</td> + <td>css=.quality-profile-header .dropdown-toggle</td> + <td></td> +</tr> +<tr> + <td>click</td> + <td>css=.quality-profile-header .dropdown-toggle</td> + <td></td> +</tr> +<tr> + <td>click</td> + <td>css=#quality-profile-delete</td> + <td></td> +</tr> +<tr> + <td>waitForElementPresent</td> + <td>css=#delete-profile-submit</td> + <td></td> +</tr> +<tr> + <td>click</td> + <td>css=#delete-profile-submit</td> + <td></td> +</tr> +<tr> + <td>waitForElementPresent</td> + <td>css=.quality-profiles-table-row[data-name="Basic"]</td> + <td></td> +</tr> +<tr> + <td>waitForElementNotPresent</td> + <td>css=.quality-profiles-table-row[data-name="sample"]</td> + <td></td> +</tr> +<tr> + <td>open</td> + <td>/profiles</td> + <td></td> +</tr> +<tr> + <td>waitForElementPresent</td> + <td>css=.quality-profiles-table-row[data-name="Basic"]</td> + <td></td> +</tr> +<tr> + <td>assertElementNotPresent</td> + <td>css=.quality-profiles-table-row[data-name="sample"]</td> + <td></td> +</tr> +</tbody> +</table> +</body> +</html> diff --git a/it/it-tests/src/test/resources/qualityProfile/QualityProfilesPageTest/should_display_changelog.html b/it/it-tests/src/test/resources/qualityProfile/QualityProfilesPageTest/should_display_changelog.html new file mode 100644 index 00000000000..18851fbf8b5 --- /dev/null +++ b/it/it-tests/src/test/resources/qualityProfile/QualityProfilesPageTest/should_display_changelog.html @@ -0,0 +1,55 @@ +<?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"/> + <link rel="selenium.base" href="http://localhost:49506"/> + <title>should_display_changelog</title> +</head> +<body> +<table cellpadding="1" cellspacing="1" border="1"> +<thead> +<tr> +<td rowspan="1" colspan="3">should_display_changelog</td> +</tr> +</thead> +<tbody> +<tr> + <td>open</td> + <td>/profiles</td> + <td></td> +</tr> +<tr> + <td>waitForElementPresent</td> + <td>css=.quality-profiles-table-name a[href^="/profiles/show?key=xoo-basic"]</td> + <td></td> +</tr> +<tr> + <td>click</td> + <td>css=.quality-profiles-table-name a[href^="/profiles/show?key=xoo-basic"]</td> + <td></td> +</tr> +<tr> + <td>waitForElementPresent</td> + <td>css=a[href^="/profiles/changelog?key=xoo-basic"]</td> + <td></td> +</tr> +<tr> + <td>click</td> + <td>css=a[href^="/profiles/changelog?key=xoo-basic"]</td> + <td></td> +</tr> +<tr> + <td>waitForElementPresent</td> + <td>css=.js-profile-changelog-event</td> + <td></td> +</tr> +<tr> + <td>assertText</td> + <td>css=.js-profile-changelog-event</td> + <td>*System*Activated*Has Tag*Major*tag*xoo*</td> +</tr> +</tbody> +</table> +</body> +</html> diff --git a/it/it-tests/src/test/resources/qualityProfile/QualityProfilesPageTest/should_display_list.html b/it/it-tests/src/test/resources/qualityProfile/QualityProfilesPageTest/should_display_list.html new file mode 100644 index 00000000000..05a3d763f2b --- /dev/null +++ b/it/it-tests/src/test/resources/qualityProfile/QualityProfilesPageTest/should_display_list.html @@ -0,0 +1,74 @@ +<?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_list</title> +</head> +<body> +<table cellpadding="1" cellspacing="1" border="1"> +<thead> +<tr> +<td rowspan="1" colspan="3">should_display_list</td> +</tr> +</thead> +<tbody> +<tr> + <td>open</td> + <td>/profiles</td> + <td></td> +</tr> +<tr> + <td>waitForElementPresent</td> + <td>css=.quality-profiles-table</td> + <td></td> +</tr> +<tr> + <td>assertElementPresent</td> + <td>css=.quality-profiles-table .data[data-language="xoo"]</td> + <td></td> +</tr> +<tr> + <td>assertElementPresent</td> + <td>css=.quality-profiles-table .data[data-language="xoo2"]</td> + <td></td> +</tr> +<tr> + <td>assertElementPresent</td> + <td>css=.quality-profiles-table-row[data-key^="xoo-basic"]</td> + <td></td> +</tr> +<tr> + <td>assertText</td> + <td>css=.quality-profiles-table-row[data-key^="xoo-basic"] .quality-profiles-table-name</td> + <td>*Basic*</td> +</tr> +<tr> + <td>assertText</td> + <td>css=.quality-profiles-table-row[data-key^="xoo-basic"] .quality-profiles-table-projects</td> + <td>*Default*</td> +</tr> +<tr> + <td>assertText</td> + <td>css=.quality-profiles-table-row[data-key^="xoo-basic"] .quality-profiles-table-rules</td> + <td>*1*</td> +</tr> +<tr> + <td>assertElementPresent</td> + <td>css=.quality-profiles-table-row[data-key^="xoo-basic"] .quality-profiles-table-rules a[href^="/coding_rules#qprofile=xoo-basic"]</td> + <td></td> +</tr> +<tr> + <td>assertText</td> + <td>css=.quality-profiles-table-row[data-key^="xoo-empty"] .quality-profiles-table-projects</td> + <td>*0*</td> +</tr> +<tr> + <td>assertText</td> + <td>css=.quality-profiles-table-row[data-key^="xoo2-basic"] .quality-profiles-table-name</td> + <td>*Basic*</td> +</tr> +</tbody> +</table> +</body> +</html> diff --git a/it/it-tests/src/test/resources/qualityProfile/QualityProfilesPageTest/should_display_profile_exporters.html b/it/it-tests/src/test/resources/qualityProfile/QualityProfilesPageTest/should_display_profile_exporters.html new file mode 100644 index 00000000000..aaabd19baac --- /dev/null +++ b/it/it-tests/src/test/resources/qualityProfile/QualityProfilesPageTest/should_display_profile_exporters.html @@ -0,0 +1,50 @@ +<?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"/> + <link rel="selenium.base" href="http://localhost:49506"/> + <title>should_display_profile_projects.html</title> +</head> +<body> +<table cellpadding="1" cellspacing="1" border="1"> +<thead> +<tr> +<td rowspan="1" colspan="3">should_display_profile_projects.html</td> +</tr> +</thead> +<tbody> +<tr> + <td>open</td> + <td>/profiles</td> + <td></td> +</tr> +<tr> + <td>waitForElementPresent</td> + <td>css=.quality-profiles-table-name a[href^="/profiles/show?key=xoo-sample"]</td> + <td></td> +</tr> +<tr> + <td>click</td> + <td>css=.quality-profiles-table-name a[href^="/profiles/show?key=xoo-sample"]</td> + <td></td> +</tr> +<tr> + <td>waitForElementPresent</td> + <td>css=.quality-profile-exporters</td> + <td></td> +</tr> +<tr> + <td>waitForElementPresent</td> + <td>css=.quality-profile-exporters [data-key="XooFakeExporter"]</td> + <td></td> +</tr> +<tr> + <td>waitForElementPresent</td> + <td>css=.quality-profile-exporters a[href^="/api/qualityprofiles/export"]</td> + <td></td> +</tr> +</tbody> +</table> +</body> +</html> diff --git a/it/it-tests/src/test/resources/qualityProfile/QualityProfilesPageTest/should_display_profile_inheritance.html b/it/it-tests/src/test/resources/qualityProfile/QualityProfilesPageTest/should_display_profile_inheritance.html new file mode 100644 index 00000000000..22477a9b4d4 --- /dev/null +++ b/it/it-tests/src/test/resources/qualityProfile/QualityProfilesPageTest/should_display_profile_inheritance.html @@ -0,0 +1,60 @@ +<?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"/> + <link rel="selenium.base" href="http://localhost:49506"/> + <title>should_display_profile_inheritance.html</title> +</head> +<body> +<table cellpadding="1" cellspacing="1" border="1"> +<thead> +<tr> +<td rowspan="1" colspan="3">should_display_profile_inheritance.html</td> +</tr> +</thead> +<tbody> +<tr> + <td>open</td> + <td>/profiles</td> + <td></td> +</tr> +<tr> + <td>waitForElementPresent</td> + <td>css=.quality-profiles-table-name a[href^="/profiles/show?key=xoo-sample"]</td> + <td></td> +</tr> +<tr> + <td>click</td> + <td>css=.quality-profiles-table-name a[href^="/profiles/show?key=xoo-sample"]</td> + <td></td> +</tr> +<tr> + <td>waitForElementPresent</td> + <td>css=.quality-profile-inheritance</td> + <td></td> +</tr> +<tr> + <td>waitForElementPresent</td> + <td>css=.js-inheritance-ancestor</td> + <td></td> +</tr> +<tr> + <td>assertText</td> + <td>css=.js-inheritance-ancestor</td> + <td>*Basic*1*</td> +</tr> +<tr> + <td>assertElementPresent</td> + <td>css=.js-inheritance-current</td> + <td></td> +</tr> +<tr> + <td>assertText</td> + <td>css=.js-inheritance-current</td> + <td>*sample*1*</td> +</tr> +</tbody> +</table> +</body> +</html> diff --git a/it/it-tests/src/test/resources/qualityProfile/QualityProfilesPageTest/should_display_profile_projects.html b/it/it-tests/src/test/resources/qualityProfile/QualityProfilesPageTest/should_display_profile_projects.html new file mode 100644 index 00000000000..fba5742452a --- /dev/null +++ b/it/it-tests/src/test/resources/qualityProfile/QualityProfilesPageTest/should_display_profile_projects.html @@ -0,0 +1,50 @@ +<?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"/> + <link rel="selenium.base" href="http://localhost:49506"/> + <title>should_display_profile_projects.html</title> +</head> +<body> +<table cellpadding="1" cellspacing="1" border="1"> +<thead> +<tr> +<td rowspan="1" colspan="3">should_display_profile_projects.html</td> +</tr> +</thead> +<tbody> +<tr> + <td>open</td> + <td>/profiles</td> + <td></td> +</tr> +<tr> + <td>waitForElementPresent</td> + <td>css=.quality-profiles-table-name a[href^="/profiles/show?key=xoo-sample"]</td> + <td></td> +</tr> +<tr> + <td>click</td> + <td>css=.quality-profiles-table-name a[href^="/profiles/show?key=xoo-sample"]</td> + <td></td> +</tr> +<tr> + <td>waitForElementPresent</td> + <td>css=.quality-profile-projects</td> + <td></td> +</tr> +<tr> + <td>waitForElementPresent</td> + <td>css=.js-profile-project</td> + <td></td> +</tr> +<tr> + <td>assertText</td> + <td>css=.js-profile-project</td> + <td>*Sample*</td> +</tr> +</tbody> +</table> +</body> +</html> diff --git a/it/it-tests/src/test/resources/qualityProfile/QualityProfilesPageTest/should_display_profile_rules.html b/it/it-tests/src/test/resources/qualityProfile/QualityProfilesPageTest/should_display_profile_rules.html new file mode 100644 index 00000000000..9819f42bdec --- /dev/null +++ b/it/it-tests/src/test/resources/qualityProfile/QualityProfilesPageTest/should_display_profile_rules.html @@ -0,0 +1,45 @@ +<?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"/> + <link rel="selenium.base" href="http://localhost:49506"/> + <title>should_display_profile_rules.html</title> +</head> +<body> +<table cellpadding="1" cellspacing="1" border="1"> +<thead> +<tr> +<td rowspan="1" colspan="3">should_display_profile_rules.html</td> +</tr> +</thead> +<tbody> +<tr> + <td>open</td> + <td>/profiles</td> + <td></td> +</tr> +<tr> + <td>waitForElementPresent</td> + <td>css=.quality-profiles-table-name a[href^="/profiles/show?key=xoo-basic"]</td> + <td></td> +</tr> +<tr> + <td>click</td> + <td>css=.quality-profiles-table-name a[href^="/profiles/show?key=xoo-basic"]</td> + <td></td> +</tr> +<tr> + <td>waitForElementPresent</td> + <td>css=.quality-profile-rules</td> + <td></td> +</tr> +<tr> + <td>waitForText</td> + <td>css=.quality-profile-rules</td> + <td>*Active*1*Bugs*0*Vulnerabilities*0*Code Smells*1*</td> +</tr> +</tbody> +</table> +</body> +</html> diff --git a/it/it-tests/src/test/resources/qualityProfile/QualityProfilesPageTest/should_filter_by_language.html b/it/it-tests/src/test/resources/qualityProfile/QualityProfilesPageTest/should_filter_by_language.html new file mode 100644 index 00000000000..cfe5321b816 --- /dev/null +++ b/it/it-tests/src/test/resources/qualityProfile/QualityProfilesPageTest/should_filter_by_language.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_filter_by_language</title> +</head> +<body> +<table cellpadding="1" cellspacing="1" border="1"> +<thead> +<tr> +<td rowspan="1" colspan="3">should_filter_by_language</td> +</tr> +</thead> +<tbody> +<tr> + <td>open</td> + <td>/profiles</td> + <td></td> +</tr> +<tr> + <td>waitForElementPresent</td> + <td>css=.quality-profiles-table .data[data-language="xoo"]</td> + <td></td> +</tr> +<tr> + <td>assertElementPresent</td> + <td>css=.quality-profiles-table .data[data-language="xoo2"]</td> + <td></td> +</tr> +<tr> + <td>assertText</td> + <td>css=.js-language-filter</td> + <td>*All*</td> +</tr> +<tr> + <td>click</td> + <td>css=.js-language-filter</td> + <td></td> +</tr> +<tr> + <td>waitForElementPresent</td> + <td>css=.js-language-filter-option[data-language="xoo2"]</td> + <td></td> +</tr> +<tr> + <td>click</td> + <td>css=.js-language-filter-option[data-language="xoo2"]</td> + <td></td> +</tr> +<tr> + <td>waitForElementNotPresent</td> + <td>css=.quality-profiles-table[data-language="xoo"]</td> + <td></td> +</tr> +<tr> + <td>assertElementPresent</td> + <td>css=.quality-profiles-table .data[data-language="xoo2"]</td> + <td></td> +</tr> +<tr> + <td>assertText</td> + <td>css=.js-language-filter</td> + <td>*Xoo2*</td> +</tr> +<tr> + <td>open</td> + <td>/profiles?language=xoo2</td> + <td></td> +</tr> +<tr> + <td>waitForElementPresent</td> + <td>css=.quality-profiles-table .data[data-language="xoo2"]</td> + <td></td> +</tr> +<tr> + <td>assertElementNotPresent</td> + <td>css=.quality-profiles-table[data-language="xoo"]</td> + <td></td> +</tr> +<tr> + <td>assertText</td> + <td>css=.js-language-filter</td> + <td>*Xoo2*</td> +</tr> +</tbody> +</table> +</body> +</html> diff --git a/it/it-tests/src/test/resources/qualityProfile/QualityProfilesPageTest/should_open_from_list.html b/it/it-tests/src/test/resources/qualityProfile/QualityProfilesPageTest/should_open_from_list.html new file mode 100644 index 00000000000..a41de0e79c7 --- /dev/null +++ b/it/it-tests/src/test/resources/qualityProfile/QualityProfilesPageTest/should_open_from_list.html @@ -0,0 +1,54 @@ +<?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_open_from_list</title> +</head> +<body> +<table cellpadding="1" cellspacing="1" border="1"> +<thead> +<tr> +<td rowspan="1" colspan="3">should_open_from_list</td> +</tr> +</thead> +<tbody> +<tr> + <td>open</td> + <td>/profiles</td> + <td></td> +</tr> +<tr> + <td>waitForElementPresent</td> + <td>css=.quality-profiles-table-row[data-key^="xoo-basic"]</td> + <td></td> +</tr> +<tr> + <td>click</td> + <td>css=.quality-profiles-table-row[data-key^="xoo-basic"] .quality-profiles-table-name a</td> + <td></td> +</tr> +<tr> + <td>waitForElementPresent</td> + <td>css=.quality-profile-header</td> + <td></td> +</tr> +<tr> + <td>waitForElementPresent</td> + <td>css=.quality-profile-rules</td> + <td></td> +</tr> +<tr> + <td>waitForElementPresent</td> + <td>css=.quality-profile-inheritance</td> + <td></td> +</tr> +<tr> + <td>waitForElementPresent</td> + <td>css=.quality-profile-projects</td> + <td></td> +</tr> +</tbody> +</table> +</body> +</html> diff --git a/it/it-tests/src/test/resources/qualityProfile/QualityProfilesPageTest/should_rename.html b/it/it-tests/src/test/resources/qualityProfile/QualityProfilesPageTest/should_rename.html new file mode 100644 index 00000000000..d86dbc2040c --- /dev/null +++ b/it/it-tests/src/test/resources/qualityProfile/QualityProfilesPageTest/should_rename.html @@ -0,0 +1,115 @@ +<?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"/> + <link rel="selenium.base" href="http://localhost:49506"/> + <title>should_create</title> +</head> +<body> +<table cellpadding="1" cellspacing="1" border="1"> +<thead> +<tr> +<td rowspan="1" colspan="3">should_create</td> +</tr> +</thead> +<tbody> +<tr> + <td>open</td> + <td>/sessions/logout</td> + <td></td> +</tr> +<tr> + <td>open</td> + <td>/sessions/login</td> + <td></td> +</tr> +<tr> + <td>type</td> + <td>id=password</td> + <td>admin</td> +</tr> +<tr> + <td>type</td> + <td>id=login</td> + <td>admin</td> +</tr> +<tr> + <td>clickAndWait</td> + <td>name=commit</td> + <td></td> +</tr> +<tr> + <td>waitForElementPresent</td> + <td>css=.js-user-authenticated</td> + <td></td> +</tr> +<tr> + <td>open</td> + <td>/profiles</td> + <td></td> +</tr> +<tr> + <td>waitForElementPresent</td> + <td>css=.quality-profiles-table-name a[href^="/profiles/show?key=xoo-sample"]</td> + <td></td> +</tr> +<tr> + <td>click</td> + <td>css=.quality-profiles-table-name a[href^="/profiles/show?key=xoo-sample"]</td> + <td></td> +</tr> +<tr> + <td>waitForElementPresent</td> + <td>css=.quality-profile-header .dropdown-toggle</td> + <td></td> +</tr> +<tr> + <td>click</td> + <td>css=.quality-profile-header .dropdown-toggle</td> + <td></td> +</tr> +<tr> + <td>click</td> + <td>css=#quality-profile-rename</td> + <td></td> +</tr> +<tr> + <td>waitForElementPresent</td> + <td>css=#rename-profile-name</td> + <td></td> +</tr> +<tr> + <td>type</td> + <td>css=#rename-profile-name</td> + <td>new name</td> +</tr> +<tr> + <td>click</td> + <td>css=#rename-profile-submit</td> + <td></td> +</tr> +<tr> + <td>waitForText</td> + <td>css=.quality-profile-header</td> + <td>*new name*</td> +</tr> +<tr> + <td>open</td> + <td>/profiles</td> + <td></td> +</tr> +<tr> + <td>waitForElementPresent</td> + <td>css=.quality-profiles-table-name a[href^="/profiles/show?key=xoo-sample"]</td> + <td></td> +</tr> +<tr> + <td>assertElementPresent</td> + <td>css=.quality-profiles-table-row[data-name="new name"]</td> + <td></td> +</tr> +</tbody> +</table> +</body> +</html> diff --git a/it/it-tests/src/test/resources/qualityProfile/QualityProfilesPageTest/should_restore.html b/it/it-tests/src/test/resources/qualityProfile/QualityProfilesPageTest/should_restore.html new file mode 100644 index 00000000000..287d6f86067 --- /dev/null +++ b/it/it-tests/src/test/resources/qualityProfile/QualityProfilesPageTest/should_restore.html @@ -0,0 +1,80 @@ +<?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"/> + <link rel="selenium.base" href="http://localhost:49506"/> + <title>should_create</title> +</head> +<body> +<table cellpadding="1" cellspacing="1" border="1"> +<thead> +<tr> +<td rowspan="1" colspan="3">should_create</td> +</tr> +</thead> +<tbody> +<tr> + <td>open</td> + <td>/sessions/logout</td> + <td></td> +</tr> +<tr> + <td>open</td> + <td>/sessions/login</td> + <td></td> +</tr> +<tr> + <td>type</td> + <td>id=password</td> + <td>admin</td> +</tr> +<tr> + <td>type</td> + <td>id=login</td> + <td>admin</td> +</tr> +<tr> + <td>clickAndWait</td> + <td>name=commit</td> + <td></td> +</tr> +<tr> + <td>waitForElementPresent</td> + <td>css=.js-user-authenticated</td> + <td></td> +</tr> +<tr> + <td>open</td> + <td>/profiles</td> + <td></td> +</tr> +<tr> + <td>waitForElementPresent</td> + <td>css=.js-more-admin-actions</td> + <td></td> +</tr> +<tr> + <td>click</td> + <td>css=.js-more-admin-actions</td> + <td></td> +</tr> +<tr> + <td>click</td> + <td>css=#quality-profiles-restore</td> + <td></td> +</tr> +<tr> + <td>waitForElementPresent</td> + <td>css=#restore-profile-backup</td> + <td></td> +</tr> +<tr> + <td>waitForElementPresent</td> + <td>css=#restore-profile-submit</td> + <td></td> +</tr> +</tbody> +</table> +</body> +</html> diff --git a/it/it-tests/src/test/resources/qualityProfile/QualityProfilesPageTest/should_restore_built_in.html b/it/it-tests/src/test/resources/qualityProfile/QualityProfilesPageTest/should_restore_built_in.html new file mode 100644 index 00000000000..261b1f140cb --- /dev/null +++ b/it/it-tests/src/test/resources/qualityProfile/QualityProfilesPageTest/should_restore_built_in.html @@ -0,0 +1,95 @@ +<?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"/> + <link rel="selenium.base" href="http://localhost:49506"/> + <title>should_create</title> +</head> +<body> +<table cellpadding="1" cellspacing="1" border="1"> +<thead> +<tr> +<td rowspan="1" colspan="3">should_create</td> +</tr> +</thead> +<tbody> +<tr> + <td>open</td> + <td>/sessions/logout</td> + <td></td> +</tr> +<tr> + <td>open</td> + <td>/sessions/login</td> + <td></td> +</tr> +<tr> + <td>type</td> + <td>id=password</td> + <td>admin</td> +</tr> +<tr> + <td>type</td> + <td>id=login</td> + <td>admin</td> +</tr> +<tr> + <td>clickAndWait</td> + <td>name=commit</td> + <td></td> +</tr> +<tr> + <td>waitForElementPresent</td> + <td>css=.js-user-authenticated</td> + <td></td> +</tr> +<tr> + <td>open</td> + <td>/profiles</td> + <td></td> +</tr> +<tr> + <td>waitForElementPresent</td> + <td>css=.quality-profiles-table-row[data-name="sample"]</td> + <td></td> +</tr> +<tr> + <td>assertElementNotPresent</td> + <td>css=.quality-profiles-table-row[data-name="empty"]</td> + <td></td> +</tr> +<tr> + <td>click</td> + <td>css=.js-more-admin-actions</td> + <td></td> +</tr> +<tr> + <td>click</td> + <td>css=#quality-profiles-restore-built-in</td> + <td></td> +</tr> +<tr> + <td>click</td> + <td>css=#restore-built-in-profiles-submit</td> + <td></td> +</tr> +<tr> + <td>waitForElementPresent</td> + <td>css=#restore-built-in-profiles-form .alert-success</td> + <td></td> +</tr> +<tr> + <td>click</td> + <td>css=.js-modal-close</td> + <td></td> +</tr> +<tr> + <td>waitForElementPresent</td> + <td>css=.quality-profiles-table-row[data-name="empty"]</td> + <td></td> +</tr> +</tbody> +</table> +</body> +</html> diff --git a/it/it-tests/src/test/resources/qualityProfile/QualityProfilesPageTest/should_set_default.html b/it/it-tests/src/test/resources/qualityProfile/QualityProfilesPageTest/should_set_default.html new file mode 100644 index 00000000000..9d514aa3c86 --- /dev/null +++ b/it/it-tests/src/test/resources/qualityProfile/QualityProfilesPageTest/should_set_default.html @@ -0,0 +1,100 @@ +<?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"/> + <link rel="selenium.base" href="http://localhost:49506"/> + <title>should_create</title> +</head> +<body> +<table cellpadding="1" cellspacing="1" border="1"> +<thead> +<tr> +<td rowspan="1" colspan="3">should_create</td> +</tr> +</thead> +<tbody> +<tr> + <td>open</td> + <td>/sessions/logout</td> + <td></td> +</tr> +<tr> + <td>open</td> + <td>/sessions/login</td> + <td></td> +</tr> +<tr> + <td>type</td> + <td>id=password</td> + <td>admin</td> +</tr> +<tr> + <td>type</td> + <td>id=login</td> + <td>admin</td> +</tr> +<tr> + <td>clickAndWait</td> + <td>name=commit</td> + <td></td> +</tr> +<tr> + <td>waitForElementPresent</td> + <td>css=.js-user-authenticated</td> + <td></td> +</tr> +<tr> + <td>open</td> + <td>/profiles</td> + <td></td> +</tr> +<tr> + <td>waitForElementPresent</td> + <td>css=.quality-profiles-table-name a[href^="/profiles/show?key=xoo-sample"]</td> + <td></td> +</tr> +<tr> + <td>click</td> + <td>css=.quality-profiles-table-name a[href^="/profiles/show?key=xoo-sample"]</td> + <td></td> +</tr> +<tr> + <td>waitForElementPresent</td> + <td>css=.quality-profile-header .dropdown-toggle</td> + <td></td> +</tr> +<tr> + <td>click</td> + <td>css=.quality-profile-header .dropdown-toggle</td> + <td></td> +</tr> +<tr> + <td>click</td> + <td>css=#quality-profile-set-as-default</td> + <td></td> +</tr> +<tr> + <td>waitForText</td> + <td>css=.quality-profile-projects</td> + <td>*Default*</td> +</tr> +<tr> + <td>open</td> + <td>/profiles</td> + <td></td> +</tr> +<tr> + <td>waitForElementPresent</td> + <td>css=.quality-profiles-table-row[data-name="sample"]</td> + <td></td> +</tr> +<tr> + <td>assertText</td> + <td>css=.quality-profiles-table-row[data-name="sample"] .quality-profiles-table-projects</td> + <td>*Default*</td> +</tr> +</tbody> +</table> +</body> +</html> diff --git a/it/it-tests/src/test/resources/serverSystem/ServerSystemTest/incompatible-plugin-1.0.jar b/it/it-tests/src/test/resources/serverSystem/ServerSystemTest/incompatible-plugin-1.0.jar Binary files differindex a998a46bb29..541131c5093 100644 --- a/it/it-tests/src/test/resources/serverSystem/ServerSystemTest/incompatible-plugin-1.0.jar +++ b/it/it-tests/src/test/resources/serverSystem/ServerSystemTest/incompatible-plugin-1.0.jar diff --git a/it/it-tests/src/test/resources/serverSystem/ServerSystemTest/missing_ip.html b/it/it-tests/src/test/resources/serverSystem/ServerSystemTest/missing_ip.html index c8a9607f25e..1a9725f07a8 100644 --- a/it/it-tests/src/test/resources/serverSystem/ServerSystemTest/missing_ip.html +++ b/it/it-tests/src/test/resources/serverSystem/ServerSystemTest/missing_ip.html @@ -54,6 +54,11 @@ <td></td> </tr> <tr> + <td>waitForElementPresent</td> + <td>css=.js-user-authenticated</td> + <td></td> + </tr> + <tr> <td>open</td> <td>/settings/index</td> <td></td> diff --git a/it/it-tests/src/test/resources/serverSystem/ServerSystemTest/organisation_must_not_accept_special_chars.html b/it/it-tests/src/test/resources/serverSystem/ServerSystemTest/organisation_must_not_accept_special_chars.html index d1d083a96d8..29823121244 100644 --- a/it/it-tests/src/test/resources/serverSystem/ServerSystemTest/organisation_must_not_accept_special_chars.html +++ b/it/it-tests/src/test/resources/serverSystem/ServerSystemTest/organisation_must_not_accept_special_chars.html @@ -29,6 +29,11 @@ <td></td> </tr> <tr> + <td>waitForElementPresent</td> + <td>css=.js-user-authenticated</td> + <td></td> + </tr> + <tr> <td>open</td> <td>/settings/index</td> <td></td> diff --git a/it/it-tests/src/test/resources/serverSystem/ServerSystemTest/system_info.html b/it/it-tests/src/test/resources/serverSystem/ServerSystemTest/system_info.html index 9d469c02f28..eb9f7ea5cf1 100644 --- a/it/it-tests/src/test/resources/serverSystem/ServerSystemTest/system_info.html +++ b/it/it-tests/src/test/resources/serverSystem/ServerSystemTest/system_info.html @@ -39,6 +39,11 @@ <td></td> </tr> <tr> + <td>waitForElementPresent</td> + <td>css=.js-user-authenticated</td> + <td></td> + </tr> + <tr> <td>open</td> <td>/system/index</td> <td></td> diff --git a/it/it-tests/src/test/resources/serverSystem/ServerSystemTest/valid_id.html b/it/it-tests/src/test/resources/serverSystem/ServerSystemTest/valid_id.html index 2ad01661ed4..4f86397d642 100644 --- a/it/it-tests/src/test/resources/serverSystem/ServerSystemTest/valid_id.html +++ b/it/it-tests/src/test/resources/serverSystem/ServerSystemTest/valid_id.html @@ -34,6 +34,11 @@ <td></td> </tr> <tr> + <td>waitForElementPresent</td> + <td>css=.js-user-authenticated</td> + <td></td> + </tr> + <tr> <td>open</td> <td>/settings/index</td> <td></td> diff --git a/it/it-tests/src/test/resources/settings/PropertySetsTest/auto-generated/create.html b/it/it-tests/src/test/resources/settings/PropertySetsTest/auto-generated/create.html index bceffc86f12..a28e6426fdf 100644 --- a/it/it-tests/src/test/resources/settings/PropertySetsTest/auto-generated/create.html +++ b/it/it-tests/src/test/resources/settings/PropertySetsTest/auto-generated/create.html @@ -29,6 +29,11 @@ <td></td> </tr> <tr> + <td>waitForElementPresent</td> + <td>css=.js-user-authenticated</td> + <td></td> + </tr> + <tr> <td>open</td> <td>/settings?category=DEV</td> <td></td> diff --git a/it/it-tests/src/test/resources/settings/PropertySetsTest/auto-generated/update.html b/it/it-tests/src/test/resources/settings/PropertySetsTest/auto-generated/update.html index dc4e7ac8ccf..2db17093913 100644 --- a/it/it-tests/src/test/resources/settings/PropertySetsTest/auto-generated/update.html +++ b/it/it-tests/src/test/resources/settings/PropertySetsTest/auto-generated/update.html @@ -29,6 +29,11 @@ <td></td> </tr> <tr> + <td>waitForElementPresent</td> + <td>css=.js-user-authenticated</td> + <td></td> + </tr> + <tr> <td>open</td> <td>/settings?category=DEV</td> <td></td> diff --git a/it/it-tests/src/test/resources/settings/PropertySetsTest/property-sets/all_types.html b/it/it-tests/src/test/resources/settings/PropertySetsTest/property-sets/all_types.html index 9cdfdc43d0b..4dfffa1d384 100644 --- a/it/it-tests/src/test/resources/settings/PropertySetsTest/property-sets/all_types.html +++ b/it/it-tests/src/test/resources/settings/PropertySetsTest/property-sets/all_types.html @@ -29,6 +29,11 @@ <td></td> </tr> <tr> + <td>waitForElementPresent</td> + <td>css=.js-user-authenticated</td> + <td></td> + </tr> + <tr> <td>open</td> <td>/settings?category=DEV</td> <td></td> diff --git a/it/it-tests/src/test/resources/settings/PropertySetsTest/property-sets/create.html b/it/it-tests/src/test/resources/settings/PropertySetsTest/property-sets/create.html index d1bc2b3a11b..d85e447c5c4 100644 --- a/it/it-tests/src/test/resources/settings/PropertySetsTest/property-sets/create.html +++ b/it/it-tests/src/test/resources/settings/PropertySetsTest/property-sets/create.html @@ -29,6 +29,11 @@ <td></td> </tr> <tr> + <td>waitForElementPresent</td> + <td>css=.js-user-authenticated</td> + <td></td> + </tr> + <tr> <td>open</td> <td>/settings?category=DEV</td> <td></td> diff --git a/it/it-tests/src/test/resources/settings/PropertySetsTest/property-sets/delete.html b/it/it-tests/src/test/resources/settings/PropertySetsTest/property-sets/delete.html index 8cc1952ef60..aa0e9cacc6d 100644 --- a/it/it-tests/src/test/resources/settings/PropertySetsTest/property-sets/delete.html +++ b/it/it-tests/src/test/resources/settings/PropertySetsTest/property-sets/delete.html @@ -29,6 +29,11 @@ <td></td> </tr> <tr> + <td>waitForElementPresent</td> + <td>css=.js-user-authenticated</td> + <td></td> +</tr> +<tr> <td>open</td> <td>/settings?category=DEV</td> <td></td> diff --git a/it/it-tests/src/test/resources/settings/PropertySetsTest/property-sets/reference.html b/it/it-tests/src/test/resources/settings/PropertySetsTest/property-sets/reference.html index d282e68e528..c212340711f 100644 --- a/it/it-tests/src/test/resources/settings/PropertySetsTest/property-sets/reference.html +++ b/it/it-tests/src/test/resources/settings/PropertySetsTest/property-sets/reference.html @@ -29,6 +29,11 @@ <td></td> </tr> <tr> + <td>waitForElementPresent</td> + <td>css=.js-user-authenticated</td> + <td></td> + </tr> + <tr> <td>open</td> <td>/settings?category=DEV</td> <td></td> diff --git a/it/it-tests/src/test/resources/settings/SettingsTest/display-license.html b/it/it-tests/src/test/resources/settings/SettingsTest/display-license.html index 4ddf1814649..f2f1d31bb87 100644 --- a/it/it-tests/src/test/resources/settings/SettingsTest/display-license.html +++ b/it/it-tests/src/test/resources/settings/SettingsTest/display-license.html @@ -34,6 +34,11 @@ <td></td> </tr> <tr> + <td>waitForElementPresent</td> + <td>css=.js-user-authenticated</td> + <td></td> + </tr> + <tr> <td>type</td> <td>id=input_typed.license.secured</td> <td>TmFtZTogRGV2ZWxvcHBlcnMKUGx1Z2luOiBhdXRvY29udHJvbApFeHBpcmVzOiAyMDEyLTA0LTAxCktleTogNjI5N2MxMzEwYzg2NDZiZTE5MDU1MWE4ZmZmYzk1OTBmYzEyYTIyMgo=</td> diff --git a/it/it-tests/src/test/resources/settings/SettingsTest/display-untyped-license.html b/it/it-tests/src/test/resources/settings/SettingsTest/display-untyped-license.html index a6bd3b1a7b8..ae353cf7618 100644 --- a/it/it-tests/src/test/resources/settings/SettingsTest/display-untyped-license.html +++ b/it/it-tests/src/test/resources/settings/SettingsTest/display-untyped-license.html @@ -34,6 +34,11 @@ <td></td> </tr> <tr> + <td>waitForElementPresent</td> + <td>css=.js-user-authenticated</td> + <td></td> + </tr> + <tr> <td>type</td> <td>id=input_untyped.license.secured</td> <td>TmFtZTogRGV2ZWxvcHBlcnMKUGx1Z2luOiBhdXRvY29udHJvbApFeHBpcmVzOiAyMDEyLTA0LTAxCktleTogNjI5N2MxMzEwYzg2NDZiZTE5MDU1MWE4ZmZmYzk1OTBmYzEyYTIyMgo=</td> diff --git a/it/it-tests/src/test/resources/settings/SettingsTest/encrypt-text.html b/it/it-tests/src/test/resources/settings/SettingsTest/encrypt-text.html index 329f11dfd76..fe174478d54 100644 --- a/it/it-tests/src/test/resources/settings/SettingsTest/encrypt-text.html +++ b/it/it-tests/src/test/resources/settings/SettingsTest/encrypt-text.html @@ -34,6 +34,11 @@ <td></td> </tr> <tr> + <td>waitForElementPresent</td> + <td>css=.js-user-authenticated</td> + <td></td> + </tr> + <tr> <td>selectFrame</td> <td>settings_iframe</td> <td></td> diff --git a/it/it-tests/src/test/resources/settings/SettingsTest/general-settings.html b/it/it-tests/src/test/resources/settings/SettingsTest/general-settings.html index f412bf865a4..89061e138ba 100644 --- a/it/it-tests/src/test/resources/settings/SettingsTest/general-settings.html +++ b/it/it-tests/src/test/resources/settings/SettingsTest/general-settings.html @@ -39,6 +39,11 @@ <td></td> </tr> <tr> + <td>waitForElementPresent</td> + <td>css=.js-user-authenticated</td> + <td></td> +</tr> +<tr> <td>open</td> <td>/settings/index</td> <td></td> diff --git a/it/it-tests/src/test/resources/settings/SettingsTest/generate-secret-key.html b/it/it-tests/src/test/resources/settings/SettingsTest/generate-secret-key.html index 8632039e4ab..c667bf3ca0b 100644 --- a/it/it-tests/src/test/resources/settings/SettingsTest/generate-secret-key.html +++ b/it/it-tests/src/test/resources/settings/SettingsTest/generate-secret-key.html @@ -34,6 +34,11 @@ <td></td> </tr> <tr> + <td>waitForElementPresent</td> + <td>css=.js-user-authenticated</td> + <td></td> + </tr> + <tr> <td>selectFrame</td> <td>settings_iframe</td> <td></td> diff --git a/it/it-tests/src/test/resources/settings/SettingsTest/global-extension-property.html b/it/it-tests/src/test/resources/settings/SettingsTest/global-extension-property.html index 73093c729ac..ad3d97682b3 100644 --- a/it/it-tests/src/test/resources/settings/SettingsTest/global-extension-property.html +++ b/it/it-tests/src/test/resources/settings/SettingsTest/global-extension-property.html @@ -33,7 +33,11 @@ <td>commit</td> <td></td> </tr> - + <tr> + <td>waitForElementPresent</td> + <td>css=.js-user-authenticated</td> + <td></td> + </tr> <tr> <td>open</td> <td>/settings?category=Settings</td> diff --git a/it/it-tests/src/test/resources/settings/SettingsTest/hidden-extension-property.html b/it/it-tests/src/test/resources/settings/SettingsTest/hidden-extension-property.html index 87f773db812..7aa9bd9cba1 100644 --- a/it/it-tests/src/test/resources/settings/SettingsTest/hidden-extension-property.html +++ b/it/it-tests/src/test/resources/settings/SettingsTest/hidden-extension-property.html @@ -33,7 +33,11 @@ <td>commit</td> <td></td> </tr> - + <tr> + <td>waitForElementPresent</td> + <td>css=.js-user-authenticated</td> + <td></td> + </tr> <tr> <td>open</td> <td>/settings?category=Settings</td> diff --git a/it/it-tests/src/test/resources/settings/SettingsTest/hide-passwords.html b/it/it-tests/src/test/resources/settings/SettingsTest/hide-passwords.html index c2ee4b33517..531e11e8bd4 100644 --- a/it/it-tests/src/test/resources/settings/SettingsTest/hide-passwords.html +++ b/it/it-tests/src/test/resources/settings/SettingsTest/hide-passwords.html @@ -34,6 +34,11 @@ <td></td> </tr> <tr> + <td>waitForElementPresent</td> + <td>css=.js-user-authenticated</td> + <td></td> + </tr> + <tr> <td>waitForText</td> <td>block_password</td> <td>*Default*</td> diff --git a/it/it-tests/src/test/resources/settings/SettingsTest/ignore-corrupted-license.html b/it/it-tests/src/test/resources/settings/SettingsTest/ignore-corrupted-license.html index 8e735cc8c8b..e05b5727102 100644 --- a/it/it-tests/src/test/resources/settings/SettingsTest/ignore-corrupted-license.html +++ b/it/it-tests/src/test/resources/settings/SettingsTest/ignore-corrupted-license.html @@ -34,6 +34,11 @@ <td></td> </tr> <tr> + <td>waitForElementPresent</td> + <td>css=.js-user-authenticated</td> + <td></td> + </tr> + <tr> <td>type</td> <td>id=input_typed.license.secured</td> <td>ABCDE</td> diff --git a/it/it-tests/src/test/resources/settings/SettingsTest/property_relocation.html b/it/it-tests/src/test/resources/settings/SettingsTest/property_relocation.html index 26a649141f3..37986cd560d 100644 --- a/it/it-tests/src/test/resources/settings/SettingsTest/property_relocation.html +++ b/it/it-tests/src/test/resources/settings/SettingsTest/property_relocation.html @@ -34,6 +34,11 @@ <td></td> </tr> <tr> + <td>waitForElementPresent</td> + <td>css=.js-user-authenticated</td> + <td></td> +</tr> +<tr> <td>waitForText</td> <td>properties</td> <td>*sonar.newKey*</td> diff --git a/it/it-tests/src/test/resources/settings/SettingsTest/validate-property-type.html b/it/it-tests/src/test/resources/settings/SettingsTest/validate-property-type.html index 43cf2f62c89..96024f79b91 100644 --- a/it/it-tests/src/test/resources/settings/SettingsTest/validate-property-type.html +++ b/it/it-tests/src/test/resources/settings/SettingsTest/validate-property-type.html @@ -34,6 +34,11 @@ <td></td> </tr> <tr> + <td>waitForElementPresent</td> + <td>css=.js-user-authenticated</td> + <td></td> + </tr> + <tr> <td>type</td> <td>id=input_float</td> <td>abc</td> diff --git a/it/it-tests/src/test/resources/settings/subcategories/global-subcategories-no-default.html b/it/it-tests/src/test/resources/settings/subcategories/global-subcategories-no-default.html index 99a509350ec..a4b69712397 100644 --- a/it/it-tests/src/test/resources/settings/subcategories/global-subcategories-no-default.html +++ b/it/it-tests/src/test/resources/settings/subcategories/global-subcategories-no-default.html @@ -29,6 +29,11 @@ <td></td> </tr> <tr> + <td>waitForElementPresent</td> + <td>css=.js-user-authenticated</td> + <td></td> + </tr> + <tr> <td>open</td> <td>/settings?category=Category 2</td> <td></td> diff --git a/it/it-tests/src/test/resources/settings/subcategories/global-subcategories.html b/it/it-tests/src/test/resources/settings/subcategories/global-subcategories.html index af4901ab6ef..3f578222762 100644 --- a/it/it-tests/src/test/resources/settings/subcategories/global-subcategories.html +++ b/it/it-tests/src/test/resources/settings/subcategories/global-subcategories.html @@ -29,6 +29,11 @@ <td></td> </tr> <tr> + <td>waitForElementPresent</td> + <td>css=.js-user-authenticated</td> + <td></td> + </tr> + <tr> <td>open</td> <td>/settings?category=Category 1</td> <td></td> diff --git a/it/it-tests/src/test/resources/settings/subcategories/project-subcategories-no-default.html b/it/it-tests/src/test/resources/settings/subcategories/project-subcategories-no-default.html index 5ff1df8ba20..f0efe3fcf35 100644 --- a/it/it-tests/src/test/resources/settings/subcategories/project-subcategories-no-default.html +++ b/it/it-tests/src/test/resources/settings/subcategories/project-subcategories-no-default.html @@ -29,6 +29,11 @@ <td></td> </tr> <tr> + <td>waitForElementPresent</td> + <td>css=.js-user-authenticated</td> + <td></td> + </tr> + <tr> <td>open</td> <td>/project/settings/sample?category=Category 2</td> <td></td> diff --git a/it/it-tests/src/test/resources/settings/subcategories/project-subcategories.html b/it/it-tests/src/test/resources/settings/subcategories/project-subcategories.html index 8e50d946ecb..1d6b7efc0c7 100644 --- a/it/it-tests/src/test/resources/settings/subcategories/project-subcategories.html +++ b/it/it-tests/src/test/resources/settings/subcategories/project-subcategories.html @@ -29,6 +29,11 @@ <td></td> </tr> <tr> + <td>waitForElementPresent</td> + <td>css=.js-user-authenticated</td> + <td></td> + </tr> + <tr> <td>open</td> <td>/project/settings/sample?category=Category 1</td> <td></td> diff --git a/it/it-tests/src/test/resources/sourceCode/ProjectCodeTest/code_page_should_expand_root_dir.html b/it/it-tests/src/test/resources/sourceCode/ProjectCodeTest/code_page_should_expand_root_dir.html index 4cc72851fb5..c9737d5fe25 100644 --- a/it/it-tests/src/test/resources/sourceCode/ProjectCodeTest/code_page_should_expand_root_dir.html +++ b/it/it-tests/src/test/resources/sourceCode/ProjectCodeTest/code_page_should_expand_root_dir.html @@ -22,7 +22,7 @@ <tr> <td>waitForText</td> <td>css=#content</td> - <td>*Hello.xoo*</td> + <td>*Hello.xoo*src/main/xoo/sample*</td> </tr> </tbody> </table> diff --git a/it/it-tests/src/test/resources/sourceCode/ProjectCodeTest/permalink.html b/it/it-tests/src/test/resources/sourceCode/ProjectCodeTest/permalink.html new file mode 100644 index 00000000000..69364a69079 --- /dev/null +++ b/it/it-tests/src/test/resources/sourceCode/ProjectCodeTest/permalink.html @@ -0,0 +1,35 @@ +<?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"/> + <link rel="selenium.base" href="http://localhost:49506"/> + <title>test_project_code_page</title> +</head> +<body> +<table cellpadding="1" cellspacing="1" border="1"> + <thead> + <tr> + <td rowspan="1" colspan="3">test_project_code_page</td> + </tr> + </thead> + <tbody> + <tr> + <td>open</td> + <td>/code?id=project-for-code&selected=project-for-code%3Asrc%2Fmain%2Fxoo%2Fsample%2FSample.xoo</td> + <td></td> +</tr> +<tr> + <td>waitForText</td> + <td>css=#content</td> + <td>*public class Sample*</td> +</tr> +<tr> + <td>waitForText</td> + <td>css=.code-breadcrumbs</td> + <td>*Project For Code*src/main/xoo/sample*Sample.xoo*</td> +</tr> +</tbody> +</table> +</body> +</html> diff --git a/it/it-tests/src/test/resources/sourceCode/ProjectCodeTest/search.html b/it/it-tests/src/test/resources/sourceCode/ProjectCodeTest/search.html new file mode 100644 index 00000000000..1594ee28cd5 --- /dev/null +++ b/it/it-tests/src/test/resources/sourceCode/ProjectCodeTest/search.html @@ -0,0 +1,60 @@ +<?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"/> + <link rel="selenium.base" href="http://localhost:49506"/> + <title>test_project_code_page</title> +</head> +<body> +<table cellpadding="1" cellspacing="1" border="1"> + <thead> + <tr> + <td rowspan="1" colspan="3">test_project_code_page</td> + </tr> + </thead> + <tbody> + <tr> + <td>open</td> + <td>/code?id=project-for-code</td> + <td></td> +</tr> +<tr> + <td>waitForText</td> + <td>css=#content</td> + <td>*Project For Code*13*0*0*0.0%*</td> +</tr> +<tr> + <td>type</td> + <td>css=.search-box-input</td> + <td>xoo</td> +</tr> +<tr> + <td>click</td> + <td>css=.search-box-submit</td> + <td></td> +</tr> +<tr> + <td>waitForText</td> + <td>css=#content</td> + <td>*Sample.xoo*</td> +</tr> +<tr> + <td>click</td> + <td>css=.code-name-cell a</td> + <td></td> +</tr> +<tr> + <td>waitForText</td> + <td>css=#content</td> + <td>*public class Sample*</td> +</tr> +<tr> + <td>waitForText</td> + <td>css=.code-breadcrumbs</td> + <td>*Project For Code*src/main/xoo/sample*Sample.xoo*</td> +</tr> +</tbody> +</table> +</body> +</html> diff --git a/it/it-tests/src/test/resources/ui/UiTest/footer.html b/it/it-tests/src/test/resources/ui/UiTest/footer.html index ff45d7cda98..4fea7c4a5d9 100644 --- a/it/it-tests/src/test/resources/ui/UiTest/footer.html +++ b/it/it-tests/src/test/resources/ui/UiTest/footer.html @@ -13,21 +13,16 @@ </thead> <tbody> <tr> - <td>open</td> - <td>/</td> - <td></td> - </tr> - <tr> - <td>waitForText</td> - <td>footer</td> - <td>*This application is based on SonarQubeâ„¢ but is not an official version provided by SonarSource SA*</td> - </tr> - <tr> - <td>waitForText</td> - <td>footer</td> - <td>*Version *.*-* - Community - Documentation - Get Support - Plugins*</td> - </tr> - </tbody> + <td>open</td> + <td>/</td> + <td></td> +</tr> +<tr> + <td>waitForText</td> + <td>footer</td> + <td>*SonarSource SA*</td> +</tr> +</tbody> </table> </body> </html> diff --git a/it/it-tests/src/test/resources/updateCenter/installed-plugins.html b/it/it-tests/src/test/resources/updateCenter/installed-plugins.html index 44bf85163fe..05c21066451 100644 --- a/it/it-tests/src/test/resources/updateCenter/installed-plugins.html +++ b/it/it-tests/src/test/resources/updateCenter/installed-plugins.html @@ -34,6 +34,11 @@ <td></td> </tr> <tr> + <td>waitForElementPresent</td> + <td>css=.js-user-authenticated</td> + <td></td> + </tr> + <tr> <td>open</td> <td>/updatecenter</td> <td></td> diff --git a/it/it-tests/src/test/resources/user/ExternalAuthenticationTest/create-and-delete-user.html b/it/it-tests/src/test/resources/user/ExternalAuthenticationTest/create-and-delete-user.html index 4a1f636691f..90d1eb36714 100644 --- a/it/it-tests/src/test/resources/user/ExternalAuthenticationTest/create-and-delete-user.html +++ b/it/it-tests/src/test/resources/user/ExternalAuthenticationTest/create-and-delete-user.html @@ -34,6 +34,11 @@ <td></td> </tr> <tr> + <td>waitForElementPresent</td> + <td>css=.js-user-authenticated</td> + <td></td> +</tr> +<tr> <td>open</td> <td>/users</td> <td></td> diff --git a/it/it-tests/src/test/resources/user/ExternalAuthenticationTest/external-user-details.html b/it/it-tests/src/test/resources/user/ExternalAuthenticationTest/external-user-details.html index f05ca36e3a5..60751a0adef 100644 --- a/it/it-tests/src/test/resources/user/ExternalAuthenticationTest/external-user-details.html +++ b/it/it-tests/src/test/resources/user/ExternalAuthenticationTest/external-user-details.html @@ -34,6 +34,11 @@ <td></td> </tr> <tr> + <td>waitForElementPresent</td> + <td>css=.js-user-authenticated</td> + <td></td> + </tr> + <tr> <td>open</td> <td>/account/index</td> <td></td> diff --git a/it/it-tests/src/test/resources/user/ExternalAuthenticationTest/external-user-details2.html b/it/it-tests/src/test/resources/user/ExternalAuthenticationTest/external-user-details2.html index 0c2dc5868a7..a245110f624 100644 --- a/it/it-tests/src/test/resources/user/ExternalAuthenticationTest/external-user-details2.html +++ b/it/it-tests/src/test/resources/user/ExternalAuthenticationTest/external-user-details2.html @@ -34,6 +34,11 @@ <td></td> </tr> <tr> + <td>waitForElementPresent</td> + <td>css=.js-user-authenticated</td> + <td></td> + </tr> + <tr> <td>open</td> <td>/account/index</td> <td></td> diff --git a/it/it-tests/src/test/resources/user/LocalAuthenticationTest/allow_users_to_sign_up.html b/it/it-tests/src/test/resources/user/LocalAuthenticationTest/allow_users_to_sign_up.html index 69784618a44..7538eaf5a11 100644 --- a/it/it-tests/src/test/resources/user/LocalAuthenticationTest/allow_users_to_sign_up.html +++ b/it/it-tests/src/test/resources/user/LocalAuthenticationTest/allow_users_to_sign_up.html @@ -84,6 +84,11 @@ <td></td> </tr> <tr> + <td>waitForElementPresent</td> + <td>css=.js-user-authenticated</td> + <td></td> + </tr> + <tr> <td>waitForText</td> <td>css=.navbar</td> <td>*SignUpName*</td> diff --git a/it/it-tests/src/test/resources/user/LocalAuthenticationTest/force-authentication.html b/it/it-tests/src/test/resources/user/LocalAuthenticationTest/force-authentication.html index 3b8f6cb4440..a2f80c42291 100644 --- a/it/it-tests/src/test/resources/user/LocalAuthenticationTest/force-authentication.html +++ b/it/it-tests/src/test/resources/user/LocalAuthenticationTest/force-authentication.html @@ -49,6 +49,11 @@ <td></td> </tr> <tr> + <td>waitForElementPresent</td> + <td>css=.js-user-authenticated</td> + <td></td> + </tr> + <tr> <td>waitForText</td> <td>css=.navbar</td> <td>*Administrator*</td> diff --git a/it/it-tests/src/test/resources/user/LocalAuthenticationTest/login_successful.html b/it/it-tests/src/test/resources/user/LocalAuthenticationTest/login_successful.html index 430e94aa539..68257d74485 100644 --- a/it/it-tests/src/test/resources/user/LocalAuthenticationTest/login_successful.html +++ b/it/it-tests/src/test/resources/user/LocalAuthenticationTest/login_successful.html @@ -39,6 +39,11 @@ <td></td> </tr> <tr> + <td>waitForElementPresent</td> + <td>css=.js-user-authenticated</td> + <td></td> + </tr> + <tr> <td>waitForText</td> <td>css=.navbar</td> <td>*Administrator*</td> diff --git a/it/it-tests/src/test/resources/user/LocalAuthenticationTest/redirect_to_original_url_after_direct_login.html b/it/it-tests/src/test/resources/user/LocalAuthenticationTest/redirect_to_original_url_after_direct_login.html index 65fb94f9368..3b4dc0e8a5f 100644 --- a/it/it-tests/src/test/resources/user/LocalAuthenticationTest/redirect_to_original_url_after_direct_login.html +++ b/it/it-tests/src/test/resources/user/LocalAuthenticationTest/redirect_to_original_url_after_direct_login.html @@ -39,6 +39,11 @@ <td></td> </tr> <tr> + <td>waitForElementPresent</td> + <td>css=.js-user-authenticated</td> + <td></td> + </tr> + <tr> <td>waitForText</td> <td>css=.navbar</td> <td>*Administrator*</td> diff --git a/it/it-tests/src/test/resources/user/LocalAuthenticationTest/redirect_to_original_url_after_indirect_login.html b/it/it-tests/src/test/resources/user/LocalAuthenticationTest/redirect_to_original_url_after_indirect_login.html index 0200a72cf4b..ef3618524db 100644 --- a/it/it-tests/src/test/resources/user/LocalAuthenticationTest/redirect_to_original_url_after_indirect_login.html +++ b/it/it-tests/src/test/resources/user/LocalAuthenticationTest/redirect_to_original_url_after_indirect_login.html @@ -43,6 +43,11 @@ <td></td> </tr> <tr> + <td>waitForElementPresent</td> + <td>css=.js-user-authenticated</td> + <td></td> + </tr> + <tr> <td>waitForText</td> <td>css=.navbar</td> <td>*Administrator*</td> diff --git a/it/it-tests/src/test/resources/user/MyAccountPageTest/should_change_password.html b/it/it-tests/src/test/resources/user/MyAccountPageTest/should_change_password.html index 7d224eb3b87..58ad7b8b089 100644 --- a/it/it-tests/src/test/resources/user/MyAccountPageTest/should_change_password.html +++ b/it/it-tests/src/test/resources/user/MyAccountPageTest/should_change_password.html @@ -35,6 +35,11 @@ <td></td> </tr> <tr> + <td>waitForElementPresent</td> + <td>css=.js-user-authenticated</td> + <td></td> +</tr> +<tr> <td>open</td> <td>/sonar/account/security</td> <td></td> diff --git a/it/it-tests/src/test/resources/user/MyAccountPageTest/should_display_issues.html b/it/it-tests/src/test/resources/user/MyAccountPageTest/should_display_issues.html index ac6bc7c6240..ab2e1c438f3 100644 --- a/it/it-tests/src/test/resources/user/MyAccountPageTest/should_display_issues.html +++ b/it/it-tests/src/test/resources/user/MyAccountPageTest/should_display_issues.html @@ -35,6 +35,11 @@ <td></td> </tr> <tr> + <td>waitForElementPresent</td> + <td>css=.js-user-authenticated</td> + <td></td> +</tr> +<tr> <td>open</td> <td>/sonar/account/issues</td> <td></td> diff --git a/it/it-tests/src/test/resources/user/MyAccountPageTest/should_display_no_projects.html b/it/it-tests/src/test/resources/user/MyAccountPageTest/should_display_no_projects.html new file mode 100644 index 00000000000..4060bf595a6 --- /dev/null +++ b/it/it-tests/src/test/resources/user/MyAccountPageTest/should_display_no_projects.html @@ -0,0 +1,60 @@ +<?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"/> + <link rel="selenium.base" href="http://localhost:49506"/> + <title>should_display_no_projects</title> +</head> +<body> +<table cellpadding="1" cellspacing="1" border="1"> + <thead> + <tr> + <td rowspan="1" colspan="3">should_display_no_projects</td> + </tr> + </thead> + <tbody> + <tr> + <td>open</td> + <td>/sessions/login</td> + <td></td> +</tr> +<tr> + <td>type</td> + <td>id=login</td> + <td>account-user</td> +</tr> +<tr> + <td>type</td> + <td>id=password</td> + <td>password</td> +</tr> +<tr> + <td>clickAndWait</td> + <td>commit</td> + <td></td> +</tr> +<tr> + <td>waitForElementPresent</td> + <td>css=.js-user-authenticated</td> + <td></td> +</tr> +<tr> + <td>open</td> + <td>/account/projects</td> + <td></td> +</tr> +<tr> + <td>waitForElementPresent</td> + <td>css=.account-projects</td> + <td></td> +</tr> +<tr> + <td>assertElementNotPresent</td> + <td>css=.account-projects-list</td> + <td></td> +</tr> +</tbody> +</table> +</body> +</html> diff --git a/it/it-tests/src/test/resources/user/MyAccountPageTest/should_display_projects.html b/it/it-tests/src/test/resources/user/MyAccountPageTest/should_display_projects.html new file mode 100644 index 00000000000..5f580876c51 --- /dev/null +++ b/it/it-tests/src/test/resources/user/MyAccountPageTest/should_display_projects.html @@ -0,0 +1,85 @@ +<?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"/> + <link rel="selenium.base" href="http://localhost:49506"/> + <title>should_display_projects</title> +</head> +<body> +<table cellpadding="1" cellspacing="1" border="1"> + <thead> + <tr> + <td rowspan="1" colspan="3">should_display_projects</td> + </tr> + </thead> + <tbody> + <tr> + <td>open</td> + <td>/sessions/login</td> + <td></td> +</tr> +<tr> + <td>type</td> + <td>id=login</td> + <td>account-user</td> +</tr> +<tr> + <td>type</td> + <td>id=password</td> + <td>password</td> +</tr> +<tr> + <td>clickAndWait</td> + <td>commit</td> + <td></td> +</tr> +<tr> + <td>waitForElementPresent</td> + <td>css=.js-user-authenticated</td> + <td></td> +</tr> +<tr> + <td>open</td> + <td>/account/projects</td> + <td></td> +</tr> +<tr> + <td>waitForElementPresent</td> + <td>css=.account-project-card</td> + <td></td> +</tr> +<tr> + <td>assertText</td> + <td>css=.account-project-name</td> + <td>*Sample*</td> +</tr> +<tr> + <td>assertText</td> + <td>css=.account-project-quality-gate</td> + <td>*Passed*</td> +</tr> +<tr> + <td>assertText</td> + <td>css=.account-project-key</td> + <td>*sample*</td> +</tr> +<tr> + <td>assertText</td> + <td>css=.account-project-description</td> + <td>*Description of a project*</td> +</tr> +<tr> + <td>assertElementPresent</td> + <td>css=.account-project-analysis</td> + <td></td> +</tr> +<tr> + <td>assertElementPresent</td> + <td>css=.account-project-links a[href="http://example.com"]</td> + <td></td> +</tr> +</tbody> +</table> +</body> +</html> diff --git a/it/it-tests/src/test/resources/user/MyAccountPageTest/should_display_user_details.html b/it/it-tests/src/test/resources/user/MyAccountPageTest/should_display_user_details.html index f1543e174d5..1036819238c 100644 --- a/it/it-tests/src/test/resources/user/MyAccountPageTest/should_display_user_details.html +++ b/it/it-tests/src/test/resources/user/MyAccountPageTest/should_display_user_details.html @@ -35,6 +35,11 @@ <td></td> </tr> <tr> + <td>waitForElementPresent</td> + <td>css=.js-user-authenticated</td> + <td></td> +</tr> +<tr> <td>open</td> <td>/sonar/account/</td> <td></td> |