blob: f3660b4ad693219ddbdaaaa464cdf693f50150de [file] [log] [blame]
Matteo Scandolo583234d2017-04-20 14:33:04 -07001const user = require('../test_helpers/user');
2const page = require('./crud.po');
3const config = require('../test_helpers/config');
4
5describe('XOS CRUD Page', function() {
6
7 beforeEach((done) => {
8 user.login()
9 .then(() => {
10 done();
11 });
12 });
13
14 describe('list view', () => {
15 beforeEach(() => {
16 browser.get(`${config.url}/core/nodes/`);
17 });
18 it('should have a table', () => {
19 expect(page.tableRows.count()).toBe(2);
20 expect(page.tableColumn.count()).toBe(5);
21 expect(page.deleteBtn.count()).toBe(1); // per row
22 });
23
24 it('should have an add button', () => {
25 expect(page.addBtn.isDisplayed()).toBeTruthy();
26 page.addBtn.click();
27 expect(browser.getCurrentUrl()).toBe(`${config.url}/core/nodes/add`);
28 });
29 });
30
31 describe('details view', () => {
32
33 describe('for an existing model', () => {
34 beforeEach(() => {
35 browser.get(`${config.url}/core/nodes/1`);
36 });
37 it('should have a form', () => {
38 expect(page.formInputs.count()).toBe(5);
39 expect(page.formBtn.isPresent()).toBeTruthy();
40 });
41
42 it('should save the model', () => {
43 page.nameField.clear().sendKeys('test');
44 page.formBtn.click();
45 expect(page.nameField.getAttribute('value')).toBe('test');
46 expect(page.successFeedback.isDisplayed()).toBeTruthy();
47 browser.sleep(3000)
48 });
49 })
50 });
51});