diff --git a/cypress/integration/WardrobePage/Outfit saving.spec.js b/cypress/integration/WardrobePage/Outfit saving.spec.js index d27030f..b372802 100644 --- a/cypress/integration/WardrobePage/Outfit saving.spec.js +++ b/cypress/integration/WardrobePage/Outfit saving.spec.js @@ -15,10 +15,8 @@ describe("WardrobePage: Outfit saving", () => { // Wait for the outfit to stop saving, and check that it redirected and // still shows the correct outfit preview and name. - cy.location("pathname", { timeout: 12000 }).should( - "match", - /^\/outfits\/[0-9]+$/ - ); + page.getOutfitIsSavedIndicator({ timeout: 12000 }).should("exist"); + cy.location("pathname").should("match", /^\/outfits\/[0-9]+$/); page.getOutfitName().should("have.text", outfitName); page.getOutfitPreview().toMatchImageSnapshot(); }); @@ -39,10 +37,8 @@ describe("WardrobePage: Outfit saving", () => { // Wait for the outfit to stop saving, and check that it redirected and // still shows the correct outfit preview and name. - cy.location("pathname", { timeout: 12000 }).should( - "match", - /^\/outfits\/[0-9]+$/ - ); + page.getOutfitIsSavedIndicator({ timeout: 12000 }).should("exist"); + cy.location("pathname").should("match", /^\/outfits\/[0-9]+$/); page.getOutfitName().should("have.text", outfitName); page.getOutfitPreview().toMatchImageSnapshot(); }); diff --git a/cypress/integration/WardrobePage/__image_snapshots__/WardrobePage Outfit saving Saves a Zafara Tourist with worn and closeted items #0.png b/cypress/integration/WardrobePage/__image_snapshots__/WardrobePage Outfit saving Saves a Zafara Tourist with worn and closeted items #0.png index 0fd75aa..948ac19 100644 Binary files a/cypress/integration/WardrobePage/__image_snapshots__/WardrobePage Outfit saving Saves a Zafara Tourist with worn and closeted items #0.png and b/cypress/integration/WardrobePage/__image_snapshots__/WardrobePage Outfit saving Saves a Zafara Tourist with worn and closeted items #0.png differ diff --git a/cypress/integration/WardrobePage/__image_snapshots__/WardrobePage Outfit saving Saves a basic outfit #0.png b/cypress/integration/WardrobePage/__image_snapshots__/WardrobePage Outfit saving Saves a basic outfit #0.png deleted file mode 100644 index bbed000..0000000 Binary files a/cypress/integration/WardrobePage/__image_snapshots__/WardrobePage Outfit saving Saves a basic outfit #0.png and /dev/null differ diff --git a/cypress/integration/WardrobePage/__image_snapshots__/WardrobePage Outfit saving Saves a simple Blue Acara #0.png b/cypress/integration/WardrobePage/__image_snapshots__/WardrobePage Outfit saving Saves a simple Blue Acara #0.png new file mode 100644 index 0000000..f5a434f Binary files /dev/null and b/cypress/integration/WardrobePage/__image_snapshots__/WardrobePage Outfit saving Saves a simple Blue Acara #0.png differ diff --git a/cypress/integration/WardrobePage/page.js b/cypress/integration/WardrobePage/page.js index 42dc938..1f602c9 100644 --- a/cypress/integration/WardrobePage/page.js +++ b/cypress/integration/WardrobePage/page.js @@ -1,14 +1,14 @@ -export function getSpeciesSelect(options) { - return cy.get("[data-test-id=wardrobe-species-picker]", options); -} +const withTestId = (testId) => (options) => + cy.get(`[data-test-id="${CSS.escape(testId)}"]`, options); -export function getColorSelect(options) { - return cy.get("[data-test-id=wardrobe-color-picker]", options); -} - -export function getPosePickerButton(options) { - return cy.get("[data-test-id=wardrobe-pose-picker]", options); -} +export const getSpeciesSelect = withTestId("wardrobe-species-picker"); +export const getColorSelect = withTestId("wardrobe-color-picker"); +export const getPosePickerButton = withTestId("wardrobe-pose-picker"); +export const getOutfitName = withTestId("outfit-name"); +export const getSaveOutfitButton = withTestId("wardrobe-save-outfit-button"); +export const getOutfitIsSavedIndicator = withTestId( + "wardrobe-outfit-is-saved-indicator" +); export function getPosePickerOption(label, options) { return cy.get(`input[aria-label="${CSS.escape(label)}"]`, options); @@ -20,11 +20,3 @@ export function getOutfitPreview() { timeout: 15000, }); } - -export function getOutfitName(options) { - return cy.get("[data-test-id=outfit-name]", options); -} - -export function getSaveOutfitButton(options) { - return cy.get("[data-test-id=wardrobe-save-outfit-button]", options); -} diff --git a/src/app/WardrobePage/ItemsPanel.js b/src/app/WardrobePage/ItemsPanel.js index d2ce512..b8762d3 100644 --- a/src/app/WardrobePage/ItemsPanel.js +++ b/src/app/WardrobePage/ItemsPanel.js @@ -429,7 +429,11 @@ function OutfitSavingIndicator({ outfitState }) { if (latestVersionIsSaved) { return ( - +