Skip to content

Commit d08d80f

Browse files
committed
Added tests for dashboard and integrated with filters
1 parent 8e3c2d2 commit d08d80f

File tree

2 files changed

+19
-3
lines changed

2 files changed

+19
-3
lines changed

cypress/integration/test_filters.spec.js renamed to cypress/integration/dashboard.spec.js

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,28 @@
11
/// <reference types="cypress" />
22

3+
describe('Tests for dashboard',()=>{
4+
5+
before(()=>{
6+
cy.visit('/')
7+
})
8+
9+
it('Shows the dashboard',()=>{
10+
cy.get('[data-cy=dashboard-heading]').contains('TELL US YOUR STORY')
11+
})
12+
})
13+
14+
315
describe('Test the filters and search for stories in Home page', () => {
416
const testStory = {
517
title: Cypress.env('testStoryTitle'),
618
product: Cypress.env('testStoryProduct'),
719
category: Cypress.env('testCategory')
820
}
921

22+
const testUser = {
23+
username: Cypress.env('testUsername')
24+
}
25+
1026
const selectProduct = (productName) => {
1127
cy.get(`[data-cy=${productName.split(' ').join('-')}-card]`).click({
1228
force: true
@@ -81,9 +97,9 @@ describe('Test the filters and search for stories in Home page', () => {
8197

8298
clearSearchInput()
8399

84-
typeOnSearch('us')
100+
typeOnSearch(testUser.username.slice(0,2))
85101
cy.get('[data-cy=search-input-div]')
86-
.contains('user1')
102+
.contains(testUser.username)
87103
.click({ force: true })
88104

89105
cy.contains(testStory.title)

src/pages/Home.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ const Home = () => {
7878
<div className='body-wrapper'>
7979
<div className='product-introduction'>
8080
<div>
81-
<h1>TELL US YOUR STORY</h1>
81+
<h1 data-cy='dashboard-heading'>TELL US YOUR STORY</h1>
8282
<h2 className='subheader'>
8383
Share with us how you use our products, relate to other users'
8484
stories, vote them up, and we'll make sure we deliver cohesive

0 commit comments

Comments
 (0)