blob: ed53436ce25e2dd6753c1aeed17a8b222cd6bcf6 [file] [log] [blame]
Matteo Scandolod3b57a12017-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);
Matteo Scandoloa4a2df72017-06-15 17:59:02 -070020 expect(page.tableColumn.count()).toBe(4);
Matteo Scandolod3b57a12017-04-20 14:33:04 -070021 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 Scandoloa4a2df72017-06-15 17:59:02 -070038 expect(page.formInputs.count()).toBe(4);
Matteo Scandolod3b57a12017-04-20 14:33:04 -070039 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});