cucumber testing for codemirror - cucumber

I want to write cucumber test (bdd) for filling in codemirror with "abcd". But I cannot write
When I fill in "myFrame" with "abcd"
The codemirror hides the textarea and the text area is replaced by iframe. If there would have been text area, I would have simply written
When I fill in "myFrame" with "abcd"
But I don't know how to write test for filling in codemirror. May be I need to add custom step. If I could any how know to insert data into iframe, I think my problem would be solved. I am open to suggestions.

There exists a CodeMirror property on the wrapper DIV (which has class CodeMirror).
So you can execute the script :
$('.CodeMirror')[0].CodeMirror.setValue('Your value')

Related

dat.gui display simple text

Is it possible to display a simple text in dat.gui?
A text input field can be achieved, but I would like to use dat.gui to display comments, such as the application controls. Is that even possible?
Yes it is.
First you will have to determine the location of your particular text. It will be either in gui.__controllers or gui.__folders.__controllers.
For instance, I have a Folder called "Animation", and inside this folder I have a simple text display. But to get rid of input that is associated with the simple text display, you have to manipulate the domElement.
The command below,
gui.__folders["Animation"].__controllers[0].domElement.hidden = true;
will hide the 'input' and only display the 'application controls'.

Do tabstops work in a MFC CCheckListBox?

I have a MFC CCheckListBox control working fine except Tab stops do not seem to work. When I supply the control with text strings that include the tab character ASCII 9 the text remains without any space for the Tabs.
Does anyone know if you can use tabstops in a CCheckListBox? I have tried a lot of different things and when I google I find same problem but no solutions. I have "Use Tabstops" box checked in the ListBox resource properties. I also have the Has Strings: True and Owner Draw: is Fixed (if that's any help). Here is the initialisation code that I am using:
BOOL CDlgQuotePOReceive::OnInitDialog()
{
CDialog::OnInitDialog();
VERIFY(((CCheckListBox *) this->GetDlgItem(IDC_LB_PO_DETAIL))->SetTabStops(10));
// Then code to fill the listbox with string data that
// is working fine to get the data into the control.
return TRUE;
}
The simple answer is no!
Reason: CCheckListBox ist just an owner draw list box. You can find the source code in the mfc. When the text is drawn the function just uses ExtTextOut and doesn't care about tab stops.
See implementation of CCheckListBox::DrawItem in VC\atlmfc\src\mfc\winctrl3.cpp
So the solution for you is also easy. Write your own class derived from CCheckedListBox and use your own DrawItem function. Also you have the source code of the current DrawItem function and you can easily use another text output function.

How to get the text of the second button on WPF application

I am using CodedUI to automate on a WPF application, I have 2 buttons in a form, I want to verify the text of each button. But when running only have passed script. Because The actual result of the second script is always the actual of the first button. So how I get the second text to verify? Please help me.
(I saw they are the same AutomationID when I record)
Check the search properties and search configurations of the buttons in the uitest file. If the properties are ambiguous, codedui will find the same button each time. If you have access to the application source, try giving the buttons unique friendly names.

hardcoded string “Button”, should use #string resource

I am new in Android app development and using Java language.
My problem is every time I make a TextView or Button there is a triangle with the exclamation mark below them.
and when I click it I saw a message saying:
hardcoded string “Button”, should use #string resource
I have two activities, in my main activity there is a Button that when you click it you will go in second activity.
But when I go to my main.java to make a code for the button. There's always the above shown error. I think the eclipse can't find the id of my button and same for my TextView they have same error message.
Here is the code I made:
Button b = FindViewById(R.id.button1);
I also add:
Button b = (Button) FindViewById(R.id.button1);
I am using the latest eclipse classic and ADT august issue. The platform is Android 4.1 API 16.
You shouldn't hardcode the "text" on the widgets use the strings resources ie., strings in the strings.xml to set the text. Declare the "text" you want to display as a string in strings.xml and access it using #string/your_string_name in the layout file.
Notice the id of the button, which is rounded in red. You have to use this id when you want to call it in a method, for an example
Button b = (Button) FindViewById(R.id.button1);
Furthermore, check whether your graphical layout matches with the image I have provided.
Just try your code again with these changes.
Your main.java would look like this.
I am a newbie too, but I believe I got this. So basically what's happening here, java wants you to put your hardcodes in string.xml. so that when accessing it, you will use the given methods below before:
.
But this is how it should be.
Let's start by string.xml
Then come back to your activity_main.xml

Watir : How do we capture the subitems displayed by doing mouseover on a particular item

I am trying to work with mouseover on a particular Item in my application by using the following command
{
ie.text_field(:xpath, "//a[contains(text(),'Deal')]").fire_event('onmouseover')
}
On doing mouseover on a item, two subitems are displayed.
Is there any way to capture the sub items which are part of the Item by doing mouseover with which we can report that our test is pass or fail.
Please suggest.
Additional Information :
If we take example,On the StackOver flow page, If i do mouseover on my name, i get a window where i see activity, privileges, Logout and other stuff. This is really what i was looking for. Is there a way to capture the items displayed on the window on doing mouseover.
I also tried to capture the subitems with the following :
{
text=ie.text_field(:xpath, "//a[contains(text(),'Deal')]").fire_event('onmouseover')
puts(text.inspect)
}
On doing this "text" value is displayed as 'nil'.
My general tactic for such things is a combination of using IRB and the IE Developer tool, or Firebug.
using IRB, type out (or cut and paste) the watir statement to fire the onmouseover command to the proper element on the page.
Then have the developer tool rescan the DOM (there's a little refresh icon you can click) The use the tool to point to an element to point to one of the items in the stuff exposed by the onmouseover. Using the info from that, you can then figure out how to address those elements to get the text from the proper div, etc.
If I do that here to the info that opens up when I float the mouse over my name I can find out that it is a table of class "profile-recent-summary" Furthermore I can then look at the way the table is made up and see for example that the 'today' reputation value is in the second cell on that row.. The row also has the text 'reputation' in it.. so
browser.table(:class, 'profile-recent-summary').row(:text, /reputation/).cell(:index, 2).flash
Should flash the cell I want (index might be 1 if using firewatir or webdriver) I can then replace the .flash with something else like .text if I want to get the text from that cell (which is actually inside a link that sits in the cell)..
without seeing your code, I would 'inspect' the element that you are trying to verify and when_present (text) assert that its true

Resources