Skip to content

Commit

Permalink
Update end-to-end dependencies and workflow, refactor upload specs (#…
Browse files Browse the repository at this point in the history
…3071)

* debug regression workflow

* wrong env var setting

* update cypress-related deps

* turn debug off

* set node version

* no more retry

* browser

* fully test on node 20

* info-box timeout

* disable leading underscore stylelint check

---------

Co-authored-by: Tim Ballard <[email protected]>
  • Loading branch information
danswick and timoballard authored Jan 4, 2024
1 parent a1c2845 commit 917bc27
Show file tree
Hide file tree
Showing 5 changed files with 788 additions and 558 deletions.
18 changes: 10 additions & 8 deletions .github/workflows/regression-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,23 +38,25 @@ jobs:
CYPRESS_LOGIN_TEST_OTP_SECRET_AUDITEE: ${{ secrets.CYPRESS_LOGIN_TEST_OTP_SECRET_AUDITEE }}
DISABLE_AUTH: False
# useful for debugging but otherwise complete overwhelm
# DEBUG: cypress:*
# DEBUG: cypress:server:util:process_profiler
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20

- name: Create .env file
run: touch .env

- name: Run Cypress full submission test
uses: Wandalen/wretry.action@master
uses: cypress-io/github-action@v6
with:
action: cypress-io/github-action@v6
with: |
working-directory: ./backend
spec: cypress/e2e/full-submission.cy.js
attempt_limit: 5
attempt_delay: 2000
browser: chrome
working-directory: ./backend
spec: cypress/e2e/full-submission.cy.js

- uses: actions/upload-artifact@v3
# add the line below to store screenshots only on failures
Expand Down
4 changes: 3 additions & 1 deletion backend/.stylelintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
"selector-class-pattern": null,
"no-descending-specificity": null,
"function-no-unknown": null,
"media-feature-range-notation": "prefix"
"media-feature-range-notation": "prefix",
"scss/at-import-no-partial-leading-underscore": null,
"scss/load-no-partial-leading-underscore": null
}
}
21 changes: 11 additions & 10 deletions backend/cypress/support/workbook-uploads.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,20 @@
// testWorkbookUpload('/audit/excel/federal-awards-expended/*', '#file-input-federal-awards-xlsx', 'federal-awards-expended-UPDATE.xlsx')
// assumes you are on the appropriate upload page already
function testWorkbookUpload(interceptUrl, uploadSelector, filename, will_intercept = true) {
cy.intercept(interceptUrl + '*', (req) => {
if (will_intercept) {
// return a success fixture
req.reply({ fixture: 'success-res.json' });
} else {
// with no intercept, don't intervene
req.continue();
}
if (will_intercept) {
cy.intercept('POST', interceptUrl + '*', (req) => {
req.reply({ fixture: 'success-res.json' });
}).as('uploadSuccess');
} else {
cy.intercept('POST', interceptUrl + '*').as('uploadSuccess');
}

cy.get(uploadSelector).attachFile(filename);
// Upload url (POST /audit/excel/workbookname) returns a redirect to "/" on successful upload. So, 302.
cy.wait('@uploadSuccess').its('response.statusCode').should('eq', 302);
cy.get('#info_box')
cy.wait('@uploadSuccess').should(({request, response}) => {
expect(response.statusCode, 'Response status code').to.equal(302);
});
cy.get('#info_box', { timeout: 10000 })
.should(
'have.text',
'File successfully validated! Your work has been saved.'
Expand Down
Loading

0 comments on commit 917bc27

Please sign in to comment.