03_model_test.js 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. function loadModel(client, fnames){
  2. for (const name of fnames) {
  3. console.log("Loading: " + name);
  4. client.execute(
  5. function (fname) {
  6. _loadModel(fname);
  7. }, [name], null
  8. );
  9. client.pause(1000);
  10. client.getTitle(function(title) {
  11. this.assert.ok(title.includes(name), "File: " + name + " is opened");
  12. });
  13. }
  14. }
  15. module.exports = {
  16. beforeEach : function (client) {
  17. client.url('http://localhost:8124/atompm').pause(300);
  18. },
  19. 'Login' : function (client) {
  20. client.execute(
  21. function() {
  22. UserManagement.login('testuser');
  23. }, [], null
  24. );
  25. client.pause(300);
  26. client.getTitle(function(title) {
  27. this.assert.ok(title.includes("AToMPM - [Unnamed]"), "AToMPM is opened");
  28. });
  29. },
  30. 'Load model' : function (client) {
  31. let filename = 'Formalisms/ClassicDEVS/ClassicDEVS.model';
  32. loadModel(client, [filename]);
  33. },
  34. 'Load two models' : function (client) {
  35. let filenames = [
  36. 'Formalisms/ClassicDEVS/ClassicDEVS.model',
  37. 'Formalisms/Annotation/AnnotationMM.model'
  38. ];
  39. loadModel(client, filenames);
  40. },
  41. after : function (client) {
  42. client.end();
  43. },
  44. };