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
  • Loading branch information
kpunwatk committed Feb 15, 2024
1 parent 6230704 commit e3c5066
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 9 deletions.
24 changes: 21 additions & 3 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 Down Expand Up @@ -170,7 +172,23 @@ 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);
selectFromDropList(dropDownMenu, target[i]);
}
if (target.includes("camel:3") || target.includes("camel:4")) {
click(camelToggleButton);
selectFromDropList(dropDownMenu, target[i]);
} else {
cy.get("div.pf-v5-c-empty-state__content")
.children("h4")
.contains(target[i])
.click();
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,41 @@ describe(["@tier1"], "Source Analysis", () => {
application.verifyEffort(3);
});

it("Openjdk17 Source + dependencies analysis on tackletest app", function () {
const application = new Analysis(
getRandomApplicationData("tackleTestApp_Source+dependencies_jws6", {
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");
});

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

after("Perform test data clean up", function () {
deleteByList(applicationsList);
writeMavenSettingsFile(data.getRandomWord(5), data.getRandomWord(5));
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";
17 changes: 16 additions & 1 deletion cypress/fixtures/analysis.json
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,21 @@
"jws6_source+dep_analysis_on_tackletestapp": {
"source": "Source code + dependencies",
"target": ["JBoss Web Server 6"],
"appName": "tackle-testapp"
"appName": "tackle-testapp",
"openSourceLibraries": true
},

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

"openJDK21_source+dep_analysis_on_dayTrader": {
"source": "Source code + dependencies",
"target": ["OpenJDK 21"],
"appName": "deps",
"openSourceLibraries": true
}
}

0 comments on commit e3c5066

Please sign in to comment.