-
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
[Draft] ✨ Adding tests for checking filter&sort abilities in application table #1238
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -45,6 +45,7 @@ import { | |
SEC, | ||
tags, | ||
archetypes, | ||
analysis, | ||
} from "../../../../types/constants"; | ||
|
||
import * as data from "../../../../../utils/data_utils"; | ||
|
@@ -140,6 +141,16 @@ describe(["@tier3"], "Application inventory filter validations", function () { | |
clickByText(button, clearAllFilters); | ||
}); | ||
|
||
it("Analysis filter validations",function(){ | ||
Application.open(); | ||
getFirstAnalysisColumnValue().then((firstValue) => { | ||
cy.log("First Analysis column value: ", firstValue); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nitpick: This line can be removed |
||
applySearchFilter(analysis,firstValue); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This test suite creates 2 applications at the beginning and does not analyze it so we can be sure that at least there is going to be one application with the "Not started" status. In fact, there is a high probability only apps with "Not started" status exist when this test is executed, so maybe it would be a good idea to create an app then start and cancel an analysis on it so we have, at least, 2 statuses to correctly test the feature. |
||
cy.wait(2000); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we can remove this line and it should work anyway |
||
exists(firstValue) | ||
}); | ||
} ); | ||
|
||
it("Tag filter validations", function () { | ||
Application.open(); | ||
|
||
|
@@ -368,3 +379,17 @@ const filterApplicationsBySubstring = (): void => { | |
|
||
clickByText(button, clearAllFilters); | ||
}; | ||
|
||
// this function finds the analysis status of the first application | ||
const getFirstAnalysisColumnValue = (): Cypress.Chainable<string> => { | ||
return cy.get('table').then(($table) => { | ||
const analysisColumnIndex = $table.find('th').toArray().findIndex(th => th.innerText.trim() === "Analysis"); | ||
if (analysisColumnIndex >= 0) { | ||
return cy.get(`tbody tr td:nth-child(${analysisColumnIndex + 1})`).first().invoke('text').then((text) => { | ||
return text.trim(); | ||
}); | ||
} else { | ||
return cy.wrap("").then(() => ""); | ||
} | ||
}); | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,7 +24,7 @@ import { | |
clickOnSortButton, | ||
deleteByList, | ||
} from "../../../../../utils/utils"; | ||
import { name, tags, SortType, businessService, SEC } from "../../../../types/constants"; | ||
import { name, tags, SortType, businessService, SEC, analysis } from "../../../../types/constants"; | ||
import * as data from "../../../../../utils/data_utils"; | ||
import { BusinessServices } from "../../../../models/migration/controls/businessservices"; | ||
import { Application } from "../../../../models/migration/applicationinventory/application"; | ||
|
@@ -74,6 +74,24 @@ describe(["@tier3"], "Application inventory sort validations", function () { | |
verifySortDesc(afterDescSortList, unsortedList); | ||
}); | ||
|
||
it("Analysis status sort validations", function () { | ||
Application.open(); | ||
// get unsorted list when page loads | ||
const unsortedList = getTableColumnData(analysis); | ||
// Sort the application inventory by Tag count in ascending order | ||
clickOnSortButton(analysis, SortType.ascending); | ||
cy.wait(2 * SEC); | ||
// Verify that the application inventory table rows are displayed in ascending order | ||
const afterAscSortList = getTableColumnData(analysis); | ||
verifySortAsc(afterAscSortList, unsortedList); | ||
// Sort the application inventory by analysis in descending order | ||
clickOnSortButton(analysis, SortType.descending); | ||
cy.wait(2000); | ||
// Verify that the application inventory table rows are displayed in descending order | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The code is explanatory enough so we can remove the comments. I think the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There are methods like verifySortAsc and verifySortDesc in utils which can be used directly .Please check. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. used these methods here a well, |
||
const afterDescSortList = getTableColumnData(analysis); | ||
verifySortDesc(afterDescSortList, unsortedList); | ||
}); | ||
|
||
it("Business service sort validations", function () { | ||
Application.open(); | ||
|
||
|
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.
nitpick: Analysis status filter validations