AndroidFindBy ID or XPATH - appium-android

Wondering if this is possible. We have our RC that has no ID for an XML layout element. In our Develop branch we add ID to the layout but haven't pulled it in yet. For AndroidFindBycan I use XPATH for RC and ID for Develop?
#AndroidFindBy(id = "fab_menu_button", xpath = "SomeXpathlocationForRC")
private MobileElement fabButton;
*** Update, this above does not work on RC build as ID is missing is there some way to have it OR this condition? by id or by xpath?

I did find the answer to this so others who need the answer can see. In our RC we have use the XPATH but in our DEV code we added the ID. This way it works on both apks.
#AndroidFindAll({
#AndroidBy(id = "fab_menu_button"),
#AndroidBy(xpath = "//android.widget.TextView[#text='Create']")
})
private MobileElement fabButton;

Related

Magento 2 with Full Page Cache: How to get product ID from a product page?

I am trying to find a solution to what seems to be a FPC-linked issue.
In my code I am using the following method in order to get the current product ID from a Product page.
$this->catalogSession->getData('last_viewed_product_id')
This worked just fine until I tried it on a website with Full Page Cache: in this case, it returns an empty value (maybe because the session data cannot be accessed from cache).
Does anyone know an alternative method to get the product ID from the current context?
I have tried this alternative synthax:
$_SESSION['catalog']['last_viewed_product_id'];
While not the best solution and definitely not best practice, you can use objectmanager:
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$product = $objectManager->get('Magento\Framework\Registry')->registry('current_product');
$id = $product->getId();
This will get you the id but, as stated above, it's not suggested and you should create a block and inject the registry there and call it in your code.
You can see this post https://meetanshi.com/blog/get-current-product-id-in-magento-2/

Aha!<>VSTS Integration - Aha! adjusted Stack Rank in VSTS - tips on reverting?

While integrating with VSTS, I accidentally wiped out the stack rank in VSTS for my 100+ features. My first choice would be to undo the import. Does anyone know how I could revert the action on either the Aha or VSTS side? My second choice would be to edit one by one. I can go into the details of each story and see the original stack rank, but I can't seem to be able to find where I could then reenter it one by one.
If there isn't any other action performed on these work items after that, the quick way is getting the Stack Rank value in the previous revision of the work items and updating the work items with the returned stack rand via coding. Following is the code sample to update the value of Stack Rank to previous version for a single work item:
using Microsoft.TeamFoundation.Client;
using System;
using Microsoft.TeamFoundation.WorkItemTracking.Client;
namespace ConsoleX
{
class Program
{
static void Main(string[] args)
{
Uri url = new Uri("https://vstsaccount.visualstudio.com");
TfsTeamProjectCollection ttpc = new TfsTeamProjectCollection(url);
WorkItemStore wis = ttpc.GetService<WorkItemStore>();
int workitemid = 12;
WorkItem wi = wis.GetWorkItem(workitemid);
int previousrevision = wi.Revision - 2;
string previousstackrank = wi.Revisions[previousrevision].Fields["Stack Rank"].Value.ToString();
wi.Fields["Stack Rank"].Value = previousstackrank;
wi.Save();
}
}
}
For you scenario, just add some code to query that 100+ features and update them one by one.

How to use Selector query in ZK

I was going through these pages on ZK documentation ID_Space -Selector and looked at following code
comp.query("#ok"); //look for a component whose ID's ok in the same ID space
comp.query("window #ok");
comp.queryAll("window button");
I am wondering how can I use this in my code? I am creating 2 drop downs and adding Id to both these drop downs
Listbox listbox=createListbox(widget, DetailsListRenderer.ORDERSTATUS.class, null,orderStatus);
listbox.setId(ORDER_STATUS_ID);
So when My page is getting refreshed, I am getting exception of Unique Id, I was wondering if these is a way I can query component and see if same component with same Id already exists and in case it exists, I should not add ID to that component, or should not create component at all
Any suggestion?
I tried something like
widget.getFellow( ORDER_STATUS_ID); but getting `org.zkoss.zk.ui.ComponentNotFoundException` exception.
widget.getFellow("#" + ORDER_STATUS_ID);
For widgets that co-exist in the same ID space (a.k.a fellow widgets), one may use any of the following to refernece a fellow from a certain widget:
var fellow = widget.$f('fellowID');
var fellow = widget.$f().fellowID;
var fellow = zk.Widget.$(jq('$fellowID')[0]);

GreenDAO really simple query

I want to create a very simple query to look up a sqlite db using greendao. 2 fields, one is the ID and the other 'affirmation'.
i am sorry to be such a beginner, but i am not sure how to use greendao including what to import etc.. All i have been able to do so far is add the greendao libraries but i cant find a good tutorial to just do a query. Basically i want it to be a random ID that calls up a random affirmation and return it to my main activity.. Once again i am sorry but i am really trying and getting nowhere..
Greendao is a ORM-framework. If you don't know what this means you should look up this first.
Greendao generally works as follows:
You create a java-project that generates your sourcecode for your real app. You have to include DaoCore and DaoGenerator in this project.
You add the generated sourcecode to your android-project and include DaoCore in it. DaoGemerator is not neccessary.
For examples how to generate the code and define your entities the greendao-website is a good place to go.
According to your description you need an entity with id-property and a string-property (affirmation).
In your android-project you then use the DevOpenHelper to get a session and from the session you can get the dao (Data Access Object) for your entity. The dao includes the very basic query to load data by id (load ()).
Please notice that the DevOpenHelper is only meant for development process. For your final release you should extend OpenHelper and costumize your actions to be taken on DB-schema update.
Here is some example code I have in my application.
DaoHelper.getInstance().getDaoSession().clear();
OperationDao dao = DaoHelper.getInstance().getDaoSession().getOperationDao();
String userId = "some id"
WhereCondition wc1 = new WhereCondition.PropertyCondition(OperationDao.Properties.UserId,
" = " + userId);
WhereCondition wc2 = new WhereCondition.PropertyCondition(OperationDao.Properties.Priority,
" > " + 4);
// Uncached is important if your data may have changed recently.
List<Operation> answer = dao.queryBuilder().where(wc1, wc2).listLazyUncached();
This is a decent tutorial on how to learn greendao. Make sure you follow the links to the further parts.
You can use:
daoMaster = new DaoMaster(db);
daoSession = daoMaster.newSession();
yourDao = daoSession.getYourDao();
Random() random = new Random();
List<YourObject> objects = yourDao.loadAll();
YourObject yourObject = objects.get(random.nextInt(objects.size());

I Want To Instatantiate System Workflow Using PlugIn In Online CRM2011

I have a workflow which need to update a custom entity(say-customentity)
But it will update which record that need to be pass(i.e GUID of that record) using PlugIn.
This PlugIn Fires On Some Event Takes GUID Of That Record And Need To Pass This Guid To System Workflow.I Don't Know How To Pass Parameters To system Workflow.
There Is Some Boundation That Is Why i can not directly trigger that workflow on that event on which PlugIn fires..
Any Kind Of Help Will Be Appreciated.
Thanks,
Anish
I'll be honest, I only slightly understand your question.
I believe you are asking: "How can I start a workflow programatically? For example in a plugin?".
In which case you do it like this:
ExecuteWorkflowRequest request = new ExecuteWorkflowRequest()
{
WorkflowId = workflowId, //Guid of the workflow you want to start
EntityId = recordId //Guid of your record
};
ExecuteWorkflowResponse response = (ExecuteWorkflowResponse)serviceProxy.Execute(request);
The workflow must be set to "Run On Demand".
Full MSDN article.