This commit is contained in:
Xiang Zhang 2018-11-01 16:17:55 -07:00
Родитель 97065cffec
Коммит a077f19a7c
4 изменённых файлов: 120 добавлений и 19 удалений

Просмотреть файл

@ -36,10 +36,14 @@
"@types/react-dom": "^16.0.6",
"@types/react-redux": "^6.0.5",
"@types/react-select": "^2.0.6",
"@types/webdriverio": "^4.13.0",
"@types/yauzl": "^2.9.0",
"ajv": "^6.5.2",
"babel-minify": "^0.4.3",
"chai": "^4.2.0",
"chai-as-promised": "^7.1.1",
"electron": "^3.0.4",
"electron-chromedriver": "^4.0.0-beta.1",
"mocha": "^5.2.0",
"npm-font-open-sans": "^1.1.0",
"office-ui-fabric-react": "^6.40.0",

Просмотреть файл

@ -180,7 +180,7 @@ class ConvertView extends React.Component<IComponentProperties, IComponentState>
return (
<div>
<div className='DisplayFlex ModelConvertBrowser'>
<TextField placeholder='Path' value={this.state.source || this.props.file && this.props.file.path} label='Model to convert' onChanged={this.setSource} />
<TextField id='modelToConvert' placeholder='Path' value={this.state.source || this.props.file && this.props.file.path} label='Model to convert' onChanged={this.setSource} />
<DefaultButton id='ConverterModelInputBrowse' text='Browse' onClick={this.browseSource}/>
</div>
<div className='Frameworks'>

Просмотреть файл

@ -0,0 +1,81 @@
// const Application = require('spectron').Application
// const assert = require('assert')
// const electronPath = require('electron') // Require Electron from the binaries included in node_modules.
// const Path = require('path')
// describe('Application launch', function () {
// this.timeout(10000)
// var app = new Application({
// path: Path.join(process.env.LOCALAPPDATA, 'WinMLDashboard/WinMLDashboard.exe')
// })
// it("start the applition", function () {
// app.start().then(function () {
// // // Check if the window is visible
// return app.browserWindow.isVisible()
// })
// })
// it('shows an initial window', function (done) {
// return app.client.getWindowCount().then(function (count) {
// assert.equal(count, 1)
// // Please note that getWindowCount() will return 2 if `dev tools` are opened.
// // assert.equal(count, 2)
// })
// })
// it('gets the tile of application', function () {
// return app.client.getTitle().then(function (title) {
// assert.equal(title, "WinML Dashboard")
// // Please note that getWindowCount() will return 2 if `dev tools` are opened.
// // assert.equal(count, 2)
// })
// })
// })
// const Application = require('spectron').Application
// const chai = require('chai')
// const chaiAsPromised = require('chai-as-promised')
// const electronPath = require('electron')
// const Path = require('path')
// chai.should()
// chai.use(chaiAsPromised)
// describe('Application launch', function () {
// this.timeout(10000);
// beforeEach(function () {
// this.app = new Application({
// path: Path.join(process.env.LOCALAPPDATA, 'WinMLDashboard/WinMLDashboard.exe')
// })
// return this.app.start()
// })
// beforeEach(function () {
// chaiAsPromised.transferPromiseness = this.app.transferPromiseness
// })
// afterEach(function () {
// if (this.app && this.app.isRunning()) {
// return this.app.stop()
// }
// })
// describe("basic tests", function () {
// it('opens a window', function () {
// return this.app.client.waitUntilWindowLoaded()
// .getWindowCount().should.eventually.have.at.least(1)
// .browserWindow.isMinimized().should.eventually.be.false
// .browserWindow.isVisible().should.eventually.be.true
// .browserWindow.isFocused().should.eventually.be.true
// .browserWindow.getBounds().should.eventually.have.property('width').and.be.above(0)
// .browserWindow.getBounds().should.eventually.have.property('height').and.be.above(0)
// })
// it('gets the tile of application', function () {
// return app.client.getTitle().then(function (title) {
// assert.equal(title, "WinML Dashboard")
// // Please note that getWindowCount() will return 2 if `dev tools` are opened.
// // assert.equal(count, 2)
// })
// })
// })
// })

Просмотреть файл

@ -2,33 +2,37 @@
var Application = require('spectron').Application
var assert = require('assert')
var path = require('path')
const chaiAsPromised = require("chai-as-promised");
const chai = require("chai");
chai.should();
chai.use(chaiAsPromised);
var appllicationPath = process.env.LOCALAPPDATA + '\\winmldashboard\\winmldashboard.exe'
console.log(appllicationPath)
var app = new Application({
path:appllicationPath,
startTimeout: 200000,
})
describe("test-login-form", function () {
this.timeout(20000);
describe("WinMLDashboard Tests", function () {
this.timeout(200000);
// CSS selectors
// const usernameInput = 'form input[formControlName="username"]';
// const usernameError = 'form input[formControlName="username"] + div';
// const passwordInput = 'form input[formControlName="password"]';
// const passwordError = 'form input[formControlName="password"] + div';
// const submitButton = 'button*=Store';
const openModelButton = '#open-file-button';
const modelPathInput = '#open-file-dialog'
const modelPathInput = '#open-file-dialog';
const editButton = '#Pivot0-Tab0';
const convertViewButton = '#Pivot0-Tab1';
const mainView = '.MainView'
const convertView = '.ConvertView'
const convertButton = '#ConvertButton'
const modelToConvertTextFiled = '#modelToConvert'
// Start spectron
beforeEach(function () {
before(function () {
return app.start();
});
// Stop Electron
afterEach(function () {
after(function () {
if (app && app.isRunning()) {
return app.stop();
}
@ -37,15 +41,27 @@ describe("test-login-form", function () {
describe("Edit View", function () {
// wait for Electron window to open
it('opens window', function () {
return app.client.waitUntilWindowLoaded().getWindowCount().should.eventually.equal(1);
return app.client
.waitUntilWindowLoaded().getWindowCount().should.eventually.equal(1)
.get
});
// Initially, the submit button should be deactivated
it("opens a model to view", function () {
it('click open model button', function(){
return app.client
.click(openModelButton)
.hasFocus(modelPathInput)
.setValue(modelPathInput, path.join(__dirname, 'la_muse.mlmodel'))
})
it('click convertButton button', function () {
return app.client
.click(convertViewButton)
.element(mainView).element(convertView).should.eventually.exist
.element(convertButton).isEnabled().should.eventually.equal(false)
});
});
it('set model path to convert', function () {
return app.client
.setValue(modelToConvertTextFiled, 'D:\\Windows-Machine-Learning\\Tools\\WinMLDashboard\\test\\la_muse.mlmodel')
.getText(modelToConvertTextFiled).should.eventually.equal('D:\\Windows-Machine-Learning\\Tools\\WinMLDashboard\\test\\la_muse.mlmodel')
});
});
});