-
-
Notifications
You must be signed in to change notification settings - Fork 87
Integrate spectron (UPLOAD-440) #1360
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from 15 commits
d01c07f
229cc8d
7e12185
dedd28b
9ccaca1
c680474
43fee77
266707d
83e23d1
f12ae9c
747de4a
84fd7bb
b7fb43f
e30eefa
e90bd84
aa73bf9
6476acb
3aa1907
77c7ae5
8b2f71c
e4b92d1
d0df5d9
37b5c33
3ee3068
6b5d8b2
1ab0eec
8d07102
53b1d91
d3a74c0
869f857
0f8fa63
08a0b82
81877b4
3b92fde
123972a
fae161d
ac5aa2b
5e4f75c
82afaae
0cc20df
3c47c7b
b83d16b
a5f6f42
764cc48
f174a26
f01ad83
e959c4f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| timeout: false |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -35,6 +35,7 @@ test_script: | |||||
| - node --version | ||||||
| - yarn lint | ||||||
| - yarn test | ||||||
| - yarn run spectron-test | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| - cmd: IF /I "%ROLLBAR_POST_TOKEN%"=="" ( ECHO Missing Rollbar POST token; no package built. ) ELSE ( yarn package ) | ||||||
| # submit uploader release to antivirus vendors if tagged | ||||||
| - cmd: IF /I %APPVEYOR_REPO_TAG% == True ( yarn av-whitelist ) ELSE ( echo Not a tagged release. ) | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| { | ||
| "name": "tidepool-uploader", | ||
| "version": "2.34.0", | ||
| "version": "2.34.0-integrate-spectron.1", | ||
| "description": "Tidepool Project Universal Uploader", | ||
| "private": true, | ||
| "main": "main.prod.js", | ||
|
|
@@ -31,7 +31,8 @@ | |
| "package-win": "npm run build && electron-builder --win --x64", | ||
| "package-mac": "npm run build && electron-builder --mac", | ||
| "package-linux": "npm run build && electron-builder --linux", | ||
| "package-all": "npm run build && electron-builder -mwl" | ||
| "package-all": "npm run build && electron-builder -mwl", | ||
| "spectron-test": "yarn build && mocha -r esm" | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We've migrated from mocha to jest a while ago. I'm just wondering whether the spectron tests will work with jest, or is it only possible with mocha?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. whoops, didn't realize that, totally will work with jest, will make it so! |
||
| }, | ||
| "dependencies": { | ||
| "@hot-loader/react-dom": "16.14.0", | ||
|
|
@@ -129,6 +130,7 @@ | |
| "babel-plugin-transform-define": "2.0.0", | ||
| "babel-plugin-transform-react-remove-prop-types": "0.4.24", | ||
| "chai": "4.2.0", | ||
| "chai-as-promised": "7.1.1", | ||
| "concurrently": "5.3.0", | ||
| "cross-env": "7.0.2", | ||
| "css-loader": "3.6.0", | ||
|
|
@@ -145,8 +147,8 @@ | |
| "eslint-formatter-pretty": "3.0.1", | ||
| "eslint-import-resolver-webpack": "0.12.2", | ||
| "eslint-plugin-import": "2.22.1", | ||
| "eslint-plugin-jsx-a11y": "6.4.1", | ||
| "eslint-plugin-jest": "23.20.0", | ||
| "eslint-plugin-jsx-a11y": "6.4.1", | ||
| "eslint-plugin-lodash": "7.1.0", | ||
| "eslint-plugin-promise": "4.2.1", | ||
| "eslint-plugin-react": "7.21.5", | ||
|
|
@@ -162,6 +164,7 @@ | |
| "json-loader": "0.5.7", | ||
| "less-loader": "6.2.0", | ||
| "mini-css-extract-plugin": "0.12.0", | ||
| "mocha": "8.2.1", | ||
| "node-hid": "1.1.0", | ||
| "object-invariant-test-helper": "0.1.1", | ||
| "open": "7.3.0", | ||
|
|
@@ -175,8 +178,8 @@ | |
| "style-loader": "1.3.0", | ||
| "terser-webpack-plugin": "3.1.0", | ||
| "url-loader": "2.3.0", | ||
| "webpack-bundle-analyzer": "3.9.0", | ||
| "webpack": "4.44.2", | ||
| "webpack-bundle-analyzer": "3.9.0", | ||
| "webpack-cli": "3.3.12", | ||
| "webpack-dev-middleware": "3.7.2", | ||
| "webpack-dev-server": "3.11.0", | ||
|
|
||
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| /* eslint-disable no-undef */ | ||
| import LoginScreen from './src/LoginScreen'; | ||
| import Base from './src/Base'; | ||
| import { startApp, stopApp } from './utilities'; | ||
|
|
||
| describe('Smoke Test', () => { | ||
| let app; | ||
| before(async () => { | ||
| app = await startApp(); | ||
| }); | ||
|
|
||
|
|
||
| after(async () => { | ||
| await stopApp(app); | ||
| }); | ||
|
|
||
| it('should open', async () => { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this actually |
||
| Base.appIsOpen().should.eventually.equal(1); | ||
| }); | ||
|
|
||
| it('should see if driver modal exists', async () => { | ||
| let check = await app.client.isExisting(LoginScreen.driverDismiss); | ||
| if (check){ | ||
| await app.client.click(LoginScreen.driverDismiss); | ||
| }; | ||
| }); | ||
|
|
||
| it('should have all UI elements', async () => { | ||
| await LoginScreen.signUpLink.should.eventually.exist; | ||
| await LoginScreen.tidepoolLogo.should.eventually.exist; | ||
| await LoginScreen.uploaderLogo.getText() | ||
| .should.eventually.equal('Uploader'); | ||
| await LoginScreen.forgotPasswordLink.should.eventually.exist; | ||
| await LoginScreen.supportLink.getText() | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I remember we had an issue for a while where the support link wasn't working. Can we also add tests here to check that the URLs don't 404? |
||
| .should.eventually.equal('Get Support'); | ||
| await LoginScreen.privacyLink.getText() | ||
| .should.eventually.equal('Privacy and Terms of Use'); | ||
| await LoginScreen.jdrfText.should.eventually.exist; | ||
| await LoginScreen.jdrfLogo.should.eventually.exist; | ||
| await LoginScreen.version.should.eventually.exist; | ||
|
|
||
| }); | ||
|
|
||
| it('should login', async () => { | ||
| await LoginScreen.usernameInput.setValue(LoginScreen.loginUsername); | ||
| await LoginScreen.usernameInput.getValue() | ||
| .should.eventually.equal(LoginScreen.loginUsername); | ||
| await LoginScreen.passwordInput.setValue(LoginScreen.loginPassword); | ||
| await LoginScreen.passwordInput.getValue() | ||
| .should.eventually.equal(LoginScreen.loginPassword); | ||
| await LoginScreen.loginButton.click(); | ||
| }); | ||
| }); | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| export const spectronUserEmail = process.env.SPECTRON_USER_EMAIL; | ||
|
|
||
| export const spectronUserPassword = process.env.SPECTRON_USER_PASSWORD; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
|
|
||
| class Base { | ||
| setApp = function(app) { | ||
| this.app = app; | ||
| } | ||
| appIsOpen() { | ||
| return this.app.client.waitUntilWindowLoaded().getWindowCount(); | ||
| } | ||
| }; | ||
|
|
||
| export default new Base(); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| import {spectronUserEmail, spectronUserPassword} from './../specConfig/Config'; | ||
|
|
||
| class LoginScreen { | ||
| setApp = function(app) { | ||
| this.app = app; | ||
| }; | ||
| get loginUsername() { | ||
| return spectronUserEmail; | ||
| }; | ||
| get loginPassword() { | ||
| return spectronUserPassword; | ||
| }; | ||
| get usernameInput() { | ||
| return this.app.client.$('[placeholder="Email"]'); | ||
| }; | ||
| get passwordInput() { | ||
| return this.app.client.$('[placeholder="Password"]'); | ||
| }; | ||
| get loginButton() { | ||
| return this.app.client.$('button[type="submit"]'); | ||
| }; | ||
| get signUpLink() { | ||
| return this.app.client.$('[href*="signup"]'); | ||
| }; | ||
| get tidepoolLogo() { | ||
| return this.app.client.$('img[class*="logo"]'); | ||
| }; | ||
| get uploaderLogo() { | ||
| return this.app.client.$('div[class*="heroText"]'); | ||
| }; | ||
| get forgotPasswordLink() { | ||
| return this.app.client.$('a[href*="request-password"]'); | ||
| }; | ||
| get supportLink(){ | ||
| return this.app.client.$('a[href="http://support.tidepool.org/"]'); | ||
| }; | ||
| get privacyLink(){ | ||
| return this.app.client.$('a[href="http://tidepool.org/legal/"]'); | ||
| }; | ||
| get jdrfText() { | ||
| return this.app.client.$('span[class*="jdrfText"]'); | ||
| }; | ||
| get jdrfLogo() { | ||
| return this.app.client.$('img[class*="jdrfImage"]'); | ||
| }; | ||
| get version() { | ||
| return this.app.client.$('div[class*="version"]'); | ||
| }; | ||
| get driverDismiss() { | ||
| return 'button[class*="btnSecondary"]'; | ||
| } | ||
| }; | ||
|
|
||
| export default new LoginScreen(); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| import { Application } from 'spectron'; | ||
| import { should, use } from 'chai'; | ||
| import chaiAsPromised from 'chai-as-promised'; | ||
| import electron from 'electron'; | ||
| import path from 'path'; | ||
| import LoginScreen from './src/LoginScreen'; | ||
| import Base from './src/Base'; | ||
|
|
||
| global.before(() => { | ||
| should(); | ||
| use(chaiAsPromised); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would you mind adding a comment here to explain why
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this won't be here if we use jest i think. |
||
| }); | ||
|
|
||
| export async function startApp() { | ||
| const app = new Application({ | ||
| path: electron, | ||
| args: [path.join(__dirname, '../app')], | ||
| }); | ||
| chaiAsPromised.transferPromiseness = app.transferPromiseness; | ||
| LoginScreen.setApp(app); | ||
| Base.setApp(app); | ||
| return app.start(); | ||
| } | ||
|
|
||
| export async function stopApp(app) { | ||
| if (app && app.isRunning()) { | ||
| await app.stop(); | ||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.