Skip to content

Commit

Permalink
test: unskip previously skipped tests
Browse files Browse the repository at this point in the history
  • Loading branch information
bapmrl committed Oct 30, 2023
1 parent cdb396d commit 2f07021
Showing 6 changed files with 24 additions and 33 deletions.
19 changes: 7 additions & 12 deletions cypress/e2e/slices/00-create.cy.js
Original file line number Diff line number Diff line change
@@ -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");
@@ -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);
14 changes: 8 additions & 6 deletions cypress/e2e/user-flows/scenario_custom_screenshots.cy.js
Original file line number Diff line number Diff line change
@@ -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()
@@ -38,17 +39,18 @@ 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");
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"]');
}
2 changes: 1 addition & 1 deletion cypress/pages/slices/slicesList.js
Original file line number Diff line number Diff line change
@@ -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() {
Original file line number Diff line number Diff line change
@@ -116,6 +116,7 @@ export const SharedSliceCard: FC<SharedSliceCardProps> = (props) => {
>
{src !== undefined ? (
<CardMedia
alt="Preview image"
overlay={
canUpdateScreenshot && !disableOverlay ? (
<Box alignItems="center" justifyContent="center">
@@ -156,9 +157,12 @@ export const SharedSliceCard: FC<SharedSliceCardProps> = (props) => {
) : action.type === "menu" ? (
<DropdownMenu modal>
<DropdownMenuTrigger disabled={disabled}>
<IconButton icon="moreVert" />
<IconButton data-cy="slice-action-icon" icon="moreVert" />
</DropdownMenuTrigger>
<DropdownMenuContent align="end">
<DropdownMenuContent
align="end"
data-cy="slice-action-icon-dropdown"
>
{action.onRename ? (
<DropdownMenuItem
onSelect={action.onRename}
4 changes: 2 additions & 2 deletions packages/slice-machine/test/pages/slices.test.tsx
Original file line number Diff line number Diff line change
@@ -31,7 +31,7 @@ describe("slices", () => {
mockRouter.setCurrentUrl("/slices");
});

test.skip("When user creates a slice it should send a tracking event", async (ctx) => {
test("When user creates a slice it should send a tracking event", async (ctx) => {
const adapter = createTestPlugin({
setup: ({ hook }) => {
hook("slice:create", () => void 0);
@@ -206,7 +206,7 @@ describe("slices", () => {
);
});

test.skip("if creation fails it sohuld not send the tracking event", async (ctx) => {
test("if creation fails it sohuld not send the tracking event", async (ctx) => {
const adapter = createTestPlugin({
setup: ({ hook }) => {
hook("slice:create", () => {

0 comments on commit 2f07021

Please sign in to comment.