Skip to content

Commit

Permalink
Merge pull request dev-next-release - 1.20.0 (#1203)
Browse files Browse the repository at this point in the history
  • Loading branch information
xrutayisire authored Nov 10, 2023
2 parents 0d11e9d + 6b023fe commit f39e057
Show file tree
Hide file tree
Showing 74 changed files with 323 additions and 1,652 deletions.
19 changes: 7 additions & 12 deletions cypress/e2e/slices/00-create.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,29 +16,24 @@ describe("Create Slices", () => {
cy.clearProject();
});

it.skip("A user can create and rename a slice", () => {
it("A user can create and rename a slice", () => {
cy.createSlice(lib, sliceId, sliceName);

sliceBuilder.addNewWidgetField("Title", "Key Text");
sliceBuilder.addNewWidgetField("Description", "Rich Text");

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

// remove widget
cy.get('[data-cy="slice-menu-button"]').first().click();
cy.contains("Delete field").click();
cy.get('[data-cy="builder-save-button"]').should("not.be.disabled");

// add a variation

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

cy.getInputByLabel("Variation name*").type("foo");
cy.getInputByLabel("Variation ID*").clear();
cy.getInputByLabel("Variation ID*").type("bar");

cy.get("#variation-add").submit();

// remove widget
cy.get('[data-cy="slice-menu-button"]').first().click();
cy.contains("Delete field").click();
cy.get('[data-cy="builder-save-button"]').should("not.be.disabled");

cy.contains("button", "Simulate").should("have.attr", "disabled");
cy.contains("button", "Simulate").realHover();
cy.get("#simulator-button-tooltip").should("be.visible");
Expand Down Expand Up @@ -144,7 +139,7 @@ describe("Create Slices", () => {
});

// See: #791
it.skip("A user cannot rename a slice with a name starting with a number", () => {
it("A user cannot rename a slice with a name starting with a number", () => {
const sliceName = "SliceName";

cy.createSlice(lib, sliceId, sliceName);
Expand Down
File renamed without changes.
70 changes: 0 additions & 70 deletions cypress/e2e/slices/02-simulator-screenshots.cy.js

This file was deleted.

18 changes: 10 additions & 8 deletions cypress/e2e/user-flows/scenario_custom_screenshots.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,11 @@ describe("I am an existing SM user and I want to upload screenshots on variation
sliceBuilder.goTo(slice.library, slice.name);
});

it.skip("Upload and replace custom screenshots", () => {
it("Upload and replace custom screenshots", () => {
// Upload custom screenshot on default variation
sliceBuilder.imagePreview.should("not.exist");
sliceBuilder.openScreenshotModal();
let sliceCard = new SliceCard(slice.name);
sliceCard.imagePreview.should("not.exist");
sliceCard.openScreenshotModal();

screenshotModal
.verifyImageIsEmpty()
Expand All @@ -38,22 +39,23 @@ describe("I am an existing SM user and I want to upload screenshots on variation
.dragAndDropImage(defaultScreenshot)
.verifyImageIs(defaultScreenshot)
.close();
sliceBuilder.imagePreview.isSameImageAs(defaultScreenshot);
sliceCard.imagePreview.isSameImageAs(defaultScreenshot);

// Upload screenshot on variation from the Changes Page
const missingScreenshotVariation = "Missing screenshot";
sliceBuilder.addVariation(missingScreenshotVariation);

sliceBuilder.imagePreview.should("not.exist");
sliceCard = new SliceCard(slice.name, missingScreenshotVariation);
sliceCard.imagePreview.should("not.exist");
sliceBuilder.save();

menu.navigateTo("Slices");
const sliceCard = new SliceCard(slice.name);
sliceCard = new SliceCard(slice.name);
sliceCard.imagePreview.isSameImageAs(defaultScreenshot);

menu.navigateTo("Changes");
changesPage.screenshotsButton.should("be.visible");
sliceCard.content.should("include.text", "1/2 screenshots missing");
sliceCard.content.should("include.text", "Missing screenshot");
sliceCard.imagePreview.isSameImageAs(defaultScreenshot);

sliceCard.openScreenshotModal();
Expand All @@ -64,7 +66,7 @@ describe("I am an existing SM user and I want to upload screenshots on variation
.dragAndDropImage(variationScreenshot)
.verifyImageIs(variationScreenshot)
.close();
sliceCard.content.should("not.include.text", "screenshots missing");
sliceCard.content.should("not.include.text", "Missing screenshot");
sliceCard.imagePreview.isSameImageAs(defaultScreenshot);

changesPage.pushChanges().isUpToDate();
Expand Down
83 changes: 0 additions & 83 deletions cypress/pages/simulator/simulatorPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,30 +5,6 @@ class SimulatorPage {
return cy.contains("Save mock content");
}

get takeScreenshotButton() {
return cy.contains("Take a screenshot");
}

get screenshotToast() {
return cy.contains("Tap to view screenshot");
}

get simulatorIframe() {
return cy.get("#__iframe-renderer");
}

get widthInput() {
return cy.get('input[name="W-screensize-input"]');
}

get heightInput() {
return cy.get('input[name="H-screensize-input"]');
}

getScreenSizeDropdown(currentValue) {
return cy.get("button").contains(currentValue);
}

/**
* Setup the slice simulator in the example project, and stub the window open
* event to open in the same page.
Expand All @@ -45,65 +21,6 @@ class SimulatorPage {
return this;
}

/**
* Use the screen size dropdown menu to change the simulator screen size.
*
* @param {string} startValue The expected start value of the dropdown button.
* @param {string} newValue The new value to set the screen size to.
*/
resizeScreenWithDropdown(startValue, newValue) {
this.getScreenSizeDropdown(startValue).click();
cy.contains(newValue).click();

return this;
}

/**
* Use the screen size input fields to change the simulator screen size.
*
* @param {number} newWidth The new value to the the width to.
* @param {number} newHeight The new value to the the height to.
*/
resizeScreenWithInput(newWidth, newHeight) {
this.widthInput.clear().type(`{rightArrow}${newWidth}`);
this.heightInput.clear().type(`{rightArrow}${newHeight}`);

return this;
}

/**
* Check that the dimensions of the simulator are equal to the provided ones.
*
* @param {number} expectedWidth The value which the width should equal.
* @param {number} expectedHeight The value which the height should equal.
*/
validateSimulatorSize(expectedWidth, expectedHeight) {
this.simulatorIframe
.should("have.css", "maxWidth")
.and("eq", `${expectedWidth}px`);
this.simulatorIframe
.should("have.css", "minWidth")
.and("eq", `${expectedWidth}px`);
this.simulatorIframe
.should("have.css", "maxHeight")
.and("eq", `${expectedHeight}px`);
this.simulatorIframe
.should("have.css", "minHeight")
.and("eq", `${expectedHeight}px`);

return this;
}

takeAScreenshotAndOpenModal() {
this.takeScreenshotButton.click();

cy.contains("Screenshot taken", { timeout: 30000 }).should("be.visible");

this.screenshotToast.click();

return this;
}

/**
* Change the slice variations using the variations dropdown in the simulator.
*
Expand Down
10 changes: 0 additions & 10 deletions cypress/pages/slices/sliceBuilder.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,6 @@
import { BaseBuilder } from "../BaseBuilder";

class SliceBuilder extends BaseBuilder {
get imagePreview() {
return cy.get("[alt='Preview image']");
}

get imagePreviewSrc() {
this.imagePreview.then(($img) => {
return $img.attr("src");
});
}

get renameButton() {
return cy.get('[data-cy="edit-slice-name"]');
}
Expand Down
13 changes: 11 additions & 2 deletions cypress/pages/slices/sliceCard.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,17 @@ export class SliceCard {
}

openScreenshotModal() {
cy.get(this.root).find('[aria-haspopup="menu"]').click();
cy.contains("Update screenshot").click();
cy.get(this.root)
.realHover()
.then(($root) => {
if ($root.find(':contains("Update screenshot")').length > 0) {
cy.wrap($root).contains("Update screenshot").click();
} else {
cy.wrap($root).find('[aria-haspopup="menu"]').click();
cy.contains("Update screenshot").click();
}
});
cy.root().children().realHover(); // Stop hovering the card.
return this;
}
}
2 changes: 1 addition & 1 deletion cypress/pages/slices/slicesList.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class SlicesList {
}

getSliceCard(sliceName) {
return cy.get(`[aria-label="${sliceName} slice card"]`);
return cy.get(`[aria-label^="${sliceName}"][aria-label$="slice card"]`);
}

get optionDopDownMenu() {
Expand Down
2 changes: 1 addition & 1 deletion e2e-projects/next-upgrade/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "next-upgrade",
"version": "1.19.1",
"version": "1.19.2-dev-next-release.6",
"private": true,
"scripts": {
"dev": "next dev",
Expand Down
2 changes: 1 addition & 1 deletion e2e-projects/next/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cimsirp",
"version": "1.19.1",
"version": "1.19.2-dev-next-release.6",
"private": true,
"scripts": {
"dev": "next dev",
Expand Down
2 changes: 1 addition & 1 deletion e2e-projects/sveltekit/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "sveltekit",
"version": "1.19.1",
"version": "1.19.2-dev-next-release.6",
"private": true,
"scripts": {
"dev": "vite dev",
Expand Down
2 changes: 1 addition & 1 deletion packages/adapter-next/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@slicemachine/adapter-next",
"version": "0.3.23",
"version": "0.3.24-dev-next-release.6",
"description": "Slice Machine adapter for Next.js.",
"keywords": [
"typescript",
Expand Down
2 changes: 1 addition & 1 deletion packages/adapter-nuxt/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@slicemachine/adapter-nuxt",
"version": "0.3.23",
"version": "0.3.24-dev-next-release.6",
"description": "Slice Machine adapter for Nuxt 3.",
"keywords": [
"typescript",
Expand Down
2 changes: 1 addition & 1 deletion packages/adapter-nuxt2/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@slicemachine/adapter-nuxt2",
"version": "0.3.23",
"version": "0.3.24-dev-next-release.6",
"description": "Slice Machine adapter for Nuxt 2.",
"keywords": [
"typescript",
Expand Down
2 changes: 1 addition & 1 deletion packages/adapter-sveltekit/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@slicemachine/adapter-sveltekit",
"version": "0.3.23",
"version": "0.3.24-dev-next-release.6",
"description": "Slice Machine adapter for SvelteKit.",
"keywords": [
"typescript",
Expand Down
2 changes: 1 addition & 1 deletion packages/init/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@slicemachine/init",
"version": "2.9.1",
"version": "2.9.2-dev-next-release.6",
"description": "Init Prismic Slice Machine in your project",
"keywords": [
"typescript",
Expand Down
4 changes: 2 additions & 2 deletions packages/init/src/lib/setupSentry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ export function setupSentry(): void {
environment: isStableVersion
? import.meta.env.MODE || "production"
: "alpha",
// Increase the default truncation length of 250 to 2500 (x10)
// Increase the default truncation length of 250 to 12500 (x50)
// to have enough details in Sentry
maxValueLength: 2_500,
maxValueLength: 12_500,
});
}
5 changes: 5 additions & 0 deletions packages/init/src/lib/updateSentryContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,9 @@ export async function updateSentryContext({
if (framework) {
Sentry.setTag("framework", framework);
}

Sentry.setContext("Process", {
"Command used": process.argv.join(" "),
cwd: process.cwd(),
});
}
Loading

0 comments on commit f39e057

Please sign in to comment.