rightclick is native to nightwatch

pull/5370/head
filip mertens 2 years ago
parent 0e2def1a6f
commit f7691a1daf
  1. 8
      apps/remix-ide-e2e/src/commands/rightClickCustom.ts
  2. 2
      apps/remix-ide-e2e/src/tests/fileExplorer.test.ts
  3. 2
      apps/remix-ide-e2e/src/tests/plugin_api.ts
  4. 4
      apps/remix-ide-e2e/src/tests/verticalIconsPanel.test.ts
  5. 2
      apps/remix-ide-e2e/src/types/index.d.ts

@ -1,10 +1,10 @@
import EventEmitter from 'events'
import { NightwatchBrowser } from 'nightwatch'
class RightClick extends EventEmitter {
class RightClickCustom extends EventEmitter {
command (this: NightwatchBrowser, cssSelector: string) {
this.api.perform((done) => {
rightClick(this.api, cssSelector, () => {
rightClickCustom(this.api, cssSelector, () => {
done()
this.emit('complete')
})
@ -13,7 +13,7 @@ class RightClick extends EventEmitter {
}
}
function rightClick (browser: NightwatchBrowser, cssSelector: string, callback: VoidFunction) {
function rightClickCustom (browser: NightwatchBrowser, cssSelector: string, callback: VoidFunction) {
browser.execute(function (cssSelector: string) {
const element: any = document.querySelector(cssSelector)
const evt = element.ownerDocument.createEvent('MouseEvents')
@ -34,4 +34,4 @@ function rightClick (browser: NightwatchBrowser, cssSelector: string, callback:
})
}
module.exports = RightClick
module.exports = RightClickCustom

@ -66,7 +66,7 @@ module.exports = {
'Should delete Browser_E2E_Tests folder': function (browser: NightwatchBrowser) {
browser
.waitForElementVisible('*[data-id="treeViewLitreeViewItemBrowser_E2E_Tests"]')
.rightClick('[data-path="Browser_E2E_Tests"]')
.rightClickCustom('[data-path="Browser_E2E_Tests"]')
.click('*[id="menuitemdelete"]')
.waitForElementVisible('[data-id="fileSystemModalDialogModalFooter-react"] .modal-ok', 60000)
.pause(2000)

@ -214,7 +214,7 @@ module.exports = {
}
})
.waitForElementVisible('[data-id="treeViewLitreeViewItemcontracts/1_Storage.sol"]')
.rightClick('[data-id="treeViewLitreeViewItemcontracts/1_Storage.sol"]').useXpath().waitForElementVisible('//*[@id="menuitemtestcommand"]').click('//*[@id="menuitemtestcommand"]', async () => {
.rightClickCustom('[data-id="treeViewLitreeViewItemcontracts/1_Storage.sol"]').useXpath().waitForElementVisible('//*[@id="menuitemtestcommand"]').click('//*[@id="menuitemtestcommand"]', async () => {
// @ts-ignore
browser.click('//*[@data-id="verticalIconsKindlocalPlugin"]').frame(0, async () => {
await clickAndCheckLog(browser, null, { id: 'localPlugin', name: 'testCommand', label: 'testCommand', type: [], extension: ['.sol'], path: ['contracts/1_Storage.sol'], pattern: [] }, null, null)

@ -13,7 +13,7 @@ module.exports = {
.click('*[data-id="verticalIconsKindpluginManager"]')
.scrollAndClick('*[data-id="pluginManagerComponentActivateButtondebugger"]')
.waitForElementVisible('*[data-id="pluginManagerComponentDeactivateButtondebugger"]', 7000)
.rightClick('[data-id="verticalIconsKinddebugger"]')
.rightClickCustom('[data-id="verticalIconsKinddebugger"]')
.waitForElementVisible('*[id="menuitemdeactivate"]')
.waitForElementVisible('*[id="menuitemdocumentation"]')
.click('*[data-id="remixIdeIconPanel"]')
@ -23,7 +23,7 @@ module.exports = {
browser.waitForElementVisible('div[data-id="remixIdeIconPanel"]', 10000)
.waitForElementVisible('*[data-id="verticalIconsKinddebugger"]', 7000)
.pause(5000)
.rightClick('[data-id="verticalIconsKinddebugger"]')
.rightClickCustom('[data-id="verticalIconsKinddebugger"]')
.click('*[id="menuitemdeactivate"]')
.click('*[data-id="verticalIconsKindsettings"]')
.click('*[data-id="verticalIconsKindpluginManager"]')

@ -28,7 +28,7 @@ declare module 'nightwatch' {
checkElementStyle(cssSelector: string, styleProperty: string, expectedResult: string): NightwatchBrowser,
openFile(name: string): NightwatchBrowser,
renamePath(path: string, newFileName: string, renamedPath: string): NightwatchBrowser,
rightClick(cssSelector: string): NightwatchBrowser,
rightClickCustom(cssSelector: string): NightwatchBrowser,
scrollToLine(line: number): NightwatchBrowser,
waitForElementContainsText(id: string, value: string, timeout?: number): NightwatchBrowser,
getModalBody(callback: (value: string, cb: VoidFunction) => void): NightwatchBrowser,

Loading…
Cancel
Save