codemod icon indicating copy to clipboard operation
codemod copied to clipboard

Error with sendKeys(Key.UP)

Open troppoli opened this issue 3 years ago • 2 comments

Sending 1 files to free worker...
 ERR test\e2e\pages\series-actions.ts Transformation error (Error transforming test\e2e\pages\series-actions.ts:276)
Error transforming test\e2e\pages\series-actions.ts:276

>                 await protractor.browser.actions().sendKeys(Key.UP).perform()
                        ^

Expected "proctractor.Key.XXX" as argument to the sendKeys command. Please raise an issue in the codemod repository: https://github.com/webdriverio/codemod/issues/new
  at test\e2e\pages\series-actions.ts:276:22

The interesting bit seems to be

         it('should select the series and combine', async () =>{
            
            // select the series
            let thumbnails:ElementFinder[] = await thumbs.thumbnails();
            expect(thumbnails).not.toBeUndefined();
            //reset selection to first series
            for(let i = 0 ; i < seriesCount ; i++){
                await protractor.browser.actions().sendKeys(Key.UP).perform(); 
            } 
            // scroll down to series via arrow keys
            for( let s = 0 ; s < selectedSeries ; s++ ){
                await protractor.browser.actions().sendKeys(Key.DOWN).perform();
            }
            expect(thumbnails[selectedSeries].isSelected()).toBeTruthy();
        })

troppoli avatar Jun 27 '22 14:06 troppoli

Any contributions that help transform that bit to browser.keys(...) would be much appreciated.

christian-bromann avatar Jun 27 '22 19:06 christian-bromann

Sending 1 files to free worker...
 ERR test\e2e\pages\series-actions.ts Transformation error (Error transforming test\e2e\pages\series-actions.ts:276)
Error transforming test\e2e\pages\series-actions.ts:276

>                 await protractor.browser.actions().sendKeys(Key.UP).perform()
                        ^

Expected "proctractor.Key.XXX" as argument to the sendKeys command. Please raise an issue in the codemod repository: https://github.com/webdriverio/codemod/issues/new
  at test\e2e\pages\series-actions.ts:276:22

The interesting bit seems to be

         it('should select the series and combine', async () =>{
            
            // select the series
            let thumbnails:ElementFinder[] = await thumbs.thumbnails();
            expect(thumbnails).not.toBeUndefined();
            //reset selection to first series
            for(let i = 0 ; i < seriesCount ; i++){
                await protractor.browser.actions().sendKeys(Key.UP).perform(); 
            } 
            // scroll down to series via arrow keys
            for( let s = 0 ; s < selectedSeries ; s++ ){
                await protractor.browser.actions().sendKeys(Key.DOWN).perform();
            }
            expect(thumbnails[selectedSeries].isSelected()).toBeTruthy();
        })

Hope this work around helps ( https://github.com/webdriverio/codemod/issues/45#issuecomment-1404109549 )

noobzillla avatar Jan 25 '23 19:01 noobzillla