Skip to content

Commit c67bebb

Browse files
committed
Updated lighthouse page object
1 parent 87faf1e commit c67bebb

File tree

2 files changed

+21
-18
lines changed

2 files changed

+21
-18
lines changed

cypress/e2e/home.cy.js

+7-18
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,22 @@ import Home_PO from "../support/pageObjects/Home_PO";
22
import Search_PO from "../support/pageObjects/Search_PO";
33
import 'cypress-axe'
44

5-
describe('Judge.Me Site', () => {
5+
describe('Judge.Me Site E2E Test', () => {
66

77
const baseUrl = 'https://judge.me/reviews';
8+
const home_po = new Home_PO();
89
const search_po = new Search_PO();
910

1011
beforeEach(() => {
11-
// visit the judge.me site before each test
1212
cy.visit(baseUrl);
1313
cy.injectAxe();
1414
});
1515

1616
// Verify Page Load
1717
it('should load the page successfully and display key elements', () => {
18-
const home_po = new Home_PO();
1918
home_po.verifyPageLoad(baseUrl)
2019
});
2120

22-
it('should have no accessibility violations', () => {
23-
cy.checkA11y();
24-
});
25-
2621
// Validate Search Functionality
2722
it('should display correct results when searching by keyword', () => {
2823
search_po.verifySearchFunctionality();
@@ -48,17 +43,11 @@ describe('Judge.Me Site', () => {
4843
search_po.validateCurrencyFilter()
4944
})
5045

46+
it('should have no accessibility violations', () => {
47+
cy.checkA11y();
48+
});
49+
5150
it('should run lighthouse performance audit', () => {
52-
const thresholds = {
53-
performance: 50,
54-
accessibility: 80,
55-
seo: 60,
56-
pwa: 50,
57-
};
58-
const lighthouseConfig = {
59-
formFactor: 'desktop',
60-
screenEmulation: { disabled: true },
61-
};
62-
cy.lighthouse(thresholds, lighthouseConfig);
51+
home_po.verifyLighthousePerformance()
6352
});
6453
});

cypress/support/pageObjects/Home_PO.js

+14
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,20 @@ class Home_PO {
1919
// validate that the footer is visible
2020
cy.get('.marketplace-footer__container--top').should('be.visible')
2121
}
22+
23+
verifyLighthousePerformance() {
24+
const thresholds = {
25+
performance: 50,
26+
accessibility: 80,
27+
seo: 60,
28+
pwa: 50,
29+
};
30+
const lighthouseConfig = {
31+
formFactor: 'desktop',
32+
screenEmulation: { disabled: true },
33+
};
34+
cy.lighthouse(thresholds, lighthouseConfig);
35+
}
2236
}
2337

2438
export default Home_PO;

0 commit comments

Comments
 (0)