This repository has been archived by the owner on Jun 28, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 362
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* 📐 functional tests 📐 functional tests + fix travis 📐 functional tests + phantomjs 📐 functional tests + trying firefox functional testing [test] working state * [test] local and ci functions [test] local and ci functions [test] local and ci functions [test] local and ci functions WIP - allow user to specify browser and use phantomjs v2 Revert "WIP - allow user to specify browser and use phantomjs v2" This reverts commit 1bb9124. upgrade webdriverio WIP remove async/await linting, and allowing user to select the browser attempt at using the node_module jar back to downloading the jar * e-2-e js functional tests * remove wait * little clean up * remove spacing * removing empty lines and refactoring
- Loading branch information
Showing
15 changed files
with
169 additions
and
152 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
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'); | ||
} | ||
|
||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
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 surahID = surahs.value[number].ELEMENT; | ||
browser.elementIdClick(surahID); | ||
return browser.getUrl(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
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' | ||
}; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
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'); | ||
}); | ||
}); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
|
||
#!/bin/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
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 | ||
} | ||
}; |