Skip to content

Commit

Permalink
tests
Browse files Browse the repository at this point in the history
  • Loading branch information
arkpar committed Apr 17, 2015
1 parent dccec4b commit ebac623
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
10 changes: 10 additions & 0 deletions test/qml/TestMain.qml
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,20 @@ TestCase
ts.keyPressChar(mainApplication, "S", Qt.ControlModifier, 200); //Ctrl+S
}

function waitForMining()
{
while (mainApplication.clientModel.mining)
ts.waitForSignal(mainApplication.clientModel, "miningComplete()", 5000);
wait(1); //allow events to propagate 2 times for transaction log to be updated
wait(1);
}

function waitForExecution()
{
while (mainApplication.clientModel.running)
ts.waitForSignal(mainApplication.clientModel, "runComplete()", 5000);
wait(1); //allow events to propagate 2 times for transaction log to be updated
wait(1);
}

function editHtml(c)
Expand All @@ -89,6 +98,7 @@ TestCase
function test_dbg_vm() { TestDebugger.test_vmDebugging(); }
function test_miner_getDefaultiner() { TestMiner.test_getDefaultMiner(); }
function test_miner_selectMiner() { TestMiner.test_selectMiner(); }
function test_miner_mine() { TestMiner.test_mine(); }
function test_project_contractRename() { TestProject.test_contractRename(); }
}

10 changes: 10 additions & 0 deletions test/qml/js/TestMiner.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,13 @@ function test_selectMiner()
compare(state.miner.secret, account.secret);
}

function test_mine()
{
newProject();
mainApplication.mainContent.startQuickDebugging();
waitForExecution();
mainApplication.clientModel.mine();
waitForMining();
tryCompare(mainApplication.mainContent.rightPane.transactionLog.transactionModel.get(3), "contract", " - Block - ");
}

4 changes: 2 additions & 2 deletions test/qml/js/TestProject.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
function test_contractRename()
{
newProject();
waitForExecution();
tryCompare(mainApplication.mainContent.projectNavigator.sections.itemAt(0).model.get(0), "name", "Contract");
editContract("contract Renamed {}");
mainApplication.mainContent.startQuickDebugging();
waitForExecution();
wait(1000);
tryCompare(mainApplication.mainContent.rightPane.transactionLog.transactionModel.get(2), "contract", "Renamed");
tryCompare(mainApplication.mainContent.projectNavigator.sections.itemAt(0).model.get(0), "name", "Renamed");
mainApplication.projectModel.stateListModel.editState(0);
mainApplication.projectModel.stateDialog.model.editTransaction(2);
Expand All @@ -14,5 +15,4 @@ function test_contractRename()
tryCompare(transactionDialog, "functionId", "Renamed");
transactionDialog.close();
mainApplication.projectModel.stateDialog.close();
tryCompare(mainApplication.mainContent.rightPane.transactionLog.transactionModel.get(2), "contract", "Renamed");
}

0 comments on commit ebac623

Please sign in to comment.