-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
$ yarn run start:storybook:test Test for the following - Material id is not on user's favorites list - Material id is on user's favorites list - User can add and remove material id from favorite list
- Loading branch information
1 parent
b818dda
commit 7a84bfa
Showing
1 changed file
with
46 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
describe("Favorite button", () => { | ||
it("Material id is not on user's favorites list", () => { | ||
cy.intercept("HEAD", "**/list/default/**", { | ||
statusCode: 404, | ||
body: {} | ||
}); | ||
cy.visit( | ||
"/iframe.html?args=&id=components-button-favourite--favourite&viewMode=story" | ||
); | ||
cy.get('[aria-label="Tilføj til favoritter"]'); | ||
}); | ||
|
||
it("Material id is on user's favorites list", () => { | ||
cy.intercept("HEAD", "**/list/default/**", { | ||
statusCode: 200, | ||
body: {} | ||
}); | ||
cy.visit( | ||
"/iframe.html?args=&id=components-button-favourite--favourite&viewMode=story" | ||
); | ||
cy.get('[aria-label="Fjern fra favoritter"]'); | ||
}); | ||
|
||
it("User can add and remove material id from favorite list", () => { | ||
cy.intercept("HEAD", "**/list/default/**", { | ||
statusCode: 404, | ||
body: {} | ||
}); | ||
cy.intercept("PUT", "**/list/default/**", { | ||
statusCode: 201, | ||
body: {} | ||
}); | ||
cy.intercept("DELETE", "**/list/default/**", { | ||
statusCode: 204, | ||
body: {} | ||
}); | ||
cy.visit( | ||
"/iframe.html?args=&id=components-button-favourite--favourite&viewMode=story" | ||
); | ||
cy.get('[aria-label="Tilføj til favoritter"]').click(); | ||
cy.get('[aria-label="Fjern fra favoritter"]').click(); | ||
cy.get('[aria-label="Tilføj til favoritter"]').click(); | ||
}); | ||
}); | ||
|
||
export {}; |