From 7aa26947337b36d1bd1f8e8c57bc45f1655a76b1 Mon Sep 17 00:00:00 2001 From: filip mertens Date: Fri, 5 Jan 2024 06:53:47 +0100 Subject: [PATCH] clipboard --- .circleci/config.yml | 2 +- .../src/commands/enableClipBoard.ts | 21 +++++++++++++++++++ apps/remix-ide-e2e/src/helpers/init.ts | 1 + .../remix-ide-e2e/src/tests/clipboard.test.ts | 13 ++++++++++++ 4 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 apps/remix-ide-e2e/src/commands/enableClipBoard.ts create mode 100644 apps/remix-ide-e2e/src/tests/clipboard.test.ts diff --git a/.circleci/config.yml b/.circleci/config.yml index 7f101ed684..528e9484e4 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -3,7 +3,7 @@ version: 2.1 parameters: run_flaky_tests: type: boolean - default: false + default: true orbs: browser-tools: circleci/browser-tools@1.4.4 jobs: diff --git a/apps/remix-ide-e2e/src/commands/enableClipBoard.ts b/apps/remix-ide-e2e/src/commands/enableClipBoard.ts new file mode 100644 index 0000000000..aef88fdd7d --- /dev/null +++ b/apps/remix-ide-e2e/src/commands/enableClipBoard.ts @@ -0,0 +1,21 @@ +import { NightwatchBrowser } from 'nightwatch' +import EventEmitter from 'events' + +class EnableClipBoard extends EventEmitter { + command (this: NightwatchBrowser, remember:boolean, accept: boolean): NightwatchBrowser { + const browser = this.api + if(browser.isChrome()){ + const chromeBrowser = (browser as any).chrome + chromeBrowser.setPermission('clipboard-read', 'granted') + chromeBrowser.setPermission('clipboard-write', 'granted') + } + if(browser.isFirefox()){ + const firefoxBrowser = (browser as any).firefox + console.log('ff', firefoxBrowser) + //firefoxBrowser.setPreference('devtools.inspector.clipboardSource.allowedOrigins', 'http://localhost:8080') + } + return this + } +} + +module.exports = EnableClipBoard diff --git a/apps/remix-ide-e2e/src/helpers/init.ts b/apps/remix-ide-e2e/src/helpers/init.ts index 8e0a93b450..657c26a450 100644 --- a/apps/remix-ide-e2e/src/helpers/init.ts +++ b/apps/remix-ide-e2e/src/helpers/init.ts @@ -24,6 +24,7 @@ export default function (browser: NightwatchBrowser, callback: VoidFunction, url .perform(done()) }) .verifyLoad() + .perform(() => { if (hideToolTips) { browser.execute(function () { // hide tooltips diff --git a/apps/remix-ide-e2e/src/tests/clipboard.test.ts b/apps/remix-ide-e2e/src/tests/clipboard.test.ts new file mode 100644 index 0000000000..0c16e50f25 --- /dev/null +++ b/apps/remix-ide-e2e/src/tests/clipboard.test.ts @@ -0,0 +1,13 @@ +'use strict' +import { NightwatchBrowser } from 'nightwatch' +import init from '../helpers/init' + +module.exports = { + '@disabled': true, + before: function (browser: NightwatchBrowser, done: VoidFunction) { + init(browser, done) + }, + 'Should copy paste a file #flaky #group1': function (browser: NightwatchBrowser) { + + }, +} \ No newline at end of file