add comands

clipboard
bunsenstraat 11 months ago
parent 7aa2694733
commit f7c2fd4eac
  1. 1
      apps/remix-ide-e2e/src/commands/enableClipBoard.ts
  2. 0
      apps/remix-ide-e2e/src/commands/getClipBoardContent.ts
  3. 2
      apps/remix-ide-e2e/src/helpers/init.ts
  4. 41
      apps/remix-ide-e2e/src/tests/clipboard.test.ts
  5. 1
      apps/remix-ide-e2e/src/types/index.d.ts
  6. 1177
      apps/remix-ide/src/assets/list.json

@ -14,6 +14,7 @@ class EnableClipBoard extends EventEmitter {
console.log('ff', firefoxBrowser) console.log('ff', firefoxBrowser)
//firefoxBrowser.setPreference('devtools.inspector.clipboardSource.allowedOrigins', 'http://localhost:8080') //firefoxBrowser.setPreference('devtools.inspector.clipboardSource.allowedOrigins', 'http://localhost:8080')
} }
this.emit('complete')
return this return this
} }
} }

@ -24,7 +24,7 @@ export default function (browser: NightwatchBrowser, callback: VoidFunction, url
.perform(done()) .perform(done())
}) })
.verifyLoad() .verifyLoad()
.enableClipBoard()
.perform(() => { .perform(() => {
if (hideToolTips) { if (hideToolTips) {
browser.execute(function () { // hide tooltips browser.execute(function () { // hide tooltips

@ -7,7 +7,44 @@ module.exports = {
before: function (browser: NightwatchBrowser, done: VoidFunction) { before: function (browser: NightwatchBrowser, done: VoidFunction) {
init(browser, done) init(browser, done)
}, },
'Should copy paste a file #flaky #group1': function (browser: NightwatchBrowser) { '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()
}
} }

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

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