Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

Revert "Remove Cypress"

This reverts commit 97b18a2.
  • Loading branch information...
brtjkzl committed Oct 21, 2018
1 parent 94a6b4d commit 69ae1c5537b5ff9598ed3f276da8a32430e84579
@@ -0,0 +1,4 @@
{
"email": "bkzl@me.com",
"token": "json.web.token"
}
@@ -0,0 +1 @@
// TODO test authentication and logout
@@ -0,0 +1,46 @@
// TODO test collection (adding, removing, unassigned)
// TODO test rating (adding, removing)
// TODO test platforms (adding, removing)

describe("Collection", () => {
it("allows to collect and rate games", () => {
// Search game as logged in user
cy.signIn();
cy.visit("/");
cy.getId("search-input").type("witcher{enter}");
cy.getId("game-card-the-witcher-3-wild-hunt");

// Add game to backlog
cy.getId("game-card-the-witcher-3-wild-hunt")
.findId("button-primary-add-to-collection")
.click();
cy.getId("dropdown-item-backlog").click();

// Rate it for 9
cy.getId("game-card-the-witcher-3-wild-hunt")
.findId("button-primary-rate")
.click();
cy.getId("dropdown-item-9").click();

// Have it on PS4
cy.getId("game-card-the-witcher-3-wild-hunt")
.findId("button-outline-ps-4")
.click();

// Verify the game has been added to the profile
cy.getId("link-profile").click();
cy.getId("game-card-the-witcher-3-wild-hunt").findId(
"button-primary-backlog"
);
cy.getId("game-card-the-witcher-3-wild-hunt").findId("button-primary-9");
cy.getId("game-card-the-witcher-3-wild-hunt").findId("button-primary-ps-4");

// Verify the game is correctly shown on search results
cy.getId("link-home").click({ force: true });
cy.getId("game-card-the-witcher-3-wild-hunt").findId(
"button-primary-backlog"
);
cy.getId("game-card-the-witcher-3-wild-hunt").findId("button-primary-9");
cy.getId("game-card-the-witcher-3-wild-hunt").findId("button-primary-ps-4");
});
});
@@ -0,0 +1,11 @@
// TODO test search

describe("Search", () => {
it("works", () => {
cy.visit("/");
cy.getId("search-input").type("witcher{enter}");
cy.getId("game-card-the-witcher-3-wild-hunt");
cy.getId("game-card-the-witcher-2-assassins-of-kings");
cy.getId("game-card-the-witcher");
});
});
@@ -0,0 +1,15 @@
Cypress.Commands.add("getId", id => cy.get(`[data-test="${id}"]`));

Cypress.Commands.add("findId", { prevSubject: true }, (subject, id) =>
subject.find(`[data-test="${id}"]`)
);

Cypress.Commands.add("signIn", () => {
cy.fixture("authCookie").then(authCookie => {
cy.setCookie("auth", encodeURIComponent(JSON.stringify(authCookie)));
});
});

Cypress.Commands.add("signOut", () => {
cy.clearCookies();
});
@@ -0,0 +1 @@
import "./commands";
@@ -3,6 +3,7 @@
"private": true,
"scripts": {
"analyze": "source-map-explorer",
"cypress": "cypress open",
"lint": "eslint app/client/",
"start": "hivemind Procfile.dev",
"test": "jest --watch",
@@ -33,6 +34,7 @@
},
"devDependencies": {
"babel-eslint": "^8.2.6",
"cypress": "^3.0.3",
"eslint": "^5.3.0",
"eslint-plugin-cypress": "^2.0.1",
"eslint-plugin-import": "^2.13.0",

0 comments on commit 69ae1c5

Please sign in to comment.
You can’t perform that action at this time.