File tree Expand file tree Collapse file tree 3 files changed +29
-1
lines changed
packages/selenium-ide/src/neo Expand file tree Collapse file tree 3 files changed +29
-1
lines changed Original file line number Diff line number Diff line change @@ -117,9 +117,11 @@ export function migrateTestCase(data) {
117117 const sanitized = sanitizeXml ( data ) ;
118118 const result = JSON . parse ( convert . xml2json ( sanitized , { compact : true } ) ) ;
119119 const baseUrl = result . html . head . link . _attributes . href ;
120+ let tr = result . html . body . table . tbody . tr ;
121+ tr = Array . isArray ( tr ) ? tr : [ tr ] ;
120122 const test = {
121123 name : result . html . body . table . thead . tr . td . _text ,
122- commands : result . html . body . table . tbody . tr . filter ( row => ( row . td [ 0 ] . _text && ! / ^ w a i t / . test ( row . td [ 0 ] . _text ) ) ) . map ( row => (
124+ commands : tr . filter ( row => ( row . td [ 0 ] . _text && ! / ^ w a i t / . test ( row . td [ 0 ] . _text ) ) ) . map ( row => (
123125 {
124126 command : row . td [ 0 ] . _text && row . td [ 0 ] . _text . replace ( "AndWait" , "" ) ,
125127 target : xmlunescape ( parseTarget ( row . td [ 1 ] ) ) ,
Original file line number Diff line number Diff line change 1+ < ?xml version="1.0" encoding="UTF-8"?>
2+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3+ < html xmlns ="http://www.w3.org/1999/xhtml " xml:lang ="en " lang ="en ">
4+ < head profile ="http://selenium-ide.openqa.org/profiles/test-case ">
5+ < meta http-equiv ="Content-Type " content ="text/html; charset=UTF-8 " />
6+ < link rel ="selenium.base " href ="https://stage.local.com/ " />
7+ < title > Log in as test user</ title >
8+ </ head >
9+ < body >
10+ < table cellpadding ="1 " cellspacing ="1 " border ="1 ">
11+ < thead >
12+ < tr > < td rowspan ="1 " colspan ="3 "> A command</ td > </ tr >
13+ </ thead > < tbody >
14+ < tr >
15+ < td > open</ td >
16+ < td > /</ td >
17+ < td > </ td >
18+ </ tr >
19+ </ tbody > </ table >
20+ </ body >
21+ </ html >
Original file line number Diff line number Diff line change @@ -74,6 +74,11 @@ describe("selenium test case migration", () => {
7474 const { test } = migrateTestCase ( file ) ;
7575 expect ( test . commands . length ) . toBe ( 2 ) ;
7676 } ) ;
77+ it ( "should import a test case with a command in it" , ( ) => {
78+ const file = fs . readFileSync ( path . join ( __dirname , "IDE_test_10.html" ) ) . toString ( ) ;
79+ const { test } = migrateTestCase ( file ) ;
80+ expect ( test . commands . length ) . toBe ( 1 ) ;
81+ } ) ;
7782} ) ;
7883
7984describe ( "selenium suite migration" , ( ) => {
You can’t perform that action at this time.
0 commit comments