Skip to content

Commit

Permalink
WIP fix cypress tests
Browse files Browse the repository at this point in the history
  • Loading branch information
pakb committed Feb 3, 2025
1 parent 120f0c4 commit ddde51c
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions packages/mapviewer/tests/cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -738,11 +738,16 @@ Cypress.Commands.add('mockupBackendResponse', mockupBackendResponse)

// Reads a value from clipboard
Cypress.Commands.add('readClipboardValue', () => {
return cy.window().then((win) => {
return win.navigator.clipboard.readText().then((t) => {
return t
})
})
// checking first that we have browser permissions to read the clipboard
cy.window()
.its('navigator.permissions')
.then((permissions) => permissions.query({ name: 'clipboard-read' }))
.its('state')
.should('eq', 'granted')
return cy
.window()
.its('navigator.clipboard')
.then((clip) => cy.wrap(clip.readText()))
})

/**
Expand Down

0 comments on commit ddde51c

Please sign in to comment.