Skip to content

Commit

Permalink
[RFR][TA] OpenJDK Targets Automation
Browse files Browse the repository at this point in the history
Signed-off-by: Karishma Punwatkar <[email protected]>

	modified:   cypress/e2e/models/migration/applicationinventory/analysis.ts
	modified:   cypress/e2e/tests/migration/applicationinventory/analysis/source_analysis.test.ts
	modified:   cypress/e2e/views/analysis.view.ts
	modified:   cypress/fixtures/analysis.json

	modified:   cypress/e2e/models/migration/applicationinventory/analysis.ts
	modified:   cypress/e2e/tests/migration/applicationinventory/analysis/source_analysis.test.ts
	modified:   cypress/e2e/types/types.ts
	modified:   cypress/e2e/views/analysis.view.ts
	modified:   cypress/fixtures/analysis.json
	modified:   cypress/utils/utils.ts

	modified:   cypress/fixtures/analysis.json

	modified:   cypress/e2e/tests/migration/applicationinventory/analysis/source_analysis.test.ts
  • Loading branch information
kpunwatk committed Feb 16, 2024
1 parent 6230704 commit 3fcddb4
Show file tree
Hide file tree
Showing 6 changed files with 89 additions and 23 deletions.
37 changes: 23 additions & 14 deletions cypress/e2e/models/migration/applicationinventory/analysis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ import {
cleanupDownloads,
click,
clickByText,
clickJs,
clickTab,
clickWithin,
doesExistSelector,
Expand All @@ -41,6 +40,7 @@ import {
performRowActionByIcon,
selectCheckBox,
selectFormItems,
selectFromDropList,
sidedrawerTab,
uploadApplications,
uploadXml,
Expand All @@ -58,6 +58,8 @@ import {
analysisColumn,
analysisDetails,
analyzeManuallyButton,
camelToggleButton,
dropDownMenu,
effortColumn,
enableAutomatedTagging,
enableTransactionAnalysis,
Expand All @@ -69,6 +71,7 @@ import {
kebabTopMenuButton,
manageCredentials,
mavenCredential,
openjdkToggleButton,
panelBody,
reportStoryPoints,
rightSideMenu,
Expand All @@ -82,7 +85,6 @@ import {
} from "../../../views/applicationinventory.view";
import { CustomMigrationTargetView } from "../../../views/custom-migration-target.view";
import { actionSelectToggle } from "../../../views/common.view";
import * as commonView from "../../../views/common.view";

export class Analysis extends Application {
name: string;
Expand All @@ -98,7 +100,7 @@ export class Analysis extends Application {
enableTransaction?: boolean;
disableTagging?: boolean;
appName?: string;
storyPoints?: number;
effort?: number;
manuallyAnalyzePackages?: string[];
excludedPackagesList?: string[];
openSourceLibraries?: boolean;
Expand Down Expand Up @@ -129,7 +131,7 @@ export class Analysis extends Application {
enableTransaction,
disableTagging,
appName,
storyPoints,
effort,
manuallyAnalyzePackages,
excludedPackagesList,
incidents,
Expand All @@ -149,7 +151,7 @@ export class Analysis extends Application {
if (enableTransaction) this.enableTransaction = enableTransaction;
if (disableTagging) this.disableTagging = disableTagging;
if (appName) this.appName = appName;
if (storyPoints) this.storyPoints = storyPoints;
if (effort) this.effort = effort;
if (excludePackages) this.excludePackages = excludePackages;
if (manuallyAnalyzePackages) this.manuallyAnalyzePackages = manuallyAnalyzePackages;
if (excludedPackagesList) this.excludedPackagesList = excludedPackagesList;
Expand All @@ -170,7 +172,22 @@ export class Analysis extends Application {

protected selectTarget(target: string[]): void {
for (let i = 0; i < target.length; i++) {
cy.get("div.pf-v5-c-empty-state__content").children("h4").contains(target[i]).click();
if (
target.includes("OpenJDK 11") ||
target.includes("OpenJDK 17") ||
target.includes("OpenJDK 21")
) {
click(openjdkToggleButton);
clickByText(dropDownMenu, target[i]);
} else if (target.includes("camel:3") || target.includes("camel:4")) {
click(camelToggleButton);
clickByText(dropDownMenu, target[i]);
} else {
cy.get("div.pf-v5-c-empty-state__content")
.children("h4")
.contains(target[i])
.click();
}
}
}

Expand Down Expand Up @@ -414,14 +431,6 @@ export class Analysis extends Application {
cy.wait(2000);
}

validateStoryPoints(): void {
cy.get(fileName).should("contain", this.appName);
//Validating that this field contains number
cy.get(reportStoryPoints).should((value) => {
expect(Number.isNaN(parseInt(value.text(), 10))).to.eq(false);
});
}

static validateTopActionMenu(rbacRules: RbacValidationRules) {
Application.open();
if (rbacRules["Top action menu"]["Not available"]) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,48 @@ describe(["@tier1"], "Source Analysis", () => {
application.manageCredentials(source_credential.name, maven_credential.name);
application.analyze();
application.verifyAnalysisStatus("Completed");
application.verifyEffort(3);
application.verifyEffort(
this.analysisData["jws6_source+dep_analysis_on_tackletestapp"]["effort"]
);
});

it("Openjdk17 Source + dependencies analysis on tackletest app", function () {
const application = new Analysis(
getRandomApplicationData("tackleTestApp_Source+dependencies_openjdk17", {
sourceData: this.appData["tackle-testapp-git"],
}),
getRandomAnalysisData(
this.analysisData["openJDK17_source+dep_analysis_on_tackletestapp"]
)
);
application.create();
applicationsList.push(application);
cy.wait("@getApplication");
cy.wait(2 * SEC);
application.manageCredentials(source_credential.name, maven_credential.name);
application.analyze();
application.verifyAnalysisStatus("Completed");
application.verifyEffort(
this.analysisData["openJDK17_source+dep_analysis_on_tackletestapp"]["effort"]
);
});

it("OpenJDK21 Source + dependencies analysis on daytrader app", function () {
const application = new Analysis(
getRandomApplicationData("dayTraderApp_Source+dependencies_openjdk21", {
sourceData: this.appData["daytrader-app"],
}),
getRandomAnalysisData(this.analysisData["openJDK21_source+dep_analysis_on_dayTrader"])
);
application.create();
applicationsList.push(application);
cy.wait("@getApplication");
cy.wait(2 * SEC);
application.analyze();
application.verifyAnalysisStatus("Completed");
application.verifyEffort(
this.analysisData["openJDK21_source+dep_analysis_on_dayTrader"]["effort"]
);
});

after("Perform test data clean up", function () {
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/types/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ export type analysisData = {
enableTransaction?: boolean;
disableTagging?: boolean;
appName?: string;
storyPoints?: number;
effort?: number;
excludePackages?: string[];
manuallyAnalyzePackages?: string[];
excludedPackagesList?: string[];
Expand Down
8 changes: 3 additions & 5 deletions cypress/e2e/views/analysis.view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@ 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.
*/
export const actionButton = "div > button[aria-label='Actions']";
export const applicationNameInput = "input[name=name]";
export const applicationDescriptionInput = "input[name=description]";
export const sourceofAnalysiSelect = "[placeholder='Select a business service']";
export const sourceDropdown = "#analysis-mode-toggle";
export const analysisColumn = "td[data-label='Analysis']";
export const effortColumn = "td[data-label='Effort']";
Expand All @@ -41,4 +37,6 @@ export const analysisDetailsEditor = ".monaco-editor";
export const rightSideMenu = "#page-drawer-content";
export const enableAutomatedTagging = "input[name=autoTaggingEnabled]";
export const kebabTopMenuButton = "#toolbar-kebab";
export const kebabButton = 'button[aria-label="Kebab toggle"]';
export const camelToggleButton = "#Camel-toggle";
export const openjdkToggleButton = "#OpenJDK-toggle";
export const dropDownMenu = "ul.pf-v5-c-select__menu";
20 changes: 19 additions & 1 deletion cypress/fixtures/analysis.json
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,24 @@
"jws6_source+dep_analysis_on_tackletestapp": {
"source": "Source code + dependencies",
"target": ["JBoss Web Server 6"],
"appName": "tackle-testapp"
"appName": "tackle-testapp",
"openSourceLibraries": true,
"effort": 3
},

"openJDK17_source+dep_analysis_on_tackletestapp": {
"source": "Source code + dependencies",
"target": ["OpenJDK 17"],
"appName": "tackle-testapp",
"openSourceLibraries": true,
"effort": 3
},

"openJDK21_source+dep_analysis_on_dayTrader": {
"source": "Source code + dependencies",
"target": ["OpenJDK 21"],
"appName": "deps",
"openSourceLibraries": true,
"effort": 596
}
}
2 changes: 1 addition & 1 deletion cypress/utils/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1091,7 +1091,7 @@ export function getRandomAnalysisData(analysisdata): analysisData {
enableTransaction: analysisdata.enableTransaction,
disableTagging: analysisdata.disableTagging,
appName: analysisdata.appName,
storyPoints: analysisdata.storyPoints,
effort: analysisdata.effort,
excludePackages: analysisdata.excludePackages,
excludeRuleTags: analysisdata.excludeRuleTags,
manuallyAnalyzePackages: analysisdata.manuallyAnalyzePackages,
Expand Down

0 comments on commit 3fcddb4

Please sign in to comment.