How can i change switchButton's value in smartface? - smartface.io

I am getting true or false value from database and I want to change the switchButton's sitation by looking this value.
I have a code as below but it doesn't work.
x[0].childNodes[0].nodeValue can be True or False and
if (x[0].childNodes[0].nodeValue) switchButton1.checked;

The switchButton's checked variable has to be defined in order to change it. Like: switchButton.checked = true;
Hope that helps! :)

Related

nsubstitute mock method with other arguments Unity

I have a code where I call a method e.g. MyMock.Create(true). I want to replace every call with true to false, when I am testing it in PlayMode. How to do that? I spend hours and I am just starting with NSubstitute so probably it is something quite easy...
Inside visual studio (crtrl + f) find & replace MyMock.Create(true) with MyMock.Create(false) for the whole project. Alternatively you could switch true with false inside the Create method like this
bool tmp = true;
if (param==true)
tmp = false
else
tmp = true
.....
Use tmp instead of the given parameter of the Method MyMock.Create

In Crystal Reports, boolean parameter to select both true and false

Using CR 2008.
I have a Boolean parameter with true and false values which works fine. Is there a way to add a third option to show both such as 'True, False, Show All'?
Without setting the parameter to allow multiple values. I.e. By setting the parameter to allow multiple values I can then just select both true and false. Not what I want - I want 3 single options as mentioned above.
Thanks in advance.
Create a String parameter.
Assume a convention.
Create a formula:
if {?MyParameter} = "True" then
//do stuff like when was true
else if {?MyParameter} = "False" then
//do stuff like when was false
else
//do new stuff: not true, not false

Xamarin.UITest-How to verify element is enabled or disabled

I am new to xamarin uitest, can any one please help me out how to verify the element is enabled or disabled with an example.
Thanks in advance.
Assuming that you are using Xamarin's Repl then you can use the following
app.Query(c => c.Id("ElementID")).FirstOrDefault().Enabled
Repl will then return whether the element's enabled property is either true or false
From this, then you can then assign that line to a variable and assert against it
var elementEnabled = app.Query(c => c.Id("ElementID")).FirstOrDefault().Enabled;
assert.AreEqual(true, elementEnabled);
I didn't really understand your question, but if what you're asking for is how to check if a toggle button is enabled, then you can go that way :
internal void SetToggle(string id, bool setToggled)
{
if (setToggled != IsToggled(id))
app.Tap(e => e.Property("id").Like(id));
}
internal bool IsToggle(string id)
{
return app.Query(e => e.Property("id").Like(id).Invoke("isChecked").Value<bool>())[0];
}

Fastlane set options auto value

I would like to submit my lane with optional options. So for example the lane:
lane :mylane do |options|
mailgun(
to: "#{options[:mailto]}"
....
)
end
How do I give :mailto a default value? So if I would run fastlane mylane it would automatically set :mailto to mail#example.com.
But if I would runfastlane mylane mailto:"secondmail#example.com" it would use that value
As Lyndsey Ferguson pointed out in a comment on this answer, the following is simplest:
mail_addr = options.fetch(:mailto, 'mail#example.com')
where the first parameter of fetch is the option to fetch, and the second is the default value if the option was not passed in.
I just want to add that this works a lot better than the other suggestion:
options[:mailto] || 'mail#example.com'
when dealing with boolean options.
Fastlane (or maybe Ruby) interprets true, false, yes, and no as boolean values instead of strings (maybe others too, though I tried N, n, NO, and FALSE and they were treated as strings), so if in your lane implementation you had:
options[:my_option] || true
or
(options[:my_option] || 'true') == 'true'
you would get unexpected behaviour.
If you didn't pass in myOption at all, this would default to true as you would expect. If you passed in true this would also return true. But if you passed in false this would turn into true, which you of course wouldn't want.
Using options.fetch(:myOption, true) works great with boolean flags like the ones mentioned above and therefore seems better to use in general.
Here's a very thorough example in case you want to test it yourself:
lane :my_lane do |options|
puts("You passed in #{options[:my_option]}")
my_option = options[:my_option] || true
if my_option
puts('Using options[:my_option], the result is true')
else
puts('Using options[:my_option] the result is false')
end
my_option_fetched = options.fetch(:my_option, true)
if my_option_fetched
puts('Using fetched, the result is true')
else
puts('Using fetched, the result is false')
end
end
Outputs:
fastlane my_lane my_option:true
You passed in true
Using options[:my_option], the result is true
Using fetched, the result is true
fastlane my_lane my_option:false
You passed in false
Using options[:my_option], the result is true
Using fetched, the result is false
fastlane my_lane my_option:no
You passed in false
Using options[:my_option], the result is true
Using fetched, the result is false
Note, e.g. FALSE would default to true as it is not being interpreted as a boolean, which seems reasonable to me.
(Fastlane 1.77.0, Ruby 2.7.2)
EDIT: It's worth noting that if you pass an empty string instead of nothing/null you would not get the default value from the fetch method.
I'm not sure there's a way to make Fastlane pass a default. The processing is pretty simple:
https://github.com/fastlane/fastlane/blob/master/fastlane/lib/fastlane/command_line_handler.rb#L10
But you can easily do this in your Fastfile:
lane :mylane do |options|
mail_addr = options[:mailto] || "mail#example.com"
mailgun(
to: "#{mail_addr}"
....
)
end

Check if text binded to a control is null

I'm trying to check if I'm binding a null data on a controller. If the data is null, I need to not show the label as well as the binded data.
Below is my code right now.
var oMatNrRow1 = new sap.ui.commons.layout.MatrixLayoutRow();
control1 = new sap.ui.commons.Label({
text : Appcc.getText("MATERIAL_NO") + ":"
});
matrixCell1 = new sap.ui.commons.layout.MatrixLayoutCell();
matrixCell1.addContent(control1);
control = new sap.ui.commons.Label();
control.bindProperty("text", "matnr");
matrixCell1.addContent(control);
oMatNrRow1.addCell(matrixCell1);
vendorTable.addRow(oMatNrRow1);
I have tried control.getProperty("text") but it only returns null when it should have return a number if matnr is not null.
I also tried formatter. I will have no problem with formatter if matnr is not null. But if it is null, the point is to destroy/delete contents of both matrixCell1 instances. In my code below, addition of matrixCell1 content will still push through.
...
formatter: function(matnr){
if (matnr !== ''){
return contract
} else{
matrixCell.destroyContent();
}
});
matrixCell1.addContent(control);
oMatNrRow1.addCell(matrixCell1);
vendorTable.addRow(oMatNrRow1);
Not sure if you can move the ff code inside if statement
matrixCell1.addContent(control);
oMatNrRow1.addCell(matrixCell1);
vendorTable.addRow(oMatNrRow1);
Any ideas are appreciated.
I would also suggest to user the visible property.
Are you aware of conditional binding of UI5? Using them you do not need the formatter at all in that case. see
Found a workaround on my issue. It was a simple if else condition. For the if statement, I just added data[j].matnr and it worked! I also noticed that this was how SAP implemented the behavior also e.g. oSearchViewData.description.