Skip to content

Commit 1ac8cdb

Browse files
committed
skips empty commands when saving
1 parent acdf3f5 commit 1ac8cdb

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

packages/selenium-ide/src/neo/IO/SideeX/playback.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,10 @@ function executionLoop() {
5555
// reached the end
5656
if (PlaybackState.currentPlayingIndex >= PlaybackState.runningQueue.length && PlaybackState.isPlaying) return false;
5757
const { id, command, target, value, isBreakpoint } = PlaybackState.runningQueue[PlaybackState.currentPlayingIndex];
58+
// is command empty?
59+
if (!command) {
60+
return executionLoop();
61+
}
5862
// breakpoint
5963
PlaybackState.setCommandState(id, PlaybackStates.Pending);
6064
if (!ignoreBreakpoint && isBreakpoint) PlaybackState.break();

packages/selianize/__tests__/command.spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@ import CommandEmitter from "../src/command";
1919
import { CommandsArray } from "../../selenium-ide/src/neo/models/Command";
2020

2121
describe("command code emitter", () => {
22-
it("should fail to emit with no command", () => {
22+
it("should skip empty commands", () => {
2323
const command = {
2424
command: "",
2525
target: "",
2626
value: ""
2727
};
28-
return expect(CommandEmitter.emit(command)).rejects.toThrow("Command can not be empty");
28+
return expect(CommandEmitter.emit(command)).resolves.toBeUndefined();
2929
});
3030
it("should fail to emit unknown command", () => {
3131
const command = {

packages/selianize/src/command.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,11 @@ export function emit(command) {
9494
rej(e);
9595
}
9696
} else {
97-
rej(command.command ? `Unknown command ${command.command}` : "Command can not be empty");
97+
if (!command.command) {
98+
res();
99+
} else {
100+
rej(`Unknown command ${command.command}`);
101+
}
98102
}
99103
});
100104
}

0 commit comments

Comments
 (0)