Xamarin UITest Query How to get just the label as response - xamarin

When I query my listview with automation Id in the Repl() window I get back a chunk of data. I only want back one field 'Text' or 'Label'
here is my query:
app.Query(q => q.Id("officerList").Descendant().Id("officerName").Index(0).Class("UILabel").Index(0))
here is the return: [ [0] {
Id => null,
Description => ">",
Rect => {
Width => 88,
Height => 20.5,
X => 12,
Y => 144,
CenterX => 56,
CenterY => 154.25
},
Label => "Abril, Jill M.",
Text => "Abril, Jill M.",
Class => "UILabel",
Enabled => true
}
]
I want to continue the query and return only "Abril, Jill M."
I tried adding .Label no luck it broke with error:
(1,103): error CS1061: Type Xamarin.UITest.Queries.AppQuery' does not contain a definition forLabel' and no extension method Label' of typeXamarin.UITest.Queries.AppQuery' could be found. Are you missing an assembly reference

This should work:
var query = app.Query(q => q.Id("officerList")
.Descendant().Id("officerName")
.Index(0).Class("UILabel")
.Index(0));
var labelText = query[0]?.Text;
labelText should contain the value of the label you want.
In resume, the Query returns an Array of AppResult (AppResult[]). You need to get the item you want which is this case is the first item.
Hope this helps.-

You can try this query also for Label -
q.Id("officerList").Descendant().Id("officerName").Index(0).Class("UILabel").Index(0)).Label
Output - "Abril, Jill M.", ,
OR For Text
q.Id("officerList").Descendant().Id("officerName").Index(0).Class("UILabel").Index(0)).first.text
Output - "Abril, Jill M."
May be this would work

Related

Perl TK - Wrap text in an Entry widget

I created a table that contains a "Key" column, "Value" column and a "New Value" column as shown in the image below.
The "Key" and "Value" columns are implemented as Labels, the "Value" column is wrapped as you can see.
The "New Value" column is implemented as an Entry widget because it should be editable. There is a Copy & Paste button that copies the value to the "New Value" Entry field.
I would like to wrap the text in the Entry widget, so after pressing the button it will look like the text in the "Value" field.
Image that shows the table I built and the difference between the wrapped Label to the text in the Entry field
Here is the piece of code that defines the shown columns:
my $key_label = $table->Label(-text => $key , -width => 50, -bg => $background_color, -anchor => 'w', -relief => $relief_style, -wraplength => 300)->pack(-side => 'left');
$table->put($curr_row,1,$key_label);
my $orig_val_label = $table->Label(-text => $full_cfg_hash{$key}{'old_value'}, -width => 50, -bg => $background_color, -anchor => 'w', -relief => $relief_style, -wraplength => 300)->pack(-side => 'left');
$table->put($curr_row,2,$orig_val_label);
my $new_val_entry = $table->Entry(-text => $full_cfg_hash{$key}{'new_value'}, -width => $entry_size, -bg => $background_color)->pack( -side => 'left', -fill => 'both', -expand => 'yes');
$table->put($curr_row,3,$new_val_entry);
my $copy_paste_btn = $table->Button(-text => "Copy & Edit\nOld Value", -command => [\&copy_n_edit_old_value,$full_cfg_hash{$key}{'old_value'},$new_val_entry], -bg => $buttons_background, -foreground => $buttons_text_color)->pack(-side => 'left', -padx => 5);
$table->put($curr_row,4,$copy_paste_btn);
The Tk::Text widget is for multi-line text entry, usually combined with Tk::Scrolled, something like:
my $new_val_entry = $table->Scrolled(
'Text',
-width => 40,
-height => 3,
-wrap => 'word',
-scrollbars => 'e',
-font => $my_font,
)->pack(
-expand => 1,
-fill => 'both',
-padx => 5,
-pady => 5,
);

Using the betweenDate operation filter for the SoftLayer Ruby API includes values beyond my endDate

I'm trying to retrieve the invoices for a single month (beginning of one month and ending at the beginning of the next month). However, I get results for the first day of the ending month in my result set, which I'm not expecting.
Example, this will return invoices for December 1st:
account = SoftLayer::Service.new("...")
billing_invoice_service = softlayer_client.service_named("Billing_Invoice");
object_filter = SoftLayer::ObjectFilter.new
object_filter.set_criteria_for_key_path('invoices.createDate',
'operation' => 'betweenDate',
'options' => [{
'name' => 'startDate',
'value' => ["11/01/2015 00:00:00"]
},
{
'name' => 'endDate',
'value' => ["12/01/2015 00:00:00"]
}
]
)
invoices = account.result_limit(0,5000).object_filter(object_filter).object_mask("mask[id,closedDate,createDate]").getInvoices
If I run with the below filter I get no results for December 1st:
account = SoftLayer::Service.new("...")
billing_invoice_service = softlayer_client.service_named("Billing_Invoice");
object_filter = SoftLayer::ObjectFilter.new
object_filter.set_criteria_for_key_path('invoices.createDate',
'operation' => 'betweenDate',
'options' => [{
'name' => 'startDate',
'value' => ["12/01/2015 00:00:00"]
},
{
'name' => 'endDate',
'value' => ["12/01/2015 00:00:00"]
}
]
)
invoices = account.result_limit(0,5000).object_filter(object_filter).object_mask("mask[id,closedDate,createDate]").getInvoices
So I'm not sure why I get results for December 1st in my first filter when I specify an ending time of 00:00:00. Thank you.
Edit: Here is a tail of the results from the first filter above (minus the id):
...
{"closedDate"=>"2015-11-30T21:52:17+05:30",
"createDate"=>"2015-11-30T21:52:16+05:30"},
{"closedDate"=>"2015-11-30T23:22:14+05:30",
"createDate"=>"2015-11-30T23:22:13+05:30"},
{"closedDate"=>"2015-12-01T01:43:59+05:30",
"createDate"=>"2015-12-01T01:43:56+05:30"},
{"closedDate"=>"2015-12-01T01:45:36+05:30",
"createDate"=>"2015-12-01T01:45:34+05:30"},
{"closedDate"=>"2015-12-01T02:05:20+05:30",
"createDate"=>"2015-12-01T02:05:16+05:30"},
{"closedDate"=>"2015-12-01T02:12:22+05:30",
"createDate"=>"2015-12-01T02:12:22+05:30"},
{"closedDate"=>"2015-12-01T02:13:06+05:30",
"createDate"=>"2015-12-01T02:13:04+05:30"},
{"closedDate"=>"2015-12-01T02:13:07+05:30",
"createDate"=>"2015-12-01T02:13:04+05:30"},
{"closedDate"=>"2015-12-01T02:13:07+05:30",
"createDate"=>"2015-12-01T02:13:05+05:30"},
{"closedDate"=>"2015-12-01T02:13:08+05:30",
"createDate"=>"2015-12-01T02:13:06+05:30"},
{"closedDate"=>"2015-12-01T02:13:07+05:30",
"createDate"=>"2015-12-01T02:13:06+05:30"},
{"closedDate"=>"2015-12-01T02:21:34+05:30",
"createDate"=>"2015-12-01T02:21:32+05:30"},
{"closedDate"=>"2015-12-01T02:38:12+05:30",
"createDate"=>"2015-12-01T02:38:10+05:30"},
{"closedDate"=>"2015-12-01T03:36:07+05:30",
"createDate"=>"2015-12-01T03:36:06+05:30"},
{"closedDate"=>"2015-12-01T04:09:57+05:30",
"createDate"=>"2015-12-01T04:09:55+05:30"},
{"closedDate"=>"2015-12-01T04:37:45+05:30",
"createDate"=>"2015-12-01T04:37:43+05:30"},
{"closedDate"=>"2015-12-01T06:35:34+05:30",
"createDate"=>"2015-12-01T06:35:33+05:30"},
{"closedDate"=>"2015-12-01T07:00:09+05:30",
"createDate"=>"2015-12-01T07:00:06+05:30"},
{"closedDate"=>"2015-12-01T08:00:32+05:30",
"createDate"=>"2015-12-01T08:00:30+05:30"}]
The error might be due to the timezone, the filter does not take in account your current timezone, it only filters the data stored in the database, when the data is displayed it is converted to your current timezone. I suggest you change your end date value considering the timezone difference between the stored data in softlayer and your current timezone

How to import address line 2 field using Magento AvS_fastsimpleimporter

How can I import a customer's address line 2 using the AvS importer for Magento? The example shows only one line and the names do not match the Magento fields, so I'm not sure how to handle this.
$data = array(
array(
'email' => 'customer#company.com',
'_website' => 'base',
'group_id' => 1,
'firstname' => 'John',
'lastname' => 'Doe',
'_address_firstname' => 'John',
'_address_lastname' => 'Doe',
'_address_street' => 'Main Street 1',
'_address_postcode' => '12345',
'_address_city' => 'Springfield',
'_address_country_id' => 'US',
'_address_telephone' => '+1 2345 6789',
'_address_default_billing_' => 1,
'_address_default_shipping_' => 0,
));
I tried adding '_address_street2', but that does not work.
You can use the \n (newline) in the _address_street field as divider between the first and second line.
...
'_address_street' => "Main Street\n1",
...
Use double quotes for this entry in the array to have the \n be parsed as newline
The result will be stored as provided in the database table customer_address_entity_text, which is in Magento terms a multiline field. For displaying it in the Magento front and backend Magento will automatically split it up by the newline and place this in separate input fields.

CodeIgniter ActiveRecord adding a random id field

$updatedOrder = array(
'ship_status' => 'shipped',
'shipped_carrier' => (string)$selectedShipper->shipper->name,
'base_rate' => (float)$selectedShipper->rate,
'discount_rate' => (float)$selectedShipper->rate,
'tracking_number' => '123',
);
$this->orders_m->where('id', $tmpOrder->id)
->update('orders', $updatedOrder);
This yields the following SQL query: UPDATE default_orders SET ship_status = 'shipped', shipped_carrier = 'UPS Next Day Air', base_rate = 22.85, discount_rate = 22.85, tracking_number = '123' WHERE id = '1' AND id = 'orders'
Where did that last bit come from? id='orders'?
Just make sure that $tmpOrder->id is a variable and not an array.
var_dump($tmpOrder->id);
Maybe there is an error somewhere where you are getting the $tmpOrder and it returns an array for that.

LINQ DataLoadOptions.loadwith

This is the code I have for loading my data entities.
DataLoadOptions dlo = new DataLoadOptions();
dlo.LoadWith<msPlaylistItem>(m => m.tbMedia);
dlo.LoadWith<tbMedia>(a => a.tbArtists);
dlo.LoadWith<msNote>(n => n.tbMedia.msNotes);
db.LoadOptions = dlo;
dlo.LoadWith(n => n.tbMedia.msNotes); This is the line I am having a problem with. This is the error "The expression specified must be of the form p.A, where p is the parameter and A is a property or field member."
What I am trying to do is load the notes that are related to the each tbMedia object.
this is the correct line
dlo.AssociateWith <tbMedia>(t => t.msNotes.Where(n => n.MediaId == n.tbMedia.id));

Resources