@@ -11,25 +11,24 @@ describe('Account Management', () => {
11
11
const path = '#/accounts' ;
12
12
before ( ( ) => helpers . navigate ( path ) ) ;
13
13
14
- const INITIAL_ACCOUNTS = 28 ;
15
- const NUM_ADDED_ACCOUNTS = 4 ;
14
+ const INITIAL_ACCOUNTS = 31 ;
16
15
17
16
// this is an account at the top of the grid - until this test is improved it relies
18
17
// on the account being visible to verify each test
19
18
const assetAccountGroup = {
20
19
id : 9 ,
21
- numberOfChildren : 21 ,
20
+ child_id : 74 , // this is an id of a child account in the group with id 9
22
21
} ;
23
22
24
23
const account = {
25
- id : 171 ,
26
- number : 41111000 ,
24
+ id : 90 ,
25
+ number : 10911010 ,
27
26
type : 'Titre' ,
28
- label : 'End to End Test Debtor Account ' ,
29
- parent : { number : 4011 } ,
27
+ label : 'Actionnaire, Capital souscrit, non appelé * ' ,
28
+ parent : { number : 1091 } ,
30
29
} ;
31
30
32
- const deletingAccount = '3645' ;
31
+ const DELETE_ACCOUNT_ID = 87 ;
33
32
34
33
const page = new AccountsPage ( ) ;
35
34
@@ -38,22 +37,22 @@ describe('Account Management', () => {
38
37
} ) ;
39
38
40
39
it ( 'expands and collapses title accounts on title click' , ( ) => {
40
+ page . expectRowVisible ( assetAccountGroup . child_id ) ;
41
41
page . toggleTitleRow ( assetAccountGroup . id ) ;
42
- page . expectGridRows ( INITIAL_ACCOUNTS - assetAccountGroup . numberOfChildren ) ;
42
+ page . expectRowHidden ( assetAccountGroup . child_id ) ;
43
43
page . toggleTitleRow ( assetAccountGroup . id ) ;
44
- page . expectGridRows ( INITIAL_ACCOUNTS ) ;
45
44
} ) ;
46
45
47
46
it ( 'create state populates parent field through in-line create' , ( ) => {
48
47
page . openAddChild ( account . id ) ;
49
48
50
49
// this relies on the account select to display the account with account number
51
- expect ( page . EditModal . parent ( ) ) . to . eventually . include ( account . number ) ;
50
+ expect ( page . EditModal . parent ( ) ) . to . eventually . include ( account . parent . number ) ;
52
51
} ) ;
53
52
54
53
it ( 'creates a single account' , ( ) => {
55
- FU . input ( 'AccountEditCtrl.account.number' , '41111013 ' ) ;
56
- FU . input ( 'AccountEditCtrl.account.label' , 'IMA World Health' ) ;
54
+ FU . input ( 'AccountEditCtrl.account.number' , '41111019 ' ) ;
55
+ FU . input ( 'AccountEditCtrl.account.label' , 'IMA World Health Account ' ) ;
57
56
58
57
// FIXME(@jniles) - relies on french translation
59
58
FU . select ( 'AccountEditCtrl.account.type_id' , 'Titre' ) . click ( ) ;
@@ -64,16 +63,16 @@ describe('Account Management', () => {
64
63
65
64
it ( 'edit state populates account data on clicking edit' , ( ) => {
66
65
page . openEdit ( account . id ) ;
67
- expect ( element ( by . id ( 'number-static' ) ) . getText ( ) ) . to . eventually . equal ( String ( account . number ) ) ;
66
+ expect ( element ( by . id ( 'number-static' ) ) . getText ( ) ) . to . eventually . equal ( String ( account . parent . number ) ) ;
68
67
69
68
// @todo removed to allow types to be updated - this should be reintroduced
70
69
// expect(element(by.id('type-static')).getText()).to.eventually.equal(account.type);
71
70
expect ( element ( by . model ( 'AccountEditCtrl.account.label' ) ) . getAttribute ( 'value' ) ) . to . eventually . equal ( account . label ) ;
72
71
} ) ;
73
72
74
73
it ( 'updates an account title and parent' , ( ) => {
75
- FU . input ( 'AccountEditCtrl.account.label' , 'Updated inventory accounts ' ) ;
76
- FU . uiSelect ( 'AccountEditCtrl.account.parent' , 'Test Income ' ) ;
74
+ FU . input ( 'AccountEditCtrl.account.label' , 'Updated Inventory Accounts ' ) ;
75
+ FU . uiSelect ( 'AccountEditCtrl.account.parent' , 'Medicaments ' ) ;
77
76
FU . modal . submit ( ) ;
78
77
79
78
components . notification . hasSuccess ( ) ;
@@ -97,6 +96,9 @@ describe('Account Management', () => {
97
96
98
97
FU . buttons . create ( ) ;
99
98
99
+ // expect the modal to open
100
+ FU . exists ( by . css ( '[uib-modal-window]' ) , true ) ;
101
+
100
102
// set modal to create any number of accounts
101
103
page . toggleBatchCreate ( ) ;
102
104
select . $ ( '[data-key="ACCOUNT.TYPES.TITLE"]' ) . click ( ) ;
@@ -116,21 +118,19 @@ describe('Account Management', () => {
116
118
components . notification . hasSuccess ( ) ;
117
119
} ) ;
118
120
119
- it ( 'displays all created accounts with model refresh' , ( ) => {
120
- browser . refresh ( ) ;
121
- page . expectGridRows ( INITIAL_ACCOUNTS + NUM_ADDED_ACCOUNTS ) ;
122
- } ) ;
123
-
124
121
// generic function to create an account in the modal
125
122
function createAccount ( accnt ) {
126
123
FU . input ( 'AccountEditCtrl.account.number' , accnt . number ) ;
127
124
FU . input ( 'AccountEditCtrl.account.label' , accnt . label ) ;
128
125
FU . modal . submit ( ) ;
129
126
}
130
127
131
- // Delete a specific Account
128
+ // delete a specific account
132
129
it ( 'can delete a specific account' , ( ) => {
133
- page . openEdit ( deletingAccount ) ;
130
+ // FIXME(@jniles) - account page does not refresh the grid on updates
131
+ browser . refresh ( ) ;
132
+
133
+ page . openEdit ( DELETE_ACCOUNT_ID ) ;
134
134
135
135
FU . buttons . delete ( ) ;
136
136
components . modalAction . confirm ( ) ;
@@ -142,6 +142,6 @@ describe('Account Management', () => {
142
142
page . openEdit ( assetAccountGroup . id ) ;
143
143
FU . buttons . delete ( ) ;
144
144
components . modalAction . confirm ( ) ;
145
- expect ( element . all ( by . css ( '[alert alert-danger ]' ) ) ) ;
145
+ FU . exists ( by . css ( '[data-submit-error ]' ) , true ) ;
146
146
} ) ;
147
147
} ) ;
0 commit comments