Added feedback

This commit is contained in:
vjrj 2018-02-21 15:29:25 +01:00
parent d865ac8e06
commit f46aabb4d3
8 changed files with 148 additions and 61 deletions

View file

@ -0,0 +1,22 @@
@watch
Feature: Allow users to give feedback
As a user (authenticated or not)
I want to give feedback about this site
Scenario: A user can login and give feedback
Given I am on the zones page
And I have an account and I logged in
# Because is not verified
Then I can send feedback with email
When I sign out
Then I can send feedback with email
Scenario: A anon user can give feedback
Given I am on the fires page
Given I'm not logged
Then I can send feedback with email
Scenario: A user cannot give feedback in home
Given I am on the home page
Then I cannot send feedback

View file

@ -1,6 +1,5 @@
Feature: This app should generate a correct sitemap, etc
@watch
Scenario: I verify that a sitemap is generated correctly
Given the page sitemap.xml
Then I check that exist this list of pages in the sitemap

View file

@ -9,7 +9,6 @@ Feature: Test all secundary pages
| activeFires | Active Fires |
Then I check that all pages works properly
@watch
Scenario: Check that all secondary pages work well
Given a list of page urls and contents
| login | Login | true |

View file

@ -0,0 +1,49 @@
/* global module expect require process client */
const { randomText, randomEmail } = require('./helper.js');
module.exports = function doSteps() {
this.Given(/^I am on the zones page$/, () => {
client.url(`${process.env.ROOT_URL}/zones`);
if (client.isVisible('#logout')) {
client.click('#logout');
}
});
this.Then(/^I can send feedback without email$/, () => {
client.waitForVisible('#feedback-tab', 10000);
client.click('#feedback-tab');
client.waitForVisible('#feedback-form', 10000);
client.setValue('#feedbackTextarea', randomText(500));
client.click('#sendFeedbackBtn');
client.waitForVisible('.bert-alert', 10000, true);
client.waitUntil(() => client.isVisible('.bert-alert') === false, 10000);
});
this.Then(/^I can send feedback with email$/, () => {
client.waitForVisible('#feedback-tab', 10000);
client.click('#feedback-tab');
client.waitForVisible('#feedback-form', 10000);
client.setValue('input[name="email"]', randomEmail());
client.setValue('#feedbackTextarea', randomText(500));
client.click('#sendFeedbackBtn');
client.waitForVisible('.bert-alert', 10000, true);
client.waitUntil(() => client.isVisible('.bert-alert') === false, 10000);
});
this.Given(/^I'm not logged$/, () => {
client.waitForVisible('#react-root', 5000);
if (client.isVisible('#logout')) {
client.click('#logout');
}
});
this.Given(/^I am on the fires page$/, () => {
client.url(`${process.env.ROOT_URL}/fires`);
});
this.Then(/^I cannot send feedback$/, () => {
client.waitForVisible('#react-root', 5000);
client.waitUntil(() => client.isVisible('#feedback-tab') === false, 10000);
});
};

View file

@ -8,6 +8,8 @@ function makeid(size) {
return text;
}
export const randomText = n => makeid(n);
export const randomUsername = () => makeid(7);
export const randomPassword = () => randomUsername();