Skip to content
This repository was archived by the owner on Jun 28, 2021. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
Prev Previous commit
Next Next commit
remove wait
  • Loading branch information
thabti committed Jul 24, 2016
commit 6bf3b1755f4ec0d1f95256cd41daf5a1af5a0a15
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"posttest:ci:functional": "bash tests/functional/test.sh stop",
"test:ci:lint": "eslint ./src/**/*.js",
"test:dev:unit": "./node_modules/karma/bin/karma start",
"test:dev:functional": "BROWSER=phantomjs bash tests/functional/test.sh start",
"test:dev:functional": "BROWSER=chrome bash tests/functional/test.sh start",
"posttest:dev:functional": "bash tests/functional/test.sh stop",
"test:dev:lint": "eslint ./src/scripts/**/*.js",
"test:stylelint": "stylelint './src/**/*.scss' --config webpack/.stylelintrc",
Expand Down
14 changes: 5 additions & 9 deletions tests/functional/pageobjects/BasePage.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,15 @@
module.exports = class BasePage {
Copy link
Contributor

Choose a reason for hiding this comment

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

why not export default ?


Copy link
Contributor

@mmahalwy mmahalwy Jul 24, 2016

Choose a reason for hiding this comment

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

empty lines!

constructor() {
constructor(selectors) {

this.selectors = {
SURAH_NAME: '.surah-body .navbar-text.surah-name'
};
}

wait(time = 200) {
this.selectors = Object.assign(selectors, {
SURAH_PAGE_SURAH_NAME: '.surah-body .navbar-text.surah-name'
});

Copy link
Contributor

Choose a reason for hiding this comment

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

✂️

browser.pause(time);
}

getSurahName() {
return browser.getText(this.selectors.SURAH_NAME);
return browser.getText(this.selectors.SURAH_PAGE_SURAH_NAME);
}

goHome() {
Expand Down
18 changes: 5 additions & 13 deletions tests/functional/pageobjects/HomePage.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,12 @@
import BasePage from './BasePage';
import selectors from './selectors';

export default class HomePage extends BasePage {

constructor(browser) {

Copy link
Contributor

Choose a reason for hiding this comment

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

✂️

const selectors = {
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_NAME: '.navbar-text.surah-name'
};

super(browser, selectors);
super(selectors);

this.browser = browser;
this.selectors = selectors;
}
Expand All @@ -33,7 +26,7 @@ export default class HomePage extends BasePage {
searchForSurahAndGoToSurahPage(searchQuery) {

browser.setValue(this.selectors.SEARCH_FORM, searchQuery);
this.wait(1000);
browser.waitForVisible(this.selectors.SEARCH_RESULT_LIST);
browser.click(this.selectors.SEARCH_RESULT_LIST);
return this.getSurahName();

Expand All @@ -43,7 +36,6 @@ export default class HomePage extends BasePage {
const surahs = browser.elements('.row .col-xs-7 span');
const surahID = surahs.value[number].ELEMENT;
browser.elementIdClick(surahID);
this.wait(1000);
return browser.getUrl();

}
Expand Down
10 changes: 10 additions & 0 deletions tests/functional/pageobjects/selectors.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
module.exports = {
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'
}