added copy check in code e2e test (#799)

Signed-off-by: Philip Molares <philip.molares@udo.edu>
This commit is contained in:
Philip Molares 2020-11-28 22:35:14 +01:00 committed by GitHub
parent 74fd6d0630
commit 26b420c500
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 19 deletions

View file

@ -6,7 +6,11 @@
describe('Code', () => { describe('Code', () => {
beforeEach(() => { 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') cy.get('.btn.active.btn-outline-secondary > i.fa-columns')
.should('exist') .should('exist')
cy.get('.CodeMirror textarea') cy.get('.CodeMirror textarea')
@ -87,9 +91,6 @@ describe('Code', () => {
cy.get('.markdown-body > pre > div > button > i') cy.get('.markdown-body > pre > div > button > i')
.should('have.class', 'fa-files-o') .should('have.class', 'fa-files-o')
.click() .click()
// This line can be activated if cypress supports copy to clipboard in firefox, too. cy.get('@copy').should('be.calledWithExactly', 'let x = 0\n');
// Please run `yarn add --dev clipboardy`
// uncomment cypress plugin
// cy.task('getClipboard').should('contain', 'let x = 0\n');
}) })
}) })

View file

@ -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();
}
});
};