-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[RFR] automate MTA-382--assess application with multiple questionnaires #828
Conversation
initial commit
cypress/e2e/tests/migration/applicationinventory/assessment/assess_review.test.ts
Show resolved
Hide resolved
cypress/e2e/models/migration/applicationinventory/assessment.ts
Outdated
Show resolved
Hide resolved
cypress/e2e/models/migration/applicationinventory/assessment.ts
Outdated
Show resolved
Hide resolved
cypress/e2e/models/migration/applicationinventory/assessment.ts
Outdated
Show resolved
Hide resolved
cypress/e2e/tests/migration/applicationinventory/assessment/assess_review.test.ts
Outdated
Show resolved
Hide resolved
cypress/e2e/tests/migration/applicationinventory/assessment/assess_review.test.ts
Outdated
Show resolved
Hide resolved
cypress/e2e/tests/migration/applicationinventory/assessment/assess_review.test.ts
Outdated
Show resolved
Hide resolved
cypress/e2e/models/migration/applicationinventory/assessment.ts
Outdated
Show resolved
Hide resolved
cypress/e2e/tests/migration/applicationinventory/assessment/assess_review.test.ts
Show resolved
Hide resolved
final push
npm run format
cypress/e2e/models/migration/applicationinventory/assessment.ts
Outdated
Show resolved
Hide resolved
updated timeout to 15 seconds
changed 2000 to 2 * SEC
Please attach a jenkins run @midays |
cypress/e2e/tests/migration/applicationinventory/assessment/assess_review.test.ts
Outdated
Show resolved
Hide resolved
added assessment validation
} else if (risk === "medium") { | ||
cy.wrap($question) | ||
.children() | ||
.find("div.pf-v5-l-split__item") | ||
.then(($questionLine) => { | ||
/* These 3 questions generate high risk with mean options, | ||
hence to keep risk to medium, select last options for these set of specific questions */ | ||
if ( | ||
$questionLine.text() === | ||
"Does the application have legal and/or licensing requirements?" || | ||
$questionLine.text() === | ||
"Does the application require specific hardware?" || | ||
$questionLine.text() === | ||
"How is the application clustering managed?" | ||
) { | ||
optionToSelect = totalOptions - 1; | ||
} else { | ||
optionToSelect = Math.floor(totalOptions / 2); | ||
} | ||
this.clickRadioOption($question, optionToSelect); | ||
}); | ||
} else { | ||
optionToSelect = 1; | ||
this.clickRadioOption($question, optionToSelect); | ||
} | ||
}); | ||
if (i === 4) { | ||
clickJs(commonView.nextButton); | ||
} else { | ||
clickJs(commonView.nextButton); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method is too complex right now, some considerations:
low
andhigh
risk conditions are almost equal, so they can be combined with something like:
if(risk === "medium") {
...
} else {
this.clickRadioOption($question, risk === "high" ? 1 : totalOptions - 1);
}
- Those 3 special questions are making the if condition too long, and in the future some questions may change, be added or removed.
In order to make the code more maintainable, an idea could be to save the questions in an array at the start of the method and use includes
instead of doing multipleConditions:
const specialHighRiskQuestions = [
"Does the application have legal and/or licensing requirements?",
"Does the application require specific hardware?",
"How is the application clustering managed?"
];
...
...
if(specialHighRiskQuestions.includes($questionLine.text())) {
...
}
- The last if-else looks identical to me:
if (i === 4) {
clickJs(commonView.nextButton);
} else {
clickJs(commonView.nextButton);
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At least point 3 should be fixed before merging.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
all of the points you mentioned are change worthy, but I dind't write any of them, I just wrapped it in a cy tag, and I don't intend to change anything in it for now, so I opened a ticket for it, and I'll work on it in the next PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@midays as discussed , implement point 3 . refactoring of answering questionnaire can be done in a separate PR . It will need thorough testing . Please open a card for it and assign it to me .
For this PR attach a jenkins run with this test
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sshveta impletmented change, jenkins run passed: https://main-jenkins-csb-migrationqe.apps.ocp-c1.prod.psi.redhat.com/job/mta/job/mta-ui-tests-runner/1343/console
cypress/e2e/tests/migration/applicationinventory/assessment/assess_review.test.ts
Outdated
Show resolved
Hide resolved
cypress/e2e/tests/migration/applicationinventory/assessment/assess_review.test.ts
Outdated
Show resolved
Hide resolved
changed timeout to 30 seconds
changed undefined to null
reload the page after opening the application page
enable the questioneer only when needed
import in TC
changed execution order
remove if statement
checkout cypress
remove condition
|
||
const stakeholdersList: Array<Stakeholders> = []; | ||
const stakeholdersNameList: Array<string> = []; | ||
const fileName = "Legacy Pathfinder"; | ||
const yamlFilePath = "questionnaire_import/cloud-native.yaml"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please rename this to "yamlFile"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
rename file
Signed-off-by: mohamed idays [email protected]