1
1
import { addresses } from '../fixtures/accounts'
2
+ import { accountDisplay } from '../support/page-objects/components/accountDisplay'
2
3
import { landingPageUrl , settingsPageWatchAccountUrl } from '../fixtures/landingData'
3
4
import { landingPage } from '../support/page-objects/landingPage'
4
5
import { settingsPage } from '../support/page-objects/settingsPage'
6
+ import { topMenuItems } from '../support/page-objects/topMenuItems'
7
+ import { watchMultisigs } from '../fixtures/watchAccounts/watchMultisigs'
8
+ import { multisigPage } from '../support/page-objects/multisigPage'
9
+ import { editNamesModal } from '../support/page-objects/modals/editNamesModal'
5
10
6
11
const addWatchAccount = ( address : string , name ?: string ) => {
7
12
settingsPage . accountAddressInput ( ) . type ( `${ address } {enter}` , { delay : 20 } )
@@ -19,9 +24,9 @@ describe('Watched Accounts', () => {
19
24
landingPage . watchAccountButton ( ) . click ( )
20
25
addWatchAccount ( addresses . Alice , 'Alice' )
21
26
settingsPage . accountContainer ( ) . within ( ( ) => {
22
- settingsPage . accountIcon ( ) . should ( 'be.visible' )
23
- settingsPage . accountAddressLabel ( ) . should ( 'be.visible' )
24
- settingsPage . accountNameLabel ( ) . should ( 'be.visible' )
27
+ accountDisplay . identicon ( ) . should ( 'be.visible' )
28
+ accountDisplay . addressLabel ( ) . should ( 'be.visible' )
29
+ accountDisplay . nameLabel ( ) . should ( 'be.visible' )
25
30
settingsPage . accountDeleteButton ( ) . should ( 'be.visible' )
26
31
} )
27
32
} )
@@ -33,8 +38,8 @@ describe('Watched Accounts', () => {
33
38
// now remove it
34
39
settingsPage . accountContainer ( ) . within ( ( ) => {
35
40
settingsPage . accountDeleteButton ( ) . click ( )
36
- settingsPage . accountIcon ( ) . should ( 'not.exist' )
37
- settingsPage . accountAddressLabel ( ) . should ( 'not.exist' )
41
+ accountDisplay . identicon ( ) . should ( 'not.exist' )
42
+ accountDisplay . addressLabel ( ) . should ( 'not.exist' )
38
43
} )
39
44
settingsPage . accountContainer ( ) . should ( 'have.length' , 0 )
40
45
} )
@@ -58,4 +63,127 @@ describe('Watched Accounts', () => {
58
63
settingsPage . accountContainer ( ) . should ( 'have.length' , 0 )
59
64
settingsPage . addButton ( ) . should ( 'be.disabled' )
60
65
} )
66
+
67
+ it ( 'can see the expected account details displayed for a watched multisig' , ( ) => {
68
+ cy . visit ( settingsPageWatchAccountUrl )
69
+ addWatchAccount (
70
+ watchMultisigs [ 'multisig-without-pure' ] . address ,
71
+ watchMultisigs [ 'multisig-without-pure' ] . name
72
+ )
73
+ // ensure the multisig name is displayed in the settings account container
74
+ settingsPage . accountContainer ( ) . within ( ( ) => {
75
+ accountDisplay . identicon ( ) . should ( 'be.visible' )
76
+ accountDisplay
77
+ . nameLabel ( )
78
+ . should ( 'be.visible' )
79
+ . should ( 'have.text' , watchMultisigs [ 'multisig-without-pure' ] . name )
80
+ } )
81
+ // ensure the name is included in the selectable drop-down option
82
+ topMenuItems . multiproxySelector ( ) . should ( 'be.visible' ) . first ( ) . click ( )
83
+ topMenuItems . multiproxySelectorOption ( ) . within ( ( ) => {
84
+ accountDisplay . identicon ( ) . should ( 'be.visible' )
85
+ accountDisplay . multisigBadge ( ) . should ( 'be.visible' )
86
+ accountDisplay . pureBadge ( ) . should ( 'not.exist' )
87
+ accountDisplay . nameLabel ( ) . should ( 'have.text' , watchMultisigs [ 'multisig-without-pure' ] . name )
88
+ } )
89
+ // ensure the name is displayed in the home page header
90
+ topMenuItems . homeButton ( ) . click ( )
91
+ multisigPage . accountHeader ( ) . within ( ( ) => {
92
+ accountDisplay . identicon ( ) . should ( 'be.visible' )
93
+ accountDisplay . multisigBadge ( ) . should ( 'be.visible' )
94
+ accountDisplay . pureBadge ( ) . should ( 'not.exist' )
95
+ accountDisplay . nameLabel ( ) . should ( 'have.text' , watchMultisigs [ 'multisig-without-pure' ] . name )
96
+ } )
97
+ } )
98
+
99
+ it ( 'can see the expected account details displayed for a watched pure' , ( ) => {
100
+ cy . visit ( settingsPageWatchAccountUrl )
101
+ addWatchAccount (
102
+ watchMultisigs [ 'multisig-with-pure' ] . pureAddress ,
103
+ watchMultisigs [ 'multisig-with-pure' ] . name
104
+ )
105
+ // ensure the multisig name is displayed in the settings account container
106
+ settingsPage . accountContainer ( ) . within ( ( ) => {
107
+ accountDisplay . identicon ( ) . should ( 'be.visible' )
108
+ accountDisplay
109
+ . nameLabel ( )
110
+ . should ( 'be.visible' )
111
+ . should ( 'have.text' , watchMultisigs [ 'multisig-with-pure' ] . name )
112
+ } )
113
+ // ensure the name is included in the selectable drop-down option
114
+ topMenuItems . multiproxySelector ( ) . should ( 'be.visible' ) . first ( ) . click ( )
115
+ topMenuItems . multiproxySelectorOption ( ) . within ( ( ) => {
116
+ accountDisplay . identicon ( ) . should ( 'be.visible' )
117
+ accountDisplay . pureBadge ( ) . should ( 'be.visible' )
118
+ accountDisplay . multisigBadge ( ) . should ( 'not.exist' )
119
+ accountDisplay . nameLabel ( ) . should ( 'have.text' , watchMultisigs [ 'multisig-with-pure' ] . name )
120
+ } )
121
+ // navigate to the multisig page and ensure the name is included in the home page header
122
+ topMenuItems . homeButton ( ) . click ( )
123
+ multisigPage . accountHeader ( ) . within ( ( ) => {
124
+ accountDisplay . identicon ( ) . should ( 'be.visible' )
125
+ accountDisplay . pureBadge ( ) . should ( 'be.visible' )
126
+ accountDisplay . multisigBadge ( ) . should ( 'not.exist' )
127
+ accountDisplay . nameLabel ( ) . should ( 'have.text' , watchMultisigs [ 'multisig-with-pure' ] . name )
128
+ } )
129
+ } )
130
+
131
+ it ( 'can edit the name of a watched pure' , ( ) => {
132
+ cy . visit ( settingsPageWatchAccountUrl )
133
+ addWatchAccount (
134
+ watchMultisigs [ 'multisig-with-pure' ] . pureAddress ,
135
+ watchMultisigs [ 'multisig-with-pure' ] . name
136
+ )
137
+ // navigate to the home page and edit the name
138
+ topMenuItems . homeButton ( ) . click ( )
139
+ multisigPage . optionsMenuButton ( ) . click ( )
140
+ multisigPage . editNamesMenuOption ( ) . click ( )
141
+ editNamesModal . body ( ) . should ( 'be.visible' )
142
+ cy . clock ( )
143
+ editNamesModal . inputEditPureName ( ) . type ( `{selectall}{del}${ `Edited Name Test` } ` )
144
+ // name edition is debounced by 300ms
145
+ cy . tick ( 300 )
146
+ editNamesModal . saveButton ( ) . should ( 'be.enabled' ) . click ( )
147
+ // ensure the edited name is now displayed in the home page header
148
+ multisigPage . accountHeader ( ) . within ( ( ) => {
149
+ accountDisplay . nameLabel ( ) . should ( 'have.text' , 'Edited Name Test' )
150
+ } )
151
+ // navigate to settings and ensure the edited name is displayed
152
+ cy . visit ( settingsPageWatchAccountUrl )
153
+ settingsPage . accountContainer ( ) . within ( ( ) => {
154
+ accountDisplay . nameLabel ( ) . should ( 'have.text' , 'Edited Name Test' )
155
+ } )
156
+ } )
157
+
158
+ it ( 'can open the correct subscan link for a watched pure' , ( ) => {
159
+ cy . visit ( settingsPageWatchAccountUrl )
160
+ addWatchAccount (
161
+ watchMultisigs [ 'multisig-with-pure' ] . pureAddress ,
162
+ watchMultisigs [ 'multisig-with-pure' ] . name
163
+ )
164
+ topMenuItems . homeButton ( ) . click ( )
165
+ multisigPage . optionsMenuButton ( ) . click ( )
166
+ multisigPage . subscanMenuOption ( ) . should ( 'be.visible' )
167
+ // stub window.open to prevent opening a new tab
168
+ cy . window ( ) . then ( ( win ) => {
169
+ cy . stub ( win , 'open' ) . as ( 'open' )
170
+ } )
171
+ multisigPage . subscanMenuOption ( ) . click ( )
172
+ // ensure the correct subscan url is opened
173
+ cy . get ( '@open' ) . should (
174
+ 'have.been.calledOnceWith' ,
175
+ `https://rococo.subscan.io/account/${ watchMultisigs [ 'multisig-with-pure' ] . pureAddress } `
176
+ )
177
+ } )
178
+
179
+ it ( 'can not see the "New Transaction" button when only a watched account' , ( ) => {
180
+ cy . visit ( settingsPageWatchAccountUrl )
181
+ addWatchAccount (
182
+ watchMultisigs [ 'multisig-with-pure' ] . pureAddress ,
183
+ watchMultisigs [ 'multisig-with-pure' ] . name
184
+ )
185
+ topMenuItems . homeButton ( ) . click ( )
186
+ multisigPage . accountHeader ( ) . should ( 'be.visible' )
187
+ multisigPage . newTransactionButton ( ) . should ( 'not.exist' )
188
+ } )
61
189
} )
0 commit comments