2021-04-19 03:56:51 -07:00
|
|
|
import * as page from "./page";
|
|
|
|
|
2021-04-19 02:16:31 -07:00
|
|
|
describe("WardrobePage: Outfit saving", () => {
|
2021-04-19 03:57:46 -07:00
|
|
|
it("Saves a basic outfit", () => {
|
2021-04-19 02:16:31 -07:00
|
|
|
cy.logInAs("dti-test");
|
2021-04-19 03:56:51 -07:00
|
|
|
cy.visit("/outfits/new?species=1&color=8");
|
|
|
|
|
|
|
|
// Give the outfit a unique timestamped name
|
|
|
|
const outfitName = `Cypress Test Outfit: ${new Date().toISOString()}`;
|
|
|
|
page.getOutfitName({ timeout: 12000 }).click();
|
|
|
|
cy.focused().type(outfitName + "{enter}");
|
|
|
|
|
|
|
|
// Save the outfit
|
|
|
|
page.getSaveOutfitButton().click().should("have.attr", "data-loading");
|
|
|
|
|
|
|
|
// Wait for the outfit to stop saving, and check that it redirected and
|
2021-04-19 04:00:22 -07:00
|
|
|
// still shows the correct outfit preview and name.
|
2021-04-19 03:56:51 -07:00
|
|
|
page
|
|
|
|
.getSaveOutfitButton({ timeout: 12000 })
|
|
|
|
.should("not.have.attr", "data-loading");
|
|
|
|
cy.location("pathname").should("match", /^\/outfits\/[0-9]+$/);
|
|
|
|
page.getOutfitName().should("have.text", outfitName);
|
2021-04-19 04:00:22 -07:00
|
|
|
page.getOutfitPreview().toMatchImageSnapshot();
|
2021-04-19 02:16:31 -07:00
|
|
|
});
|
|
|
|
});
|