diff --git a/cypress.config.ts b/cypress.config.ts index eab3a9a68..ef16d005b 100644 --- a/cypress.config.ts +++ b/cypress.config.ts @@ -10,6 +10,8 @@ export default defineConfig({ pass: "Dog8code", git_user: "", git_password: "", + svn_user: "qe-admin", + svn_password: "Dog8code", jira_stage_datacenter_url: "https://issues.stage.redhat.com/", jira_stage_bearer_token: "", jira_stage_basic_login: "", diff --git a/cypress/e2e/tests/administration/repository/subversion.test.ts b/cypress/e2e/tests/administration/repository/subversion.test.ts index 27658d47d..0b5b0c8ff 100644 --- a/cypress/e2e/tests/administration/repository/subversion.test.ts +++ b/cypress/e2e/tests/administration/repository/subversion.test.ts @@ -21,31 +21,35 @@ import { getRandomAnalysisData, getRandomApplicationData, login, - resetURL, - writeMavenSettingsFile, } from "../../../../utils/utils"; -import * as data from "../../../../utils/data_utils"; import { SubversionConfiguration } from "../../../models/administration/repositories/subversion"; import { CredentialsSourceControlUsername } from "../../../models/administration/credentials/credentialsSourceControlUsername"; -import { button, CredentialType, SEC, UserCredentials } from "../../../types/constants"; +import { + AnalysisStatuses, + button, + CredentialType, + SEC, + UserCredentials, +} from "../../../types/constants"; import { Analysis } from "../../../models/migration/applicationinventory/analysis"; import { footer } from "../../../views/common.view"; - -let subversionConfiguration = new SubversionConfiguration(); -let source_credential: CredentialsSourceControlUsername; -let applicationsList: Analysis[] = []; +import { getDescription, getRandomWord } from "../../../../utils/data_utils"; describe(["@tier1"], "Test secure and insecure svn repository analysis", () => { + const subversionConfiguration = new SubversionConfiguration(); + let sourceCredential: CredentialsSourceControlUsername; + let applicationsList: Analysis[] = []; + before("Login", function () { login(); - source_credential = new CredentialsSourceControlUsername( - data.getRandomCredentialsData( - CredentialType.sourceControl, - UserCredentials.usernamePassword, - true - ) - ); - source_credential.create(); + sourceCredential = new CredentialsSourceControlUsername({ + type: CredentialType.sourceControl, + name: getRandomWord(6), + description: getDescription(), + username: Cypress.env("svn_user"), + password: Cypress.env("svn_password"), + }); + sourceCredential.create(); }); beforeEach("Load data", function () { @@ -56,61 +60,51 @@ describe(["@tier1"], "Test secure and insecure svn repository analysis", () => { this.analysisData = analysisData; }); - // Interceptors - cy.intercept("POST", "/hub/application*").as("postApplication"); cy.intercept("GET", "/hub/application*").as("getApplication"); }); - // test that when the insecure repository is enabled, then the analysis on a http repo should be completed successfully - // Skipped until a svn server is provided in https://issues.redhat.com/browse/MTA-1717 - it.skip("Analysis on insecure subversion Repository(http) for tackle test app when insecure repository is allowed", function () { + it("Analysis on insecure SVN Repository(http) when allowed", function () { subversionConfiguration.enableInsecureSubversionRepositories(); const application = new Analysis( - getRandomApplicationData("Secure_enabled_tackle_test_app", { - sourceData: this.appData["tackle-testapp-svn-insecure"], + getRandomApplicationData("Insecure svn enabled bookserver app", { + sourceData: this.appData["bookserver-svn-insecure"], }), getRandomAnalysisData(this.analysisData["source_analysis_on_bookserverapp"]) ); application.create(); applicationsList.push(application); cy.wait("@getApplication"); - cy.wait(2 * SEC); - application.manageCredentials(source_credential.name, null); + application.manageCredentials(sourceCredential.name, null); application.analyze(); - application.verifyAnalysisStatus("Completed"); - application.openReport(); + application.verifyAnalysisStatus(AnalysisStatuses.completed); }); - // Negative test case, when the insecure repository is disabled, then the analysis on a http repo should fail - it("Analysis on insecure subversion Repository(http) for tackle test app when insecure repository is not allowed", function () { + it("Analysis on insecure SVN Repository(http) when not allowed", function () { subversionConfiguration.disableInsecureSubversionRepositories(); const application = new Analysis( - getRandomApplicationData("Secure_disabled_tackle_test_app", { - sourceData: this.appData["tackle-testapp-svn-insecure"], + getRandomApplicationData("Insecure svn disabled bookserver app", { + sourceData: this.appData["bookserver-svn-insecure"], }), getRandomAnalysisData(this.analysisData["source_analysis_on_bookserverapp"]) ); application.create(); applicationsList.push(application); cy.wait("@getApplication"); - cy.wait(2 * SEC); - application.manageCredentials(source_credential.name, null); + application.manageCredentials(sourceCredential.name, null); application.analyze(); - application.verifyAnalysisStatus("Failed"); + application.verifyAnalysisStatus(AnalysisStatuses.failed); application.openAnalysisDetails(); clickWithinByText(footer, button, "Close"); }); - afterEach("Persist session", function () { - // Reset URL from report page to web UI - resetURL(); + afterEach("Clear state", function () { + Analysis.open(true); }); after("Perform test data clean up", () => { deleteByList(applicationsList); - source_credential.delete(); - writeMavenSettingsFile(data.getRandomWord(5), data.getRandomWord(5)); + sourceCredential.delete(); }); }); diff --git a/cypress/e2e/tests/migration/applicationinventory/analysis/source_analysis.test.ts b/cypress/e2e/tests/migration/applicationinventory/analysis/source_analysis.test.ts index daac2bc17..f84f6bf0d 100644 --- a/cypress/e2e/tests/migration/applicationinventory/analysis/source_analysis.test.ts +++ b/cypress/e2e/tests/migration/applicationinventory/analysis/source_analysis.test.ts @@ -167,24 +167,6 @@ describe(["@tier1"], "Source Analysis", () => { application.verifyAnalysisStatus("Completed"); }); - // Skipped until a svn server is provided in https://issues.redhat.com/browse/MTA-1717 - it.skip("Source Analysis on tackle testapp for svn repo type", function () { - // For tackle test app source credentials are required. - const application = new Analysis( - getRandomApplicationData("tackleTestApp_svnRepo", { - sourceData: this.appData["tackle-testapp-svn"], - }), - getRandomAnalysisData(this.analysisData["analysis_for_enableTagging"]) - ); - application.create(); - applicationsList.push(application); - cy.wait("@getApplication"); - cy.wait(2 * SEC); - application.manageCredentials(source_credential.name, null); - application.analyze(); - application.verifyAnalysisStatus("Completed"); - }); - it("Analysis for known Open Source libraries on tackleTest app", function () { // Source code analysis require both source and maven credentials const application = new Analysis( diff --git a/cypress/fixtures/application.json b/cypress/fixtures/application.json index 2bd61afda..de346bac8 100644 --- a/cypress/fixtures/application.json +++ b/cypress/fixtures/application.json @@ -29,9 +29,9 @@ "repoType": "Git", "sourceRepo": "http://github.com/konveyor/tackle-testapp" }, - "tackle-testapp-svn-insecure": { + "bookserver-svn-insecure": { "repoType": "Subversion", - "sourceRepo": "http://github.com/konveyor/tackle-testapp" + "sourceRepo": "http://10.0.188.129/svn/mtaqe-svn/book-server" }, "konveyor-exampleapp": { "repoType": "Git",