mirror of
https://github.com/vercel/commerce.git
synced 2025-05-17 23:16:59 +00:00
no yarn
This commit is contained in:
parent
185f9fb48b
commit
a0f00c2a3c
36
cypress/integration/header.spec.js
Normal file
36
cypress/integration/header.spec.js
Normal file
@ -0,0 +1,36 @@
|
||||
describe('Header', () => {
|
||||
beforeEach(() => cy.visit('/'))
|
||||
|
||||
it('links to the correct pages', () => {
|
||||
cy.getBySel('logo').click()
|
||||
cy.location('pathname').should('eq', '/')
|
||||
|
||||
cy.getBySel('nav-link-search').click()
|
||||
cy.location('pathname').should('eq', '/search')
|
||||
|
||||
cy.getBySelLike('nav-link-home-page-New').click()
|
||||
cy.location('pathname').should('eq', '/search/new-arrivals')
|
||||
})
|
||||
|
||||
it('the search bar returns the correct search results', () => {
|
||||
cy.getBySel('search-input').eq(0).type('New Short Sleeve T-Shirt{enter}')
|
||||
|
||||
// nothing gets filtered
|
||||
// cy.getBySel('product-tag')
|
||||
// .eq(0)
|
||||
// .within(() => {
|
||||
// cy.getBySel('product-name').should(
|
||||
// 'contain',
|
||||
// 'New Short Sleeve T-Shirt'
|
||||
// )
|
||||
// cy.getBySel('product-price').should('contain', '$25.00 USD')
|
||||
// })
|
||||
})
|
||||
})
|
||||
|
||||
describe('Shopping Cart', () => {
|
||||
it('users can add products to the cart', () => {
|
||||
cy.visit('/')
|
||||
cy.getBySel('product-tag').eq(0).click()
|
||||
})
|
||||
})
|
@ -27,40 +27,3 @@ describe('Home Page', () => {
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
describe('Header', () => {
|
||||
beforeEach(() => cy.visit('/'))
|
||||
|
||||
it('links to the correct pages', () => {
|
||||
cy.getBySel('logo').click()
|
||||
cy.location('pathname').should('eq', '/')
|
||||
|
||||
cy.getBySel('nav-link-search').click()
|
||||
cy.location('pathname').should('eq', '/search')
|
||||
|
||||
cy.getBySelLike('nav-link-home-page-New').click()
|
||||
cy.location('pathname').should('eq', '/search/new-arrivals')
|
||||
})
|
||||
|
||||
it('the search bar returns the correct search results', () => {
|
||||
cy.getBySel('search-input').eq(0).type('New Short Sleeve T-Shirt{enter}')
|
||||
|
||||
// nothing gets filtered
|
||||
// cy.getBySel('product-tag')
|
||||
// .eq(0)
|
||||
// .within(() => {
|
||||
// cy.getBySel('product-name').should(
|
||||
// 'contain',
|
||||
// 'New Short Sleeve T-Shirt'
|
||||
// )
|
||||
// cy.getBySel('product-price').should('contain', '$25.00 USD')
|
||||
// })
|
||||
})
|
||||
})
|
||||
|
||||
describe('Shopping Cart', () => {
|
||||
it('users can add products to the cart', () => {
|
||||
cy.visit('/')
|
||||
cy.getBySel('product-tag').eq(0).click()
|
||||
})
|
||||
})
|
||||
|
@ -323,3 +323,21 @@ Yes, we are performing these in the guide, but the rule of 3 is key knowledge, c
|
||||
_____
|
||||
|
||||
We could bring up an optional Cypress Dashboard topic here. Not only that would be good for knowledge, but also promote Cypress some. But maybe it could be better to cause an intentional CI failure, then bring it up when there is a need. Something to consider. The distinction that needs to be made is `CYPRESS_RECORD_KEY` is not really needed in the local `.env` file, but it is still needed in Github secrets and the yml file.
|
||||
|
||||
____________
|
||||
|
||||
When did we create a `header.spec.js` file? It is possible that one might miss this. Perhaps at the end of Part 3 we give a tree structure and the final, ready-to-copy code for the spec files.
|
||||
|
||||
```bash
|
||||
├── fixtures
|
||||
│ └── example.json
|
||||
├── integration
|
||||
│ ├── header.spec.js
|
||||
│ └── home.spec.js
|
||||
├── plugins
|
||||
│ └── index.js
|
||||
└── support
|
||||
├── commands.js
|
||||
└── index.js
|
||||
```
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user