-
-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
37 additions
and
41 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,37 @@ | ||
describe('Inventory', () => { | ||
interface Item { | ||
name: string | ||
desc: string | ||
price: number | ||
} | ||
|
||
beforeEach(() => { | ||
cy.log('**log in**') | ||
cy.visit('/') | ||
cy.getByTest('username').type('standard_user') | ||
cy.getByTest('password').type('secret_sauce') | ||
cy.getByTest('login-button').click() | ||
cy.location('pathname').should('equal', '/inventory.html') | ||
}) | ||
|
||
it('has every item from the inventory', () => { | ||
// load the inventory JSON fixture file | ||
// https://on.cypress.io/fixture | ||
cy.fixture('inventory.json').then((items) => { | ||
// iterate over every data item | ||
items.forEach((item: Item) => { | ||
cy.log(`checking 🎁 **${item.name}**`) | ||
// and confirm there is an item on the page | ||
// with the name, description, and price listed | ||
// https://on.cypress.io/contains | ||
// https://on.cypress.io/within | ||
// Note: check the properties in the inventory object | ||
cy.contains('.inventory_item', item.name).within(() => { | ||
cy.contains('.inventory_item_name', item.name) | ||
cy.contains('.inventory_item_desc', item.desc) | ||
cy.contains('.inventory_item_price', item.price) | ||
}) | ||
}) | ||
}) | ||
}) | ||
}) |
This file was deleted.
Oops, something went wrong.