Jasmine2 Stacktrace - jasmine

When we run our Protractor tests with the jasmine2 framework we get rather useless stack traces such as the following. These are sporadic and never in the same place twice. I can re-run the tests and it'll work just fine.
What exact causes this type of error and how can I go about fixing it?
should log in as admin user and do something (22 secs)
- Failed: null
at /var/lib/jenkins/jobs/Code-Test/workspace/node_modules/protractor/node_modules/jasminewd2/index.js:102:16
at [object Object].promise.ControlFlow.runInFrame_ (/var/lib/jenkins/jobs/Code-Test/workspace/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:1877:20)
at [object Object].promise.Callback_.goog.defineClass.notify (/var/lib/jenkins/jobs/Code-Test/workspace/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:2464:25)
at [object Object].promise.Promise.notify_ (/var/lib/jenkins/jobs/Code-Test/workspace/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:563:12)

You need to upgrade jasmine to >=2.2 version (2.3 is currently latest), reference:
Getting the same stack trace for different errors

Related

Getting a weird error in Cypress and unsure what's causing it?

I'm getting this error in Cypress:
[14884:0531/191841.692335:ERROR:system_services.cc(34)] SetApplicationIsDaemon: Error Domain=NSOSStatusErrorDomain Code=-50 "paramErr: error in user parameter list" (-50
Looked it up and can't find information anywhere specific to Cypress, does anyone know what's causing it?
It's not failing my tests, but it's making the build in circleci show a failure :(
Thanks,
Not sure of your config setup but if it's using the default Electron browser I usually get this error. If i change to browser: "chrome" in cypress.run this error message disappears.

SwiftUI previews error: Connecting to launched interactive agent

I received the above error when using the SwiftUI previews feature and can't figure out why this happens. The error always looks something like this:
GenericHumanReadableError: unexpected error occurred
messageRepliedWithError("Connecting to launched interactive agent 1894", Optional(Error Domain=com.apple.dt.xcodepreviews.service Code=17 "connectToPreviewHost: Failed to connect to 1894: (null)" UserInfo={NSLocalizedDescription=connectToPreviewHost: Failed to connect to 1894: (null)}))
I managed to figure out a good way to debug this, please see below
If you head into /Users/USERNAME/Library/Logs/DiagnosticReports you will see the latest crash reports. Open the most recent one (should start with your app name), and it should tell you the reason the app crashed. It'll look something like this:
Application Specific Information:
Fatal error: This request requires an authenticated account: file /Users/USERNAME/Work/AppName/Models/CloudKitAlbumManager.swift, line 101
In my case, it was a fatalError i threw in development for debugging. The previews loads your app and thus call your whole stack and will crash if you like me throws fatalErrors for debugging.
I hope this helps

Laravel - how to show errors on terminal rather than log file?

I'm watching TDD by Example Laracast and I see whenever he runs phpunit and a fatal error or an uncaught exception is thrown, it gets logged in the terminal like this:
MyControllerTest::test_it_shows_create_form
InvalidArgumentException: View [mycontroller.create] not found
But whenever I run phpunit and get a fatal error or an uncaught exception, it just get logged directly to storage/logs/laravel.log instead of showing it in the terminal, which makes it harder and slower to do TDD.
Is there a configuration I might be missing that's causing me this issue?
Edit:
My console outputs this
MyControllerTest::test_it_shows_create_form
Failed to assert 200 equals 500
The failed assertion is a $this->assertResponseOk(), and since something is wrong (an uncaught exception maybe) http response code is 500.
But as you can see, it won't show me what the error is
Testing with PHPUnit, Behat, etc. runs your application in a different environment. So basically you should enable debugging for the environment that your test suite is using. If I recall correctly, test suites run your application in the testing environment. In that case you should create a .env.testing file in your root directory and enable debug option there.

HTMLUnit error: Attempted to refresh a page using an ImmediateRefreshHandler which

For several days I'm facing an odd error with HTMLUnit - all page loads fail with following exception:
java.lang.RuntimeException: Refresh to https://acme.com:11111/x/y/z aborted by HtmlUnit: Attempted to refresh a page using an ImmediateRefreshHandler which could have caused an OutOfMemoryError Please use WaitingRefreshHandler or ThreadedRefreshHandler instead.
at com.gargoylesoftware.htmlunit.ImmediateRefreshHandler.handleRefresh(ImmediateRefreshHandler.java:56)
at com.gargoylesoftware.htmlunit.html.HtmlPage.executeRefreshIfNeeded(HtmlPage.java:1276)
at com.gargoylesoftware.htmlunit.html.HtmlPage.initialize(HtmlPage.java:216)
at com.gargoylesoftware.htmlunit.WebClient.loadWebResponseInto(WebClient.java:440)
at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:311)
at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:373)
at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:358)
...
Well ... the error message is descriptive enough and I guess I can make the WebClient instances use WaitingRefreshHandler or ThreadedRefreshHandler.
However:
these tests run against 4 different product releases and this issue
occurs only on one of them.
they run for about 3 years now and this
issue appeared only recently.
Based on that - most probably the reason is in the target system but the error does not provide any further details what happened and why. Does anyone have an idea what is the root cause of this issue?
Note: I'm using htmlunit 2.9.

Selenium RC test passes when it should fail on verifyTrue(selenium.isTextPresent("string"))

I have a suite of Selenium tests that I created in the Selenium IDE and ported over to Java. In several tests I use the Java equivalent of the verifyTextPresent command to confirm some text on the page (verifyTrue(selenium.isTextPresent())).
I found an spelling error in the text on the page when running the test from the IDE, but the error was not caught when running the test via Selenium RC/TestNG. Here's an example of the code that I have and the text that is causing the problem (spelling error in bold):
Text:
Please correct the errors indicated below.
You need to add a least one restriction.
IDE:
verifyTextPresent | Please correct the errors indicated below.
verifyTextPresent | You need to add at least one restriction.
Java:
verifyTrue(selenium.isTextPresent("Please correct the errors indicated below."));
verifyTrue(selenium.isTextPresent("You need to add at least one restriction."));
Since both versions of the test have the correct text, why is the Selenium RC version not catching the error? Has anyone else had this problem?
The reason why this happens is that the test continues to run after the call to verifyTrue(). Verifications in Selenium catch the exceptions that would be thrown by a failed verification, as opposed to an assertion which throws an exception and causes the test to fail. Because verifications catch exceptions instead of throwing them, the test passes.
At the end of the test, the method checkForVerificationErrors() needs to be called to see if any of the verifications failed. If the method is not called, any verification errors will be ignored and the test will still pass (absent any other problems).
A discussion on the Selenium Google Group about the error itself is here. A discussion about the various verifications vs. assertions is here.
I had a similar problem... My workaround is to use assertTrue() instead of verifyTrue(). I hope it works for you to.

Resources