recordFailureWithDescription("Custom Description", inFile: #file, atLine: #line, expected: true) is not working xcode 8 UI xctest - xcode8

When using XCTest method recordFailureWithDescription like this:
func testRecordFailureMessageNotWorking() {
XCUIApplication().button["Login"].tap()
self.recordFailureWithDescription("Custom Description", inFile: #file, atLine: #line, expected: true)
}
The console output no longer provides the custom description or the file name or the line number as it did in xcode 7.
Anyone have any thoughts on this? or a way to get the custom description?

Upgrade your OS to macOS Sierra - this will improve the console functionality.

Xcode 8 changed the output for logs, for me it included a lot of 'garbage' code. Are you getting any of that or is it just the omission of the file name/ line number that is affecting you? If its the former, you can edit the projects scheme:
1- From Xcode menu open: Product > Scheme > Edit Scheme
2- On your Environment Variables set OS_ACTIVITY_MODE = disable
The above is detailed more here:
Hide strange unwanted Xcode 8 logs
(Sorry if I am totally off, first time poster)

Related

IntelliJ and xDebug - xdebug.file_link_format

I've searched much time about IntelliJ IDEA 12 and the xdebug.file_link_format configuration value.
I found nothing which works...
Using protocols like "idea", "intellij", "txmt", or other protocols doesn't work.
I found nothing about a plugin which register the IntelliJ protocol...
Is it possible to use the xdebug file links with IntelliJ IDEA or PhpStorm?
Yes and No.
No -- there is no proper built-in support for this. Watch this ticket for details: http://youtrack.jetbrains.com/issue/IDEA-65879
Yes -- you may find some workaround, at very least the aforementioned ticket has recipes for Mac OS (using AppleScript) or via Remote Call etc.
Update: as of PhpStorm 8 you may use:
xdebug.file_link_format = "phpstorm://open?file=%f&line=%l"
Not out of the box, but it is possible to get the links to work. I have this working with Windows 7, Firefox and PhpStorm 10 - in this example, I'm using the protocol phpstorm://, but this will work regardless of the name.
create a custom protocol handler: Any executable will do, here I have modified a WScript from https://pla.nette.org/en/how-open-files-in-ide-from-debugger . Save as run-editor.js :
// note: edit the path, with backslashes escaped
var editor = '"c:\\Program Files (x86)\\JetBrains\\PhpStorm 143.434\\bin\\PhpStorm.exe" nosplash --line %line% "%file%"';
var url = WScript.Arguments(0);
var match = /^phpstorm:\/\/open\/\?file=(.+)&line=(\d+)$/.exec(url);
if (match) {
var file = decodeURIComponent(match[1]).replace(/\+/g, ' ');
var command = editor.replace(/%line%/g, match[2]).replace(/%file%/g, file);
var shell = new ActiveXObject("WScript.Shell");
shell.Exec(command.replace(/\\/g, '\\\\'));
}
create the protocol in registry: create the following as editor.reg and import to Registry. Note that you again need to double-escape the path to the above file, and set it to wherever yours is saved:
REGEDIT4
[HKEY_CLASSES_ROOT\phpstorm]
#="URL:phpstorm Protocol"
"URL Protocol"=""
[HKEY_CLASSES_ROOT\phpstorm\shell\open\command]
#="wscript \"C:\\path\\to\\run-editor.js\" \"%1\""
enable the protocol in Firefox:
in about:config, create a "logical value" named
network.protocol-handler.expose.phpstorm and set it to false
open one such link in Firefox, e.g. phpstorm://open?file=somefile.html&line=123 - it should open in PhpStorm.
Per the comment from #gapple, this will make Xdebug link to the file/link in PhpStorm:
xdebug.file_link_format = "phpstorm://open?file=%f&line=%l"
I tested this in PhpStorm 10 on Mac and it works great.
You need to ad to the php.ini file in the [xdebug] section the following line:
xdebug.file_link_format = "phpstorm://open?file=%f&line=%l"
Then restart your web server (Apache for me on Mac)
The REST API is probably the best option now:
http://localhost:63342/api/file%f:%l
Wrapping in a javascript protocol and AJAX request allows the permission approval to be saved so you don't have to approve every time you click:
javascript: var r = new XMLHttpRequest; r.open('get', 'http://localhost:63342/api/file%f:%l');r.send()
API specs:
https://www.develar.org/idea-rest-api/

Source for WinJS.UI.Menu and WinJS.UI.MenuCommand

For some reason, I was under the impression that the source code for WinJS.UI.Menu and WinJS.UI.MenuCommand will be in ui.js file that get added under References -> Windows Library for JavaScript 1.0 but its not there. Any suggestion as to where can I find its source code?
it is in UI.js only. I can see it around line # 35016
WinJS.Namespace.define("WinJS.UI", {
Menu: WinJS.Class.derive(WinJS.UI

Elm Graphics.Input

I'm trying to run the Elm input examples from this page. Specifically, the Text Field example, and I'm getting an error saying that the Graphics.Input module is missing.
I've got this in a file called Main.elm:
import Graphics.Input as Input
main = let (field, state) = Input.field "Type here!"
in lift2 display field state
display field state =
field `above` asText state
If I run elm-server and navigate to localhost:8000, I get the error
Your browser may not be supported. Are you using a modern browser?
Runtime Error in Main module:
Error: Module 'Graphics.Input' is missing. Compile with --make flag or load missing module in a separate JavaScript file.
The problem may stem from an improper usage of:
Input.field, above
Compiling the project with elm --make Main.elm gives me
elm: Graphics/Input.elm: openFile: does not exist (No such file or directory)
Is there something extra I need to do to install the Graphic.Input?
Additional Notes:
I'm running this on a Debian machine, and installed it using cabal install elm fairly recently (Jun 15 2013). The current version is labeled Elm-0.7.1.1.
If I hop into the chromium JS prompt and poke around, it turns out there's no Elm.Graphics.Input module, but there is an Elm.Input. There isn't a function called field, there's a similar looking one called textField, but it isn't trivially interchangeable.
Running this:
import Input
main = let (field, state) = textField "Type here!"
in lift2 display field state
display field state =
field `above` asText state
gives me the error
Your browser may not be supported. Are you using a modern browser?
Runtime Error in Main module:
TypeError: a is undefined
The problem may stem from an improper usage of:
above
The Graphics.Input package is new in version 0.8. So, since you're running version 0.7, that explains your problem.
0.8 was released somewhat recently, but it's definitely been out longer than June 15th, so you probably just forgot to cabal update before installing it. Running cabal update now and then updating elm to 0.8 should fix your issue.

How to use a dependency of a module within a Play app

I am writing a Play Framework module in order to share some common logic among multiple Play apps. One of the things I would like my module to do is provide some frequently-used functionality by way of 3rd-party modules, for example the excellent Markdown module.
First of all, is it possible to do this? I want all the apps that include my module to be able to use the .markdown().raw() String extension without needing to explicitly declare the Markdown module as a dependency. The Play Framework Cookbook chapter 5 seems to imply that it is possible, unless I am reading it wrong.
Secondly, if it is possible, how does it work? I have created the following vanilla example case, but I'm still getting errors.
I created a new, empty application "myapp", and a new, empty module "mymod", both in the same parent directory. I then modified mymod/conf/dependencies.yml to:
self: mymod -> mymod 0.1
require:
- play
- play -> markdown [1.5,)
I ran play deps on mymod and it successfully downloaded and installed the Markdown module. Running play build-module also worked fine with no errors.
Then, I modified myapp/conf/dependencies.yml to:
# Application dependencies
require:
- play
- mymod -> mymod 0.1
repositories:
- Local Modules:
type: local
artifact: ${application.path}/../[module]
contains:
- mymod
I ran play deps on myapp and it successfully found mymod, and generated the myapp/modules/mymod file, containing the absolute path to mymod.
I ran myapp using play run and was able to see the welcome page on http://localhost:9000/. So far so good.
Next, I modified myapp/app/views/Application/index.html to:
#{extends 'main.html' /}
#{set title:'Home' /}
${"This is _MarkDown_, by [John Gruber](http://daringfireball.net/projects/markdown/).".markdown().raw()}
I restarted myapp, and now I get the following error.
09:03:23,425 ERROR ~
#6a6eppo46
Internal Server Error (500) for request GET /
Template execution error (In /app/views/Application/index.html around line 4)
Execution error occured in template /app/views/Application/index.html. Exception raised was MissingMethodException : No signature of method: java.lang.String.markdown() is applicable for argument types: () values: [].
play.exceptions.TemplateExecutionException: No signature of method: java.lang.String.markdown() is applicable for argument types: () values: []
at play.templates.BaseTemplate.throwException(BaseTemplate.java:86)
at play.templates.GroovyTemplate.internalRender(GroovyTemplate.java:257)
at play.templates.Template.render(Template.java:26)
at play.templates.GroovyTemplate.render(GroovyTemplate.java:187)
at play.mvc.results.RenderTemplate.<init>(RenderTemplate.java:24)
at play.mvc.Controller.renderTemplate(Controller.java:660)
at play.mvc.Controller.renderTemplate(Controller.java:640)
at play.mvc.Controller.render(Controller.java:695)
at controllers.Application.index(Application.java:13)
at play.mvc.ActionInvoker.invokeWithContinuation(ActionInvoker.java:548)
at play.mvc.ActionInvoker.invoke(ActionInvoker.java:502)
at play.mvc.ActionInvoker.invokeControllerMethod(ActionInvoker.java:478)
at play.mvc.ActionInvoker.invokeControllerMethod(ActionInvoker.java:473)
at play.mvc.ActionInvoker.invoke(ActionInvoker.java:161)
at Invocation.HTTP Request(Play!)
Caused by: groovy.lang.MissingMethodException: No signature of method: java.lang.String.markdown() is applicable for argument types: () values: []
at /app/views/Application/index.html.(line:4)
at play.templates.GroovyTemplate.internalRender(GroovyTemplate.java:232)
... 13 more
And just to confirm I'm not crazy, I tried adding the play -> markdown [1.5,) line to myapp/conf/dependencies.yml and restarted the app, and confirmed that it works.
I feel like I'm missing something obvious. Many thanks in advance to anyone who can help! :)
Yes I had the same problem, it seems that transitive dependencies through custom home made modules does not work

How can I get stacktrace for Adobe AIR global runtime errors in non-debug mode?

The new version AIR gives us the ability to globally capture run time errors and handle them. The problem is that it doesn't have the stacktrace or any helpful information about the error other than the error id and error message and name. For example it may tell me that a null pointer exception has happened but it will not tell me where or which method or anything. The debug version of the runtime gives us all of that but when the app is deployed to customers it is not running on the debug version so none of the useful information is available. I was wondering if this group has any suggestions on how to enable better logging of errors in an AIR app for better supportability of the product. Any suggestions?
I have a little hack to get line numbers too. :)
make a listener to get uncaught errors. I do it in my main class:
private function addedToStageHandler(event:Event):void {
loaderInfo.uncaughtErrorEvents.addEventListener( UncaughtErrorEvent.UNCAUGHT_ERROR, uncaughtErrorHandler );
}
for example my listener with error.getStackTrace():
private function uncaughtErrorHandler( event:UncaughtErrorEvent ):void
{
var errorText:String;
var stack:String;
if( event.error is Error )
{
errorText = (event.error as Error).message;
stack = (event.error as Error).getStackTrace();
if(stack != null){
errorText += stack;
}
} else if( event.error is ErrorEvent )
{
errorText = (event.error as ErrorEvent).text;
} else
{
errorText = event.text;
}
event.preventDefault();
Alert.show( errorText + " " + event.error, "Error" );
}
Add additional compiler argument: -compiler.verbose-stacktraces=true
Create the release build.
now the little hack:
Mac:
Go to the installation location where you have your .app file. Right click and choose show package content. Navigate to Contents ▸ Resources ▸ META-INF ▸ AIR. There you can find a file called hash. Duplicate the hash file and rename it to debug. Open the debug file with some text editor and remove the content. Done now you get the stack trace + line numbers.
Windows:
Browse to its install directory in a file explorer. Navigate to {app-folder}▸META-INF▸AIR▸. Here you can find a file called hash. Duplicate the hash file and rename it to debug. Open the debug file with some text editor and remove the content. Done now you get the stack trace + line numbers.
If you can't find the hash file, just create an empty file without file extension and call it debug.
Tested with Air 3.6!
No way until new version of AIR supports it. It doesn't now because of performance issues, rendering global handler almost useless. I'm waiting for it too, because alternative is logging everything yourself, and this is very time consuming.
The compiler option:
compiler.verbose-stacktraces=true
should embed stack information even in a non-debug build.
About the compiler option.
I develop with IntelliJ IDEA 14. In my build options i have also "Generate debuggable SWF". Maybe thats the reason why its working. Check my attachment.
Grettings