File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed
x-pack/test/functional/services/ml Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -35,6 +35,7 @@ export function MachineLearningCommonUIProvider({ getService }: FtrProviderConte
3535 // clicking on the testSubject
3636 const input = await find . activeElement ( ) ;
3737
38+ // make sure that clearing the element's value works
3839 await retry . tryForTime ( 5000 , async ( ) => {
3940 let currentValue = await input . getAttribute ( 'value' ) ;
4041 if ( currentValue !== '' ) {
@@ -53,6 +54,7 @@ export function MachineLearningCommonUIProvider({ getService }: FtrProviderConte
5354 }
5455 } ) ;
5556
57+ // make sure that typing a character really adds that character to the input value
5658 for ( const chr of text ) {
5759 await retry . tryForTime ( 5000 , async ( ) => {
5860 const oldValue = await input . getAttribute ( 'value' ) ;
@@ -70,6 +72,16 @@ export function MachineLearningCommonUIProvider({ getService }: FtrProviderConte
7072 } ) ;
7173 } ) ;
7274 }
75+
76+ // make sure that finally the complete text is entered
77+ // this is needed because sometimes the field value is reset while typing
78+ // and the above character checking might not catch it due to bad timing
79+ const currentValue = await input . getAttribute ( 'value' ) ;
80+ if ( currentValue !== text ) {
81+ throw new Error (
82+ `Expected input '${ selector } ' to have the value '${ text } ' (got ${ currentValue } )`
83+ ) ;
84+ }
7385 } ) ;
7486 } ,
7587
You can’t perform that action at this time.
0 commit comments