Permalink
Browse files

add phantomjs test

  • Loading branch information...
1 parent 8b23e62 commit 1c3cfc30ce8ff964a17c09b68bb42bbc6b09081a @hotchpotch hotchpotch committed Mar 4, 2011
Showing with 24 additions and 0 deletions.
  1. +24 −0 test-phantomjs.js
View
@@ -0,0 +1,24 @@
+
+if (phantom.state.length === 0) {
+ phantom.state = 'test-phantomejs';
+ phantom.open('./test.html');
+} else {
+ if (phantom.loadStatus === 'success') {
+ window.setInterval(function () {
+ var list, i, text;
+ list = document.body.querySelectorAll('#results > tbody > tr');
+ for (i = 0; i < list.length; ++i) {
+ text = list[i].innerText.replace(/[\n]/, '');
+ if (text.length > 1)
+ console.log(text);
+ list[i].parentNode.removeChild(list[i]);
+ }
+
+ var nums = document.getElementById('nums').innerText.split('/');
+ if (nums[0] == nums[1]) {
+ console.log('All Tests(' + nums[0] + ') finished');
+ phantom.exit(0);
+ }
+ }, 30);
+ }
+}

0 comments on commit 1c3cfc3

Please sign in to comment.