Skip to content

Commit 31e8df7

Browse files
committed
Merge branch master into callstack
2 parents cc1c17a + b6542f9 commit 31e8df7

File tree

3 files changed

+29
-1
lines changed

3 files changed

+29
-1
lines changed

packages/selenium-ide/src/neo/IO/legacy/migrate.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,9 +118,11 @@ export function migrateTestCase(data) {
118118
const sanitized = sanitizeXml(data);
119119
const result = JSON.parse(convert.xml2json(sanitized, { compact: true }));
120120
const baseUrl = result.html.head.link._attributes.href;
121+
let tr = result.html.body.table.tbody.tr;
122+
tr = Array.isArray(tr) ? tr : [tr];
121123
const test = {
122124
name: result.html.body.table.thead.tr.td._text,
123-
commands: result.html.body.table.tbody.tr.filter(row => (row.td[0]._text && !/^wait/.test(row.td[0]._text))).map(row => (
125+
commands: tr.filter(row => (row.td[0]._text && !/^wait/.test(row.td[0]._text))).map(row => (
124126
{
125127
command: row.td[0]._text && row.td[0]._text.replace("AndWait", ""),
126128
target: xmlunescape(parseTarget(row.td[1])),
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
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>

packages/selenium-ide/src/neo/__test__/IO/legacy/migrate.spec.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff 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

7984
describe("selenium suite migration", () => {

0 commit comments

Comments
 (0)