Integration Test for creation of a default poll
This commit is contained in:
parent
7ba00a1b31
commit
8af5a9df09
7 changed files with 74 additions and 9 deletions
|
@ -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
|
||||
|
|
|
@ -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>
|
|
@ -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>
|
|
@ -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>
|
|
@ -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>
|
|
@ -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>
|
63
tests/integrations/create-poll-test.js
Normal file
63
tests/integrations/create-poll-test.js
Normal 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()
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
Loading…
Reference in a new issue