updated failing header test

This commit is contained in:
Dinushi Herath 2022-05-13 15:57:06 +10:00
parent 4f3b9460f2
commit b6177c440b
6 changed files with 6152 additions and 6236 deletions

View File

@ -1,5 +0,0 @@
{
"baseUrl": "http://localhost:3000",
"viewportHeight": 1000,
"viewportWidth": 1280
}

View File

@ -11,9 +11,7 @@
"dev": "turbo run dev",
"start": "turbo run start",
"types": "turbo run types",
"prettier-fix": "prettier --write .",
"cypress:open": "cypress open",
"cypress:run": "cypress run"
"prettier-fix": "prettier --write ."
},
"devDependencies": {
"cypress": "^9.6.0",

View File

@ -71,11 +71,11 @@ const ProductCard: FC<Props> = ({
/>
)}
{!noNameTag && (
<div className={s.header}>
<div className={s.header} data-test="product-card">
<h3 className={s.name}>
<span>{product.name}</span>
<span data-test="product-name">{product.name}</span>
</h3>
<div className={s.price}>
<div className={s.price} data-test="product-price">
{`${price} ${product.price?.currencyCode}`}
</div>
</div>

View File

@ -16,7 +16,7 @@ describe("Header", ()=>{
it.only("the search bar returns the correct search results", ()=>{
cy.getBySel("search-input").eq(0).type("purple{enter}")
cy.get('[data-test="product-tag"]').within(() => {
cy.get('[data-test="product-card"]').within(() => {
cy.get('[data-test="product-name"]').should("contain", "Purple dress")
cy.get('[data-test="product-price"]').should("contain", "$95.00 AUD")
})

View File

@ -9,7 +9,9 @@
"analyze": "BUNDLE_ANALYZE=both next build",
"lint": "next lint",
"prettier-fix": "prettier --write .",
"find:unused": "npx next-unused"
"find:unused": "npx next-unused",
"cypress:open": "cypress open",
"cypress:run": "cypress run"
},
"sideEffects": false,
"dependencies": {
@ -29,6 +31,7 @@
"autoprefixer": "^10.4.2",
"body-scroll-lock": "^4.0.0-beta.0",
"clsx": "^1.1.1",
"cypress": "^9.6.1",
"email-validator": "^2.0.4",
"js-cookie": "^3.0.1",
"keen-slider": "^6.6.3",

12366
yarn.lock

File diff suppressed because it is too large Load Diff