parent
4b4e1c7229
commit
8d164e7860
@ -0,0 +1,15 @@ |
||||
import { NightwatchBrowser } from "nightwatch" |
||||
|
||||
const EventEmitter = require('events') |
||||
|
||||
class ClickLaunchIcon extends EventEmitter { |
||||
command (this: NightwatchBrowser, icon: string) { |
||||
this.api.waitForElementVisible('#icon-panel div[plugin="' + icon + '"]').click('#icon-panel div[plugin="' + icon + '"]').perform((done: CallableFunction) => { |
||||
done() |
||||
this.emit('complete') |
||||
}) |
||||
return this |
||||
} |
||||
} |
||||
|
||||
module.exports = ClickLaunchIcon |
@ -0,0 +1,38 @@ |
||||
import { NightwatchBrowser } from "nightwatch" |
||||
|
||||
require('dotenv').config() |
||||
|
||||
module.exports = function (browser: NightwatchBrowser, callback: CallableFunction, url: string, preloadPlugins = true) { |
||||
browser |
||||
.url(url || 'http://127.0.0.1:8080') |
||||
.pause(5000) |
||||
.switchBrowserTab(0) |
||||
.injectScript('test-browser/helpers/applytestmode.js', function () { |
||||
browser.fullscreenWindow(() => { |
||||
if (preloadPlugins) { |
||||
console.log('preloadPlugins: ', preloadPlugins) |
||||
initModules(browser, () => { |
||||
browser.clickLaunchIcon('solidity') |
||||
.waitForElementPresent('[for="autoCompile"]') |
||||
.click('[for="autoCompile"]') |
||||
}) |
||||
} |
||||
}) |
||||
}) |
||||
.perform(() => { |
||||
callback() |
||||
}) |
||||
} |
||||
|
||||
function initModules (browser, callback) { |
||||
browser.pause(5000) |
||||
.click('[data-id="verticalIconsKindpluginManager"]') |
||||
.scrollAndClick('[data-id="pluginManagerComponentActivateButtonsolidityStaticAnalysis"]') |
||||
.scrollAndClick('[data-id="pluginManagerComponentActivateButtondebugger"]') |
||||
.scrollAndClick('[data-id="verticalIconsKindfileExplorers"]') |
||||
.clickLaunchIcon('settings') |
||||
.setValue('[data-id="settingsTabGistAccessToken"]', process.env.gist_token) |
||||
.click('[data-id="settingsTabSaveGistToken"]') |
||||
.click('[data-id="settingsTabThemeFlatly"]') // e2e tests were initially developed with Flatly. Some tests are failing with the default one (Dark), because the dark theme put uppercase everywhere.
|
||||
.perform(() => { callback() }) |
||||
} |
@ -0,0 +1,15 @@ |
||||
// Merge custom command types with nightwatch types
|
||||
|
||||
import { NightwatchBrowser, NightwatchAPI, NightwatchBrowser, NightwatchBrowser } from "nightwatch"; |
||||
|
||||
declare module "nightwatch" { |
||||
export interface NightwatchCustomCommands { |
||||
clickLaunchIcon(this: NightwatchBrowser, icon: string), |
||||
switchBrowserTab(this: NightwatchBrowser, index: number) |
||||
} |
||||
|
||||
export interface NightwatchBrowser { |
||||
api: NightwatchAPI, |
||||
emit: (status: string) => void |
||||
} |
||||
} |
@ -1,7 +1,7 @@ |
||||
{ |
||||
"extends": "../../tsconfig.json", |
||||
"compilerOptions": { |
||||
"types": ["node"] |
||||
"types": ["node", "nightwatch"] |
||||
}, |
||||
"include": ["**/*.ts", "**/*.js"] |
||||
} |
||||
|
Loading…
Reference in new issue