Skip to content

Commit

Permalink
cypress: Replace obsolete Cypress.Cookies.preserveOnce
Browse files Browse the repository at this point in the history
  • Loading branch information
mamedin committed Sep 28, 2023
1 parent 83e7bfd commit ed01b64
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,10 @@ jobs:
sudo rm -f /etc/nginx/sites-enabled/default
sudo nginx -t
sudo systemctl restart nginx
- name: Create and set permissions /home/runner/work/atom/atom/cypress/screenshots
- name: Create writable Cypress videos and screenshots dirs
run: |
sudo mkdir /home/runner/work/atom/atom/cypress/screenshots
sudo chmod a=rwx /home/runner/work/atom/atom/cypress/screenshots
sudo mkdir -p ${{ github.workspace }}/cypress/screenshots ${{ github.workspace }}/cypress/videos
sudo chmod a=rwx ${{ github.workspace }}/cypress/screenshots ${{ github.workspace }}/cypress/videos
- name: Run tests
env:
BROWSER: ${{ matrix.browser }}
Expand Down
19 changes: 14 additions & 5 deletions cypress/e2e/finding_aid.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,21 +24,30 @@ describe(
})
})


beforeEach(() => {
// Preserve authentication cookies between tests
cy.getCookies().then((cookies) => {
const cookiesToPreserve = ['atom_authenticated', 'symfony'];
const preservePromises = [];

cookiesToPreserve.forEach((cookieName) => {
const cookie = cookies.find((c) => c.name === cookieName);
if (cookie) {
cy.setCookie(cookie.name, cookie.value, {
// Add any additional options if needed
// For example, { domain: 'example.com' }
});
preservePromises.push(
cy.setCookie(cookie.name, cookie.value, {
// Add any additional options if needed
// For example, { domain: 'example.com' }
})
);
}
});

// Wait for all setCookie promises to complete before proceeding
return Promise.all(preservePromises);
});
})
});


it('Disables finding aids', () => {
cy.visit('settings/findingAid')
Expand Down

0 comments on commit ed01b64

Please sign in to comment.