Skip to content

Commit

Permalink
bdd initial test passed
Browse files Browse the repository at this point in the history
  • Loading branch information
rrfaria committed Apr 16, 2017
1 parent 5d357eb commit 3aeb026
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 21 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
node_modules
.idea/
features/reports/screenshot
6 changes: 3 additions & 3 deletions features/home.feature
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Feature: Test open page
I will test the open page of app
I will test open app page

Scenario: Try open the initial page
Given the initial page
And I have the content table in body
Then I should have a title "Projeto Crud - localStorage" on page
And there is the content table in body
Then I should have a title "Projeto Crud - LocalStorage" on page
4 changes: 4 additions & 0 deletions features/reports/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Ignore everything in this directory
*
# Except this file
!.gitignore
30 changes: 18 additions & 12 deletions features/step_definitions/home.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,30 @@
var seleniumWebdriver = require('selenium-webdriver');

module.exports = function () {
this.Given(/^the initial page$/, function(done) {
helpers.loadPage('http://mywebsite.dev:3001/')
.then(
done()
);
this.Given(/^the initial page$/, function() {
return helpers.loadPage('http://mywebsite.dev:3001/')
.then(function () {
return driver.wait(until.elementsLocated(by.css('body')),30000).then(function(){

// return the promise of an element to the following then.
return driver.findElements(by.css('body'));
})
});

});

this.When(/^I have the content table in body$/, function (done) {
driver.findElement(by.id("txtFullname")).then(function(element) {
//expect(elements.length).to.not.equal(0);
done();
this.When(/^there is the content table in body$/, function () {
driver.wait(until.elementsLocated(by.id("tablerows")), 20000).then(function(element) {
return driver.findElements(by.css('#tablerows'));
});
});

this.Then(/^I should have a title "([^"]*)" on page$/, function (text) {
var xpath = "//*[contains(text(),'" + text + "')]";
var condition = seleniumWebdriver.until.elementLocated({xpath: xpath});
return this.driver.wait(condition, 5000);
driver.findElement(by.css('h2.title')).then(function(h2) {
h2.getText().then(function(content){
expect(content).to.be.a('string');
expect(content).to.equal(text);
})
})
});
};
5 changes: 0 additions & 5 deletions features/step_definitions/hooks.js

This file was deleted.

0 comments on commit 3aeb026

Please sign in to comment.