Skip to content
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

new demo site with integrated capture and graph/download, plus Cypress tests #175

Merged
merged 37 commits into from
Nov 15, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
f0635b3
CISC 699 initial commit
TonyIversonLin Aug 28, 2020
2d26192
package Initialization
TonyIversonLin Aug 29, 2020
de91150
new router of the new demo page
yg4886 Aug 29, 2020
5d6a262
add all files and start to refactor ui
yg4886 Aug 29, 2020
5bed37f
half way
yg4886 Aug 29, 2020
de41dcd
add some comments
yg4886 Aug 30, 2020
baef78d
finished the capturing step
yg4886 Aug 30, 2020
8cac73d
Landing Page inital setup complete
TonyIversonLin Aug 30, 2020
8c13593
Bring in global stepper toolbar, fix styling
TonyIversonLin Aug 31, 2020
fcd418b
merge conflict
TonyIversonLin Aug 31, 2020
40e1dad
Merge pull request #1 from TonyIversonLin/yechao-change
TonyIversonLin Aug 31, 2020
a9d242e
More style update
TonyIversonLin Aug 31, 2020
8df8400
Wire up the plotting UI
TonyIversonLin Aug 31, 2020
1c8614e
disable stepper while in plotting step; add restart button on plottin…
yg4886 Sep 1, 2020
95372fb
Added testing framework
TonyIversonLin Sep 2, 2020
5a25826
Merge changes
TonyIversonLin Sep 2, 2020
d66001e
Add in basic test case
TonyIversonLin Sep 4, 2020
23ebbb0
Remove the temp home.html file
TonyIversonLin Sep 5, 2020
8454141
cleaning up unused files
jywarren Sep 22, 2020
9bd7fc1
reconnected to npm instead of bower, cleanup
jywarren Sep 22, 2020
1e80c87
Merge branch 'main' into demo-site
jywarren Sep 22, 2020
2674b75
remove bower from .travis.yml
jywarren Sep 22, 2020
755f33e
cypress .travis.yml changes
jywarren Sep 23, 2020
3f90256
Update cypress.json
jywarren Sep 23, 2020
5273dd7
jasmine using npm not bower
jywarren Sep 23, 2020
2c30de8
run node_modules/http-server/bin/http-server on port 8080
jywarren Sep 24, 2020
ef09ffb
Update .travis.yml
jywarren Sep 24, 2020
3fe47c9
<script src="https://cdn.temasys.io/adapterjs/0.15.x/adapter.min.…
jywarren Sep 24, 2020
c38e339
Update .gitignore
jywarren Sep 29, 2020
77ba1f8
revert d3 to v3.4
jywarren Sep 29, 2020
b05ab44
remove d3 from package-lock
jywarren Sep 29, 2020
02c1adc
bump d3 to v3.5.4 to resolve contextify issues
jywarren Sep 30, 2020
8f87228
small fixes to demo
jywarren Nov 14, 2020
12f58d2
fixed basic svg and other errors
jywarren Nov 14, 2020
1260187
fixed!
jywarren Nov 15, 2020
77354ba
node 12
jywarren Nov 15, 2020
18e2a39
update grunt-contrib-jasmine
jywarren Nov 15, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 24 additions & 12 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,28 @@
language: node_js
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

node_js:
- '8'
before_script: grunt build
script: grunt jasmine
before_install:
- npm install -g grunt-cli bower
- bower install
- '12'
cache:
# Caches $HOME/.npm when npm ci is default script command
# Caches node_modules in all other cases
npm: true
directories:
# we also need to cache folder with Cypress binary
- ~/.cache
install:
- npm ci
before_script:
- grunt build
- node_modules/http-server/bin/http-server &
script:
- $(npm bin)/cypress run --record
- grunt jasmine
env:
- CXX=g++-4.8
- CXX=g++-4.8
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- g++-4.8
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- g++-4.8
# Ubuntu 16+ does not install this dependency by default, so we need to install it ourselves
- libgconf-2-4
8 changes: 4 additions & 4 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,10 @@ module.exports = function(grunt) {
specs: 'spec/javascripts/*spec.js',
vendor: [
'node_modules/jquery/dist/jquery.min.js',
'bower_components/d3/d3.js',
'bower_components/nvd3/build/nv.d3.js',
'bower_components/bootstrap-css/js/bootstrap.min.js',
'bower_components/moment/moment.js',
'node_modules/d3/d3.js',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could something be wrong with this line, for jasmine?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah yes! I think d3 would be in a dist folder... checking...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm. <script src="../../node_modules/d3/d3.js" type="text/javascript"></script> indicates not...

'node_modules/nvd3/build/nv.d3.js',
'node_modules/bootstrap/dist/js/bootstrap.min.js',
'node_modules/moment/moment.js',
'node_modules/jasmine-jquery/lib/jasmine-jquery.js',
'node_modules/jasmine-ajax/lib/mock-ajax.js',
'spec/javascripts/helpers/test_responses.js'
Expand Down
20 changes: 0 additions & 20 deletions bower.json

This file was deleted.

3 changes: 3 additions & 0 deletions cypress.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"projectId": "128076ed-9868-4e98-9cef-98dd8b705d75"
}
5 changes: 5 additions & 0 deletions cypress/fixtures/example.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"name": "Using fixtures to represent data",
"email": "hello@cypress.io",
"body": "Fixtures are a great way to mock data for responses to routes"
}
32 changes: 32 additions & 0 deletions cypress/integration/spectral-workbench-demo.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/// <reference types="cypress" />

context('Actions', () => {

beforeEach(() => {
cy.visit('http://127.0.0.1:8080/examples/new-capture/')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's change this!

})


it('It reach the default landing page', () => {
cy.get('#landing-page-content').contains('Spectral WorkBench');
cy.get('#landing-page-content').contains('What is Spectral Workbench?');
})

it('The header navigation stepper is present and it is in the correct order', () => {
cy.get('.bs-stepper-header')
cy.get('.bs-stepper-header>div').eq(0).contains('Home Page')
cy.get('.bs-stepper-header>div').eq(2).contains('Settings')
cy.get('.bs-stepper-header>div').eq(4).contains('Capture')
cy.get('.bs-stepper-header>div').eq(6).contains('Plotting')
});

it('The default Home page step should be highlighted but not the rest', () => {
cy.get('.bs-stepper-header')
cy.get('.bs-stepper-header>div').eq(0).should('have.class', 'active')
cy.get('.bs-stepper-header>div').eq(2).not('have.class', 'active')
cy.get('.bs-stepper-header>div').eq(4).not('have.class', 'active')
cy.get('.bs-stepper-header>div').eq(6).not('have.class', 'active')
});


})
21 changes: 21 additions & 0 deletions cypress/plugins/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/// <reference types="cypress" />
// ***********************************************************
// This example plugins/index.js can be used to load plugins
//
// You can change the location of this file or turn off loading
// the plugins file with the 'pluginsFile' configuration option.
//
// You can read more here:
// https://on.cypress.io/plugins-guide
// ***********************************************************

// This function is called when a project is opened or re-opened (e.g. due to
// the project's config changing)

/**
* @type {Cypress.PluginConfig}
*/
module.exports = (on, config) => {
// `on` is used to hook into various events Cypress emits
// `config` is the resolved Cypress config
}
25 changes: 25 additions & 0 deletions cypress/support/commands.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// ***********************************************
// This example commands.js shows you how to
// create various custom commands and overwrite
// existing commands.
//
// For more comprehensive examples of custom
// commands please read more here:
// https://on.cypress.io/custom-commands
// ***********************************************
//
//
// -- This is a parent command --
// Cypress.Commands.add("login", (email, password) => { ... })
//
//
// -- This is a child command --
// Cypress.Commands.add("drag", { prevSubject: 'element'}, (subject, options) => { ... })
//
//
// -- This is a dual command --
// Cypress.Commands.add("dismiss", { prevSubject: 'optional'}, (subject, options) => { ... })
//
//
// -- This will overwrite an existing command --
// Cypress.Commands.overwrite("visit", (originalFn, url, options) => { ... })
20 changes: 20 additions & 0 deletions cypress/support/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// ***********************************************************
// This example support/index.js is processed and
// loaded automatically before your test files.
//
// This is a great place to put global configuration and
// behavior that modifies Cypress.
//
// You can change the location of this file or turn off
// automatically serving support files with the
// 'supportFile' configuration option.
//
// You can read more here:
// https://on.cypress.io/configuration
// ***********************************************************

// Import commands.js using ES2015 syntax:
import './commands'

// Alternatively you can use CommonJS syntax:
// require('./commands')
24 changes: 16 additions & 8 deletions dist/spectral-workbench.js
Original file line number Diff line number Diff line change
Expand Up @@ -5371,29 +5371,37 @@ SpectralWorkbench.Graph = Class.extend({
d3.selectAll('g.nv-focus g.nv-line > g > g.nv-groups g')
//.addClass('main-line') // we should do this (or the d3 equiv.) for later selections. Or if nvd3 offers a ready-made selection
.attr("id", function(datum, index) {
var id = d3.select('svg').data()[0][index].id; // this is the real d3 DOM-stored data
return 'spectrum-line-' + id;
if (index < 4) {
var id = d3.select('svg').data()[0][index].id; // this is the real d3 DOM-stored data
return 'spectrum-line-' + id;
}
});

// zoom graph lines
d3.selectAll('g.nv-context g.nv-line > g > g.nv-groups g')
.attr("id", function(datum, index) {
var id = d3.select('svg').data()[0][index].id; // this is the real d3 DOM-stored data
return 'spectrum-line-' + id;
if (index < 4) {
var id = d3.select('svg').data()[0][index].id; // this is the real d3 DOM-stored data
return 'spectrum-line-' + id;
}
});

// graph line hover circles for main graph lines
d3.selectAll('g.nv-focus g.nv-scatterWrap g.nv-groups g')
.attr("id", function(datum, index) {
var id = d3.select('svg').data()[0][index].id; // this is the real d3 DOM-stored data
return 'spectrum-hover-' + id;
if (index < 4) {
var id = d3.select('svg').data()[0][index].id; // this is the real d3 DOM-stored data
return 'spectrum-hover-' + id;
}
});

// graph line hover circles for zoom graph lines
d3.selectAll('g.nv-context g.nv-scatterWrap g.nv-groups g')
.attr("id", function(datum, index) {
var id = d3.select('svg').data()[0][index].id; // this is the real d3 DOM-stored data
return 'spectrum-hover-' + id;
if (index < 4) {
var id = d3.select('svg').data()[0][index].id; // this is the real d3 DOM-stored data
return 'spectrum-hover-' + id;
}
});

if (_graph.dataType == "spectrum") {
Expand Down
5 changes: 3 additions & 2 deletions examples/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,9 @@
jQuery(document).ready(function($) {

var data = {
"data": {
"name": "Test spectrum",
"id": 9,
"title": "Test spectrum",
"data": {
"lines":[ // as many data points as you like may be entered here:
{"average":64.3333,"r":69,"g":46,"b":78,"wavelength":269.089},
{"average":64.3333,"r":70,"g":46,"b":77,"wavelength":270.815},
Expand Down
1 change: 1 addition & 0 deletions examples/new-capture/asset/help.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions examples/new-capture/asset/home.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added examples/new-capture/asset/landing_1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added examples/new-capture/asset/landing_2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added examples/new-capture/asset/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added examples/new-capture/asset/sample-image.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added examples/new-capture/calibration-example.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added examples/new-capture/example-cfl-vertical.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading