diff --git a/.gitignore b/.gitignore index d612dfb1b..54d5ca4a0 100644 --- a/.gitignore +++ b/.gitignore @@ -11,9 +11,7 @@ webpack-stats.json webpack-assets.json bundle-stats.json selenium-debug.log -tests/functional/output/* -test/functional/screenshots/* .ssh webpack-stats.debug.json *.DS_Store -.vscode \ No newline at end of file +.vscode diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e35fbfe63..4b545569f 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -55,10 +55,6 @@ Pull requests are the greatest contributions, so be sure they are focused in sco ``` Our `npm run test` tests and _watch_. Otherwise use `npm run test:ci:unit` for CI level tests. - We also have nightwatch function tests. You can install nightwatch globally and can run tests like this: - ``` - nightwatch --test tests/functional/specs/Index_spec.js - ``` 5. To create a PR you need to push your branch to the origin(forked) remote and then press some buttons on GitHub: diff --git a/package.json b/package.json index 4ea3792b6..0fb5d184a 100644 --- a/package.json +++ b/package.json @@ -7,12 +7,8 @@ "test": "npm run test:dev:unit", "test:ci:unit": "karma start --browsers PhantomJS --single-run", "pretest:ci:unit": "npm run test:ci:lint", - "test:ci:functional": "BROWSER=phantomjs ./tests/functional/test.sh start-ci", - "posttest:ci:functional": "./tests/functional/test.sh stop", "test:dev:unit": "karma start", "test:ci:lint": "./node_modules/eslint/bin/eslint.js ./src", - "test:dev:functional": "BROWSER=chrome ./tests/functional/test.sh start", - "posttest:dev:functional": "./tests/functional/test.sh stop", "test:dev:lint": "./node_modules/eslint/bin/eslint.js ./src", "test:stylelint": "stylelint './src/**/*.scss' --config ./webpack/.stylelintrc", "dev-old": "env NODE_PATH='./src' PORT=8000 UV_THREADPOOL_SIZE=100 node ./webpack/webpack-dev-server.js & env NODE_PATH='./src' PORT=8000 node ./bin/server.js", @@ -174,14 +170,10 @@ "redux-devtools": "3.1.1", "redux-devtools-dock-monitor": "1.1.0", "redux-devtools-log-monitor": "1.0.5", - "selenium-server": "2.48.2", "sinon": "1.15.3", "sinon-chai": "2.8.0", "stylelint": "7.1.0", "stylelint-webpack-plugin": "0.2.0", - "wdio-mocha-framework": "0.3.7", - "wdio-spec-reporter": "0.0.3", - "webdriverio": "4.2.1", "webpack-bundle-analyzer": "2.2.1", "webpack-dev-server": "2.1.0-beta.0", "webpack-hot-middleware": "2.12.2" diff --git a/tests/functional/globals.js b/tests/functional/globals.js deleted file mode 100644 index b32cb85a3..000000000 --- a/tests/functional/globals.js +++ /dev/null @@ -1,20 +0,0 @@ -var witm = require('../../webpack-isomorphic-tools-main'); -var server = require('../../server'); -var app; - -module.exports = { - before: function(done) { - return witm(function() { - server(function(serverScope) { - app = serverScope; - done(); - }) - }); - }, - after: function(done) { - done(); - app.close(function() { - process.exit(0); - }); - } -}; diff --git a/tests/functional/pageobjects/BasePage.js b/tests/functional/pageobjects/BasePage.js deleted file mode 100644 index 788b2c0d0..000000000 --- a/tests/functional/pageobjects/BasePage.js +++ /dev/null @@ -1,16 +0,0 @@ -export default class BasePage { - constructor(selectors) { - this.selectors = Object.assign(selectors, { - SURAH_PAGE_SURAH_NAME: '.surah-body .navbar-text.surah-name' - }); - } - - getSurahName() { - return browser.getText(this.selectors.SURAH_PAGE_SURAH_NAME); - } - - goHome() { - browser.url('http://quran.com'); - } - -}; diff --git a/tests/functional/pageobjects/HomePage.js b/tests/functional/pageobjects/HomePage.js deleted file mode 100644 index 6f1e7c376..000000000 --- a/tests/functional/pageobjects/HomePage.js +++ /dev/null @@ -1,33 +0,0 @@ -import BasePage from './BasePage'; -import selectors from './selectors'; - -export default class HomePage extends BasePage { - constructor() { - super(selectors); - this.selectors = selectors; - } - - getLandingText() { - const landingText = browser.getText(this.selectors.LANDING_TEXT); - return landingText; - } - - getNumberOfSurahs() { - const surahs = browser.elements(this.selectors.SURAH_LIST); - return surahs.value.length; - } - - searchForSurahAndGoToSurahPage(searchQuery) { - browser.setValue(this.selectors.SEARCH_FORM, searchQuery); - browser.waitForVisible(this.selectors.SEARCH_RESULT_LIST); - browser.click(this.selectors.SEARCH_RESULT_LIST); - return this.getSurahName(); - } - - clickOntheSurahByNumber(number) { - const surahs = browser.elements('.row .col-xs-7 span'); - const chapterId = surahs.value[number].ELEMENT; - browser.elementIdClick(chapterId); - return browser.getUrl(); - } -} diff --git a/tests/functional/pageobjects/selectors.js b/tests/functional/pageobjects/selectors.js deleted file mode 100644 index 1a8d66fb8..000000000 --- a/tests/functional/pageobjects/selectors.js +++ /dev/null @@ -1,10 +0,0 @@ -export default { - LANDING_TEXT: 'h4.title', - NEXT: 'a[data-direction="next"]', - PREVIOUS: 'a[data-direction="previous"]', - SURAH_LIST: '.row .col-md-4 li', - SEARCH_FORM: '.searchinput input', - SEARCH_RESULT_LIST: '.searchinput a', - SURAH_PAGE: '.surah-body .surah-title', - SURAH_NAME: '.navbar-text.surah-name' -}; diff --git a/tests/functional/specs/HomePageTests.js b/tests/functional/specs/HomePageTests.js deleted file mode 100644 index e860bde0b..000000000 --- a/tests/functional/specs/HomePageTests.js +++ /dev/null @@ -1,27 +0,0 @@ -import Homepage from '../pageobjects/HomePage'; -const homePage = new Homepage(browser); - -describe('Home Page', () => { - - it('Should Have English Heading', () => { - homePage.goHome(); - const text = homePage.getLandingText(); - expect(text).to.equal('THE NOBLE QUR\'AN'); - }); - - it('Should have 114 surahs', () => { - const numberSurahs = homePage.getNumberOfSurahs(); - expect(numberSurahs).to.equal(114); - }); - - it('Should search for surah, click the first result item and land on the surah page', () => { - const surahName = homePage.searchForSurahAndGoToSurahPage('ya-sin'); - expect(surahName).to.equal('YA-SIN (YA SIN) - سورة يس'); - }); - - it('Should click a surah from the list of surahs and land on the surah page', () => { - homePage.goHome(); - const url = homePage.clickOntheSurahByNumber(1); - expect(url).to.contain('/1'); - }); -}); diff --git a/tests/functional/test.sh b/tests/functional/test.sh deleted file mode 100755 index 49f0ca954..000000000 --- a/tests/functional/test.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/usr/bin/env bash - -if [ "$1" == 'stop' ]; then - echo "Stopping selenium server..." - pid=`ps -eo pid,args | grep selenium-server-standalone | grep -v grep | cut -c1-6` - echo $pid - kill $pid -elif [ "$1" == 'start' ]; then - echo "Starting selenium server..." - PATH="./node_modules/phantomjs/bin:$PATH" java -jar ./node_modules/selenium-server/lib/runner/selenium-server-standalone-2.53.0.jar &> /dev/null & - sleep 2 - BROWSERNAME=$BROWSER ./node_modules/.bin/wdio ./tests/functional/wdio.conf.js -elif [ "$1" == 'start-ci' ]; then - echo "[CI] Starting selenium server..." - - if [ ! -f selenium-server-standalone-2.53.1.jar ]; then - echo "selenium jar File not found!" - wget https://selenium-release.storage.googleapis.com/2.53/selenium-server-standalone-2.53.1.jar - fi - - PATH="./node_modules/phantomjs/bin:$PATH" java -jar selenium-server-standalone-2.53.1.jar &> /dev/null & - sleep 5 - BROWSERNAME=$BROWSER ./node_modules/.bin/wdio ./tests/functional/wdio.conf.js -else - echo "Nothing to do!" -fi diff --git a/tests/functional/wdio.conf.js b/tests/functional/wdio.conf.js deleted file mode 100644 index b02f41928..000000000 --- a/tests/functional/wdio.conf.js +++ /dev/null @@ -1,44 +0,0 @@ -const browser = process.env.BROWSERNAME || 'phantomjs'; - -exports.config = { - - maxInstances: 4, - sync: true, - specs: [ - './tests/functional/specs/**/*.js' - ], - exclude: [ - ], - - capabilities: [ - { - browserName: browser - } - ], - - logLevel: 'error', - coloredLogs: true, - screenshotPath: './errorShots/', - - waitforTimeout: 10000, - framework: 'mocha', - reporters: ['dot', 'spec'], - onPrepare: () => { - }, - before: () => { - - const chai = require('chai'); // eslint-disable-line global-require - global.chai = chai; - global.expect = chai.expect; - - process.on('unhandledRejection', (e) => { - console.error(e); - if (e.stack) { - console.error(e.stack); - } - }); - - require('babel-core/register'); // eslint-disable-line global-require - require('babel-polyfill'); // eslint-disable-line global-require - } -};