@@ -13,6 +13,7 @@ const formErrors = {
1313 ] ,
1414 linkDescription : "max-80-characters-error" ,
1515 email : "invalid-email-address-error" ,
16+ image : "invalid-image-url-error" ,
1617 links : {
1718 url : "link-reference-description-1-error" ,
1819 description : "link-reference-description-1-error" ,
@@ -59,6 +60,9 @@ export default class DRepForm {
5960 readonly motivationsInput = this . form . getByTestId ( "motivations-input" ) ;
6061 readonly qualificationsInput = this . form . getByTestId ( "qualifications-input" ) ;
6162 readonly paymentAddressInput = this . form . getByTestId ( "payment-address-input" ) ;
63+ readonly imageInput = this . form . locator (
64+ "div:nth-child(4) > div:nth-child(2) > input"
65+ ) ; // BUG missing test id
6266 readonly doNotListCheckBox = this . form . getByRole ( "checkbox" ) ;
6367
6468 constructor ( private readonly form : Page ) { }
@@ -149,6 +153,7 @@ export default class DRepForm {
149153 await this . motivationsInput . fill ( dRepInfo . motivations ) ;
150154 await this . qualificationsInput . fill ( dRepInfo . qualifications ) ;
151155 await this . paymentAddressInput . fill ( dRepInfo . paymentAddress ) ;
156+ await this . imageInput . fill ( dRepInfo . image ) ;
152157 await this . linkRefrenceFirstUrlInput . fill (
153158 dRepInfo . linksReferenceLinks [ 0 ] . url
154159 ) ;
@@ -175,6 +180,9 @@ export default class DRepForm {
175180 const motivationsInputText = await this . motivationsInput . textContent ( ) ;
176181 const qualificationsInputText =
177182 await this . qualificationsInput . textContent ( ) ;
183+ const isImageErrorVisible = await this . form
184+ . getByTestId ( formErrors . image )
185+ . isVisible ( ) ;
178186 const isReferenceLinkErrorVisible = await this . form
179187 . getByTestId ( formErrors . links . url )
180188 . isVisible ( ) ;
@@ -202,6 +210,10 @@ export default class DRepForm {
202210 `${ dRepInfo . qualifications } is not equal to ${ qualificationsInputText } ` ,
203211 } ) . toEqual ( dRepInfo . qualifications ) ;
204212
213+ await expect ( this . form . getByTestId ( formErrors . image ) , {
214+ message : isImageErrorVisible && `${ dRepInfo . image } is an invalid image` ,
215+ } ) . toBeHidden ( ) ;
216+
205217 await expect ( this . form . getByTestId ( formErrors . links . url ) , {
206218 message :
207219 isReferenceLinkErrorVisible &&
@@ -246,6 +258,9 @@ export default class DRepForm {
246258 const motivationsInputText = await this . motivationsInput . textContent ( ) ;
247259 const qualificationsInputText =
248260 await this . qualificationsInput . textContent ( ) ;
261+ const isImageErrorVisible = await this . form
262+ . getByTestId ( formErrors . image )
263+ . isVisible ( ) ;
249264 const isReferenceLinkErrorVisible = await this . form
250265 . getByTestId ( formErrors . links . url )
251266 . isVisible ( ) ;
@@ -284,6 +299,12 @@ export default class DRepForm {
284299 `${ dRepInfo . qualifications } is equal to ${ qualificationsInputText } ` ,
285300 } ) . not . toEqual ( dRepInfo . qualifications ) ;
286301
302+ await expect ( this . form . getByTestId ( formErrors . image ) , {
303+ message : ! isImageErrorVisible && `${ dRepInfo . image } is a valid image` ,
304+ } ) . toBeVisible ( {
305+ timeout : 60_000 ,
306+ } ) ;
307+
287308 await expect ( this . form . getByTestId ( formErrors . links . url ) , {
288309 message :
289310 ! isReferenceLinkErrorVisible &&
0 commit comments