Skip to content

Commit

Permalink
#63 - extending check step for auto test assertions
Browse files Browse the repository at this point in the history
WIP - more details at #63

- increment test assertions count for check step
- required for total assertions number to tally
- otherwise a dubious assertion error will appear
- update on ’test.’ string to prevent replacement when run with test
option
  • Loading branch information
kensoh committed Oct 29, 2017
1 parent 25d48fc commit adc4955
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/tagui_header.js
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,7 @@ if ((raw_intent.substr(0,7) == 'switch ') || (raw_intent.substr(0,5) == 'case ')
if ((raw_intent.substr(0,6) == 'break;') || (raw_intent.substr(0,9) == 'function ')) return true;
if ((raw_intent.substr(0,7) == 'casper.') || (raw_intent.substr(0,5) == 'this.')) return true;
if (raw_intent.substr(0,7) == 'chrome.') return true; // chrome object for chrome integration
if (raw_intent.substr(0,5) == 'test.') return true;
if (raw_intent.substr(0,5) == ('test'+'.')) return true; // avoid replacement with test option
if ((raw_intent.substr(0,2) == '//') || (raw_intent.charAt(raw_intent.length-1) == ';')) return true;
// assume = is assignment statement, kinda acceptable as this is checked at the very end
if (raw_intent.indexOf('=') > -1) return true; return false;}
Expand Down
4 changes: 2 additions & 2 deletions src/tagui_parse.php
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ function get_intent($raw_intent) {$lc_raw_intent = strtolower($raw_intent);
if (substr($lc_raw_intent,0,6)=="table ") return "table";
if (substr($lc_raw_intent,0,5)=="wait ") return "wait";
if (substr($lc_raw_intent,0,5)=="live ") return "live";
if (substr($lc_raw_intent,0,6)=="check ") return "check";
if (substr($lc_raw_intent,0,6)=="check ") {$GLOBALS['test_automation']++; return "check";}
if (substr($lc_raw_intent,0,5)=="test ") return "test";
if (substr($lc_raw_intent,0,6)=="frame ") return "frame";
if (substr($lc_raw_intent,0,6)=="popup ") return "popup";
Expand Down Expand Up @@ -237,7 +237,7 @@ function get_intent($raw_intent) {$lc_raw_intent = strtolower($raw_intent);
if ($lc_raw_intent=="table") return "table";
if ($lc_raw_intent=="wait") return "wait";
if ($lc_raw_intent=="live") return "live";
if ($lc_raw_intent=="check") return "check";
if ($lc_raw_intent=="check") {$GLOBALS['test_automation']++; return "check";}
if ($lc_raw_intent=="test") return "test";
if ($lc_raw_intent=="frame") return "frame";
if ($lc_raw_intent=="popup") return "popup";
Expand Down
6 changes: 3 additions & 3 deletions src/test/positive_test
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
https://www.google.com
// code to auto-replace local path names in generated js file with /full_path
var fs = require('fs');
var js_result = fs.read('test' + fs.separator + 'positive_test.js');
var js_result = fs.read('test' + fs.separator + 'positive_test' + '.js');
var local_path = js_result.substring(js_result.indexOf("var flow_path = '") + 17);
local_path = local_path.substring(0,local_path.indexOf("'"));
var regex = new RegExp(local_path,"g"); js_result = js_result.replace(regex,"/full_path");
fs.write('test' + fs.separator + 'positive_test.js', js_result, 'w');
fs.remove('test' + fs.separator + 'positive_test.log');
fs.write('test' + fs.separator + 'positive_test' + '.js', js_result, 'w');
fs.remove('test' + fs.separator + 'positive_test' + '.log');
this.exit(); // don't actually run the steps and code, test is for language conversion
// add a navigation step in order to exit in time and block below output from running
https://ca.yahoo.com
Expand Down
8 changes: 4 additions & 4 deletions src/test/positive_test.signature
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,7 @@ if ((raw_intent.substr(0,7) == 'switch ') || (raw_intent.substr(0,5) == 'case ')
if ((raw_intent.substr(0,6) == 'break;') || (raw_intent.substr(0,9) == 'function ')) return true;
if ((raw_intent.substr(0,7) == 'casper.') || (raw_intent.substr(0,5) == 'this.')) return true;
if (raw_intent.substr(0,7) == 'chrome.') return true; // chrome object for chrome integration
if (raw_intent.substr(0,5) == 'test.') return true;
if (raw_intent.substr(0,5) == ('test'+'.')) return true; // avoid replacement with test option
if ((raw_intent.substr(0,2) == '//') || (raw_intent.charAt(raw_intent.length-1) == ';')) return true;
// assume = is assignment statement, kinda acceptable as this is checked at the very end
if (raw_intent.indexOf('=') > -1) return true; return false;}
Expand Down Expand Up @@ -848,12 +848,12 @@ techo('https://www.google.com' + ' - ' + this.getTitle() + '\n');});
casper.then(function() {
// code to auto-replace local path names in generated js file with /full_path
var fs = require('fs');
var js_result = fs.read('test' + fs.separator + 'positive_test.js');
var js_result = fs.read('test' + fs.separator + 'positive_test' + '.js');
var local_path = js_result.substring(js_result.indexOf("var flow_path = '") + 17);
local_path = local_path.substring(0,local_path.indexOf("'"));
var regex = new RegExp(local_path,"g"); js_result = js_result.replace(regex,"/full_path");
fs.write('test' + fs.separator + 'positive_test.js', js_result, 'w');
fs.remove('test' + fs.separator + 'positive_test.log');
fs.write('test' + fs.separator + 'positive_test' + '.js', js_result, 'w');
fs.remove('test' + fs.separator + 'positive_test' + '.log');
this.exit(); // don't actually run the steps and code, test is for language conversion
// add a navigation step in order to exit in time and block below output from running
});casper.thenOpen('https://ca.yahoo.com', function() {
Expand Down

0 comments on commit adc4955

Please sign in to comment.