Add e2e tests for export hosts feature (#5895)
This commit is contained in:
@@ -29,7 +29,6 @@ describe("Hosts flow", () => {
|
||||
cy.visit("/hosts/manage");
|
||||
|
||||
cy.getAttached(".manage-hosts").within(() => {
|
||||
// cy.getAttached(".manage-hosts__export-btn").click(); // Feature pushed back from 4.13 release
|
||||
cy.contains("button", /add hosts/i).click();
|
||||
});
|
||||
cy.getAttached(".react-tabs").within(() => {
|
||||
@@ -71,6 +70,20 @@ describe("Hosts flow", () => {
|
||||
});
|
||||
}
|
||||
});
|
||||
it(`exports hosts to CSV`, () => {
|
||||
cy.visit("/hosts/manage");
|
||||
cy.getAttached(".manage-hosts").within(() => {
|
||||
cy.getAttached(".manage-hosts__export-btn").click();
|
||||
});
|
||||
if (Cypress.platform !== "win32") {
|
||||
// windows has issues with downloads location
|
||||
const formattedTime = format(new Date(), "yyyy-MM-dd");
|
||||
const filename = `Hosts ${formattedTime}.csv`;
|
||||
cy.readFile(path.join(Cypress.config("downloadsFolder"), filename), {
|
||||
timeout: 5000,
|
||||
});
|
||||
}
|
||||
});
|
||||
it(`hides and shows "Used by" column`, () => {
|
||||
cy.visit("/hosts/manage");
|
||||
cy.getAttached("thead").within(() =>
|
||||
|
||||
@@ -1281,7 +1281,7 @@ const ManageHostsPage = ({
|
||||
evt.preventDefault();
|
||||
|
||||
const hiddenColumnsStorage = localStorage.getItem("hostHiddenColumns");
|
||||
let currentHiddenColumns;
|
||||
let currentHiddenColumns = [];
|
||||
let visibleColumns;
|
||||
if (hiddenColumnsStorage) {
|
||||
currentHiddenColumns = JSON.parse(hiddenColumnsStorage);
|
||||
|
||||
Reference in New Issue
Block a user