Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
ThieryMichel committed May 13, 2015
1 parent 692a9c1 commit 9dee910
Showing 1 changed file with 49 additions and 0 deletions.
49 changes: 49 additions & 0 deletions src/javascripts/test/e2e/ListViewSpec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/*global describe,it,expect,$$,element,browser,by*/
describe('ListView', function () {
'use strict';

var listUrl;

beforeEach(function() {
listUrl = encodeURI(browser.baseUrl + '/#/comments/list?search={"post_id":"9"}&page=1');
browser.get(listUrl);
});

describe('ma-list-button', function () {
it('should restore the list with filter when used from edit', function () {
browser.executeScript('window.scrollTo(810, 481)').then(function () {
$$('ma-edit-button a').then(function (elements) {
expect(elements[0].getText()).toBe(' Edit');
elements[0].click();
expect(browser.getCurrentUrl()).toBe(browser.baseUrl + '/#/comments/edit/2');
$$('ma-list-button a').then(function (elements) {
elements[0].click();
expect(browser.getCurrentUrl()).toBe(listUrl);
});
});
});
});

it('should restore the list with filter when used from delete', function () {
browser.get(listUrl);
browser.executeScript('window.scrollTo(810, 481)').then(function () {

$$('ma-delete-button a').then(function (elements) {
expect(elements[0].getText()).toBe(' Delete');
elements[0].click();
expect(browser.getCurrentUrl()).toBe(browser.baseUrl + '/#/comments/delete/2');
$$('button.btn-default').then(function (elements) {
elements[0].click();
expect(browser.getCurrentUrl()).toBe(browser.baseUrl + '/#/comments/edit/2');

$$('ma-list-button a').then(function (elements) {
elements[0].click();
expect(browser.getCurrentUrl()).toBe(listUrl);
});
});
});
});
});
});

});

0 comments on commit 9dee910

Please sign in to comment.