Skip to content

Commit

Permalink
Merge branch 'dev-next-release' into aa/dt-1646
Browse files Browse the repository at this point in the history
  • Loading branch information
angeloashmore committed Oct 26, 2023
2 parents 455671e + e7533b4 commit 1ba0c93
Show file tree
Hide file tree
Showing 320 changed files with 3,282 additions and 2,384 deletions.
1 change: 1 addition & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
4 changes: 2 additions & 2 deletions cypress/e2e/customTypes/01-duplicate.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ describe.skip("Duplicate custom types", () => {
cy.get("[type=submit]").should("be.disabled");

cy.get("[data-cy=ct-name-input-error]").contains(
"Custom type name is already taken."
"Custom type name is already taken.",
);
});

Expand All @@ -34,7 +34,7 @@ describe.skip("Duplicate custom types", () => {
cy.get("[type=submit]").should("be.disabled");

cy.get("[data-cy=ct-id-input-error]").contains(
`ID "${customTypeId}" exists already.`
`ID "${customTypeId}" exists already.`,
);
});
});
23 changes: 5 additions & 18 deletions cypress/e2e/slices/00-create.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ describe("Create Slices", () => {

// add a variation

cy.get("button").contains("Default").click();
cy.contains("+ Add new variation").click();
cy.contains("button", "Add a new variation").click();

cy.getInputByLabel("Variation name*").type("foo");
cy.getInputByLabel("Variation ID*").clear();
Expand All @@ -45,34 +44,22 @@ describe("Create Slices", () => {
cy.get("#simulator-button-tooltip").should("be.visible");
cy.get("#simulator-button-tooltip").should(
"contain",
"Save your work in order to simulate"
);
cy.contains("button", "Update screenshot").should("have.attr", "disabled");
cy.contains("button", "Update screenshot").realHover();
cy.get("#update-screenshot-button-tooltip").should("be.visible");
cy.get("#update-screenshot-button-tooltip").should(
"contain",
"Save your work in order to update the screenshot"
"Save your work in order to simulate",
);

cy.location("pathname", { timeout: 20000 }).should(
"eq",
`/slices/${lib}/${sliceName}/bar`
`/slices/${lib}/${sliceName}/bar`,
);
cy.get("button").contains("foo").click();
cy.contains("Default").click();
cy.contains("a", "Default").click();
cy.location("pathname", { timeout: 20000 }).should(
"eq",
`/slices/${lib}/${sliceName}/default`
`/slices/${lib}/${sliceName}/default`,
);

cy.contains("Save").click();

cy.contains("button", "Simulate").should("not.have.attr", "disabled");
cy.contains("button", "Update screenshot").should(
"not.have.attr",
"disabled"
);

// simulator

Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/slices/01-duplicates.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ describe("Duplicate Slices", () => {
cy.get("input[data-cy=slice-name-input]").type(sliceName).blur();
cy.get("[type=submit]").should("be.disabled");
cy.get("[data-cy=slice-name-input-error]").contains(
"Slice name is already taken."
"Slice name is already taken.",
);
});
});
2 changes: 1 addition & 1 deletion cypress/e2e/slices/03-build-slices.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ describe.skip("I am a new SM user (with Next) who wants to build a slice with di
sliceBuilder.addNewWidgetField("SelectField", "Select");
sliceBuilder.addNewWidgetField(
"ContentRelationshipField",
"Content Relationship"
"Content Relationship",
);

sliceBuilder.openEditWidgetModal("SimpleTextField");
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/updates/changelog.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ describe.skip("changelog.warningBreakingChanges", () => {

it("shows warning if the selected release note has a breaking changes title.", () => {
mockChangelogCall(
"### Breaking Changes\n -this changes is breaking your slice machine"
"### Breaking Changes\n -this changes is breaking your slice machine",
);
cy.visit("/changelog");
cy.waitUntil(() => cy.contains("All versions"));
Expand Down
4 changes: 2 additions & 2 deletions cypress/e2e/updates/simulator-tooltip.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ describe("simulator tooltip", () => {
cy.getSliceMachineUserContext().should((data) => {
expect(data.hasSeenSimulatorToolTip).equal(
true,
"userContext.hasSeenSimulatorToolTip should set in local storage"
"userContext.hasSeenSimulatorToolTip should set in local storage",
);
});
});
Expand Down Expand Up @@ -67,7 +67,7 @@ describe("simulator tooltip", () => {
cy.getSliceMachineUserContext().should((data) => {
expect(data.hasSeenSimulatorToolTip).equal(
true,
"userContext.hasSeenSimulatorToolTip should set in local storage"
"userContext.hasSeenSimulatorToolTip should set in local storage",
);
});
});
Expand Down
8 changes: 4 additions & 4 deletions cypress/e2e/updates/video-tooltip.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ describe.skip("video tooltip", () => {
cy.getSliceMachineUserContext().then((data) => {
expect(data.hasSeenTutorialsToolTip).equal(
true,
"userContext.hasSeenTutorialsToolTip should set in local storage"
"userContext.hasSeenTutorialsToolTip should set in local storage",
);
});
});
Expand All @@ -37,14 +37,14 @@ describe.skip("video tooltip", () => {
.should(
"have.attr",
"href",
"https://youtube.com/playlist?list=PLUVZjQltoA3wnaQudcqQ3qdZNZ6hyfyhH"
"https://youtube.com/playlist?list=PLUVZjQltoA3wnaQudcqQ3qdZNZ6hyfyhH",
)
.click();

cy.getSliceMachineUserContext().should((data) => {
expect(data.hasSeenTutorialsToolTip).equal(
true,
"userContext.hasSeenTutorialsToolTip should set in local storage"
"userContext.hasSeenTutorialsToolTip should set in local storage",
);
});
});
Expand All @@ -68,7 +68,7 @@ describe.skip("video tooltip", () => {
cy.getSliceMachineUserContext().should((data) => {
expect(data.hasSeenTutorialsToolTip).equal(
true,
"userContext.hasSeenTutorialsToolTip should set in local storage"
"userContext.hasSeenTutorialsToolTip should set in local storage",
);
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ describe.skip("Scenario 008", () => {
.invoke("attr", "aria-checked")
.then((currentValue) => {
cy.wrap(currentValue == "true" ? "false" : "true").as(
"newBooleanValue"
"newBooleanValue",
);
});

Expand All @@ -82,7 +82,7 @@ describe.skip("Scenario 008", () => {

cy.getInputByLabel("SimpleTextField").should(
"contain",
"SimpleTextContent"
"SimpleTextContent",
);
cy.getInputByLabel("RichTextField").should("contain", "RichTextContent");
cy.getInputByLabel("NumberField").should("have.value", "42");
Expand Down
10 changes: 6 additions & 4 deletions cypress/e2e/user-flows/scenario_custom_screenshots.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,21 +71,23 @@ describe("I am an existing SM user and I want to upload screenshots on variation
});

it("Error displayed when non-image files are uploaded", () => {
const variationName = "Error handling";

sliceBuilder.goTo(slice.library, slice.name);
sliceBuilder.addVariation("Error handling");
sliceBuilder.addVariation(variationName);
sliceBuilder.save();

sliceBuilder.openScreenshotModal();
new SliceCard(slice.name, variationName).openScreenshotModal();
cy.contains("Select file").selectFile(
{
contents: Cypress.Buffer.from("this is not an image"),
fileName: "file.txt",
mimeType: "text/plain",
},
{ action: "drag-drop" }
{ action: "drag-drop" },
);
cy.contains("Only files of type png, jpg, jpeg are accepted.").should(
"be.visible"
"be.visible",
);

screenshotModal.verifyImageIsEmpty().close();
Expand Down
12 changes: 6 additions & 6 deletions cypress/e2e/user-flows/scenario_slice_association.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,25 +49,25 @@ describe.skip("I am an existing SM user (Next) and I want to associate a Slice t
cy.addStaticFieldToSlice(
"Key Text",
"Static Key Text Field",
"static_key_text_id"
"static_key_text_id",
);

cy.addStaticFieldToSlice(
"Rich Text",
"Static Rich Text Field",
"static_rich_text_id"
"static_rich_text_id",
);

cy.addRepeatableFieldToSlice(
"Rich Text",
"Repeatable Rich Text Field",
"repeatable_rich_text_id"
"repeatable_rich_text_id",
);

cy.addRepeatableFieldToSlice(
"Key Text",
"Repeatable Key Text Field",
"repeatable_key_text_id"
"repeatable_key_text_id",
);

sliceBuilder.save();
Expand All @@ -87,7 +87,7 @@ describe.skip("I am an existing SM user (Next) and I want to associate a Slice t
cy.visit(`/custom-types/${customTypeId}`);

cy.get("[data-cy=update-slices]").click();
cy.get(`[data-cy=shared-slice-selection-card-${sliceId}]`).click();
cy.get(`[data-cy=shared-slice-card-${sliceId}]`).click();
cy.get("[data-cy=update-slices-modal]").submit();

customTypeBuilder.save();
Expand Down Expand Up @@ -115,7 +115,7 @@ describe.skip("I am an existing SM user (Next) and I want to associate a Slice t
cy.get("#review-form");
cy.get("[data-cy=review-form-score-3]").click();
cy.get("[data-cy=review-form-comment]").type(
"Cypress test - testing the comment of the survey"
"Cypress test - testing the comment of the survey",
);
cy.get("#review-form").submit();

Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/user-flows/transactional-push.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ describe.skip("I am an existing SM user and I want to push local changes", () =>
changesPage.mockPushError(500).pushChanges();

cy.contains(
"Something went wrong when pushing your changes. Check your terminal logs."
"Something went wrong when pushing your changes. Check your terminal logs.",
);

cy.clearProject();
Expand Down
2 changes: 1 addition & 1 deletion cypress/helpers/customTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export function createCustomType(id, name) {

cy.location("pathname", { timeout: 15000 }).should(
"eq",
`/custom-types/${id}`
`/custom-types/${id}`,
);
cy.readFile(TYPES_FILE).should("contains", name);
cy.readFile(CUSTOM_TYPE_MODEL(id));
Expand Down
2 changes: 1 addition & 1 deletion cypress/helpers/filesystem.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,6 @@ export function removeTypes() {
*/
export function modifyFile(filePath, updateContent) {
cy.readFile(filePath).then((content) =>
cy.writeFile(filePath, updateContent(content))
cy.writeFile(filePath, updateContent(content)),
);
}
2 changes: 1 addition & 1 deletion cypress/helpers/images.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export function isSameImageAs(subject, fixtureImage) {
isCorrectDimensions(
subject,
fixtureImage.naturalWidth,
fixtureImage.naturalHeight
fixtureImage.naturalHeight,
);
resolve();
};
Expand Down
2 changes: 1 addition & 1 deletion cypress/helpers/localStorage.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export function setSliceMachineUserContext({
lastSyncChange,
hasSeenSimulatorToolTip,
}),
})
}),
);
}

Expand Down
3 changes: 1 addition & 2 deletions cypress/helpers/slices.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export function createSlice(lib, id, name) {

cy.location("pathname", { timeout: 20000 }).should(
"eq",
`/slices/${lib}/${name}/default`
`/slices/${lib}/${name}/default`,
);
cy.readFile(TYPES_FILE).should("contains", name);
}
Expand Down Expand Up @@ -121,7 +121,6 @@ function addFieldToSlice(elements, fieldType, fieldName, fieldId) {
* @param {string} variationName Name of the variation.
*/
export function addVariationToSlice(variationName) {
sliceBuilder.variationsDropdown.click({ force: true });
sliceBuilder.addVariationButton.click();

addVariationModal.root.within(() => {
Expand Down
2 changes: 1 addition & 1 deletion cypress/pages/RenameModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class CustomTypeRenameModal extends RenameModal {
constructor() {
super(
"[data-cy=rename-custom-type-modal]",
'[data-cy="custom-type-name-input"]'
'[data-cy="custom-type-name-input"]',
);
}
}
Expand Down
2 changes: 1 addition & 1 deletion cypress/pages/UpdateSliceZoneModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class UpdateSliceZoneModal {
}

selectSlice(sliceId) {
cy.get(`[data-cy=shared-slice-selection-card-${sliceId}]`).click();
cy.get(`[data-cy=shared-slice-card-${sliceId}]`).click();
return this;
}

Expand Down
2 changes: 1 addition & 1 deletion cypress/pages/customTypes/customTypeBuilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class CustomTypeBuilder extends BaseBuilder {
async addSliceToSliceZone(sliceId) {
await cy.findAllByText(/Add slices/)[0].click();
this.updateSliceZoneButton.click();
cy.get(`[data-cy=shared-slice-selection-card-${sliceId}]`).click();
cy.get(`[data-cy=shared-slice-card-${sliceId}]`).click();
cy.get("[data-cy=update-slices-modal]").submit();
return this;
}
Expand Down
2 changes: 1 addition & 1 deletion cypress/pages/simulator/editorPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class EditorPage {
.then((currentValue) => {
if (currentValue === value) {
throw new Error(
`Cannot toggle "${inputLabel}" to same value (${value})`
`Cannot toggle "${inputLabel}" to same value (${value})`,
);
}
});
Expand Down
2 changes: 1 addition & 1 deletion cypress/pages/slices/screenshotModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class ScreenshotModal {
uploadImage(imageFixturePath) {
cy.get(`${this.root} input[type="file"]`).selectFile(
`${fixturePath}${imageFixturePath}`,
{ force: true }
{ force: true },
);
return this;
}
Expand Down
22 changes: 3 additions & 19 deletions cypress/pages/slices/sliceBuilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,8 @@ class SliceBuilder extends BaseBuilder {
return cy.get("[data-cy=add-Repeatable-field]");
}

get variationsDropdown() {
return cy.get("[aria-label='Expand variations']");
}

get addVariationButton() {
return cy.contains("button", "Add new variation");
return cy.contains("button", "Add a new variation");
}

goTo(sliceLibrary, sliceName, variation = "default") {
Expand All @@ -50,17 +46,6 @@ class SliceBuilder extends BaseBuilder {
return this;
}

openScreenshotModal() {
cy.contains("Update screenshot").click();
return this;
}

openVariationModal() {
cy.get("[aria-label='Expand variations']").parent().click();
cy.contains("Add new variation").click();
return this;
}

changeToVariation(startVariation, targetVariation) {
cy.get("button").contains(startVariation).click();
cy.contains(targetVariation).click();
Expand All @@ -83,7 +68,7 @@ class SliceBuilder extends BaseBuilder {
.callsFake((url) => {
simUrl = url;
console.log(
`window.open() won't be called as it currently generates a timeout in cypress. Calling cy.visit('${url}') instead.`
`window.open() won't be called as it currently generates a timeout in cypress. Calling cy.visit('${url}') instead.`,
);
// win.open.wrappedMethod.call(win, url, "_self");
});
Expand All @@ -103,8 +88,7 @@ class SliceBuilder extends BaseBuilder {
* @param {string} variationName Name of the variation.
*/
addVariation(variationName) {
cy.get("[aria-label='Expand variations']").click({ force: true });
cy.contains("button", "Add new variation").click();
cy.contains("button", "Add a new variation").click();

cy.get("[aria-modal]").within(() => {
cy.getInputByLabel("Variation name*").type(variationName);
Expand Down
Loading

0 comments on commit 1ba0c93

Please sign in to comment.