Skip to content

Commit

Permalink
[Saran] Introduce JavaScript Standard Style linter
Browse files Browse the repository at this point in the history
- fix js style using standardjs
- add linter command in npm package script
- add lint check before run test
  • Loading branch information
SARAN-thala committed Dec 23, 2018
1 parent 6715447 commit 70be411
Show file tree
Hide file tree
Showing 35 changed files with 2,325 additions and 1,430 deletions.
932 changes: 920 additions & 12 deletions package-lock.json

Large diffs are not rendered by default.

27 changes: 22 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"description": "",
"main": "index.js",
"scripts": {
"test": "istanbul cover jasmine",
"test": "standard && istanbul cover jasmine",
"test:lint": "npx standard",
"dev": "webpack-dev-server --mode development --inline",
"build": "webpack --mode production",
"end_to_end_test": "node_modules/.bin/cypress run --env host=$TEST_URL",
Expand All @@ -25,25 +26,26 @@
"babel-preset-env": "^1.7.0",
"css-loader": "^2.0.1",
"cssnano": "^4.1.7",
"cypress": "^3.1.3",
"file-loader": "^2.0.0",
"html-webpack-plugin": "^3.2.0",
"istanbul": "^0.4.5",
"jasmine": "^2.5.2",
"json-loader": "^0.5.7",
"mini-css-extract-plugin": "^0.5.0",
"mocha": "^5.2.0",
"mochawesome": "^3.1.1",
"node-sass": "^4.11.0",
"postcss-loader": "^3.0.0",
"postcss-preset-env": "^6.5.0",
"sass-loader": "^7.1.0",
"standard": "^12.0.1",
"style-loader": "^0.23.1",
"webpack": "^4.28.0",
"webpack-cli": "^3.1.2",
"webpack-dev-server": "^3.1.10",
"xmlhttprequest": "^1.8.0",
"yargs": "^5.0.0",
"cypress": "^3.1.3",
"mocha": "^5.2.0",
"mochawesome": "^3.1.1"
"yargs": "^5.0.0"
},
"dependencies": {
"chance": "^1.0.4",
Expand All @@ -55,5 +57,20 @@
},
"peerDependencies": {
"mocha": "*"
},
"standard": {
"globals": [
"Cypress",
"cy",
"XMLHttpRequest"
],
"env": [
"jasmine",
"mocha"
],
"ignore": [
"radar-spec.js",
"ref-table-spec.js"
]
}
}
10 changes: 5 additions & 5 deletions spec/end_to_end_tests/pageObjects/base_page.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
class base_page{
/* eslint no-useless-constructor: "off" */

constructor(){

}
class BasePage {
constructor () {

}
}

module.exports = new base_page();
module.exports = new BasePage()
26 changes: 13 additions & 13 deletions spec/end_to_end_tests/pageObjects/byor_page.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
var config = require('../../../cypress.json');
var config = require('../../../cypress.json')

class byor_page{
class ByorPage {
constructor () {
this.text_box = "[name='sheetId']"
this.submit = '.button'
}

constructor(){
this.text_box="[name='sheetId']";
this.submit=".button";
}
provide_excel_name = function() {
cy.get(this.text_box).type(config.excel);
}
provideExcelName () {
cy.get(this.text_box).type(config.excel)
}

click_submit_button = function() {
cy.get(this.submit).click();
}
clickSubmitButton () {
cy.get(this.submit).click()
}
}

module.exports = new byor_page();
module.exports = new ByorPage()
42 changes: 20 additions & 22 deletions spec/end_to_end_tests/pageObjects/radar_page.js
Original file line number Diff line number Diff line change
@@ -1,28 +1,26 @@
class radar_page{
class RadarPage {
constructor () {
this.blip = '.quadrant-group-second .blip-link'
this.blip_selected = '.quadrant-table.selected .blip-list-item'
this.blip_description = '.blip-item-description.expanded p'
this.sheet2 = '.alternative'
}

constructor(){
this.blip=".quadrant-group-second .blip-link";
this.blip_selected=".quadrant-table.selected .blip-list-item";
this.blip_description=".blip-item-description.expanded p";
this.sheet2=".alternative";
}
clickTheBlipFromInteractiveSection () {
cy.get(this.blip).click()
}

click_the_blip_from_interactive_section = function() {
cy.get(this.blip).click();
}
clickTheBlip () {
cy.get(this.blip_selected).click()
}

click_the_blip = function() {
cy.get(this.blip_selected).click();
}
validateBlipDescription (text) {
expect(cy.get(this.blip_description).contains(text))
}


validate_blip_description = function(text) {
expect(cy.get(this.blip_description).contains(text));
}

click_sheet2 = function() {
cy.get(this.sheet2).click();
}
clickSheet2 () {
cy.get(this.sheet2).click()
}
}

module.exports = new radar_page();
module.exports = new RadarPage()
59 changes: 30 additions & 29 deletions spec/end_to_end_tests/specs/end_to_end_test.js
Original file line number Diff line number Diff line change
@@ -1,33 +1,34 @@
var byorPage = require("../pageObjects/byor_page");
var basePage = require("../pageObjects/base_page");
var radarPage = require("../pageObjects/radar_page");
var config = require('../../../cypress.json');
var byorPage = require('../pageObjects/byor_page')
// var basePage = require('../pageObjects/base_page')
var radarPage = require('../pageObjects/radar_page')
// var config = require('../../../cypress.json')

Cypress.on('uncaught:exception', (err, runnable) => {
return false
});

describe("Build your radar", function(){
it("validate 1st sheet", function(){
cy.visit(Cypress.env('host'));
byorPage.provide_excel_name();
byorPage.click_submit_button();
radarPage.click_the_blip_from_interactive_section();
radarPage.click_the_blip();
radarPage.validate_blip_description("test");
});
});

describe("Validate multiple sheet", function() {
it("validate 2nd sheet", function () {
cy.visit(Cypress.env('host'));
byorPage.provide_excel_name();
byorPage.click_submit_button();
radarPage.click_sheet2();
radarPage.click_the_blip_from_interactive_section();
radarPage.click_the_blip();
radarPage.validate_blip_description("testing");
});
});
if (err) {
console.log(err.stack)
}
return false
})

describe('Build your radar', function () {
it('validate 1st sheet', function () {
cy.visit(Cypress.env('host'))
byorPage.provideExcelName()
byorPage.clickSubmitButton()
radarPage.clickTheBlipFromInteractiveSection()
radarPage.clickTheBlip()
radarPage.validateBlipDescription('test')
})
})

describe('Validate multiple sheet', function () {
it('validate 2nd sheet', function () {
cy.visit(Cypress.env('host'))
byorPage.provideExcelName()
byorPage.clickSubmitButton()
radarPage.clickSheet2()
radarPage.clickTheBlipFromInteractiveSection()
radarPage.clickTheBlip()
radarPage.validateBlipDescription('testing')
})
})
18 changes: 9 additions & 9 deletions spec/end_to_end_tests/util/hooks.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
let basePage = require("../pageObjects/base_page");
// let basePage = require('../pageObjects/base_page')

describe('Hooks', function() {
before(function() {
// basePage.login();
})
describe('Hooks', function () {
before(function () {
// basePage.login();
})

after(function() {
// runs once after all tests in the block
})
})
after(function () {
// runs once after all tests in the block
})
})
Loading

0 comments on commit 70be411

Please sign in to comment.