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", "dev": "turbo run dev",
"start": "turbo run start", "start": "turbo run start",
"types": "turbo run types", "types": "turbo run types",
"prettier-fix": "prettier --write .", "prettier-fix": "prettier --write ."
"cypress:open": "cypress open",
"cypress:run": "cypress run"
}, },
"devDependencies": { "devDependencies": {
"cypress": "^9.6.0", "cypress": "^9.6.0",

View File

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

View File

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

View File

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

12366
yarn.lock

File diff suppressed because it is too large Load Diff