Skip to content

Commit

Permalink
bypass uncaught exceptions during login
Browse files Browse the repository at this point in the history
  • Loading branch information
schiwaa committed Feb 11, 2025
1 parent f5a582a commit 29d3049
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
11 changes: 10 additions & 1 deletion frontend-e2e/cypress/e2e/experimental.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,14 @@ describe('login and logout with authentication modal, captcha v3 and fetch(POST)

cy.log('LOGIN:')
cy.log("Cypress.browser.isHeaded? " + Cypress.browser.isHeaded);
if (Cypress.browser.isHeadless){
// Sign-in with google recaptcha v3 in headless mode --> "TypeError: Cannot read properties of null (reading 'message')"
Cypress.on('uncaught:exception', (err) => {
if (err.message.includes('Cannot read properties of null')) {
return false
}
})
}
cy.contains('header a', 'Sign in').click();
cy.get('#loginEmail').wait(500).type(admin.username, { delay: 50 });
cy.get('#loginPassword').wait(500).type(admin.password, { delay: 50 });
Expand All @@ -39,7 +47,8 @@ describe('login and logout with authentication modal, captcha v3 and fetch(POST)

// some fetch(POST) for headless mode
describe('addStemma and deleteStemma with login, passes in headless mode despite fetch(POST)', () => {
it('passes in headless mode local and on github. passes in local headed mode. with original guest config', {}, () => {
// it('passes in headless mode local and on github. passes in local headed mode. with original guest config', { retries: 5 }, () => {
it('passes in headless mode local and on github. passes in local headed mode. with original guest config', () => {
cy.loginViaUi(admin);
const tradition = test_traditions.find(trad => trad.title.startsWith('John verse'));
cy.log('tradition.title: ' + tradition.title);
Expand Down
8 changes: 8 additions & 0 deletions frontend-e2e/cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,14 @@

// Login via user interface
Cypress.Commands.add('loginViaUi', (userObj) => {
if (Cypress.browser.isHeadless){
// Sign-in with google recaptcha v3 in headless mode --> "TypeError: Cannot read properties of null (reading 'message')"
Cypress.on('uncaught:exception', (err) => {
if (err.message.includes('Cannot read properties of null')) {
return false
}
})
}
cy.log("Cypress.browser.isHeaded? " + Cypress.browser.isHeaded);
cy.contains('header a', 'Sign in').click();
cy.get('#loginEmail').wait(500).type(userObj.username, { delay: 50 });
Expand Down

0 comments on commit 29d3049

Please sign in to comment.