diff --git a/cypress/integration/code.spec.ts b/cypress/integration/code.spec.ts index 6c1bc8fea..7d37f49c9 100644 --- a/cypress/integration/code.spec.ts +++ b/cypress/integration/code.spec.ts @@ -6,7 +6,11 @@ describe('Code', () => { beforeEach(() => { - cy.visit('/n/test') + cy.visit('/n/test', { + onBeforeLoad (win: Window): void { + cy.spy(win.navigator.clipboard, 'writeText').as('copy') + } + }) cy.get('.btn.active.btn-outline-secondary > i.fa-columns') .should('exist') cy.get('.CodeMirror textarea') @@ -87,9 +91,6 @@ describe('Code', () => { cy.get('.markdown-body > pre > div > button > i') .should('have.class', 'fa-files-o') .click() - // This line can be activated if cypress supports copy to clipboard in firefox, too. - // Please run `yarn add --dev clipboardy` - // uncomment cypress plugin - // cy.task('getClipboard').should('contain', 'let x = 0\n'); + cy.get('@copy').should('be.calledWithExactly', 'let x = 0\n'); }) }) diff --git a/cypress/plugins/index.js b/cypress/plugins/index.js deleted file mode 100644 index e748a486c..000000000 --- a/cypress/plugins/index.js +++ /dev/null @@ -1,14 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2020 The HedgeDoc developers (see AUTHORS file) - * - * SPDX-License-Identifier: AGPL-3.0-only - */ - -// const clipboardy = require('clipboardy'); -module.exports = ( on ) => { - on('task', { - getClipboard () { - // return clipboardy.readSync(); - } - }); -};