Matteo Scandolo | d3b57a1 | 2017-04-20 14:33:04 -0700 | [diff] [blame] | 1 | const user = require('../test_helpers/user'); |
| 2 | const page = require('./crud.po'); |
| 3 | const config = require('../test_helpers/config'); |
| 4 | |
| 5 | describe('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); |
Matteo Scandolo | a4a2df7 | 2017-06-15 17:59:02 -0700 | [diff] [blame] | 20 | expect(page.tableColumn.count()).toBe(4); |
Matteo Scandolo | d3b57a1 | 2017-04-20 14:33:04 -0700 | [diff] [blame] | 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', () => { |
Matteo Scandolo | a4a2df7 | 2017-06-15 17:59:02 -0700 | [diff] [blame] | 38 | expect(page.formInputs.count()).toBe(4); |
Matteo Scandolo | d3b57a1 | 2017-04-20 14:33:04 -0700 | [diff] [blame] | 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 | }); |