Integration Test for creation of a default poll

This commit is contained in:
jelhan 2014-11-26 13:15:05 +01:00
parent 7ba00a1b31
commit 8af5a9df09
7 changed files with 74 additions and 9 deletions

View file

@ -6,6 +6,8 @@ export default DS.RESTAdapter.extend({
window.location.pathname
// remove index.html if it's there
.replace(/index.html$/, '')
// remove tests prefix which are added if tests are running
.replace(/tests/, '')
// remove leading and trailing slash
.replace(/\/$/, '')
// add api.php

View file

@ -9,5 +9,5 @@
}}
{{/form-for}}
<button {{action "submit"}} class="btn btn-default btn-primary"> {{t 'create.next'}} </button>
<button {{action "submit"}} class="btn btn-default btn-primary button-next"> {{t 'create.next'}} </button>
</div>

View file

@ -11,6 +11,6 @@
}}
{{/form-for}}
<button {{action "submit"}} class="btn btn-default btn-primary"> {{t 'create.next'}} </button>
<button {{action "submit"}} class="btn btn-default btn-primary button-next"> {{t 'create.next'}} </button>
</div>

View file

@ -32,9 +32,9 @@
{{/input}}
{{/form-for}}
<button {{action "moreTimes"}} class="btn btn-default">{{t "create.options-datetime.more-inputs"}}</button>
<button {{action "moreTimes"}} class="btn btn-default button-more-times">{{t "create.options-datetime.more-inputs"}}</button>
<button {{action "copyFirstLine"}} class="btn btn-default">{{t "create.options-datetime.copy-first-line"}}</button>
<button {{action "copyFirstLine"}} class="btn btn-default button-copy-first-line">{{t "create.options-datetime.copy-first-line"}}</button>
<button {{action "submit"}} class="btn btn-default btn-primary"> {{t 'create.next'}} </button>
<button {{action "submit"}} class="btn btn-default btn-primary button-next"> {{t 'create.next'}} </button>
</div>

View file

@ -18,9 +18,9 @@
{{/input}}
{{/form-for}}
<button {{action "moreOptions" target="view"}} class="btn btn-default"> {{t 'create.options.input.moreOptions.label'}} </button>
<button {{action "moreOptions" target="view"}} class="btn btn-default button-more-options"> {{t 'create.options.input.moreOptions.label'}} </button>
<button {{action "submit"}} class="btn btn-default btn-primary"> {{t 'create.next'}} </button>
<button {{action "submit"}} class="btn btn-default btn-primary button-next"> {{t 'create.next'}} </button>
{{/if}}
@ -42,7 +42,7 @@
}}
{{/form-for}}
<button {{action "submit"}} class="btn btn-default btn-primary"> {{t 'create.next'}} </button>
<button {{action "submit"}} class="btn btn-default btn-primary button-next"> {{t 'create.next'}} </button>
{{/if}}
</div>

View file

@ -15,5 +15,5 @@
}}
{{/form-for}}
<button {{action "submit"}} class="btn btn-default btn-primary"> {{t 'create.next'}} </button>
<button {{action "submit"}} class="btn btn-default btn-primary button-next"> {{t 'create.next'}} </button>
</div>

View file

@ -0,0 +1,63 @@
import Ember from "ember";
import { test } from 'ember-qunit';
import startApp from '../helpers/start-app';
/* global moment */
var App;
module('Integration - create poll', {
setup: function() {
App = startApp();
},
teardown: function() {
Ember.run(App, App.destroy);
}
});
test("default poll", function() {
expect(8);
visit('/create').then(function() {
click('.button-next');
andThen(function(){
equal(currentPath(), 'create.meta');
fillIn('input[name="title"]', 'default poll');
click('.button-next');
andThen(function(){
equal(currentPath(), 'create.options');
// select days in calendar
// today and last day on current calendar page
click('.datepicker tbody td.today');
click('.datepicker tbody tr:last-child td:last-child');
click('.button-next');
andThen(function(){
equal(currentPath(), 'create.settings');
click('.button-next');
andThen(function(){
equal(currentPath(), 'poll');
equal(find('.meta-data .title').text(), 'default poll');
equal(find('.meta-data .description').text(), '');
// check that there are two options
// head of user selections table is options + leading column (user names) + last column (buttons)
equal(find('.user-selections-table thead tr th').length, 4);
// check that current day is first option
equal(find(
Ember.$('.user-selections-table thead tr th')[1]).text().trim(),
moment().format(moment.localeData().longDateFormat( 'LLLL' ).replace('LT' , '')).trim()
);
});
});
});
});
});
});