Merge branch 'clipboard' of https://github.com/ethereum/remix-project into newFEdesktop

LianaHus-patch-7
bunsenstraat 11 months ago
commit 5354236e39
  1. 2
      .circleci/config.yml
  2. 22
      apps/remix-ide-e2e/src/commands/enableClipBoard.ts
  3. 0
      apps/remix-ide-e2e/src/commands/getClipBoardContent.ts
  4. 2
      apps/remix-ide-e2e/src/helpers/init.ts
  5. 50
      apps/remix-ide-e2e/src/tests/clipboard.test.ts
  6. 1
      apps/remix-ide-e2e/src/types/index.d.ts
  7. 1177
      apps/remix-ide/src/assets/list.json

@ -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
win: circleci/windows@5.0

@ -0,0 +1,22 @@
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')
}
this.emit('complete')
return this
}
}
module.exports = EnableClipBoard

@ -22,8 +22,8 @@ export default function (browser: NightwatchBrowser, callback: VoidFunction, url
.perform(done())
})
.verifyLoad()
.enableClipBoard()
.perform((done) => {
//if (hideToolTips) {
browser.execute(function () { // hide tooltips
function addStyle(styleString) {
const style = document.createElement('style');

@ -0,0 +1,50 @@
'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 text with JS chrome only #flaky #group1': function (browser: NightwatchBrowser) {
const textToCopyPaste = 'text to copy paste'
if (browser.isChrome()) {
browser.executeAsyncScript(function (txt, done) {
navigator.clipboard.writeText(txt).then(function () {
navigator.clipboard.readText().then(function (text) {
console.log('Pasted content: ', text)
done(text)
}).catch(function (err) {
console.error('Failed to read clipboard contents: ', err)
done()
})
}).catch(function (err) {
console.error('Failed to write to clipboard: ', err)
done()
})
}, [textToCopyPaste], function (result) {
console.log(result.value)
browser.assert.ok((result as any).value === textToCopyPaste)
})
}
},
'Should copy file name': function (browser: NightwatchBrowser) {
browser
.clickLaunchIcon('filePanel')
.waitForElementVisible('li[data-id="treeViewLitreeViewItemREADME.txt"]')
.rightClick('li[data-id="treeViewLitreeViewItemREADME.txt"]')
.waitForElementPresent('[data-id="context_menuitem_copyFileName"]')
.click('[data-id="context_menuitem_copyFileName"]')
.click('*[data-id="fileExplorerNewFilecreateNewFile"]')
.pause(1000)
.waitForElementVisible('*[data-id$="/blank"]')
.sendKeys('*[data-id$="/blank"]', browser.Keys.CONTROL + 'v')
.pause(1000)
.sendKeys('*[data-id$="/blank"]', browser.Keys.ENTER)
.pause()
.waitForElementVisible('*[data-id="treeViewLitreeViewItem5_New_contract.sol"]', 7000)
.pause()
}
}

@ -71,6 +71,7 @@ declare module 'nightwatch' {
connectToExternalHttpProvider: (url: string, identifier: string) => NightwatchBrowser
waitForElementNotContainsText: (id: string, value: string, timeout: number = 10000) => NightwatchBrowser
hideToolTips: (this: NightwatchBrowser) => NightwatchBrowser
enableClipBoard: () => NightwatchBrowser
}
export interface NightwatchBrowser {

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save