-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
3141 - fix cypress #3260
3141 - fix cypress #3260
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop #3260 +/- ##
========================================
Coverage 91.52% 91.52%
========================================
Files 297 297
Lines 8415 8415
Branches 608 608
========================================
Hits 7702 7702
Misses 603 603
Partials 110 110
Flags with carried forward coverage won't be shown. Click here to find out more. Continue to review full report in Codecov by Sentry.
|
@@ -1,38 +1,44 @@ | |||
import { When } from '@badeball/cypress-cucumber-preprocessor' | |||
|
|||
When('{string} visits the home page', (username) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can't we store the admin and user separately and use them from store as necessary, instead of deleting them?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jtimpe 🆙
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is technically what's being done already via the following calls in cypress/support/commands.js
// regular login
cy.getCookie('sessionid').its('value').as('userSessionId')
cy.getCookie('csrftoken').its('value').as('userCsrfToken')
// admin login
cy.getCookie('sessionid').its('value').as('adminSessionId')
cy.getCookie('csrftoken').its('value').as('adminCsrfToken')
this takes the value from the cookie immediately after login and stores it in the cypress intermediary variable, which lives for the test run. So the cy.clearCookie
and cy.setCookie
apply to the browser window during the test run and use the stored values.
We should do better caching of the vars so that we don't have to re-login both users before every test, but that's covered in a followup ticket #3274
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM only have a question but the solution works
confirmed with @jtimpe that this is fixing an issue on develop branch only. bypassing qasp. please feel free to merge when ready 😄 |
Summary of Changes
Pull request closes #3141
cy.visit('/')
beforeadminLogin
, so that the page is first accessed from a logged-out statecy.clearcookies()
beforecy.visit('/')
on regular-user login, so that any cookies grabbed fromadminLogin
are removedHow to Test
cypress.config.js
and make the following changescd ./tdrs-frontend npm run test:e2e
Deliverables
More details on how deliverables herein are assessed included here.
Deliverable 1: Accepted Features
Checklist of ACs:
lfrohlich
and/oradpennington
confirmed that ACs are met.Deliverable 2: Tested Code
CodeCov Report
comment in PR)CodeCov Report
comment in PR)Deliverable 3: Properly Styled Code
Deliverable 4: Accessible
iamjolly
andttran-hub
using Accessibility Insights reveal any errors introduced in this PR?Deliverable 5: Deployed
Deliverable 6: Documented
Deliverable 7: Secure
Deliverable 8: User Research
Research product(s) clearly articulate(s):