Skip to content

Commit

Permalink
[RFR] Fix custom migration crud test (konveyor#1207)
Browse files Browse the repository at this point in the history
* fix custom migration target crud test

Signed-off-by: Alejandro Brugarolas <[email protected]>

* fix custom migration target crud test

Signed-off-by: Alejandro Brugarolas <[email protected]>

---------

Signed-off-by: Alejandro Brugarolas <[email protected]>
  • Loading branch information
abrugaro authored Aug 28, 2024
1 parent 5c2d78f commit e7ec17b
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import {
sourcesToggle,
} from "../../../views/custom-migration-target.view";
import { RulesManualFields, RulesRepositoryFields } from "../../../types/types";
import { actionSelectToggle, submitButton } from "../../../views/common.view";
import { submitButton } from "../../../views/common.view";

export interface CustomMigrationTarget {
name: string;
Expand Down Expand Up @@ -143,7 +143,7 @@ export class CustomMigrationTarget {

public static selectLanguage(language: Languages) {
CustomMigrationTarget.open();
cy.get(actionSelectToggle, { timeout: 30 * SEC }).click();
cy.get(CustomMigrationTargetView.languageDropdown, { timeout: 30 * SEC }).click();
clickByText("button", language);
}

Expand Down
31 changes: 14 additions & 17 deletions cypress/e2e/models/migration/applicationinventory/analysis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import {
analyzeAppButton,
analyzeButton,
button,
clearAllFilters,
Languages,
ReportTypeSelectors,
RepositoryType,
Expand All @@ -32,6 +33,7 @@ import {
clickByText,
clickTab,
clickWithin,
clickWithinByText,
doesExistSelector,
doesExistText,
inputText,
Expand Down Expand Up @@ -68,6 +70,7 @@ import {
expandAll,
fileName,
kebabTopMenuButton,
languageSelectionDropdown,
manageCredentials,
mavenCredential,
openjdkToggleButton,
Expand All @@ -82,7 +85,6 @@ import {
kebabMenu,
} from "../../../views/applicationinventory.view";
import { CustomMigrationTargetView } from "../../../views/custom-migration-target.view";
import { actionSelectToggle } from "../../../views/common.view";

export class Analysis extends Application {
name: string;
Expand Down Expand Up @@ -168,25 +170,20 @@ export class Analysis extends Application {
*/
public static selectLanguage(language: Languages, removePreSelected = false) {
cy.wait(2 * SEC);
click(actionSelectToggle);

if (removePreSelected) {
cy.get("#filter-by-language input[type=checkbox]").each(($checkbox) => {
cy.wrap($checkbox).then((checkbox) => {
if (checkbox.is(":checked")) {
cy.wrap($checkbox).uncheck();
}
});
});
// find the language's input checkbox and make sure it is checked
cy.get(`${actionSelectToggle} + .pf-v5-c-menu`)
.contains(language)
.closest(".pf-v5-c-menu__list-item")
.find("input[type=checkbox]")
.check();

click(actionSelectToggle);
clickWithinByText(".pf-v5-c-wizard__main-body", "button", clearAllFilters);
}

cy.get(languageSelectionDropdown).click();

cy.get(`#filter-control-name-select-typeahead-listbox > li`)
.contains(language)
.closest(".pf-v5-c-menu__list-item")
.find("input[type=checkbox]")
.check();

cy.get(languageSelectionDropdown).click();
}

public selectTarget(target: string[]): void {
Expand Down
1 change: 1 addition & 0 deletions cypress/e2e/views/analysis.view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,4 @@ export const closeWizard = ".pf-v5-c-wizard__close > .pf-v5-c-button";
export const codeEditorControls = "div.pf-v5-c-code-editor__controls";
export const menuToggle = "button.pf-v5-c-menu-toggle";
export const menuList = "div.pf-v5-c-menu";
export const languageSelectionDropdown = "#filter-control-name-Languages";
1 change: 1 addition & 0 deletions cypress/e2e/views/custom-migration-target.view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,5 @@ export enum CustomMigrationTargetView {
dragButton = "#drag-button",
card = ".pf-v5-c-card",
cardContainer = "div.dnd-grid",
languageDropdown = "#action-select-toggle",
}

0 comments on commit e7ec17b

Please sign in to comment.