Skip to content

Commit a289849

Browse files
committed
add data-cy for home page fully load test
1 parent 554e75c commit a289849

File tree

2 files changed

+25
-2
lines changed

2 files changed

+25
-2
lines changed

cypress/e2e/home.cy.js

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,4 +43,27 @@ describe('Viewing Home page', () => {
4343
})
4444
})
4545
})
46-
})
46+
47+
context('home page components are loading successfully, &', () => {
48+
before(() => {
49+
featuredServices = true
50+
loading =
51+
error = false
52+
})
53+
it('should show the search bar.', () => {
54+
cy.get("[data-cy='search-bar']").should('exist').then(() => {
55+
cy.log('Search bar renders successfully.')
56+
})
57+
})
58+
it('should show the about text.', () => {
59+
cy.get('TitledTextBox[data-cy="about-us"]').should('exist').then(() => {
60+
cy.log('Abouttext renders successfully.')
61+
})
62+
})
63+
it('should show the featured services cards.', () => {
64+
cy.get("row[data-cy='item-group']").should('exist').then(() => {
65+
cy.log('Status bar renders successfully.')
66+
})
67+
})
68+
})
69+
})

pages/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ const Home = () => {
4444
/>
4545
<div className='container'>
4646
<SearchBar onSubmit={handleOnSubmit} />
47-
<TitledTextBox title={ABOUT_US_TITLE} text={ABOUT_US_TEXT} />
47+
<TitledTextBox title={ABOUT_US_TITLE} text={ABOUT_US_TEXT} data-cy='about-us'/>
4848
{isError ? (
4949
<Notice
5050
alert={configureErrors([isError])}

0 commit comments

Comments
 (0)