Comments (35)
I am having this same issue. When I run phantomjs with "--debug=yes", I get the following output:
......removed some output......
2013-05-22T14:20:43 [DEBUG] WebPage - updateLoadingProgress: 10
2013-05-22T14:20:43 [DEBUG] WebPage - updateLoadingProgress: 100
2013-05-22T14:20:43 [DEBUG] WebPage - setupFrame ""
2013-05-22T14:20:43 [DEBUG] WebPage - setupFrame ""
2013-05-22T14:20:43 [DEBUG] WebPage - evaluateJavaScript "(function() { return (function () {
window["__jr965331"] = {};
window.fs_path_separator = "";
window.__phantom_writeFile = function(filename, text) {
window["__jr965331"][filename] = text;
};
})(); })()"
SyntaxError: Parse error
2013-05-22T14:20:43 [DEBUG] WebPage - evaluateJavaScript result QVariant(, )
2013-05-22T14:20:43 [DEBUG] WebPage - evaluateJavaScript "(function() { return (function () {
// if there's a JUnitXmlReporter, return a boolean indicating if it is finished
if (jasmine.JUnitXmlReporter) {
return jasmine.JUnitXmlReporter.finished_at !== null;
}
// otherwise, see if there is anything in a "finished-at" element
return document.getElementsByClassName("finished-at").length &&
document.getElementsByClassName("finished-at")[0].innerHTML.length > 0;
})(); })()"
ReferenceError: Can't find variable: jasmine
So there are a couple issues.
First is the SyntaxError, which is found in phantomjs-testrunner.js at setupWriteFileFunction().
Second is the ReferenceError, where it doesn't know what "jasmine" is. This is in the processPage() function where it checks if the JUnitXmlReporter exists.
Am I doing something wrong, or is this a bug?
from jasmine-reporters.
The same thing happened to me as well.
In the end it was an authentication issue. Have you tried to use the file protocol (file://...
) instead of http?
from jasmine-reporters.
Hi,
I had the same problem. I think it's a bug in phantomjs-testrunner.js, and was able to fix by changing the line:
window.fs_path_separator = "%fs_path_separator%";
to
window.fs_path_separator = "%fs_path_separator%";
I also submitted a pull request with this change.
from jasmine-reporters.
Hi,
I had the same problem on Phantomjs 1.9.1 even after applying the window.fs_path_separator change which is required. What fixed for me was removing the addition of 'file://' to the address and using an absolute path. Basically page.open is returning success when file:// protocol is used even though the page cannot be found.
from jasmine-reporters.
It's been a while since this issue got any comments, are people still observing this problem with recent versions of PhantomJS (1.9.6+) and up-to-date jasmine-reporters? If not I would like to close the issue. If so, can someone still observing the issue provide an updated pull request?
from jasmine-reporters.
+1
Yes... as of yesterday, using the latest version of Phantom with my existing Jasmine 1.3.1 based project am having this same issue.
So it would appear that there's a game of finger pointing between PhantomJS the jasmine-reporters projects?
from jasmine-reporters.
I think this is fixed on the jasmine2
branch. I tested this on Windows 7 with PhantomJS 1.9.7, but the fix should be good for older versions as well.
I successfully generated JUnit xml files like so:
phantomjs bin\phantomjs-testrunner.js file:///Users/IEUser/Downloads/jasmine-reporters/test/junit_xml_reporter.html
Please try this branch / fix and let me know if it's working for others. If so, I'll merge this into master
as well.
from jasmine-reporters.
Hey Ben, so were you ever able to reproduce this originally?
Would the fix be in phantomjs-testrunner.js ?
from jasmine-reporters.
Yes, I was able to reproduce the issue on Win 7, and the commit I pushed fixed it for me. Is it not working for you?—
Ben Loveridge (phone--sorry for typos)
On Tue, Apr 22, 2014 at 8:36 AM, karlkras [email protected]
wrote:
Hey Ben, so were you ever able to reproduce this originally?
Reply to this email directly or view it on GitHub:
#28 (comment)
from jasmine-reporters.
Oh, I'm just getting into the office now... so I'm going to give it a go now. Just curious to know if you actually saw the problem personally. I can see by the change that this would be the logical problem.
I'll let you know shortly.
from jasmine-reporters.
so with this change I need to use the new reporters too? It wouldn't do just to swap out the jasime2 phantomjs-testrunner.js ?
from jasmine-reporters.
This change has only been applied to the new reporters branch. The single line change could be copied over directly, but you couldn't just take phantomjs-testrunner.js
wholesale -- the logic for determining that the test run has finished is only compatible with the jasmine2
branch.
from jasmine-reporters.
and just wanted to make sure... this example that I'm trying to run, if phantomjs is indicated as the target browser, these are the reporters being issued:
jasmine.getEnv().addReporter(new jasmine.TrivialReporter());
jasmine.getEnv().addReporter(new jasmine.JUnitXmlReporter('target/test-reports/'));
jasmine.getEnv().addReporter(new jasmine.ConsoleReporter());
does that look right?
from jasmine-reporters.
If you copy that line over, then what you have might work. It is quite possible you'll need to switch your savePath to use the appropriate separator for the OS you're running the tests on, ie it might need to be target\test-reports
.
Alternately, you could just check out the jasmine2
branch and try out the included example runner, which just uses ..
as the savePath, and see if that works. That should be enough to tell us if the "fix" is actually a fix :)
from jasmine-reporters.
I see that jasmine.console_reporter.js is no longer in the jasmine2 branch. should I be using jasmine.terminal_reporter.js ?
Okay, yeah, I'll try the test in the branch... but I am trying to avoid (for now) having to move to jasmine 2.0
from jasmine-reporters.
ConsoleReporter is no longer in the jasmine2
branch because Jasmine Core has a console reporter. TerminalReporter has very nice output when run from the command line.
TrivialReporter was also replaced with HtmlReporter in Jasmine 2.
Out of curiosity, what is your reason for avoiding Jasmine 2 right now? (I've got one project with a few thousand test cases that I have been avoiding, simply because of the size of the test suite, but I recently migrated a smaller project to Jasmine 2 with very little difficulty.)
from jasmine-reporters.
Fear of the unknown ;)
from jasmine-reporters.
Have you had a chance to give the PhantomJS fix a try? From your question to the jasmine-js group it sounds like either you are having fewer troubles or you think that the health is generally improving for unspecified reasons :)
If it's working for you, I'd like to port the change to the Jasmine 1 branch and close this issue.
from jasmine-reporters.
well, I'm working on porting my tests over to jasmine 2.0 which is having it's own set of challenges. At which point I'll confirm the fixes for the reporters. Let's just say this is pretty bad timing.
from jasmine-reporters.
Don't let that stop you. I can port the change to the jasmine 1 branch pretty quickly. I thought you could verify pretty quickly, I don't mean to be a road block. —
Ben Loveridge (phone--sorry for typos)
On Tue, Apr 22, 2014 at 9:30 PM, karlkras [email protected]
wrote:
well, I'm working on porting my tests over to jasmine 2.0 which is having it's own set of challenges. At which point I'll confirm the fixes for the reporters. Let's just say this is pretty bad timing.
Reply to this email directly or view it on GitHub:
#28 (comment)
from jasmine-reporters.
Committed to both master
and jasmine2
from jasmine-reporters.
Okay... sorry for the false alarms... simple testing would show it working. Apparently I can't use the absolute file location (%CD%/test/testingfile.html) for the target, must be in the form file:///C:/Users/.../GitHub/vt-code-camp-2012/test/all-tests-spec.htm
from jasmine-reporters.
I'm glad it's working out for you. Yes, you do need to use either http
or file
protocol to locate your runner, as noted at the top of phantomjs-testrunner.js
and printed to the console if no arguments are provided. A much earlier rendition tried to support local paths, but there were enough scenarios where things just didn't work right in PhantomJS that it was changed to only support actual protocols.
As you and I have both verified this now works, I'm going to close the issue.
from jasmine-reporters.
Okay... something completely different. I want to use require in the processing of my tests.
In the standard jasmine-html.js, reporter it provides the concept of "specFilter" ... is there something similar in these other reporters? How does one use require otherwise? I guess I should have considered this on my original eval, but just thought it would be covered? I'd like to use the teamcity reporter but not sure if I can without some added support that the html viewer supplies.
from jasmine-reporters.
In Jasmine 2, spec filter is something you set up in boot.js
and should apply to all reporters.
In Jasmine 1, there is a similar feature.
jasmine.getEnv().specFilter = function(spec) {
// determine if you want to run this spec
return myDecision;
}
This is used like so:
jasmine.Spec.prototype.execute = function(onComplete) {
var spec = this;
if (!spec.env.specFilter(spec)) {
spec.results_.skipped = true;
spec.finish(onComplete);
return;
}
this.env.reporter.reportSpecStarting(this);
spec.env.currentSpec = spec;
spec.addBeforesAndAftersToQueue();
spec.queue.start(function () {
spec.finish(onComplete);
});
};
As you can see, it will mark specs that don't match the filter as skipped, which should work with all reporters.
I believe the specFilter support you are seeing in jasmine-html
is simply the bit which allows you to click on a test and then it will only display results for that test. It still runs all the tests, it just doesn't show you the results in your browser (there have been several discussions about this on the jasmine-js
mailing list in the by people wishing it would actually limit the test execution, not simply the results).
Give jasmine.getEnv().specFilter
a try, I think you'll find it does what you need without changes to any reporters.
from jasmine-reporters.
Okay... a bit closer... but in my case my filter looks like:
jasmineEnv.specFilter = function (spec) {
return theReporter.specFilter(spec);
};
and the "Decision" is being determined by the reporter. In this case (and only as far as I can tell) the html reporter.
from jasmine-reporters.
theReporter.specFilter(spec)
just returns a boolean. You can swap this line out with whatever you want to make the decision.
from jasmine-reporters.
oh I see. Okay, if I simply return true out of this then it seems to work... any hints on conditions I'd consider returning false?
from jasmine-reporters.
I really don't understand what you're trying to do, a better place to ask would be the jasmine-js group and provide an example. —
Ben Loveridge (phone--sorry for typos)
On Fri, Apr 25, 2014 at 12:12 PM, karlkras [email protected]
wrote:
oh I see. Okay, if I simply return true out of this then it seems to work... any hints on conditions I'd consider returning false?
Reply to this email directly or view it on GitHub:
#28 (comment)
from jasmine-reporters.
Okay... I'll do that. One thing you might be able to address... when using the phantomjs-testrunner.js, shouldn't this kill the phantomjs process when the tests are considered complete?
from jasmine-reporters.
Yes it should, what is happening instead? Are you returned to your terminal session, or does the script just sit there occupying your session and you have to CTRL-C or similar to abort?
from jasmine-reporters.
yes... script just sit there occupying your session and you have to CTRL-C or similar to abort?
from jasmine-reporters.
Okay... it looks like I have to add the TrivialReporter to have this puppy work correctly.. fine now. Thanks for listening.
from jasmine-reporters.
Yeah, that's due to how phantomjs-testrunner
checks for test completion. This is not necessary in the Jasmine2 branch, and should probably be refactored a little bit in the Jasmine1 branch too.
from jasmine-reporters.
Hey... once again, thanks for your support and have a great weekend. It's nice to end the week on a positive experience.
from jasmine-reporters.
Related Issues (20)
- Consider a JSON reporter HOT 3
- Consider adding an option to Not Show Skipped Tests
- JUnit xml output fails with Jenkins xUnit plugin HOT 5
- Jenkins xUnit 2.0.2 cannot parse JUnit file HOT 1
- Xml report not generated for failing testcase on compilation error HOT 1
- Time value being returned as NaN for testcases HOT 3
- PLease help me with the add log for this report
- Consolidate tests with same describe in multiple files
- request, files property in testcase element
- Test name should include 'describe' name when publishing protractor results HOT 1
- failure in beforeAll() and afterAll() not present in junit report
- xmloutput folder not getting generated in Azure devops
- Vulnerability: Misinterpretation of malicious XML input HOT 6
- Update needed as mkdirp:0.5.1 Legacy versions of mkdirp are no longer supported.
- JunitXmlReporter: Add ability to captureStdErr
- JUnitXmlReporter in docker container
- Multiple failures in testsuite for failures under single testcase HOT 1
- A new release and a new upload to npm ~2.5.1 would be nice. HOT 8
- Dependency @xmldom/xmldom 0.8.3 has a critical CVE vulnerability
- stack can be undefined on uncaught exceptions causing TerminalReporter to throw
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jasmine-reporters.