How to fetch unique items from a list of items in Appium, wherein the list does not have any unique identifier - appium

As you can see in the attached image, we have an order receipt consisting of a list of items inside recycler view and the receipt can contain any number of items but we don't have any unique identifier to distinguish the items in the list, in the attached image you can see class, resource-id is same for all the items in the receipt. So when we scroll the list, duplicate items are fetched again, as we don't have any unique identifier to check if that particular item is fetched already from DOM or not.
So how can we check if that particular item is fetched already from DOM or not when we scroll the list.
REQUIREMENT:- We want to fetch the items from the receipt just once(no same receipt data should be fetched twice)
So how can we achieve the same using Appium?

Related

Google Sheets - Have working Tabs retain the entered information

I have a sheet that multiple people are working on, but only on certain rows in the sheet that they mark with their name. There is a master sheet where they are marking which ones they're working on, then a tab for each named person. The tab with their name gets populated using a "=QUERY(Master!A3:AX,"select * Where L='NAME'")". The goal of the tab is so they can work on their own stuff without having to scroll through the thousands of rows to find their next entry. Getting the info from the master to the tab is working fine, but when they are working on their tab, they add information to a few new columns at the end of the query. This is where my problem lies, when they go and tag another entry on the master as theirs, the columns they added information to already do not move with the entrys, they just get pushed up or down depending on the new entry placement.
Is there something I can do that will still pull in the data from the master sheet to the corresponding tab, but then keep what the staff is actually entering/working on, to remain in line with the entry that got pulled in? The whole process is sort of useless if their work is not retained as they are working through it.
For example, the query pulls in column A-L, then they are adding information to column M and N for the management to read and make decisions off of their input. I need the information they enter into column M and N to remain with the row the query originally pulled in. The master is sorted by a unique number in column A that needs to remain in that order, so they may add new entries randomly as they assign rows to themselves.

How to insert data into a query from another tab in Google Sheets

I have a tab with raw data which is automatically populated and refreshed, therefore the row position that some names appear may vary daily, but the full row is aligned according to the name. I need to be able to add additional columns that match with that raw data.
For example, i have created another tab (Data) where I query the data from RAW and order according to the birthday date, therefore columns A, B, C, D and E are dynamically loaded and also change positions according to the new data populated in the RAW tab, but in the DATA tab i need to insert 2 additional tabs (F and G), in which a checkbox is checked wether to send an email to that user, but when the raw data loads new data, they change position and since the columns F and G are static they go out of order and the checkbox is attributed to another user, what would be the approach to fix this? Any ideas to select a checkbox and to be attributed to a user even if the row changes order, the checkbox or the value needs to follow the user
Thanks in Advance
Link to the sheet

Create dropdown list from data tab (conditional)

Not sure how to phrase this correctly, but I can't get my head around the next thing;
I have a Google Sheet with two tabs. One tab showing the data based on the selected parameters (ID and Category) and one tab with all of the data.
The data consists out of one ID and up to 4 categories with each category having 3 unique values. When selecting an item ID in the first tab, it should generate a dropdown list with all of the Category names of the item with the same ID from the data tab. It should only pull the categories which are not empty. Once an ID and one of the categories is selected in the first tab, it should pull the 3 unique values of that specific Category and display it in the first tab.
Tab 1
The dropdown list in the first cell is simply the range of all the values in the 'B' column of the data tab. Once an ID has been selected in Tab 1, it should automatically generate a dropdown list including all Category Values (if not empty). In the example below it should create a dropdown list with the values "Example 1 and Example 2". If there would be a value below Category 3 it should create a dropdown list with 3.
Once the ID and the Category has been selected, it should pull the corresponding First, Second and Third value from the selected category.
Data tab
There are several ways to achieve this behavior, but I would suggest using the =FILTER function (you can read more about it here).
I have set up my mock Data tab as follows, but of course this method can be easily adapted:
You can see that I am listing all the ID-Category combinations and their corresponding value (I presume there are several Categories per ID).
Now to the main tab:
For the ID column a simple Data Validation can be done. You can select all the IDs in the Data tab, the duplicates will automatically be thrown out. This can easily be achieved by:
=Sheet2!$A$2:$A$7
For the Category validation in the second column, an extra step is needed because natively populating drop-down lists (to dynamically adapt the Category drop-down to the current selected ID) is not [yet] supported. However, it can still be achieved will the following trick:
Where the formula used in the helper for validation is the following:
=TRANSPOSE(FILTER(Sheet2!B$2:B$7,Sheet2!A$2:A$7=A2))
and in the catergory data validation we have the following range:
=G2:2
For the different values, we can again make use of the FILTER formula. You can paste this into the C2 cell and extend it to as may columns and rows as required:
=FILTER(Sheet2!C$2:C$7,Sheet2!$B$2:$B$7=$B2,Sheet2!$A$2:$A$7=$A2)

How to get the all the recyclerView Items into ArrayList using appium

I have a scenario to verify the Sort&Filter functionality for Mobile App in Android.
Scenario:
Search for Item
Search Result Apper
Sort&Filter with some criteria
Have to Verify that Sort&Filter is applied correctly
Here results are added to RecyclerView.
As per RecyclerView/appium functionality, all the items are not loaded into view. Only visible Items are loaded into the view Hierarchy.
When I scroll Up the Linear Layout Indexes are re-arranged. I could not able to get all the Items.
Could you kindly provide me any sample scenario of this kind?
Or How can we achieve this kind of scenarios in Real Automation while working on the project?
Regards,
Shiva Oleti
Issue with Android as You stated is that it "sees" only what is visible on screen. I have similar issue, so I had to go deeper into element and fetch text. In your case I would do following:
1. Search Result Appear:
- fetch all visible elements, input search, fetch again -n results containing search result. Eg. if input 'beer' there should be eg. 4 elements with text containing "beer". Put elements in list and iterate:
List <MobileElement> listElements = driver.findElements(By.id("someId"));
for(MobileElement el : listElements){
if(el.getText().equalsIgnoreCase(expected)){
// do some validation //
}
}
Search Result Appear:
input exact value that will return unique, one result so You can easily count.
Sort&Filter with some criteria
remember initial values in items (text like 'Budweiser beer'), do some filtering / sorting, and check text in first element if is changed and if correct logic is applied (eg. sort desc.)
Have to Verify that Sort&Filter is applied correctly
think I answered in 3.
Basically:
'pick' text from items store them,
do some action (search, sort, filter),
'pick' newly changed items caused by 2. step, store them,
compare (depending on what You need...),
To get all items you have to swipe and store them in list.

Infinite scroll and duplicated data

I work on a mobile app which shows a stream of data fetched from the server. Initially the app fetches first page with 10 items. When user scrolls down, the app fetches the second page with next 10 items (in other words - infinite scroll). The problem I have is that when the user A fetches page number X it is possible, that the user B creates a new content on the server which modifies the resultset available for the user A. This means that if the user A tries to fetch X+1 page, it will contain previous item(s) which were "pushed back" by the new content. How to solve it? I came out with two solutions but I don't know which is better:
the mobile app remembers ids of already shown items and if in the next page there is an item which was already shown, it is not shown again.
the app remembers date of creation of the first item from the first page. When it fetches next pages, it additionaly sends this date to the server which adds this date to the sql query in order to maintain the same resultset
What do you think? Which is better? Are there better solutions?
UPDATE:
Imagine that I have a table 'queries' with columns 'queries_id' (integer, primary key), 'date_created' (timestamp). My query looks like this: select * from queries order by date_created desc. It is not true that date_created date_created increments with primary key incremenatation. I paginate data with Spring Data using Pageable object. Now the problem is that if new rows are created and they have date_created newer then previous newest row then they modify resultset.
This happens because you do the pagination based only on the date_created.
I assume that you do your query with ORDER BY date_created DESC and you offset for the current page.
To avoid your problem you need to add the last id of the previous fetch in your query. I.e. queries_id < last_id ORDER BY date_created .... etc

Resources