Skip to content

Commit

Permalink
Merge pull request #295 from lsst-ts/release/4.0.0
Browse files Browse the repository at this point in the history
Release/4.0.0
  • Loading branch information
sebastian-aranda authored Apr 1, 2021
2 parents e68bcfd + 93ab247 commit 7be8788
Show file tree
Hide file tree
Showing 360 changed files with 17,786 additions and 9,539 deletions.
17 changes: 17 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.2.0
hooks:
- id: check-yaml
exclude: conda/meta.yaml

- repo: https://github.com/pre-commit/mirrors-prettier
rev: v2.2.1
hooks:
- id: prettier
types: [javascript]

- repo: https://github.com/pre-commit/mirrors-eslint
rev: v7.19.0
hooks:
- id: eslint
28 changes: 28 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ pipeline {
registryCredential = "dockerhub-inriachile"
dockerImageName = "lsstts/love-frontend:"
dockerImage = ""
user_ci = credentials('lsst-io')
LTD_USERNAME="${user_ci_USR}"
LTD_PASSWORD="${user_ci_PSW}"
}
stages {
stage("Build Docker image") {
Expand Down Expand Up @@ -67,6 +70,31 @@ pipeline {
}
}

stage("Deploy documentation") {
agent {
docker {
alwaysPull true
image 'lsstts/develop-env:develop'
args "-u root --entrypoint=''"
}
}
when {
anyOf {
changeset "docs/*"
}
}
steps {
script {
sh "pwd"
sh """
source /home/saluser/.setup_dev.sh
pip install ltd-conveyor
ltd upload --product love-frontend --git-ref ${GIT_BRANCH} --dir ./docs
"""
}
}
}

stage("Trigger develop deployment") {
when {
branch "develop"
Expand Down
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,19 @@ If rather than build you want to launch a development server for the documentati
```
yarn guide:start
```

### Linting & Formatting
In order to maintaing code linting and formatting we use `pre-commit` that runs **ESLint** (https://eslint.org/) and **Prettier** (https://prettier.io/) using Git Hooks. To enable this you have to:

1. Install `pre-commit` in your local development environment:
```
pip install pre-commit
```

2. Set up the git hook scripts running:
```
pre-commit install
```

3. Start developing! Linter and Formatter will be executed on every commit you make

4 changes: 2 additions & 2 deletions love/.eslintignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
serviceWorker.js
index.js
src/serviceWorker.js
src/index.js
**/icons/**
19 changes: 17 additions & 2 deletions love/.eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,33 @@
"object-curly-newline": "off",
"no-bitwise": "off",
"no-eval": "off",
"no-underscore-dangle": "off"
"no-underscore-dangle": "off",
"no-plusplus": [0, { "allowForLoopAfterthoughts": true }],
"import/no-unresolved": "off",
"func-names": "off"
},
"plugins": ["only-warn"],
"settings": {
"import/resolver": {
"node": {
"paths": ["src"],
"extensions": [".js", ".jsx", ".ts", ".tsx"]
}
}
},
"env": {
"browser": true,
"node": true
}
},
"overrides": [
{
"files": [
"**/*.test.js",
"**/*.test.jsx"
],
"env": {
"jest": true
}
}
]
}
25 changes: 11 additions & 14 deletions love/cypress/integration/commands_spec.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
it(`GIVEN the user is on the test window AND subscribed to the azimuthCommandedState event
WHEN it sends a command to update the ATDome azimuth on the simulator
THEN it should receive the updated data inside the message of the azimuthCommandedState event`, function() {

//---Arrange---
THEN it should receive the updated data inside the message of the azimuthCommandedState event`, () => {
// ---Arrange---
cy.visit('http://localhost');
cy.url().should('include', '/login');
cy.get('#id_username').type('test');
Expand All @@ -12,24 +11,22 @@ THEN it should receive the updated data inside the message of the azimuthCommand
.click();
cy.url().should('not.include', 'login');
cy.root().should('contain', 'Component index');
cy.visit('http://localhost/test')
// subscribe to the ATDome sim
cy.visit('http://localhost/test');
// subscribe to the ATDome sim
cy.get('#id_category').clear().type('event');
cy.get('#id_salindex').clear().type('1');
cy.get('#id_csc').clear().type('ATDome');
cy.get('#id_stream').clear().type('azimuthCommandedState');
cy.get('button').contains('Subscribe').click();


//---Act---
// ---Act---
// change the azimuth
cy.get('#id_commands_csc').clear().type('ATDome')
cy.get('#id_cmd_salindex').clear().type('1')
cy.get('#id_commands').clear().type('moveAzimuth')
cy.get('#id_parameters').clear().type('{{}"azimuth": 123.456}')
cy.get('#id_commands_csc').clear().type('ATDome');
cy.get('#id_cmd_salindex').clear().type('1');
cy.get('#id_commands').clear().type('moveAzimuth');
cy.get('#id_parameters').clear().type('{{}"azimuth": 123.456}');
cy.get('button').contains('Launch').click();

//---Assert---
cy.get('body').contains((`"value": 123.456`));

// ---Assert---
cy.get('body').contains(('"value": 123.456'));
});
17 changes: 8 additions & 9 deletions love/cypress/integration/login_spec.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
describe('Given the user just submitted its credentials', function() {
it('When accepted it should display the Component Index screen', function() {
describe('Given the user just submitted its credentials', () => {
it('When accepted it should display the Component Index screen', () => {
cy.visit('http://localhost');
cy.url().should('include', '/login');
cy.get('#id_username').type('test');
Expand All @@ -11,36 +11,35 @@ describe('Given the user just submitted its credentials', function() {
cy.root().should('contain', 'Component index');
});

it('When rejected it should display a warning message', async function() {
it('When rejected it should display a warning message', async () => {
cy.visit('http://localhost');
cy.url().should('include', '/login');
cy.get('#id_username').type('asdf');
cy.get('#id_password').type('asdf');
cy.get('button')
.contains('Login')
.click();
cy.root().should('contain', "Your username and password did not match, please try again");
cy.root().should('contain', 'Your username and password did not match, please try again');
});
it('Logout works', function() {
it('Logout works', () => {
cy.visit('http://localhost');
cy.get('#id_username').type('test');
cy.get('#id_password').type('test');
cy.get('button')
.contains('Login')
.click();

cy.url().should('not.include', 'login');
cy.get('button')
.contains('Logout')
.click();
cy.visit('http://localhost/auxiliary-telescope');
cy.url().should('include', '/login');
});
it('If the token expired before logging in it should display a warning message', function() {

it('If the token expired before logging in it should display a warning message', () => {
localStorage.setItem('LOVE-TOKEN', 'asdf');
cy.visit('http://localhost/auxiliary-telescope');
cy.root().should('contain', 'Your session has expired, you have been logged out');
});
});

2 changes: 1 addition & 1 deletion love/cypress/plugins/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@
module.exports = (on, config) => {
// `on` is used to hook into various events Cypress emits
// `config` is the resolved Cypress config
}
};
2 changes: 1 addition & 1 deletion love/cypress/support/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
// ***********************************************************

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

// Alternatively you can use CommonJS syntax:
// require('./commands')
33 changes: 20 additions & 13 deletions love/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,46 +16,53 @@
"howler": "^2.1.3",
"html2canvas": "^1.0.0-rc.5",
"lodash": "^4.17.19",
"lodash.throttle": "^4.1.1",
"luxon": "^1.23.0",
"ml-matrix": "^6.5.0",
"moment-range": "^4.0.0",
"path-js": "^1.0.1",
"pathfinding": "^0.4.18",
"paths-js": "^0.4.10",
"prop-types": "^15.5.7",
"react": "^16.13.1",
"re-reselect": "^4.0.0",
"react": "17.0.1",
"react-ace": "^8.0.0",
"react-datetime": "^2.16.3",
"react-dom": "^16.8.6",
"react-datetime": "^3.0.0",
"react-dom": "17.0.1",
"react-dropdown": "^1.6.4",
"react-grid-layout": "^0.18.2",
"react-json-pretty": "^2.1.0",
"react-modal": "^3.11.1",
"react-redux": "^7.0.3",
"react-rnd": "^10.0.0",
"react-router-dom": "^5.0.0",
"react-scripts": "3.4.0",
"react-scripts": "4.0.0",
"react-toastify": "^5.3.2",
"react-uid": "^2.2.0",
"react-vega": "^7.3.0",
"react-vega": "^7.4.1",
"redux": "^4.0.1",
"redux-batched-subscribe": "^0.1.6",
"redux-logger": "^3.0.6",
"redux-thunk": "^2.3.0",
"redux-undo": "^1.0.0",
"reselect": "^4.0.0",
"resize-observer-polyfill": "^1.5.1",
"rfdc": "^1.1.4",
"vega": "^5.4.0",
"vega-embed": "^6.4.0",
"vega": "^5.17.3",
"vega-embed": "^6.12.2",
"vega-lib": "^4.4.0",
"vega-lite": "^4.6.0",
"vega-lite": "^4.17.0",
"websocket-playback": "^1.0.0",
"yaml": "^1.7.2"
},
"scripts": {
"start": "npx react-scripts start",
"build": "npx react-scripts build",
"test": "npx react-scripts test",
"eject": "npx react-scripts eject",
"guide:start": "npx styleguidist server",
"guide:build": "npx styleguidist build"
"guide:start": "FAST_REFRESH=false npx styleguidist server",
"guide:build": "npx styleguidist build",
"lint": "eslint src"
},
"eslintConfig": {
"extends": "react-app"
Expand All @@ -74,15 +81,15 @@
},
"devDependencies": {
"@testing-library/jest-dom": "^5.1.1",
"@testing-library/react": "^10.0.1",
"@testing-library/react": "^11.2.2",
"cypress": "^4.1.0",
"eslint-config-airbnb": "^18.1.0",
"eslint-plugin-only-warn": "^1.0.1",
"fetch-mock": "^9.1.2",
"jest-fetch-mock": "^3.0.3",
"jest-websocket-mock": "^2.0.2",
"mock-socket": "^9.0.3",
"react-dev-utils": "^10.2.0",
"react-styleguidist": "11.0.1"
"react-dev-utils": "^11.0.4",
"react-styleguidist": "11.0.8"
}
}
Loading

0 comments on commit 7be8788

Please sign in to comment.