calabash-Android - multiple instances of same radioButton - how to assert? - cucumber

I am testing an android form (xamarin).
My script looks for a radioButton with a label ="Registered"
It finds and performs action on this
However there is another instance of a radioButton labelled "Registered" which is several lines below the 1st instance. The cucumber script is always finding the first one only, therefore the script fails.
I need to perform actions on both buttons not just the first instance.
When I do a query("RadioButton") it returns just the one radio button, as on the form the C# code is simply instantiating another instance of the one radioButton. We do not wish to change the code if need be, so I was wondering is there anyway in Cucumber/Calabash to ignore the 1st instance and perform and action on the second instance? Thank you.

If the element you want is inside another element, you can use the query syntax to chain together locators. e.g.
query(ListView index: 1 * RadioButton)
Using this you could find the one that you want.
That said, query("RadioButton") should return two elements if there are two currently on the screen. The way the query method works shouldn't care if it's the same element in the c# code. If the element isn't on the screen then query won't return it, so you may need to scroll down/across etc.

Related

How to refer same DataTable across different features in cucumber-jvm?

In one of step definitions I have created a function say “someFunction” that takes a DataTable, which has been defined in my feature file Feature1.
Feature1.feature
Given: User enters the following data
Varibale1|Variable2|Variable3
Value1|Value2|Value3
StpeDef.java
#Given(“^User enters the following data$”)
public void someFunction(DataTable input){
}
Now in another feature file “Feature2.feature”, one of my scenario needs to use same step i.e. call someFunction. I know I can use the same step definition but does that mean that I would have to redefine same DataTable input in Feature2 file.
If not, how would I do it?
Please note that I understand the Backgound keyword and its use, but if I say I need to keep these scenarios in different feature files, how should this be done?
You'll have to duplicate the common background. Since duplication is unwanted, you should consider giving a name/title to the resulting state that is represented by that common background and create a single given step that can be re-used. Something like "Given: the user has entered valid contact data" or "Given: the shopping cart has 3 items" (where any 3 will do).

JHipster ComboBox lazyloading

I'm starter to use JHipster. One of my entity A has more than 3000 data. So I used infinite-scroll as pagination. But as relation to another Entry B, it will be generated as a comboBox in the dialog. I got only 20 data in the comboBox. There is no infinit-scroll or search and loading to get more data.
Can someone give any advice to fix the problem?
The infinite scroll uses pages (which is mapped to pageablea in spring). Thus, your service call that fetches the data for the box only fetches the first page. And the default page size is 20. So, you need to increase the page size to get more results.
You can either overwrite the "size" variable or the global constant called "itemsPerPage" which is located in pagination.constants.js
Am I right that it is a one-to-many relationshiop and you want to choose one of 3000 possible A for an entity B?
If so, you don't want to load all 3000 possible As into the dropdown. Therefore, I would replace the dropdown with another input, e.g. the typeahead from angular-ui (https://angular-ui.github.io/bootstrap/#/typeahead), so you can fetch a filtered subset of your entities.
Another way, I also used before, would be a list with a pagination for A that opens in a modal and returns the selected entity that could be passed to b.
Or, if you really want to fetch all: I would add a new endpoint without the pageable, add a new method to the angular-resource-service and call this instead of the paged version.

ADF: Show/hide options in af:navigationPane

I'm using JDeveloper 11.1.1.7.0
I have followed this tutorial http://docs.oracle.com/cd/E18941_01/tutorials/jdtut_11r2_43/jdtut_11r2_43.html to create a basic and plain left-side menu in my application.
This tutorial shows more advance topics, but I have created a simple left-side menu, with a list.
I haved created an unbounded task flow, drag/drop a wildcard, then the views, then the control flows, ... It works perfect
In the JSF template, in the left-side, I have this code:
<af:navigationPane id="pt_np1" hint="list" value="#{supervision_menu}" var="supervisionInfo">
<f:facet name="nodeStamp">
<af:commandNavigationItem text="#{supervisionInfo.label}" id="pt_cni1"
destination="#{supervisionInfo.destination}"
action="#{supervisionInfo.doAction}"/>
</f:facet>
I need an advanced feature, and I want to show/hide some options, based on a parameter.
I need to execute a view object with this parameter, process the results, so I get the information to know which options could be shown or hidden.
So, my questions are:
How could I force to execute this check as the first step of this flow?
In generated menu.xml and in af:commandNavigationItem, there are visible attribute. Where should I place the condition?
Any help would be very appreciated. Thanks
Not exactly sure what you mean by this:
I need to execute a view object with this parameter.
Assuming you mean "execute a QUERY against the VO", then if you used a ViewCriteria to create the where clause fragment that gets ANDed to the VO where clause, then you can use ExecWithParams (here,here, here) and drag this method onto the task flow as part of the navigation to the View. Then this will execute prior to entry to the view. Or use you can use Invoke on there Executables of the Binding layer - drag to top of list of executables, but this is no longer the recommended way, being replaced with the previous method.
if you are not using ViewCriteria (why not?) then one suggestion is to expose a method on the AM containing the VO, and pass the parms to this method and have it call the VO, but this is basically what ExecWithParms does. This method, once exposed, could be utilized in the same fashion as I mentioned above. If you can describe more precisely what you are trying to do I can try to be of more help.
As I told to Joe, the final solution requires to change the approach.
I have made an unbounded task flow, then created a menu, then adding ADF Security and finally shown/hidden options, in function of user roles/permissions.
I hope it helps. Thank you

Need syntax to call a refresh on one component from another on the page

I have a fairly straightforward and common use case. A panel, in which resides a repeat control. The repeat control gets its content from a view lookup by key. Below that repeat control is another panel. This panel has a data binding to a new notesdocument. The panel has a couple of fields on it for the new document and a submit button.
It all works, however after submit (presumably in the "postSaveDocument()" event) I want to call back up to the repeat control and have it re-perform its lookup and refresh its content.
I'm looking to understand syntactically, how I can reference the repeat control and its properties and methods from elsewhere on the document -- and secondarily (though I can look this up once I get the first part figured out) what the refresh() method would be for that that repeat control.
Ideally, I think its something like: xp:page.repeatcontrolname.refresh() -- though I know that isn't right.
I'm sure once I see an example, it will apply to a myriad of other things.
Update :
I discovered that the repeated elements were actually refreshing but I wasn't seeing a new entry added to the list. The reason, ultimately, turned out to be that to add another entry to the repeat list I needed a new "control" -- but I'd checked that box (on the repeat control) that said "Create Controls at Page Creation". It was preventing my XPage from creating another entry for the new document to display!
This article explains the syntax for doing what you describe:
http://avatar.red-pill.mobi/tim/blog.nsf/d6plinks/TTRY-84B6VP
I have a feeling that this one captures the actual use case.
http://www-10.lotus.com/ldd/ddwiki.nsf/dx/Create_and_display_responses
The key setting that people tend to miss is "ignoreRequestParams".
Andrew,
The 'XSP.PartialRefreshGet' call was broken in Domino release 8.5.3 which results in the '_c9 is undefined' error.
Have a look at the article posted by Tommy Valand:
http://dontpanic82.blogspot.com.au/2012/03/patch-for-bug-in-xsppartialrefreshget.html
Basically to work around the problem a second argument is required to be passed to the call, for example:
XSP.partialRefreshGet("#{id:ExistingDevicesList}", "")

Problem getting value from "Checkbox group value prompt"

I've value prompt with ui:checkbox group
parameter: p_IsLastMonth
Name: Prompt_IsLastMonth
ItemCount: 1; UseValue:Yes, DisplayValue: LastMonth?
and two Date Prompts.
Whenever the checkbox is checked, the UseValue 'Yes' is passed to the parameter 'p_IsLastMonth'. But whenever the checkbox is left as it is, it results in an error.
Element 'selectOptions' is not valid for content model: 'All(style,defaultSelections,conditionalStyles,conditionalRender,XMLAttributes)'
I also tried giving a default value. But the default value has to be in the collection. But i want only one checkbox to be displayed.
I tried with html checkbox. But i'm not able to send the value 'either yes or no' to the parameter through javascript because however the finish button overrides the value.
Any help?
There are 2 ways you can use Parameters:
Evaluate Parameter value
Evaluate expression against Parameter value.
Either way your Parameter has some value, and no value is a kind of value. And you need to cater for empty value in some way. Eg:
If (?Parameter? <>'') then ([Selection Criteria] = 'True') Else (1=1)
OR
([Selection Criteria] = ?Parameter?) OR ?Parameter? = ''
There other ways of using parameters too. You should choose one that better suits situation and coding practices you are following.
You can use optional checkbox or text item. In Cognos 10 I get "Deselect" option under checkbox group.
Unfortunately, I don't think you can accomplish what you want to do with only one checkbox. The only way you can leave a value prompt unselected and still submit the prompt page is to make it "optional", which means no value will be passed. An option is to use two check boxes and make them "required" so that either "yes" or "no" must be selected (but this can result in both being selected, which isn't good), or preferably use a radio list with two values and "yes" as the default. There may be a javascript answer to this, but I try to avoid that as much as possible since it sometimes leaves you open to version upgrade issues. Using a radio list is your easiest option.
Well here is something that will work. I've done advanced scorecarding and dashboarding for years with Cognos and Javascript will work:
Create a real cognos parameter that has both choices you need Yes/No with no being the default. Put them perhaps in a html table somewhere off the main real-estate of the report/param canvas. Once you have the param configed you can make the size as small as you want and then make the table/checkbox invisible by turning the visible property to no. Basically the users won't see these params. Don't do box-type = non or the parameter won't even get generated. You could also wait on hidding them until we get step 3 working(Make it easier to troubleshoot).
Then create a HTML parameter that the user will use to interact with in the style that you want the users to see, and use javascript onchange events to manipulate the real hidden parameter by finding it via DOM model. You can make finding it easier by perhaps surrounding the hidden params with an HTML tag that has a unique name/ID and referencing the child items from there.
Since your cognos parameter is invisible you may not even need to use a check box... you could simply use a hidden text box that has stores Yes/No. This will make your coding simplified on the javascript until you get used to it.
Also When programming with javascript on Cognos i find using alert to echo a object's innerhtml to screen while troubleshooting to be very handy.
* One other less impressive approach if i remember right as well..
1. Leave your original cognos style checkbox alone and create another cognos prompt that is always defaulted to "-NO-" and hidden on the canvas.
2. In the expressions used to evaluate the parameters the would evaulate the concatenation values of both params and you could take logical action based on those values. So if the concatted results were "-No-" then you know the original paramater was not selected and to use "No". etc... I believe there could be a nuance to getting this to evaluate correctly in the expression editors but i have got this owrking before as well. * So i your case if the concatted results first 3 characters = "Yes" the "Yes" otherwise no.

Resources