Remove Cypress integration tests
We haven't attended to them in a while, idk if they still work. They were helpful for automatic TDD when building certain complex features like outfit saving, but now it's just noise in the repo I think. We can get them back sometime by reverting this if we really want them!
|
@ -1,4 +0,0 @@
|
|||
{
|
||||
"baseUrl": "http://localhost:3000",
|
||||
"ignoreTestFiles": ["**/__snapshots__/*", "**/__image_snapshots__/*"]
|
||||
}
|
|
@ -1,5 +0,0 @@
|
|||
{
|
||||
"name": "Using fixtures to represent data",
|
||||
"email": "hello@cypress.io",
|
||||
"body": "Fixtures are a great way to mock data for responses to routes"
|
||||
}
|
|
@ -1,55 +0,0 @@
|
|||
// Give network requests a bit of breathing room! (A bit more, because this
|
||||
// page has a lot of data!)
|
||||
const networkTimeout = { timeout: 10000 };
|
||||
|
||||
describe("ItemZonesInfo", () => {
|
||||
it("shows simple zone data for an all-species Background", () => {
|
||||
cy.visit("/items/37375");
|
||||
cy.get("[data-test-id='item-zones-info']", networkTimeout).should(
|
||||
"have.text",
|
||||
"Occupies: Background" + "Restricts: N/A"
|
||||
);
|
||||
});
|
||||
|
||||
it("shows simple zone data for a species-specific Hat", () => {
|
||||
cy.visit("/items/34985");
|
||||
cy.get("[data-test-id='item-zones-info']", networkTimeout).should(
|
||||
"have.text",
|
||||
"Occupies: Hat" + "Restricts: N/A"
|
||||
);
|
||||
});
|
||||
|
||||
it("shows distinct zone data for an all-species in-hand item", () => {
|
||||
cy.visit("/items/43397");
|
||||
cy.get("[data-test-id='item-zones-info']", networkTimeout).should(
|
||||
"have.text",
|
||||
"Occupies: Right-hand Item (52 species)" +
|
||||
"Left-hand Item (2 species)" +
|
||||
"Restricts: N/A"
|
||||
);
|
||||
|
||||
cy.contains("(52 species)").focus();
|
||||
cy.contains(
|
||||
"Acara, Aisha, Blumaroo, Bori, Bruce, Buzz, Chia, Chomby, Cybunny, Draik, Elephante, Eyrie, Flotsam, Gelert, Gnorbu, Grarrl, Grundo, Hissi, Ixi, Jetsam, Jubjub, Kacheek, Kau, Kiko, Koi, Korbat, Kougra, Krawk, Kyrii, Lupe, Lutari, Meerca, Moehog, Mynci, Nimmo, Ogrin, Peophin, Poogle, Pteri, Quiggle, Ruki, Scorchio, Shoyru, Skeith, Techo, Tonu, Uni, Usul, Wocky, Xweetok, Yurble, Zafara"
|
||||
).should("exist");
|
||||
|
||||
cy.contains("(2 species)").focus();
|
||||
cy.contains("Lenny, Tuskaninny").should("exist");
|
||||
});
|
||||
|
||||
it("shows simple zone data for a Mutant-only Dress", () => {
|
||||
cy.visit("/items/70564");
|
||||
cy.get("[data-test-id='item-zones-info']", networkTimeout).should(
|
||||
"have.text",
|
||||
"Occupies: Shirt/Dress" + "Restricts: N/A"
|
||||
);
|
||||
});
|
||||
|
||||
it("shows zone restrict data for a simple hood", () => {
|
||||
cy.visit("/items/38911");
|
||||
cy.get("[data-test-id='item-zones-info']", networkTimeout).should(
|
||||
"have.text",
|
||||
"Occupies: Hat" + "Restricts: Hair Front" + "Head Transient Biology"
|
||||
);
|
||||
});
|
||||
});
|
|
@ -1,16 +0,0 @@
|
|||
// Give network requests a bit of breathing room!
|
||||
const networkTimeout = { timeout: 6000 };
|
||||
|
||||
describe("ItemSearchPage", () => {
|
||||
// NOTE: This test depends on specific search results on certain pages, and
|
||||
// could break if a lot of matching items are added to the site!
|
||||
it("Searches by keyword", () => {
|
||||
cy.visit("/items/search");
|
||||
|
||||
// The first page should contain this item.
|
||||
cy.get("[data-test-id=item-search-input]").type("winter");
|
||||
cy.contains("A Warm Winters Night Background", networkTimeout).should(
|
||||
"exist"
|
||||
);
|
||||
});
|
||||
});
|
|
@ -1,87 +0,0 @@
|
|||
import * as page from "./page";
|
||||
|
||||
// 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)
|
||||
.find(":selected")
|
||||
.should("have.text", "Acara");
|
||||
page.getColorSelect().find(":selected").should("have.text", "Blue");
|
||||
cy.location().toMatchSnapshot();
|
||||
|
||||
cy.contains("A Warm Winters Night Background", networkTimeout).should(
|
||||
"exist"
|
||||
);
|
||||
|
||||
page.getOutfitPreview().toMatchImageSnapshot();
|
||||
});
|
||||
|
||||
it("Changes species and color", () => {
|
||||
cy.visit("/outfits/new?species=1&color=8&objects[]=76789");
|
||||
|
||||
page
|
||||
.getSpeciesSelect(networkTimeout)
|
||||
.find(":selected")
|
||||
.should("have.text", "Acara");
|
||||
page.getColorSelect().find(":selected").should("have.text", "Blue");
|
||||
cy.location().toMatchSnapshot();
|
||||
page.getOutfitPreview().toMatchImageSnapshot();
|
||||
|
||||
page.getSpeciesSelect().select("Aisha");
|
||||
|
||||
page.getSpeciesSelect().find(":selected").should("have.text", "Aisha");
|
||||
page.getColorSelect().find(":selected").should("have.text", "Blue");
|
||||
cy.location().toMatchSnapshot();
|
||||
page.getOutfitPreview().toMatchImageSnapshot();
|
||||
|
||||
page.getColorSelect().select("Red");
|
||||
|
||||
page.getSpeciesSelect().find(":selected").should("have.text", "Aisha");
|
||||
page.getColorSelect().find(":selected").should("have.text", "Red");
|
||||
cy.location().toMatchSnapshot();
|
||||
page.getOutfitPreview().toMatchImageSnapshot();
|
||||
});
|
||||
|
||||
it("Changes pose", () => {
|
||||
cy.visit("/outfits/new?species=1&color=8&pose=HAPPY_FEM");
|
||||
|
||||
page.getPosePickerButton(networkTimeout).click();
|
||||
page.getPosePickerOption("Happy and Feminine").should("be.checked");
|
||||
cy.location().toMatchSnapshot();
|
||||
page.getOutfitPreview().toMatchImageSnapshot();
|
||||
|
||||
page.getPosePickerOption("Sad and Masculine").check({ force: true });
|
||||
page.getPosePickerOption("Sad and Masculine").should("be.checked");
|
||||
cy.location().toMatchSnapshot();
|
||||
page.getOutfitPreview().toMatchImageSnapshot();
|
||||
});
|
||||
|
||||
it("Toggles item", () => {
|
||||
cy.visit("/outfits/new?species=1&color=8&objects[]=76789");
|
||||
|
||||
page.getOutfitPreview().toMatchImageSnapshot();
|
||||
cy.location().toMatchSnapshot();
|
||||
|
||||
cy.contains("A Warm Winters Night Background").click();
|
||||
|
||||
page.getOutfitPreview().toMatchImageSnapshot();
|
||||
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");
|
||||
|
||||
page.getOutfitName().click();
|
||||
cy.focused().type("Awesome outfit{enter}");
|
||||
|
||||
page.getOutfitName().should("have.text", "Awesome outfit");
|
||||
cy.location().toMatchSnapshot();
|
||||
});
|
||||
});
|
|
@ -1,133 +0,0 @@
|
|||
import * as page from "./page";
|
||||
|
||||
describe("WardrobePage: Outfit saving", () => {
|
||||
it("Saves a simple Blue Acara", () => {
|
||||
cy.logInAs("dti-test");
|
||||
cy.visit("/outfits/new?species=1&color=8");
|
||||
|
||||
// Give the outfit a unique timestamped name
|
||||
const outfitName = `Cypress Test - Blue Acara - ${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
|
||||
// still shows the correct outfit preview and name.
|
||||
page.getOutfitIsSavedIndicator({ timeout: 12000 }).should("exist");
|
||||
cy.location("pathname").should("match", /^\/outfits\/[0-9]+$/);
|
||||
page.getOutfitName().should("have.text", outfitName);
|
||||
page.getOutfitPreview().toMatchImageSnapshot();
|
||||
});
|
||||
|
||||
it("Saves a Zafara Tourist with worn and closeted items", () => {
|
||||
cy.logInAs("dti-test");
|
||||
cy.visit(
|
||||
"/outfits/new?species=54&color=34&pose=HAPPY_FEM&objects%5B%5D=38916&objects%5B%5D=51054&objects%5B%5D=38914&closet%5B%5D=36125&closet%5B%5D=36467&closet%5B%5D=47075&closet%5B%5D=47056&closet%5B%5D=39662&closet%5B%5D=56706&closet%5B%5D=38915&closet%5B%5D=56398"
|
||||
);
|
||||
|
||||
// Give the outfit a unique timestamped name
|
||||
const outfitName = `Cypress Test - Zafara Tourist - ${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
|
||||
// still shows the correct outfit preview and name.
|
||||
page.getOutfitIsSavedIndicator({ timeout: 12000 }).should("exist");
|
||||
cy.location("pathname").should("match", /^\/outfits\/[0-9]+$/);
|
||||
page.getOutfitName().should("have.text", outfitName);
|
||||
page.getOutfitPreview().toMatchImageSnapshot();
|
||||
});
|
||||
|
||||
it("Saves an outfit, then toggles an item to auto-save it", () => {
|
||||
cy.logInAs("dti-test");
|
||||
cy.visit("/outfits/new?species=1&color=8&closet[]=78104");
|
||||
|
||||
// Give the outfit a unique timestamped name
|
||||
const outfitName = `Cypress Test - Auto-Save on Items - ${new Date().toISOString()}`;
|
||||
page.getOutfitName({ timeout: 12000 }).click();
|
||||
cy.focused().type(outfitName + "{enter}");
|
||||
|
||||
// Save the outfit, and wait for it to finish.
|
||||
page.getSaveOutfitButton().click().should("have.attr", "data-loading");
|
||||
page.getOutfitIsSavedIndicator({ timeout: 12000 }).should("exist");
|
||||
|
||||
// Click the background to toggle it on.
|
||||
cy.contains("#1 Fan Room Background").click();
|
||||
|
||||
// Wait for the outfit to start auto-saving, then finish again.
|
||||
page.getOutfitIsSavingIndicator({ timeout: 5000 }).should("exist");
|
||||
page.getOutfitIsSavedIndicator({ timeout: 12000 }).should("exist");
|
||||
|
||||
// Reload the page. The outfit preview should still contain the background.
|
||||
cy.reload();
|
||||
page.getOutfitPreview({ timeout: 20000 }).toMatchImageSnapshot();
|
||||
});
|
||||
|
||||
it("Saves an outfit, then changes the color to auto-save it", () => {
|
||||
cy.logInAs("dti-test");
|
||||
cy.visit("/outfits/new?species=1&color=8");
|
||||
|
||||
// Give the outfit a unique timestamped name
|
||||
const outfitName = `Cypress Test - Auto-Save on Color - ${new Date().toISOString()}`;
|
||||
page.getOutfitName({ timeout: 12000 }).click();
|
||||
cy.focused().type(outfitName + "{enter}");
|
||||
|
||||
// Save the outfit, and wait for it to finish.
|
||||
page.getSaveOutfitButton().click().should("have.attr", "data-loading");
|
||||
page.getOutfitIsSavedIndicator({ timeout: 12000 }).should("exist");
|
||||
|
||||
// Change the color from Blue to Red.
|
||||
page.getColorSelect().select("Red");
|
||||
|
||||
// Wait for the outfit to start auto-saving, then finish again.
|
||||
page.getOutfitIsSavingIndicator({ timeout: 5000 }).should("exist");
|
||||
page.getOutfitIsSavedIndicator({ timeout: 12000 }).should("exist");
|
||||
|
||||
// Reload the page. The outfit preview should still show a Red Acara.
|
||||
cy.reload();
|
||||
page.getOutfitPreview({ timeout: 20000 }).toMatchImageSnapshot();
|
||||
});
|
||||
|
||||
it("prompts before navigating away from unsaved changes", () => {
|
||||
// Create stub methods to reject navigation confirmation prompts. We need
|
||||
// `confirm` for react-router's client-side nav, and `before:unload` for
|
||||
// the browser's built-in full-page nav prompts.
|
||||
const confirmStub = cy.stub().returns(false);
|
||||
cy.on("window:confirm", confirmStub);
|
||||
const beforeUnloadStub = cy.stub();
|
||||
cy.on("window:before:unload", beforeUnloadStub);
|
||||
|
||||
cy.logInAs("dti-test");
|
||||
cy.visit("/outfits/new?species=1&color=8");
|
||||
|
||||
// Give the outfit a unique timestamped name
|
||||
const outfitName = `Cypress Test - Block Navigation - ${new Date().toISOString()}`;
|
||||
page.getOutfitName({ timeout: 12000 }).click();
|
||||
cy.focused().type(outfitName + "{enter}");
|
||||
|
||||
// Save the outfit, but don't wait for it to finish.
|
||||
page.getSaveOutfitButton().click().should("have.attr", "data-loading");
|
||||
|
||||
// Click the big back button, and observe that it triggers a confirm prompt.
|
||||
// We'll reject it. HACK: It's a bit flaky if you try the clicks
|
||||
// immediately in sequence. Is there a better way to do this?
|
||||
page.showOutfitControls();
|
||||
cy.wait(100); // eslint-disable-line cypress/no-unnecessary-waiting
|
||||
page.getNavBackButton().click();
|
||||
cy.wrap(confirmStub).should("be.called");
|
||||
|
||||
// Try to reload the page, and observe that it would trigger the browser's
|
||||
// built-in prompt, i.e., `defaultPrevented`. Cypress will automatically
|
||||
// confirm the simulated prompt, and complete the reload.
|
||||
cy.reload();
|
||||
cy.wrap(beforeUnloadStub).should(
|
||||
"be.calledWith",
|
||||
Cypress.sinon.match((e) => e.defaultPrevented)
|
||||
);
|
||||
});
|
||||
});
|
|
@ -1,35 +0,0 @@
|
|||
// Give network requests a bit of breathing room!
|
||||
const networkTimeout = { timeout: 10000 };
|
||||
|
||||
describe("WardrobePage: SearchPanel", () => {
|
||||
// NOTE: This test depends on specific search results on certain pages, and
|
||||
// could break if a lot of matching items are added to the site!
|
||||
it("Searches by keyword", () => {
|
||||
cy.visit("/outfits/new");
|
||||
|
||||
// The first page should contain this item.
|
||||
cy.get("[data-test-id=item-search-input]").type("winter");
|
||||
cy.contains("A Warm Winters Night Background", networkTimeout).should(
|
||||
"exist"
|
||||
);
|
||||
|
||||
// And the second page should contain this item.
|
||||
cy.get("[data-test-id=search-panel-scroll-container]").scrollTo("bottom");
|
||||
cy.contains(
|
||||
"Dyeworks Purple: Winter Rose Foreground",
|
||||
networkTimeout
|
||||
).should("exist");
|
||||
});
|
||||
|
||||
it("Only shows items that fit", () => {
|
||||
cy.visit("/outfits/new");
|
||||
|
||||
// Searching for Christmas paintbrush items should show the Acara items,
|
||||
// but not the Aisha items.
|
||||
cy.get("[data-test-id=item-search-input]")
|
||||
.type("pb{enter}")
|
||||
.type("christmas");
|
||||
cy.contains("Christmas Acara Coat", networkTimeout).should("exist");
|
||||
cy.contains("Christmas Aisha Collar").should("not.exist");
|
||||
});
|
||||
});
|
Before Width: | Height: | Size: 62 KiB |
Before Width: | Height: | Size: 62 KiB |
Before Width: | Height: | Size: 288 KiB |
Before Width: | Height: | Size: 284 KiB |
Before Width: | Height: | Size: 280 KiB |
Before Width: | Height: | Size: 288 KiB |
Before Width: | Height: | Size: 288 KiB |
Before Width: | Height: | Size: 51 KiB |
Before Width: | Height: | Size: 364 KiB |
Before Width: | Height: | Size: 56 KiB |
Before Width: | Height: | Size: 57 KiB |
Before Width: | Height: | Size: 398 KiB |
|
@ -1,143 +0,0 @@
|
|||
exports[`WardrobePage: Basic outfit state > Initialize simple outfit from URL #0`] =
|
||||
{
|
||||
"auth": "",
|
||||
"hash": "",
|
||||
"host": "localhost:3000",
|
||||
"hostname": "localhost",
|
||||
"href": "http://localhost:3000/outfits/new?name=&species=1&color=8&pose=HAPPY_FEM&objects%5B%5D=76789",
|
||||
"origin": "http://localhost:3000",
|
||||
"originPolicy": "http://localhost:3000",
|
||||
"pathname": "/outfits/new",
|
||||
"port": "3000",
|
||||
"protocol": "http:",
|
||||
"search": "?name=&species=1&color=8&pose=HAPPY_FEM&objects%5B%5D=76789",
|
||||
"superDomain": "localhost"
|
||||
};
|
||||
|
||||
exports[`WardrobePage: Basic outfit state > Changes species and color #0`] =
|
||||
{
|
||||
"auth": "",
|
||||
"hash": "",
|
||||
"host": "localhost:3000",
|
||||
"hostname": "localhost",
|
||||
"href": "http://localhost:3000/outfits/new?name=&species=1&color=8&pose=HAPPY_FEM&objects%5B%5D=76789",
|
||||
"origin": "http://localhost:3000",
|
||||
"originPolicy": "http://localhost:3000",
|
||||
"pathname": "/outfits/new",
|
||||
"port": "3000",
|
||||
"protocol": "http:",
|
||||
"search": "?name=&species=1&color=8&pose=HAPPY_FEM&objects%5B%5D=76789",
|
||||
"superDomain": "localhost"
|
||||
};
|
||||
|
||||
exports[`WardrobePage: Basic outfit state > Changes species and color #1`] =
|
||||
{
|
||||
"auth": "",
|
||||
"hash": "",
|
||||
"host": "localhost:3000",
|
||||
"hostname": "localhost",
|
||||
"href": "http://localhost:3000/outfits/new?name=&species=2&color=8&pose=HAPPY_FEM&objects%5B%5D=76789",
|
||||
"origin": "http://localhost:3000",
|
||||
"originPolicy": "http://localhost:3000",
|
||||
"pathname": "/outfits/new",
|
||||
"port": "3000",
|
||||
"protocol": "http:",
|
||||
"search": "?name=&species=2&color=8&pose=HAPPY_FEM&objects%5B%5D=76789",
|
||||
"superDomain": "localhost"
|
||||
};
|
||||
|
||||
exports[`WardrobePage: Basic outfit state > Changes species and color #2`] =
|
||||
{
|
||||
"auth": "",
|
||||
"hash": "",
|
||||
"host": "localhost:3000",
|
||||
"hostname": "localhost",
|
||||
"href": "http://localhost:3000/outfits/new?name=&species=2&color=61&pose=HAPPY_FEM&objects%5B%5D=76789",
|
||||
"origin": "http://localhost:3000",
|
||||
"originPolicy": "http://localhost:3000",
|
||||
"pathname": "/outfits/new",
|
||||
"port": "3000",
|
||||
"protocol": "http:",
|
||||
"search": "?name=&species=2&color=61&pose=HAPPY_FEM&objects%5B%5D=76789",
|
||||
"superDomain": "localhost"
|
||||
};
|
||||
|
||||
exports[`WardrobePage: Basic outfit state > Toggles item #0`] =
|
||||
{
|
||||
"auth": "",
|
||||
"hash": "",
|
||||
"host": "localhost:3000",
|
||||
"hostname": "localhost",
|
||||
"href": "http://localhost:3000/outfits/new?name=&species=1&color=8&pose=HAPPY_FEM&objects%5B%5D=76789",
|
||||
"origin": "http://localhost:3000",
|
||||
"originPolicy": "http://localhost:3000",
|
||||
"pathname": "/outfits/new",
|
||||
"port": "3000",
|
||||
"protocol": "http:",
|
||||
"search": "?name=&species=1&color=8&pose=HAPPY_FEM&objects%5B%5D=76789",
|
||||
"superDomain": "localhost"
|
||||
};
|
||||
|
||||
exports[`WardrobePage: Basic outfit state > Toggles item #1`] =
|
||||
{
|
||||
"auth": "",
|
||||
"hash": "",
|
||||
"host": "localhost:3000",
|
||||
"hostname": "localhost",
|
||||
"href": "http://localhost:3000/outfits/new?name=&species=1&color=8&pose=HAPPY_FEM&closet%5B%5D=76789",
|
||||
"origin": "http://localhost:3000",
|
||||
"originPolicy": "http://localhost:3000",
|
||||
"pathname": "/outfits/new",
|
||||
"port": "3000",
|
||||
"protocol": "http:",
|
||||
"search": "?name=&species=1&color=8&pose=HAPPY_FEM&closet%5B%5D=76789",
|
||||
"superDomain": "localhost"
|
||||
};
|
||||
|
||||
exports[`WardrobePage: Basic outfit state > Changes pose #0`] =
|
||||
{
|
||||
"auth": "",
|
||||
"hash": "",
|
||||
"host": "localhost:3000",
|
||||
"hostname": "localhost",
|
||||
"href": "http://localhost:3000/outfits/new?name=&species=1&color=8&pose=HAPPY_FEM",
|
||||
"origin": "http://localhost:3000",
|
||||
"originPolicy": "http://localhost:3000",
|
||||
"pathname": "/outfits/new",
|
||||
"port": "3000",
|
||||
"protocol": "http:",
|
||||
"search": "?name=&species=1&color=8&pose=HAPPY_FEM",
|
||||
"superDomain": "localhost"
|
||||
};
|
||||
|
||||
exports[`WardrobePage: Basic outfit state > Changes pose #1`] =
|
||||
{
|
||||
"auth": "",
|
||||
"hash": "",
|
||||
"host": "localhost:3000",
|
||||
"hostname": "localhost",
|
||||
"href": "http://localhost:3000/outfits/new?name=&species=1&color=8&pose=SAD_MASC",
|
||||
"origin": "http://localhost:3000",
|
||||
"originPolicy": "http://localhost:3000",
|
||||
"pathname": "/outfits/new",
|
||||
"port": "3000",
|
||||
"protocol": "http:",
|
||||
"search": "?name=&species=1&color=8&pose=SAD_MASC",
|
||||
"superDomain": "localhost"
|
||||
};
|
||||
|
||||
exports[`WardrobePage: Basic outfit state > Renames outfit #0`] =
|
||||
{
|
||||
"auth": "",
|
||||
"hash": "",
|
||||
"host": "localhost:3000",
|
||||
"hostname": "localhost",
|
||||
"href": "http://localhost:3000/outfits/new?name=Awesome+outfit&species=1&color=8&pose=HAPPY_FEM",
|
||||
"origin": "http://localhost:3000",
|
||||
"originPolicy": "http://localhost:3000",
|
||||
"pathname": "/outfits/new",
|
||||
"port": "3000",
|
||||
"protocol": "http:",
|
||||
"search": "?name=Awesome+outfit&species=1&color=8&pose=HAPPY_FEM",
|
||||
"superDomain": "localhost"
|
||||
};
|
|
@ -1,45 +0,0 @@
|
|||
const withTestId = (testId) => (options) =>
|
||||
cy.get(`[data-test-id="${CSS.escape(testId)}"]`, options);
|
||||
|
||||
export const getNavBackButton = withTestId("wardrobe-nav-back-button");
|
||||
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 const getOutfitIsSavingIndicator = withTestId(
|
||||
"wardrobe-outfit-is-saving-indicator"
|
||||
);
|
||||
|
||||
export function getPosePickerOption(label, options) {
|
||||
return cy.get(`input[aria-label="${CSS.escape(label)}"]`, options);
|
||||
}
|
||||
|
||||
export function getOutfitPreview(options = { timeout: 15000 }) {
|
||||
// HACK: To return the screenshottable preview *area* (which is what this
|
||||
// function is currently used for), we select the first img tag. That's
|
||||
// because the app relies on CSS `object-fit` to get images to position
|
||||
// correctly, rather than styling the container. This will still
|
||||
// screenshot the full preview, because Cypress can't separate the
|
||||
// layers! It just screenshots the bounded area.
|
||||
//
|
||||
// TODO: The way the layer positioning works is a bit fragile tbh, and the
|
||||
// canvases already do math; it could make sense to just have the
|
||||
// container use the same math, or some clever CSS?
|
||||
//
|
||||
// NOTE: The tests need to run in a 600x600 actual window, or else the
|
||||
// snapshot will come out smaller. This because our snapshot plugin
|
||||
// performs its snapshot within the window's natural area, rather than
|
||||
// the simulated area that most tests run in.
|
||||
return cy
|
||||
.get("[data-test-id=wardrobe-outfit-preview]:not([data-loading])", options)
|
||||
.get("img")
|
||||
.first();
|
||||
}
|
||||
|
||||
export function showOutfitControls(options) {
|
||||
return cy.get("[data-test-id=wardrobe-outfit-controls]", options).click();
|
||||
}
|
|
@ -1,41 +0,0 @@
|
|||
require("dotenv").config();
|
||||
const { initPlugin } = require("cypress-plugin-snapshots/plugin");
|
||||
|
||||
module.exports = (on, config) => {
|
||||
initPlugin(on, config);
|
||||
|
||||
ensureWindowSize(on);
|
||||
|
||||
config.env.AUTH0_TEST_CLIENT_ID = process.env.AUTH0_TEST_CLIENT_ID;
|
||||
config.env.AUTH0_TEST_CLIENT_SECRET = process.env.AUTH0_TEST_CLIENT_SECRET;
|
||||
config.env.DTI_TEST_USER_PASSWORD = process.env.DTI_TEST_USER_PASSWORD;
|
||||
|
||||
return config;
|
||||
};
|
||||
|
||||
// Our screenshots from `cypress-plugin-snapshots` are affected by the actual
|
||||
// window size, not just the viewport size! To avoid downscaling outfit
|
||||
// previews, try to open the window at 1000x800 at minimum.
|
||||
//
|
||||
// Adapted from https://github.com/meinaart/cypress-plugin-snapshots/issues/104#issuecomment-636463370
|
||||
function ensureWindowSize(on) {
|
||||
const w = 1000;
|
||||
const h = 800;
|
||||
|
||||
on("before:browser:launch", (browser = {}, launchOptions) => {
|
||||
switch (browser.name) {
|
||||
case "chrome":
|
||||
launchOptions.args.push(`--window-size=${w},${h}`);
|
||||
break;
|
||||
case "electron":
|
||||
launchOptions.preferences.width = w;
|
||||
launchOptions.preferences.height = h;
|
||||
break;
|
||||
default:
|
||||
console.warn(
|
||||
`[ensureWindowSize] Browser engine ${browser.name} not recognized`
|
||||
);
|
||||
}
|
||||
return launchOptions;
|
||||
});
|
||||
}
|
|
@ -1,42 +0,0 @@
|
|||
import "cypress-plugin-snapshots/commands";
|
||||
import * as jwt from "jsonwebtoken";
|
||||
|
||||
// https://docs.cypress.io/guides/testing-strategies/auth0-authentication#Custom-Command-for-Auth0-Authentication
|
||||
// Adapted and simplified by a lot though!
|
||||
Cypress.Commands.add("logInAs", (username) => {
|
||||
if (username !== "dti-test") {
|
||||
throw new Error(`Cypress can only log in as dti-test right now`);
|
||||
}
|
||||
const password = Cypress.env("DTI_TEST_USER_PASSWORD");
|
||||
|
||||
const client_id = Cypress.env("AUTH0_TEST_CLIENT_ID");
|
||||
const client_secret = Cypress.env("AUTH0_TEST_CLIENT_SECRET");
|
||||
const audience = "https://impress-2020.openneo.net/api";
|
||||
const scope = "";
|
||||
|
||||
// TODO: This grant doesn't seem to include the custom username field. The
|
||||
// app is generally resilient to that, but yeah, it means the username
|
||||
// might not show up in the global header UI during these tests.
|
||||
cy.request({
|
||||
method: "POST",
|
||||
url: `https://openneo.us.auth0.com/oauth/token`,
|
||||
body: {
|
||||
grant_type: "password",
|
||||
username,
|
||||
password,
|
||||
audience,
|
||||
scope,
|
||||
client_id,
|
||||
client_secret,
|
||||
},
|
||||
}).then(({ body }) => {
|
||||
const decodedUser = jwt.decode(body.access_token);
|
||||
|
||||
const auth0Cypress = {
|
||||
encodedToken: body.access_token,
|
||||
decodedUser,
|
||||
};
|
||||
|
||||
window.localStorage.setItem("auth0Cypress", JSON.stringify(auth0Cypress));
|
||||
});
|
||||
});
|
|
@ -1,20 +0,0 @@
|
|||
// ***********************************************************
|
||||
// This example support/index.js is processed and
|
||||
// loaded automatically before your test files.
|
||||
//
|
||||
// This is a great place to put global configuration and
|
||||
// behavior that modifies Cypress.
|
||||
//
|
||||
// You can change the location of this file or turn off
|
||||
// automatically serving support files with the
|
||||
// 'supportFile' configuration option.
|
||||
//
|
||||
// You can read more here:
|
||||
// https://on.cypress.io/configuration
|
||||
// ***********************************************************
|
||||
|
||||
// Import commands.js using ES2015 syntax:
|
||||
import './commands'
|
||||
|
||||
// Alternatively you can use CommonJS syntax:
|
||||
// require('./commands')
|
|
@ -71,7 +71,6 @@
|
|||
"deploy-setup": "echo $'Setup requires you to become the root user. You\\'ll need to enter the password for your account on the remote web server below, and you must be part of the `sudo` user group.' && ansible-playbook -K -i deploy/inventory.cfg deploy/playbooks/setup.yml",
|
||||
"deploy": "ansible-playbook -i deploy/inventory.cfg deploy/playbooks/deploy.yml",
|
||||
"deploy-skip-build": "ansible-playbook -i deploy/inventory.cfg deploy/playbooks/deploy.yml --extra-vars='{\"skip_build\": true}'",
|
||||
"cypress": "cypress open",
|
||||
"mysql": "mysql --host=impress.openneo.net --user=$(dotenv -p IMPRESS_MYSQL_USER) --password=$(dotenv -p IMPRESS_MYSQL_PASSWORD) --database=openneo_impress",
|
||||
"mysql-dev": "mysql --host=localhost --user=impress_2020_dev --password=impress_2020_dev --database=openneo_impress",
|
||||
"mysql-admin": "mysql --host=impress.openneo.net --user=matchu --password --database=openneo_impress",
|
||||
|
@ -105,13 +104,10 @@
|
|||
"@typescript-eslint/parser": "^5.3.0",
|
||||
"apollo-server-testing": "^2.12.0",
|
||||
"auth0": "^2.28.0",
|
||||
"cypress": "^7.2.0",
|
||||
"cypress-plugin-snapshots": "^1.4.4",
|
||||
"dotenv-cli": "^3.1.0",
|
||||
"es6-promise-pool": "^2.5.0",
|
||||
"eslint": "<8.0.0",
|
||||
"eslint-config-next": "12.0.2",
|
||||
"eslint-plugin-cypress": "^2.11.2",
|
||||
"husky": "^6.0.0",
|
||||
"imports-loader": "^1.2.0",
|
||||
"inquirer": "^7.3.3",
|
||||
|
|