diff --git a/apps/datahub-e2e/src/e2e/home.cy.ts b/apps/datahub-e2e/src/e2e/home.cy.ts
index e8465065f5..feee999e30 100644
--- a/apps/datahub-e2e/src/e2e/home.cy.ts
+++ b/apps/datahub-e2e/src/e2e/home.cy.ts
@@ -96,7 +96,12 @@ describe('home', () => {
.invoke('text')
.as('favoriteTitle')
cy.get('@favoriteItem').find('gn-ui-favorite-star button').click()
- cy.wait(100)
+
+ // wait for the favorite count to change before filtering
+ cy.get('@favoriteItem')
+ .find('[data-test=favorite-count]')
+ .invoke('text')
+ .should('eq', '1')
// show my favorites only
cy.get('datahub-header-badge-button[label$=favorites] button').click({
diff --git a/libs/feature/search/src/lib/favorites/favorite-star/favorite-star.component.html b/libs/feature/search/src/lib/favorites/favorite-star/favorite-star.component.html
index ad071d7bd2..78c5fb604d 100644
--- a/libs/feature/search/src/lib/favorites/favorite-star/favorite-star.component.html
+++ b/libs/feature/search/src/lib/favorites/favorite-star/favorite-star.component.html
@@ -1,6 +1,7 @@
{{ favoriteCount }}
@@ -10,7 +11,8 @@
[disabled]="loading || (isAnonymous$ | async)"
>
diff --git a/libs/feature/search/src/lib/favorites/favorite-star/favorite-star.component.spec.ts b/libs/feature/search/src/lib/favorites/favorite-star/favorite-star.component.spec.ts
index b2d3272a07..7c01e1502f 100644
--- a/libs/feature/search/src/lib/favorites/favorite-star/favorite-star.component.spec.ts
+++ b/libs/feature/search/src/lib/favorites/favorite-star/favorite-star.component.spec.ts
@@ -88,7 +88,7 @@ describe('FavoriteStarComponent', () => {
})
it('shows the amount of favorites on the record', () => {
favoriteCountHTMLEl = fixture.debugElement.query(
- By.css('.favorite-count')
+ By.css('[data-test=favorite-count]')
).nativeElement
expect(favoriteCountHTMLEl).toBeTruthy()
expect(favoriteCountHTMLEl.textContent).toEqual(
@@ -103,7 +103,7 @@ describe('FavoriteStarComponent', () => {
})
it('does not show the amount of favorites on the record', () => {
const favoriteCountEl = fixture.debugElement.query(
- By.css('.favorite-count')
+ By.css('[data-test=favorite-count]')
)
expect(favoriteCountEl).toBeFalsy()
})
@@ -182,7 +182,7 @@ describe('FavoriteStarComponent', () => {
}
fixture.detectChanges()
favoriteCountHTMLEl = fixture.debugElement.query(
- By.css('.favorite-count')
+ By.css('[data-test=favorite-count]')
).nativeElement
})
describe('When my record is part of the updates', () => {