impress-2020/cypress/integration/WardrobePage/Basic outfit state.spec.js

88 lines
2.8 KiB
JavaScript
Raw Normal View History

import * as page from "./page";
2021-04-16 03:04:39 -07:00
// Give network requests a bit of breathing room!
const networkTimeout = { timeout: 12000 };
describe("WardrobePage: Basic outfit state", () => {
it("Initialize simple outfit from URL", () => {
cy.visit("/outfits/new?species=1&color=8&objects[]=76789");
page
.getSpeciesSelect(networkTimeout)
2021-04-16 03:04:39 -07:00
.find(":selected")
.should("have.text", "Acara");
page.getColorSelect().find(":selected").should("have.text", "Blue");
2021-04-16 03:04:39 -07:00
cy.location().toMatchSnapshot();
cy.contains("A Warm Winters Night Background", networkTimeout).should(
"exist"
);
page.getOutfitPreview().toMatchImageSnapshot();
2021-04-16 03:04:39 -07:00
});
it("Changes species and color", () => {
cy.visit("/outfits/new?species=1&color=8&objects[]=76789");
page
.getSpeciesSelect(networkTimeout)
2021-04-16 03:04:39 -07:00
.find(":selected")
.should("have.text", "Acara");
page.getColorSelect().find(":selected").should("have.text", "Blue");
2021-04-16 03:04:39 -07:00
cy.location().toMatchSnapshot();
page.getOutfitPreview().toMatchImageSnapshot();
2021-04-16 03:04:39 -07:00
page.getSpeciesSelect().select("Aisha");
2021-04-16 03:04:39 -07:00
page.getSpeciesSelect().find(":selected").should("have.text", "Aisha");
page.getColorSelect().find(":selected").should("have.text", "Blue");
2021-04-16 03:04:39 -07:00
cy.location().toMatchSnapshot();
page.getOutfitPreview().toMatchImageSnapshot();
2021-04-16 03:04:39 -07:00
page.getColorSelect().select("Red");
2021-04-16 03:04:39 -07:00
page.getSpeciesSelect().find(":selected").should("have.text", "Aisha");
page.getColorSelect().find(":selected").should("have.text", "Red");
2021-04-16 03:04:39 -07:00
cy.location().toMatchSnapshot();
page.getOutfitPreview().toMatchImageSnapshot();
2021-04-16 03:04:39 -07:00
});
it("Changes pose", () => {
2021-04-16 03:04:39 -07:00
cy.visit("/outfits/new?species=1&color=8&pose=HAPPY_FEM");
page.getPosePickerButton(networkTimeout).click();
page.getPosePickerOption("Happy and Feminine").should("be.checked");
2021-04-16 03:04:39 -07:00
cy.location().toMatchSnapshot();
page.getOutfitPreview().toMatchImageSnapshot();
2021-04-16 03:04:39 -07:00
page.getPosePickerOption("Sad and Masculine").check({ force: true });
page.getPosePickerOption("Sad and Masculine").should("be.checked");
2021-04-16 03:04:39 -07:00
cy.location().toMatchSnapshot();
page.getOutfitPreview().toMatchImageSnapshot();
2021-04-16 03:04:39 -07:00
});
it("Toggles item", () => {
cy.visit("/outfits/new?species=1&color=8&objects[]=76789");
page.getOutfitPreview().toMatchImageSnapshot();
2021-04-16 03:04:39 -07:00
cy.location().toMatchSnapshot();
cy.contains("A Warm Winters Night Background").click();
page.getOutfitPreview().toMatchImageSnapshot();
2021-04-16 03:04:39 -07:00
cy.location().toMatchSnapshot();
});
it("Renames outfit", () => {
cy.visit("/outfits/new?name=My+outfit&species=1&color=8");
page.getOutfitName(networkTimeout).should("have.text", "My outfit");
2021-04-16 03:04:39 -07:00
page.getOutfitName().click();
cy.focused().type("Awesome outfit{enter}");
2021-04-16 03:04:39 -07:00
page.getOutfitName().should("have.text", "Awesome outfit");
2021-04-16 03:04:39 -07:00
cy.location().toMatchSnapshot();
});
});