Skip to content

Commit

Permalink
fix(cy): Disable spell checking in the browser
Browse files Browse the repository at this point in the history
Signed-off-by: Max <[email protected]>
  • Loading branch information
max-nextcloud committed Feb 12, 2025
1 parent 404e5b7 commit 8724551
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 3 deletions.
18 changes: 18 additions & 0 deletions cypress.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,24 @@ export default defineConfig({
cypressSplit(on, config)
configureVisualRegression(on)

// Disable spell checking to prevent rendering differences
on('before:browser:launch', (browser, launchOptions) => {
if (browser.family === 'chromium' && browser.name !== 'electron') {
launchOptions.preferences.default['browser.enable_spellchecking'] = false
return launchOptions
}

if (browser.family === 'firefox') {
launchOptions.preferences['layout.spellcheckDefault'] = 0
return launchOptions
}

if (browser.name === 'electron') {
launchOptions.preferences.spellcheck = false
return launchOptions
}
})

return config
},

Expand Down
4 changes: 2 additions & 2 deletions cypress/e2e/print.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ describe('Open print.md and compare print view', function() {
.get('h1:not(.hidden-visually)').should('contain', 'Print test')
.should('be.visible')

cy.compareSnapshot('print view in viewer', { capture: 'fullPage' })
cy.compareSnapshot('print view in viewer')
cy.setCssMedia('screen')
})

Expand All @@ -45,7 +45,7 @@ describe('Open print.md and compare print view', function() {
.get('h1:not(.hidden-visually)').should('contain', 'Print test')
.should('be.visible')

cy.compareSnapshot('print view in single-file share', { capture: 'fullPage' })
cy.compareSnapshot('print view in single-file share')
cy.setCssMedia('screen')
})
})
Expand Down
2 changes: 1 addition & 1 deletion cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { addCompareSnapshotCommand } from 'cypress-visual-regression/dist/comman
// eslint-disable-next-line no-unused-vars,n/no-extraneous-import
import regeneratorRuntime from 'regenerator-runtime'

addCompareSnapshotCommand()
addCompareSnapshotCommand({ capture: 'fullPage' })

const url = Cypress.config('baseUrl').replace(/\/index.php\/?$/g, '')
Cypress.env('baseUrl', url)
Expand Down

0 comments on commit 8724551

Please sign in to comment.