Skip to content

Commit

Permalink
js: Added new tests
Browse files Browse the repository at this point in the history
Signed-off-by: Alexandru Lie <[email protected]>
  • Loading branch information
liealex committed Aug 14, 2024
1 parent d19fdf2 commit d322cc2
Showing 1 changed file with 68 additions and 8 deletions.
76 changes: 68 additions & 8 deletions js/scopyDefaultTests.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,74 @@ function connectionTest(){
disconnect()
}

function switchToolTest(){
printToConsole("TEST SWITCH TOOL")
connect()
scopy.switchTool("Time")
scopy.switchTool("DataLogger 0")
scopy.switchTool("Debugger")
disconnect()
function switchAllToolsTest() {
printToConsole("TEST SWITCH ALL TOOLS")
connect()
let compatibleTools = scopy.getTools()
for (let i = 0; i < compatibleTools.length; i++){
scopy.switchTool(compatibleTools[i])
}
disconnect()
}

function switchToolsPluginTest(plugin) {
printToConsole("TEST ALL TOOLS FROM PLUGIN")
connect()
let toolsFromPlugin = scopy.getToolsPlugin(plugin)
for (let i = 0; i < toolsFromPlugin.length; i++){
scopy.switchTool(toolsFromPlugin[i])
}
disconnect()
}

function runAllToolsTest() {
printToConsole("TEST RUN ALL TOOLS")
connect()
let compatibleTools = scopy.getTools()
for (let i = 0; i < compatibleTools.length; i++){
scopy.switchTool(compatibleTools[i])
if (scopy.getToolBtn(compatibleTools[i]))
{
scopy.runTool(compatibleTools[i], true)
scopy.runTool(compatibleTools[i], false)
}
}
disconnect()
}

function runAllPluginToolsTest(plugin) {
printToConsole("TEST RUN ALL PLUGIN TOOLS")
connect()
let compatibleTools = scopy.getToolsPlugin(plugin)
for (let i = 0; i < compatibleTools.length; i++){
scopy.switchTool(compatibleTools[i])
if (scopy.getToolBtn(compatibleTools[i]))
{
scopy.runTool(compatibleTools[i], true)
scopy.runTool(compatibleTools[i], false)
}
}
disconnect()
}

function saveTest(fileName) {
printToConsole("TEST SAVE")
connect()
scopy.saveSetup(fileName)
disconnect()
}

function loadTest(fileName) {
printToConsole("TEST LOAD")
connect()
scopy.loadSetup(fileName)
disconnect()
}

connectionTest()
switchToolTest()
switchAllToolsTest()
switchToolsPluginTest("DataLoggerPlugin")
runAllToolsTest()
runAllPluginToolsTest("DataLoggerPlugin")
saveTest("testFile")
loadTest("testFile")

0 comments on commit d322cc2

Please sign in to comment.