dgit tests plus extra assertion logging upd types

indexworkspace2
bunsenstraat 3 years ago
parent 0237bb8676
commit cb33c10cc6
  1. 25
      apps/remix-ide-e2e/src/tests/plugin_api.ts
  2. 1496
      package-lock.json
  3. 3
      package.json

@ -17,7 +17,21 @@ const localPluginData: Profile & LocationProfile & ExternalProfile = {
const getBrowserLogs = function (browser: NightwatchBrowser) { const getBrowserLogs = function (browser: NightwatchBrowser) {
browser.getLog('browser', (logEntries) => { browser.getLog('browser', (logEntries) => {
console.log(logEntries) if (logEntries && logEntries.length > 0) {
console.log('Browser log:')
console.log(logEntries)
}
})
}
const debugValues = function (browser: NightwatchBrowser, field: string, expected: string) {
browser.waitForElementVisible(`//*[@id="${field}"]`).getText(`//*[@id="${field}"]`, (result) => {
if (!result.value.toString().includes(expected)) {
console.log('Actual result:')
console.log(result.value.toString())
console.log('Expected result:')
console.log(expected)
getBrowserLogs(browser)
}
}) })
} }
@ -32,11 +46,12 @@ const clickAndCheckLog = function (browser: NightwatchBrowser, buttonText: strin
.useXpath().waitForElementVisible(`//*[@data-id='${buttonText}']`).click(`//*[@data-id='${buttonText}']`) .useXpath().waitForElementVisible(`//*[@data-id='${buttonText}']`).click(`//*[@data-id='${buttonText}']`)
.pause(2000) .pause(2000)
getBrowserLogs(browser)
if (methodResult) { if (methodResult) {
debugValues(browser, 'methods', methodResult)
browser.waitForElementVisible('//*[@id="methods"]').verify.containsText('//*[@id="methods"]', methodResult) browser.waitForElementVisible('//*[@id="methods"]').verify.containsText('//*[@id="methods"]', methodResult)
} }
if (eventResult) { if (eventResult) {
debugValues(browser, 'events', eventResult)
browser.waitForElementVisible('//*[@id="events"]').verify.containsText('//*[@id="events"]', eventResult) browser.waitForElementVisible('//*[@id="events"]').verify.containsText('//*[@id="events"]', eventResult)
} }
} }
@ -119,6 +134,12 @@ module.exports = {
clickAndCheckLog(browser, 'solidity:getCompilationResult', 'contracts/1_Storage.sol', null, null) clickAndCheckLog(browser, 'solidity:getCompilationResult', 'contracts/1_Storage.sol', null, null)
}, },
// DGIT
'Should have changes on new workspace': function (browser: NightwatchBrowser) {
clickAndCheckLog(browser, 'filePanel:createWorkspace', null, null, 'dgit')
clickAndCheckLog(browser, 'dGitProvider:status', [['README.txt', 0, 2, 0], ['contracts/1_Storage.sol', 0, 2, 0], ['contracts/2_Owner.sol', 0, 2, 0], ['contracts/3_Ballot.sol', 0, 2, 0], ['scripts/deploy_ethers.js', 0, 2, 0], ['scripts/deploy_web3.js', 0, 2, 0], ['tests/4_Ballot_test.sol', 0, 2, 0]], null, null)
},
// UNIT TESTING // UNIT TESTING
'Should activate solidityUnitTesting': function (browser: NightwatchBrowser) { 'Should activate solidityUnitTesting': function (browser: NightwatchBrowser) {
clickAndCheckLog(browser, 'manager:activatePlugin', null, null, 'solidityUnitTesting') clickAndCheckLog(browser, 'manager:activatePlugin', null, null, 'solidityUnitTesting')

1496
package-lock.json generated

File diff suppressed because it is too large Load Diff

@ -217,8 +217,7 @@
"@types/jest": "^27.0.2", "@types/jest": "^27.0.2",
"@types/lodash": "^4.14.172", "@types/lodash": "^4.14.172",
"@types/mocha": "^7.0.2", "@types/mocha": "^7.0.2",
"@types/nightwatch": "^1.1.6", "@types/nightwatch": "1.3.4",
"@types/node": "~8.9.4",
"@types/react": "^17.0.24", "@types/react": "^17.0.24",
"@types/react-beautiful-dnd": "^13.1.2", "@types/react-beautiful-dnd": "^13.1.2",
"@types/react-dom": "^17.0.9", "@types/react-dom": "^17.0.9",

Loading…
Cancel
Save