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

Finish cypress specs

  • Loading branch information...
brtjkzl committed Oct 22, 2018
1 parent f1ff7c5 commit 57bb5cca18aa99b309ca9eb8198131fec5c3c181
@@ -12,14 +12,16 @@ const Icon = ({
after,
onClick,
onMouseEnter,
onMouseLeave
onMouseLeave,
testId
}) => {
const SVG = getIconSVG(type);
const sizeProps = size ? { width: size, height: size } : {};
const colorProps = color ? { fill: color } : {};

return (
<$Icon
data-cy={testId}
before={before}
after={after}
onClick={onClick}
@@ -47,7 +49,8 @@ Icon.propTypes = {
size: PropTypes.number,
onClick: PropTypes.func,
onMouseEnter: PropTypes.func,
onMouseLeave: PropTypes.func
onMouseLeave: PropTypes.func,
testId: PropTypes.string
};

export default Icon;
@@ -8,7 +8,7 @@ import $RatingToggle from "./$RatingToggle";

const RatingToggle = ({ onClick, rating, isMouseOverUnrate }) => {
return (
<$RatingToggle onClick={onClick}>
<$RatingToggle onClick={onClick} data-cy="rating-toggle">
{rating ? (
<Flex alignItems="center">
<Box>{rating}</Box>
@@ -71,6 +71,7 @@ class Rating extends PureComponent {
<$RatingMenu innerRef={clickableElement}>
{!!initialValue && (
<Icon
testId="rating-unstar"
color={isMouseOverUnrate ? COLOR_DESTRUCTIVE : COLOR_ACCENT}
type="unstar"
onClick={() => this.rate(null)}
@@ -86,6 +87,7 @@ class Rating extends PureComponent {
)}
{times(10, n => (
<Icon
testId={`rating-star-${n + 1}`}
key={n}
type="star"
color={n < value ? COLOR_ACCENT : COLOR_PRIMARY}
@@ -19,8 +19,8 @@ const Score = ({ value, votes }) => {
</Box>
<Box>
<$Score>
<$ScoreValue>{value.toFixed(1)}</$ScoreValue>
<$ScoreVotes>
<$ScoreValue data-cy="score-value">{value.toFixed(1)}</$ScoreValue>
<$ScoreVotes data-cy="score-votes">
( <Icon type="user" size={10} after={2} color={COLOR_LIGHT} />
{votes} )
</$ScoreVotes>
@@ -3,6 +3,6 @@
"pluginsFile": false,
"fixturesFolder": false,
"video": false,
"viewportWidth": 1280,
"viewportHeight": 800
"viewportWidth": 1400,
"viewportHeight": 1050
}
@@ -1,7 +1,6 @@
describe("Collection", () => {
before(() => {
cy.signIn();
cy.visit("/");
});

it("allows to add to collection", () => {
@@ -10,22 +9,68 @@ describe("Collection", () => {
.findNode("button-outline-add-to-collection")
.click();
cy.getNode("dropdown-item-playing").click();

cy.getNode("game-card-the-witcher-2-assassins-of-kings")
.findNode("button-outline-add-to-collection")
.click();
cy.getNode("dropdown-item-backlog").click();
cy.getNode("logo").click();

cy.getNode("game-card-the-witcher-3-wild-hunt").should("exist");
cy.getNode("tab-backlog").click();
cy.getNode("game-card-the-witcher-2-assassins-of-kings").should("exist");
});

it.skip("allows to remove from collection", () => {});
it.skip("allows to add rating", () => {});
it.skip("allows to remove rating", () => {});
it.skip("allows to add platform", () => {});
it.skip("allows to remove platform", () => {});
it.skip("shows unassigned collection", () => {});
it("allows to remove from collection", () => {
cy.getNode("game-card-the-witcher-2-assassins-of-kings").should("exist");
cy.getNode("button-primary-backlog").click();
cy.getNode("dropdown-item-remove-from-collection").click();
cy.getNode("game-card-the-witcher-2-assassins-of-kings").should(
"not.exist"
);
});

it("allows to add rating", () => {
cy.getNode("tab-playing").click();
cy.getNode("game-card-the-witcher-3-wild-hunt").should("exist");
cy.getNode("rating-toggle").click();
cy.getNode("rating-star-9").click();
cy.getNode("score-value").contains(9.0);
cy.getNode("score-votes").contains(1);
});

it("allows to remove rating", () => {
cy.getNode("game-card-the-witcher-3-wild-hunt").should("exist");
cy.getNode("rating-toggle").click();
cy.getNode("rating-unstar").click();
cy.getNode("score-value").should("not.exist");
cy.getNode("score-votes").should("not.exist");
});

it("allows to add platform", () => {
cy.getNode("button-outline-pc").click();
cy.getNode("button-outline-pc").should("not.exist");
cy.getNode("button-primary-pc").should("exist");
});

it("shows unassigned collection", () => {
cy.getNode("button-primary-playing").click();
cy.getNode("dropdown-item-remove-from-collection").click();
cy.getNode("tab-unassigned").click();
cy.getNode("game-card-the-witcher-3-wild-hunt").should("exist");
cy.getNode("game-card-the-witcher-3-wild-hunt")
.findNode("button-outline-add-to-collection")
.click();
cy.getNode("dropdown-item-playing").click();
cy.getNode("tab-playing").click();
cy.getNode("game-card-the-witcher-3-wild-hunt").should("exist");
});

it("allows to remove platform", () => {
cy.getNode("button-primary-pc").click();
cy.getNode("button-primary-pc").should("not.exist");
cy.getNode("button-outline-pc").should("exist");
});

after(() => {
cy.signOut();
});
});

0 comments on commit 57bb5cc

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