Skip to content

Commit c70acef

Browse files
authored
Jgasiorek cypress test medicaid only gh test (#2)
* start action * waiton * screenshot * try with other browser * enable video * trigger click * run dev * debug * enable logging * try this command * try this * use this for pa11y * no need to build several times
1 parent dbacdef commit c70acef

File tree

5 files changed

+381
-19
lines changed

5 files changed

+381
-19
lines changed

Diff for: .github/workflows/build.yml

+17-7
Original file line numberDiff line numberDiff line change
@@ -90,11 +90,21 @@ jobs:
9090
# const coverageFilePath = process.env['COVERAGE_FILE_PATH']
9191
# const prNumber = process.env['PR_NUMBER']
9292
# script({github, context, mainWorkflowRunSha, coverageFilePath, prNumber})
93-
# - name: Cypress testing
94-
# uses: cypress-io/github-action@v6
95-
# with:
96-
# build: npm run build
97-
# start: npm run start
98-
# browser: chrome
93+
- name: Cypress testing
94+
run: npm run e2e:headless
95+
- name: Upload Screenshots
96+
if: always()
97+
uses: actions/upload-artifact@v4
98+
with:
99+
name: cypress-screenshots
100+
path: cypress/screenshots
101+
if-no-files-found: ignore
102+
- name: Upload Videos
103+
if: always()
104+
uses: actions/upload-artifact@v4
105+
with:
106+
name: cypress-videos
107+
path: cypress/videos
108+
if-no-files-found: ignore
99109
- name: Pa11y testing
100-
run: npm run dev & sleep 5; npm run pa11y-ci
110+
run: npm run pa11y-ci

Diff for: cypress.config.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
import { defineConfig } from "cypress";
22

33
export default defineConfig({
4+
video: true,
5+
includeShadowDom: true,
46
e2e: {
7+
baseUrl: 'http://localhost:3000',
58
setupNodeEvents(on, config) {
6-
// implement node event listeners here
79
},
810
},
911
});

Diff for: cypress/e2e/spec.cy.ts

+10-7
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
describe('Flow Tests', () => {
22
it('Shows the landing page', () => {
3-
cy.visit('http://localhost:3000')
3+
cy.visit('/')
4+
cy.get('[data-testid=get_started_button]').click()
45
})
56

67
it('Navigates through the Medicaid only flow', () => {
@@ -11,17 +12,19 @@ describe('Flow Tests', () => {
1112
const expenseDate = '09/04/2024'
1213
const expenseAmount = '33'
1314
const username = 'Jane Doe'
14-
15+
cy.visit('/')
16+
1517
// Landing Page
16-
cy.visit('http://localhost:3000')
18+
cy.get('button').contains('Get Started').should('exist')
19+
cy.get('[data-testid=get_started_button]').should('exist')
1720
cy.get('[data-testid=get_started_button]').click()
1821

1922
// How This Works
2023
cy.url().should('include', '/introduction/how-this-works')
2124
cy.contains("Lorem ipsum").not('be.visible')
22-
cy.get('[data-testid=accordionButton_what_is_self_employment]').click()
25+
cy.get('[data-testid=accordionButton_what_is_self_employment]').trigger("click")
2326
cy.contains("Lorem ipsum").should('be.visible')
24-
cy.get('[data-testid=get_started_button]').click()
27+
cy.get('[data-testid=get_started_button]').trigger("click")
2528

2629
// Benefits page
2730
cy.url().should('include', '/introduction/benefits')
@@ -31,9 +34,9 @@ describe('Flow Tests', () => {
3134
// Ledger landing
3235
cy.url().should('include', '/ledger/income')
3336
cy.get('[data-testid=accordionItem_income_landing_what_counts]').not('be.visible')
34-
cy.get('[data-testid=accordionButton_income_landing_what_counts').click()
37+
cy.get('[data-testid=accordionButton_income_landing_what_counts').trigger("click")
3538
cy.get('[data-testid=accordionItem_income_landing_what_counts]').should('be.visible')
36-
cy.get('[data-testid=add_income_button').click()
39+
cy.get('[data-testid=add_income_button').trigger("click")
3740

3841
// Ledger add page
3942
cy.url().should('include', '/ledger/income/add')

0 commit comments

Comments
 (0)