From 9bc396b35973e8f3378d2f4e869d12bfaba7f6c6 Mon Sep 17 00:00:00 2001 From: Igor Braginsky Date: Tue, 24 Oct 2023 16:49:53 +0300 Subject: [PATCH] Filtering test for issues by app name Signed-off-by: Igor Braginsky --- .../migration/dynamic-reports/filter.test.ts | 89 +++++++++++++++++++ cypress/e2e/views/issue.view.ts | 6 +- 2 files changed, 92 insertions(+), 3 deletions(-) create mode 100644 cypress/e2e/tests/migration/dynamic-reports/filter.test.ts diff --git a/cypress/e2e/tests/migration/dynamic-reports/filter.test.ts b/cypress/e2e/tests/migration/dynamic-reports/filter.test.ts new file mode 100644 index 000000000..a48edef46 --- /dev/null +++ b/cypress/e2e/tests/migration/dynamic-reports/filter.test.ts @@ -0,0 +1,89 @@ +/* +Copyright © 2021 the Konveyor Contributors (https://konveyor.io/) + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ +/// + +import { + login, + getRandomApplicationData, + getRandomAnalysisData, + resetURL, + deleteByList, + checkSuccessAlert, +} from "../../../../utils/utils"; +import { Analysis } from "../../../models/migration/applicationinventory/analysis"; +import { CredentialType, UserCredentials, SEC, filterIssue } from "../../../types/constants"; +import * as data from "../../../../utils/data_utils"; +import { CredentialsSourceControlUsername } from "../../../models/administration/credentials/credentialsSourceControlUsername"; +import { infoAlertMessage } from "../../../views/common.view"; +import { Issue } from "../../../models/migration/dynamicreports/issue"; +let sourceCredential: CredentialsSourceControlUsername; +let applicationsList: Array = []; + +describe(["@tier2"], "Issues filtering", () => { + before("Login", function () { + login(); + + // Create source Credentials + sourceCredential = new CredentialsSourceControlUsername( + data.getRandomCredentialsData( + CredentialType.sourceControl, + UserCredentials.usernamePassword, + true + ) + ); + sourceCredential.create(); + }); + + beforeEach("Load data", function () { + cy.fixture("application").then(function (appData) { + this.appData = appData; + }); + cy.fixture("analysis").then(function (analysisData) { + this.analysisData = analysisData; + }); + + // Interceptors + cy.intercept("POST", "/hub/application*").as("postApplication"); + cy.intercept("GET", "/hub/application*").as("getApplication"); + }); + + it("Running analysis and filtering issues by app name", function () { + // For source code analysis application must have source code URL git or svn + cy.log(this.analysisData[0]); + const application = new Analysis( + getRandomApplicationData("bookserverApp", { + sourceData: this.appData["bookserver-app"], + }), + getRandomAnalysisData(this.analysisData["source_analysis_on_bookserverapp"]) + ); + application.create(); + applicationsList.push(application); + cy.wait("@getApplication"); + cy.wait(2 * SEC); + application.analyze(); + checkSuccessAlert(infoAlertMessage, `Submitted for analysis`); + application.verifyAnalysisStatus("Completed"); + + Issue.openList(); + Issue.filterBy(filterIssue.appName, application.name); + cy.pause(); + }); + + after("Perform test data clean up", function () { + deleteByList(applicationsList); + sourceCredential.delete(); + }); +}); diff --git a/cypress/e2e/views/issue.view.ts b/cypress/e2e/views/issue.view.ts index f0abe6ac1..10974719f 100644 --- a/cypress/e2e/views/issue.view.ts +++ b/cypress/e2e/views/issue.view.ts @@ -1,6 +1,6 @@ -export const appFilterName = "#application.name-input"; -export const bsFilterName = "#businessService.name-filter-value-select"; -export const tagFilterName = "#tag.id-filter-value-select"; +export const appFilterName = "#application\\.name-input"; +export const bsFilterName = "#businessService\\.name-filter-value-select"; +export const tagFilterName = "#tag\\.id-filter-value-select"; export const categoryFilterName = "#category-input"; export const sourceFilterName = "#source-input"; export const targetFilterName = "#target-input";