Skip to content

Commit

Permalink
Merge branch 'cucumber' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthew Mulholland committed Feb 28, 2018
2 parents dcf64a2 + 8689133 commit bfba403
Show file tree
Hide file tree
Showing 27 changed files with 1,050 additions and 117 deletions.
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,11 @@ yarn-error.log
test/temp/
test/unit/coverage/
.eslintrc
coverage/
src/renderer/data
.nyc_output/
cucumber_report.html
cucumber_report.json
test/cucumber_report.html
test/cucumber_report.json
lib/
14 changes: 14 additions & 0 deletions .nycrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"sourceMap": false,
"instrument": false,
"reporter": [
"lcov",
"text"
],
"include": [
"**/*.js"
],
"exclude" : [
"node_modules"
]
}
3 changes: 3 additions & 0 deletions .yarnclean
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ doc
website
images
!istanbul/lib/assets
!babel-istanbul/lib/assets
!istanbul-reports/lib/html/assets
!nyc/node_modules/istanbul-reports/lib/html/assets
assets
!karma/static
static
Expand Down
1 change: 0 additions & 1 deletion data-curator

This file was deleted.

19 changes: 15 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,11 @@
"test-main": "mocha-webpack --webpack-config .electron-vue/webpack.test.config.js --glob *_spec.js test/main/specs",
"test": "yarn run unit && yarn run e2e",
"unit": "karma start test/unit/karma.conf.js",
"e2e": "yarn run pack && mocha test/e2e"
"e2e": "yarn run pack && yarn run cucumber:postpack; yarn run cucumber:report",
"e2e:dev": "yarn run cucumber:postpack:dev; yarn run cucumber:report",
"cucumber:postpack:dev": "cross-env BABEL_ENV=test nyc cucumber-js --require-module babel-core/register --tags @latest test/features -f json:test/cucumber_report.json",
"cucumber:postpack": "cross-env BABEL_ENV=test nyc cucumber-js --require-module babel-core/register --tags @impl test/features -f json:test/cucumber_report.json",
"cucumber:report": "node test/cucumber-report.js"
},
"build": {
"productName": "DataCurator",
Expand Down Expand Up @@ -78,7 +82,7 @@
"datapackage": "^1.0.5",
"escape-regexp": "^0.0.1",
"etl": "^0.5.8",
"fs-extra": "^5.0.0",
"fs-extra": "~5.0.0",
"handsontable": "^0.34.5",
"imports-loader": "^0.7.1",
"lodash": "^4.17.4",
Expand All @@ -90,6 +94,7 @@
"rxjs": "^5.5.2",
"slug": "^0.9.1",
"sortablejs": "^1.6.0",
"spectron-fake-dialog": "^0.0.1",
"svgo": "^1.0.0",
"tableschema": "^1.7.0",
"temp": "^0.8.3",
Expand All @@ -110,19 +115,22 @@
"babel-core": "^6.22.1",
"babel-eslint": "^8.0.1",
"babel-loader": "^7.0.0",
"babel-plugin-istanbul": "^4.1.1",
"babel-plugin-istanbul": "^4.1.5",
"babel-plugin-transform-runtime": "^6.22.0",
"babel-polyfill": "^6.26.0",
"babel-preset-env": "^1.6.1",
"babel-preset-stage-0": "^6.5.0",
"babel-register": "^6.2.0",
"babel-register": "^6.26.0",
"babili-webpack-plugin": "^0.1.1",
"cfonts": "^1.1.3",
"chai": "^4.0.0",
"chai-as-promised": "^7.1.1",
"chalk": "^2.3.0",
"copy-webpack-plugin": "^4.2.0",
"cross-env": "^5.0.0",
"css-loader": "^0.28.4",
"cucumber": "^4.0.0",
"cucumber-html-reporter": "^4.0.1",
"del": "^3.0.0",
"devtron": "^1.1.0",
"electron": "^1.7.11",
Expand Down Expand Up @@ -155,13 +163,16 @@
"karma-webpack": "^2.0.5",
"mocha": "^3.0.2",
"mocha-webpack": "^1.0.1",
"multispinner": "^0.2.1",
"node-gyp": "^3.6.2",
"node-loader": "^0.6.0",
"nyc": "^11.4.1",
"require-dir": "^0.3.0",
"sinon": "^4.0.2",
"sinon-chai": "^2.14.0",
"sinon-test": "^2.1.2",
"spectron": "^3.7.1",
"spectron-fake-menu": "^0.0.1",
"style-loader": "^0.18.1",
"stylus": "^0.54.5",
"stylus-loader": "^3.0.1",
Expand Down
3 changes: 3 additions & 0 deletions src/main/file.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,9 @@ function openFile(format) {
Dialog.showOpenDialog({
filters: format.filters
}, function(filenames) {
if (process.env.BABEL_ENV === 'test') {
global.openFileDialogReturned = filenames
}
if (filenames === undefined || filenames.length === 0) {
return
}
Expand Down
36 changes: 36 additions & 0 deletions src/main/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,3 +163,39 @@ export function quitOrSaveDialog(event, endButtonName, callback) {
}
})
}

export function testMenu() {
clickLabelsOnMenu()
}

ipc.on('clickLabelsOnMenu', async function(event, arg) {
let returned = await promiseClickLabelsOnMenu()
event.returnValue = returned
// menu = subMenu
// }
})

function promiseClickLabelsOnMenu() {
return new Promise((resolve, reject) => {
// There is a short render wait in home page, so if hotId not first returned, just wait and try again
resolve(clickLabelsOnMenu())
})
}

function clickLabelsOnMenu() {
// console.log(arg) // prints "ping"
// console.log('args are')
// console.log(args)
// let menuLabel = args.shift()
let menu = Menu.getApplicationMenu().items.find(x => x.label === 'File')
// console.log(menu.submenu.items)
menu.click()
// for (subMenuLabel of args) {
let subMenu = menu.submenu.items.find(x => x.label === 'Open')
// console.log(subMenu.submenu.items)
subMenu.click()
let subSubMenu = subMenu.submenu.items.find(x => x.label.startsWith('Comma'))
// console.log(subSubMenu)
subSubMenu.click()
return subSubMenu.label
}
13 changes: 10 additions & 3 deletions src/renderer/components/Home.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<!-- <a href="#"> -->
<i v-if="menu.icon" class="fa" :class="menu.icon" aria-hidden="true" />
<object v-if="menu.image" :class="menu.class" :data="menu.image" type="image/svg+xml" />
<div class="toolbar-text">{{menu.name}}</div>
<div :id="menu.id" class="toolbar-text">{{menu.name}}</div>
</a>
<component :is="menu.tooltipView" />
</li>
Expand Down Expand Up @@ -88,13 +88,13 @@
</ul>
<h3>{{messagesTitle}}</h3>
<template v-if="messagesType === 'error'">
<div v-for="errorMessage in messages">
<div :id="'error-messages' + index" v-for="(errorMessage, index) in messages" :key="index">
<span v-show="errorMessage.rowNumber">(row:{{errorMessage.rowNumber}})</span>
<span v-show="errorMessage.columnNumber">(column:{{errorMessage.columnNumber}})</span>
<span>{{errorMessage.message}}</span>
</div>
</template>
<div v-else>
<div id="error-message" v-else>
<span>{{messages}}</span>
</div>
</div>
Expand Down Expand Up @@ -181,12 +181,14 @@ export default {
sideNavFormHeight: '300px',
toolbarMenus: [{
name: 'Guess',
id: 'guess-column-properties',
image: 'static/img/guess-column-properties.svg',
tooltipId: 'tooltip-guess',
tooltipView: 'tooltipGuess'
},
{
name: 'Column',
id: 'column-properties',
image: 'static/img/column-properties.svg',
tooltipId: 'tooltip-column',
tooltipView: 'tooltipColumn',
Expand All @@ -195,6 +197,7 @@ export default {
},
{
name: 'Table',
id: 'table-properties',
image: 'static/img/table-properties.svg',
tooltipId: 'tooltip-table',
tooltipView: 'tooltipTable',
Expand All @@ -203,6 +206,7 @@ export default {
},
{
name: 'Provenance',
id: 'provenance-information',
image: 'static/img/provenance-information.svg',
tooltipId: 'tooltip-provenance',
tooltipView: 'tooltipProvenance',
Expand All @@ -211,6 +215,7 @@ export default {
},
{
name: 'Package',
id: 'data-package-properties',
image: 'static/img/data-package-properties.svg',
tooltipId: 'tooltip-package',
tooltipView: 'tooltipPackage',
Expand All @@ -219,12 +224,14 @@ export default {
},
{
name: 'Validate',
id: 'validate-data',
image: 'static/img/validate.svg',
tooltipId: 'tooltip-validate',
tooltipView: 'tooltipValidate'
},
{
name: 'Export',
id: 'export-package',
image: 'static/img/export.svg',
tooltipId: 'tooltip-export',
tooltipView: 'tooltipExport',
Expand Down
13 changes: 11 additions & 2 deletions src/renderer/hot.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Handsontable from 'handsontable/dist/handsontable.full.js'
import {remote} from 'electron'
import {remote, ipcRenderer as ipc} from 'electron'
import store from '@/store/modules/hots.js'
import {allTablesAllColumnsFromSchema$, allTablesAllColumnNames$} from '@/rxSubject.js'
const Dialog = remote.dialog
Expand Down Expand Up @@ -197,7 +197,7 @@ export function insertRow(offset, mathFn) {
if (typeof range !== 'undefined') {
const selection = mathFn(range.from.row, range.to.row) + offset
hot.alter('insert_row', selection)
reselectCurrentCellOrMin()
hot.selectCell(selection, 0)
}
}

Expand Down Expand Up @@ -272,6 +272,15 @@ export function removeColumns() {
reselectCurrentCellOrMin()
}

ipc.on('reselectCurrentCellOrMin', function(event, arg) {
reselectCurrentCellOrMin()
})

ipc.on('selectHotCell', function(event, rowCountNumber, ColCountNumber) {
let hot = HotRegister.getActiveInstance()
hot.selectCell(rowCountNumber - 1, ColCountNumber - 1)
})

export {
HotRegister
}
13 changes: 10 additions & 3 deletions src/renderer/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,7 @@ export function addHotContainerListeners(container) {

container.addEventListener('contextmenu', function(e) {
e.preventDefault()
menu.popup(BrowserWindow.getFocusedWindow())
// rowAbove.enabled = true
// columnLeft.enabled = true
menu.popup(BrowserWindow.getFocusedWindow(), {async: true})
}, false)
}

Expand All @@ -44,6 +42,7 @@ ipc.on('saveData', function(e, format, fileName) {
saveDataToFile(hot, format, fileName)
})

// TODO: correct once github references re-introduced
ipc.on('getCSV', function(e, format) {
let hot = HotRegister.getActiveInstance()
var data
Expand Down Expand Up @@ -88,6 +87,14 @@ ipc.on('insertRowBelow', function() {
insertRowBelow()
})

ipc.on('clickLabelOnContextMenu', function(event, arg) {
menu.items.find(x => x.label === arg).click()
})

ipc.on('closeContextMenu', function() {
menu.closePopUp(BrowserWindow.getFocusedWindow())
})

ipc.on('insertColumnLeft', function() {
insertColumnLeft()
})
Expand Down
9 changes: 0 additions & 9 deletions src/renderer/menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,4 @@ menu.append(removeCol)

export {
menu
// rowAbove
// rowBelow: rowBelow,
// columnLeft
// ,
// columnRight,
// removeRow,
// removeCol: removeCol,
// freezeRow: freezeRow,
// unfreezeRow: unfreezeRow
}
20 changes: 20 additions & 0 deletions test/cucumber-report.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
var reporter = require('cucumber-html-reporter')

var options = {
theme: 'bootstrap',
jsonFile: 'test/cucumber_report.json',
output: 'test/cucumber_report.html',
reportSuiteAsScenarios: true,
launchReport: true,
storeScreenshots: false,
metadata: {
'App Version': '0.3.2',
'Test Environment': 'STAGING',
'Browser': 'Chrome 54.0.2840.98',
'Platform': 'Windows 10',
'Parallel': 'Scenarios',
'Executed': 'Remote'
}
}

reporter.generate(options)
18 changes: 0 additions & 18 deletions test/e2e/index.js

This file was deleted.

13 changes: 0 additions & 13 deletions test/e2e/specs/Launch.spec.js

This file was deleted.

23 changes: 0 additions & 23 deletions test/e2e/utils.js

This file was deleted.

Loading

0 comments on commit bfba403

Please sign in to comment.