get the current view which is displayed to user and verify - eclipse

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.

Related

Error handling in Sublime Text Plugin API

I'm creating my first sublime plugin to be used internally and was wondering if there's a way to stop the plugin from executing and display an error message on screen like an alert?
I took a look at view#show_popup() but this didn't render for me. Below is how I attempted to show it:
if "WebContent" in subdirectories:
directory = ROOT_DIR + "/WebContent"
elif "Content" in subdirectories:
directory = ROOT_DIR + "/Content"
else:
self.view.show_popup('Directory not found', location=-1)
Working Principle:
The plugin takes some data from one view and then pastes them in another view. The plugin has two TextCommands. One command takes the data from the first view, opens a new view and then executes the 2nd command on the new view. The above snippet is in the 2nd command.
I was unable to find any resources to help with show_popup() or any other error handling.
Does any one have possible ideas?
view.show_popup() is for showing things like hover popups next to the cursor; it's used for things like the built in functionality for going to references/definitions for functions:
While you could in theory use this for error messages, it may not be the sort of user experience that anyone would expect.
Your code above is technically valid, but since the content is expected to be minihtml it may be hard to see because as just a single string all you're going to see is just the text (i.e. you have no font style, padding, etc):
Perhaps more importantly, when location is -1, the popup appears at the point in the buffer closest to the first cursor position, so depending on your circumstance it may be appearing in a place you don't expect, and then vanishing away before you can scroll to see it, etc.
What you want here is sublime.error_message(); given a string, it will display that string in a dialog for the user to interact with, and it also logs the error into the Sublime console as well so that there's an additional trace.

VSCode - auto_prepend_file for code suggestions

I have been using VS code instead of eclipse for the last few weeks and find it much quicker, easier to use. However there is one thing I can’t seem to figure out.
My php app calls a prepend file which initiates a class called GlobalClass:
$gc = new GlobalClass();
When I type $gc-> in eclipse I get all the functions prompted. This doesn’t work within VS Code.
If I add use GlobalClass or add the $gc = new GlobalClass(); to the top of the file then it works. Is there any way to declare this within VS Code or to point the editor to the code within the prepend file?

how to verify text present in placeholder in selenium IDE

I want to verify the text present in placeholder. I have located the element and i am using Assert text command. I've entered the same string in value. On executing it is showing actual value did not match
Use assertAttribute or verifyAttribute command.
Example:
verifyAttribute | css=#search#placeholder | Sample String
Notes:
In the Target column of Selenium IDE, you need to provide the proper path of the element followed by an # sign
and then the name of the attribute. (placeholder in your case)
Using
verifyAttibute will still continue running the test case once an
error is detected while using assertAttribute doesn't.
You need to understand that assertText function can only check static text on your webpage.
You must be getting an error message.
This is perfectly normal.
What can help in this situation is using the assertAttribute or verifyAttribute functions.
Both these functions perform the same task; the former stops the test after receiving an error message in the text box while verifyValue just records the error in the log and runs the next commands.
While giving the target, either specify the XPath or refer by using the name=name#placeholder format.
You can find the name value by inspecting the box with a firefox addon called Firepath which runs with another firefox tool called Firebug. Install them if you don't already have.
Hope this helps!
Xpath contains() is the best way.
driver.find_element_by_xpath('//input[contains(#placeholder,"email")]')
Format : '//tag[contains(#attribute,"value")]'

IUIAutomationValuePattern SetValue has no effect

I am using MS UIAutomation in C++ to control a third party WPF application. I can read the value of an edit control (IUIAutomationElement objects). When I try to set the value with SetValue (IUIAutomationValuePattern objects) it does not return an error, but does not set the value of the edit control.
The manifest contains , the application is signed and is run from C:\Program Files.
I experienced that some UI Elements do not implement the UI Automation Provider correctly, as a result some patterns do simply not work as expected or even fail (although they are shown available).
To verify that the object is corrupt and not your code you could use the ValuePattern via Inspect.exe. Open Inspect -> select the control -> Action (Toolbar) -> ValuePattern.setValue
As a workaround I would suggest you to use SendKeys. If you need to focus the element first, yourAutomationElement.setFocus() is your friend. If setFocus does not work get the ClickablePoint/BoundingRectangle of the AutomationElement and use user32.dll in order to click the object.

How could I embedded socket in Lua internally, just like oslib, debuglib?

I want to implement the function like embedding the socket function in my Lua build.
So I don't need to copy socket.core.dll any more (just for fun).
I search the maillist, and see some guys discuss the topic,
http://lua-users.org/lists/lua-l/2005-10/msg00269.html
But I have question for the details steps, who could give me a detailed steps for changing the lua and luasocket code to make them work together (not with dll method).
I tried these steps in windows xp with VC2008:
1) copy luasocket code to Lua project.
2) add some code
static const luaL_Reg lualibs[] = {
{"", luaopen_base},
{LUA_LOADLIBNAME, luaopen_package},
{LUA_TABLIBNAME, luaopen_table},
{LUA_IOLIBNAME, luaopen_io},
{LUA_OSLIBNAME, luaopen_os},
{LUA_STRLIBNAME, luaopen_string},
{LUA_MATHLIBNAME, luaopen_math},
{LUA_DBLIBNAME, luaopen_debug},
{LUA_SOCKETLIBNAME, luaopen_socket_core}, // add this line
{LUA_MIMELIBNAME, luaopen_socket_core}, // add this line
{NULL, NULL}
};
3) build the project, and run it.
When I type print(socket._VERSION), it shows luasocket 2.0.2, it is correct.
When I type print(socket.dns.toip("localhost")), it shows 127.0.0.1 table: 00480AD0, it is correct too.
But when I try to use other features, for example bind, it can't work.
Who could tell me the reason?
you need put luasocket stuff into the package.preload table, in this way:
lua_getfield(L, LUA_GLOBALSINDEX, "package");
lua_getfield(L, -1, "preload");
lua_pushcfunction(L, luaopen_socket_core);
lua_setfield(L, -2, "socket.core");
// add mime.core yourself...
luasocket is a mixed C/lua module, you need to bundle both versions into your application if you want it to work without any extra files.
socket.lua loads socket.core (from socket/core.dll)
mime.lua loads mime.core (from mime/core.dll)
So in order for your application to work you will need to build all the .dll files and the .lua files into your application and manually load them (or set them up to be loaded correctly via custom package loaders).
The email you quoted is tweaking the package.preload table (in a way that appears a tad odd now but might work anyway) to get the built-in C code to be loaded correctly when require is called.
Try running
for k, v in pairs(socket) do print(k, v) end
and maybe we'll be able to help.