Topsite cell count is not updated after deleting only Topsite icon left

RESOLVED FIXED

Status

()

Firefox for iOS
Home screen
RESOLVED FIXED
6 months ago
5 months ago

People

(Reporter: njpark, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

6 months ago
Tests in TopsitesTest.swift is disabled, because test was crashing with view inconsistency.  What happens is that when all of the topsite cells are that the count of visible cells decrease as the cells are deleted, but when the last cell is deleted, the count remains 1, yet the cell's isVisibleInViewHierachy() value is set to false. Hence, below code will hit break at the last iteration:

var topSiteCell = tester().waitForView(withAccessibilityIdentifier: "TopSitesCell") as! ASHorizontalScrollCell
        var collection = topSiteCell.collectionView
        
        while collection.visibleCells.count > 0 {
            let firstCell = collection.visibleCells.first!
            if firstCell.isVisibleInViewHierarchy() == false {
                break
            } else {
                // Deletes the cell by long press -> select 'Remove' menu
                deleteSuggestedTopsite(firstCell.accessibilityLabel!)
            }
        }

The workaround is that when the view is changed to something else, like Bookmarks, and return to Topsites view, the number will be updated.  But since it had no problem decrementing the visible cell's count except in the case when there was only one cell left, I believe this is a bug that should be fixed.

Farhan, is this something that can be fixed in short term?  if not, then I'll mark the tests and put workaround to it.
(Reporter)

Updated

6 months ago
Flags: needinfo?(fpatel)
(Reporter)

Updated

6 months ago
Summary: Topsite cell count is not updated after deleting only Topsite icon → Topsite cell count is not updated after deleting only Topsite icon left
There's been some changes to Topsites so these tests will need to be completely rewritten.
Flags: needinfo?(fpatel)
Is this still valid? If not could you close this :)
Flags: needinfo?(npark)
(Reporter)

Comment 3

5 months ago
wait, yeah this change is already made a while ago. closing it.
Status: NEW → RESOLVED
Last Resolved: 5 months ago
Flags: needinfo?(npark)
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.