Skip to content

Commit e35f02c

Browse files
committed
allow plugins to delete commands
1 parent b16fbc0 commit e35f02c

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

packages/selenium-ide/src/api/v1/record.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,4 +76,27 @@ router.put('/command', (req, res) => {
7676
}
7777
})
7878

79+
router.delete('/command', (req, res) => {
80+
if (!req.id) {
81+
res({ status: 'error', message: 'No id sent' })
82+
} else {
83+
const test = UiState.displayedTest
84+
if (test) {
85+
const command = test.commands.find(cmd => cmd.id === req.id)
86+
if (command) {
87+
test.removeCommand(command)
88+
res(true)
89+
} else {
90+
res({
91+
status: 'error',
92+
message:
93+
'No command with that id exists in the currently displayed test',
94+
})
95+
}
96+
} else {
97+
res({ status: 'error', message: 'No test selected' })
98+
}
99+
}
100+
})
101+
79102
export default router

0 commit comments

Comments
 (0)