Skip to content
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

FOUR-19630 Fix Support backward compatibility of screens #1747

Merged
merged 11 commits into from
Oct 22, 2024
16 changes: 11 additions & 5 deletions src/mixins/Clipboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,17 @@ export default {
addUuidToElements(screenConfig) {
const replaceInPage = (page) => {
page.items.forEach((item, index) => {
if (!item.uuid) {
item.uuid = this.generateUUID();
}
if (item.items) {
replaceInPage(item);
if (item instanceof Array) {
// multi-column each item in the column
replaceInPage({ items: item });
} else {
// loop through children
if (!item.uuid) {
item.uuid = this.generateUUID();
}
if (item.items) {
replaceInPage(item);
}
}
});
}
Expand Down
1 change: 1 addition & 0 deletions tests/e2e/fixtures/UUID_compatibility.json

Large diffs are not rendered by default.

40 changes: 40 additions & 0 deletions tests/e2e/specs/ClipboardBwCompatibility.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import ClipboardManager from "../../../src/store/modules/ClipboardManager";

describe("Clipboard backward compatibility", () => {
beforeEach(() => {
cy.visit("/");
});

it("FOUR-19630: Check clipboard with a screen from a previous version", () => {
ClipboardManager.saveToLocalStorage([]);
cy.loadFromJson("UUID_compatibility.json", 1);

// for each control, check if it can be added to the clipboard
cy.get('.control-item').each(($el, index) => {
cy.wrap($el).click({ force: true });
cy.get('[data-cy="addToClipboard"]').click({ force: true });
cy.get('[data-cy="addToClipboard"]').should("not.exist").then(() => {
// Verify it was added to the clipboard storage
const content = ClipboardManager.loadFromLocalStorage();
expect(content.length).to.equal(index + 1);
});
});

// Go to second page
cy.get('[data-test="page-dropdown"] button').click({force: true});
cy.get('[data-test="page-popup"]').click({force: true});
cy.wait(1000);
const elementsAddedFromMainPage = 17;

// check if each control in the second page can be added to the clipboard
cy.get('.control-item').each(($el, index) => {
cy.wrap($el).click({ force: true });
cy.get('[data-cy="addToClipboard"]').click({ force: true });
cy.get('[data-cy="addToClipboard"]').should("not.exist").then(() => {
// Verify it was added to the clipboard storage
const content = ClipboardManager.loadFromLocalStorage();
expect(content.length).to.equal(elementsAddedFromMainPage + index + 1);
});
});
});
});
2 changes: 1 addition & 1 deletion tests/e2e/specs/ScreenTemplateSection.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ it("Displays Shared Templates when Shared Templates button is clicked", () => {
});
});

it.only("Is hidden when an Inspector Panel should open", () => {
it("Is hidden when an Inspector Panel should open", () => {
cy.visit("/");

cy.get("[data-cy=screen-templates]").click();
Expand Down
Loading