I'm gonna ask a weird question:
Is there a way to run a code snippet on a breakpoint set on the DOM?
Use example:
- Visit a website with a table.
- Set a Break On Subtree Modification
- Run MySnippet when the breakpoint hits.
What you can do though is set a conditional breakpoint with an eval('...') statement.
for example the following with log to the console:
test 11:59:51:326
Good for checking timing issues...
eval('let current=new Date();console.log("test",current.getHours()+":"
+current.getMinutes()+":"+current.getSeconds()+":"
+current.getMilliseconds());')
you can also print a local object, e.g if localVar is defined:
eval('let current=new
Date();console.log("test”,localVar,current.getHours()+":"
+current.getMinutes()+":"+current.getSeconds()+":"+current.getMilliseconds());')
DevTools doesn't have this feature. After your DOM breakpoint triggers you can run a Snippet though. You can run Snippets from the Command Menu.
Related
A while ago I wrote myself a nice SQL Developer plugin (back then for Oracle SQL Developer v19.x).
I haven't used for a while and meanwhile I migrated to SQL Developer v21.2.1.204.
When I wanted to run my plugin again, there is no output displayed anywhere!? Where does the output generated by a plugin and emitted by dbms_output.put_line(...) end up?
In "Messages - Log" which used to be the tab where the output ended up, the execution only emits a final "PL/SQL procedure successfully completed." but nothing else.
For my colleagues who still run Oracle SQL Developer v19 it still works - all output goes to "Messages - Log".
I also tried "Dbms Output" (View --> Dmbs Outout) but nothing appears there.
Thus my question: Where does the output of an SQL Developer Plugin go to in OSD v21+? Do I need to enable anything beforehand to capture or redirect its output?
Nevermind - problem solved:
while experimenting I had commented the script's preamble
set serveroutput on;
set wrap off;
set linesize 4000;
...
and then - of course - there is no script output returned to SQLDeveloper.
Everything's working now...
There is a bug report in the open source cheat project described here: https://github.com/cheat/cheat/issues/632
As described in that bug report, a variable named $state never gets set. Looking at the code, it should be set to a value of "none", "full", "personal", "taglist", or "pathlist".
The completion script is here: https://github.com/cheat/cheat/blob/master/scripts/cheat.zsh
I don't know if this script is unfinished or what. But not being a very good shell scripting and knowing nothing about zsh completion, I don't have any ideas on how I might set the $state variable to the appropriate value.
If someone can offer suggestions, I'd appreciate it.
UPDATE
I'm using ohmyzsh, if that makes a difference.
OK, I just made the default value for state to be 'full'. Seems to work.
_cheat() {
local state
state='full'
...snip...
Then it get overridden by the _arguments portion of the code.
I am testing my eclipse rcp app GUI using a tool called RCPTT.
In rcptt, i want to check that a specific editor is opened or not.
right now i am using
get-view "Console" | get-table | is-disabled | verify-false
but this is wrong way to do verification.
using this code, if the console is not opened, than it click on console and do verification.
It passed all time.
So, is there any way to
- first get the current view(which view is displaying currently to user.)
- then verify this view.
Thanks
You can not solve it within ECL, there's no support for this.
However you can solve it with Java code. It's not easy, could be a few hours of work.
1) Write a Java method that detects the name of the active View and returns it as a String
2) Make sure it's part of your application as a static class's static method
3) Invoke it from your ECL script with the invoke-static command
4) Compare the returned value in ECL script to what you've expected
Check methods parseComposites(), viewOrEditorIsFocused() and checkNextComposite() from this tutorial:
https://openchrom.wordpress.com/2011/08/12/capture-a-snapshot-of-the-active-vieweditor-in-a-rcp-application/
You do not need all the code from it and you need some editing too.
If you make an error/typo at points 2) or 3), then RCPTT-runner will simply throw an Exception without further explanation; be careful there.
I found a neat bit of code for setting drawing tools via callback:
draw.m .
Edit
My apologies - I didn't realize that the Name property was a red herring - it is the annotation call that enables drawing the various figures.
So my corrected question is: is there a way to execute other menu item commands, such as set(gcf,'Some_property','Rotate 3D') ?
The easiest way to execute a menu item's command is to get a handle to the menu item and then inspect the Callback property to see what it calls internally.
rotate_menu = findall(gcf, 'type', 'uimenu', 'tag', 'figMenuRotate3D');
rotate_menu.Callback
% 'toolsmenufcn Rotate'
As you can see this uses an internal function toolsmenufcn which we could call directly to activate the tool.
toolsmenufcn(gcf, 'Rotate')
If you actually look at the contents of toolsmenufcn.m (edit toolsmenufcn), you will see a list of all available commands.
Using the toolsmenufcn directly is of course undocumented so use at your own risk. On the other hand, dynamically retrieving and executing the Callback for the menu should work across versions.
I've configured my karma.conf.js with enabled preprocessing to get a report about the code coverage of my tests. I've added this line to the preprocessors section.
preprocessors: {
'public/js/app.js': ['coverage'],
'public/js/filters.js': ['coverage'],
'public/js/directives.js': ['coverage'],
'public/js/services/*.js': ['coverage'],
'public/js/controllers/*.js': ['coverage'],
},
What I'm get is a report that is totally wrong. I know that I've written tests for each modules and the function within. But the coverage report shows me only the tests for the services correctly.
For instance the tests for directives. I know that I've written some tests and the tests will also be executed. But the report shows me that I've just tests for 36% of my code lines.
What could be the reason for this strange behavior?
Update:
I see this output from the spec reporter:
Directives:
bsTooltip:
when the element was created:
PASSED - should call the popup function
bsSwitchtext:
when the model isBusy changes to true:
PASSED - should call the button method with loading
when the model isBusy changes to false changes:
PASSED - should call the button method with loading
So I think that my test will all be executed.
Looks like there's issue with Typescript & Jasmine which is used by Angular. Enabling source map for test build appears to fix this issue.
I enabled source map in Angular 6.1 as follows,
Go to angular.json and in main project, find test, and add sourceMap:true to enable source map for the test run.
to enable that in CLI, run with command --source-map or --sm=true
Github issue links
Code coverage report issue with branch coverage (if path not taken)
ng test --code-coverage in 6.1 improperly detecting branches
I'm obligated to write this answer as I had the same issue, and this was the first question on Google search.
Try adding a console.log('testing123'); at one of the points which shows as not covered. If it shows up when you run the tests you know that something is going wrong with Istanbul.
However my guess would be that either there is something wrong with your configuration, and those tests are not running at al, or the tests are not executing the code as you think they are.
Try changing what you have in preprocessors to:
preprocessors: {
'**/public/js/**/*.js': ['coverage']
},
I was not able to the report to work unless I followed the specific syntax with **/ before directors in the preprocessors object.
The karma-coverage documentation includes the preceding **/ before directories listed in preprocessors.
Based on this SO answer.