Skip to content

Commit 1d48276

Browse files
committed
Updated tests
1 parent 411e975 commit 1d48276

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

cypress/integration/test_filters.spec.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ describe('Test the filters and search for stories in Home page', () => {
77
category: Cypress.env('testCategory')
88
}
99

10+
const selectProduct = (productName) => {
11+
cy.get(`[data-cy=${productName.split(' ').join('-')}-card]`)
12+
.click({ force: true })
13+
}
14+
1015
const setDropdown = (dropdown, value) => {
1116
cy.get('[data-cy=search-input-div]')
1217
.get(`[data-cy=${dropdown}-dropdown]`)
@@ -32,13 +37,15 @@ describe('Test the filters and search for stories in Home page', () => {
3237
})
3338

3439
it('Filters stories based on product', () => {
35-
setDropdown('product', 'EOS User Story')
40+
selectProduct('EOS User Story')
3641

3742
cy.contains('No stories')
3843

39-
setDropdown('product', testStory.product)
44+
selectProduct(testStory.product)
4045

4146
cy.contains(testStory.title)
47+
48+
selectProduct(testStory.product)
4249
})
4350

4451
it('Filters stories based on category', () => {

src/components/ProductSelect.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ const ProductCard = ({ product, selected, setProduct }) => {
2222
className={`flex flex-center flex-align-center product-card ${
2323
selected ? 'product-card-selected' : ''
2424
}`}
25+
data-cy={`${product.Name.split(' ').join('-')}-card`}
2526
onClick={() => {
2627
if (!selected) {
2728
setProduct(product.Name)

0 commit comments

Comments
 (0)