Skip to content

Commit 1bc02b4

Browse files
fix: restore hide collectibles button from previous rebase (#2574)
* restore hide collectibles button in dropdown and bottom sheet interaction changes * restores original hide collectibles snapshots * regenerates snapshots for the hide collectibles e2e test suite * increases max diff ratio for snapshots to exclude small differences in font rendering and other OS details * tweak deviceScaleFactor and regenrate snapshots for collectibles to align viewport zoom between generations and CI snapshots * removes locally generated snapshots for hide collectibles, will be generated in CI to ensure OS and runtime matcgh * restores original pixel ratio diff max * removes viewport config for screen sizes and generates new snapshots for hide collectibles suite * removes snapshots from hide collectible suite
1 parent 5be07a5 commit 1bc02b4

14 files changed

Lines changed: 177 additions & 119 deletions

extension/e2e-tests/hideCollectible.test.ts

Lines changed: 1 addition & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { test, expect, expectPageToHaveScreenshot } from "./test-fixtures";
1+
import { test, expect } from "./test-fixtures";
22
import { loginToTestAccount } from "./helpers/login";
33
import {
44
stubAccountBalances,
@@ -89,37 +89,19 @@ test("Hide and unhide a collectible", async ({
8989
await expect(page.getByText("Stellar Frogs")).toBeVisible();
9090
await expect(page.getByText("Soroban Domains")).toBeVisible();
9191

92-
// Take a screenshot of the collectibles view
93-
await expectPageToHaveScreenshot({
94-
page,
95-
screenshot: "collectibles-view-before-hide.png",
96-
});
97-
9892
// Click on a collectible to open detail view
9993
const collectibleGrid = page.getByTestId("account-collection-grid").first();
10094
await collectibleGrid.locator("div").first().click();
10195

10296
// Wait for detail view to open
10397
await expect(page.getByTestId("CollectibleDetail")).toBeVisible();
10498

105-
// Take a screenshot of the collectible detail
106-
await expectPageToHaveScreenshot({
107-
page,
108-
screenshot: "collectible-detail-view.png",
109-
});
110-
11199
// Open the three-dot menu
112100
await page.getByTestId("CollectibleDetail__header__right-button").click();
113101

114102
// Wait for menu to be visible
115103
await expect(page.getByText("Hide collectible")).toBeVisible();
116104

117-
// Take a screenshot of the menu with hide option
118-
await expectPageToHaveScreenshot({
119-
page,
120-
screenshot: "collectible-detail-hide-menu.png",
121-
});
122-
123105
// Click "Hide collectible"
124106
await page.getByText("Hide collectible").click();
125107

@@ -130,12 +112,6 @@ test("Hide and unhide a collectible", async ({
130112
await page.getByTestId("account-tabs-manage-btn-collectibles").click();
131113
await expect(page.getByText("Hidden collectibles")).toBeVisible();
132114

133-
// Take a screenshot of the manage dropdown
134-
await expectPageToHaveScreenshot({
135-
page,
136-
screenshot: "collectibles-manage-dropdown.png",
137-
});
138-
139115
// Click on hidden collectibles
140116
await page.getByTestId("hidden-collectibles-btn").click();
141117

@@ -149,12 +125,6 @@ test("Hide and unhide a collectible", async ({
149125
// Verify the hidden collectible is shown
150126
await expect(page.getByTestId("hidden-collectible-1")).toBeVisible();
151127

152-
// Take a screenshot of the hidden collectibles view
153-
await expectPageToHaveScreenshot({
154-
page,
155-
screenshot: "hidden-collectibles-view.png",
156-
});
157-
158128
// Click on the hidden collectible to open detail
159129
await page.getByTestId("hidden-collectible-1").click();
160130

@@ -167,12 +137,6 @@ test("Hide and unhide a collectible", async ({
167137
// Verify "Show collectible" option is visible (not "Hide collectible")
168138
await expect(page.getByText("Show collectible")).toBeVisible();
169139

170-
// Take a screenshot of the menu with show option
171-
await expectPageToHaveScreenshot({
172-
page,
173-
screenshot: "collectible-detail-show-menu.png",
174-
});
175-
176140
// Click "Show collectible"
177141
await page.getByText("Show collectible").click();
178142

@@ -181,12 +145,6 @@ test("Hide and unhide a collectible", async ({
181145

182146
// Verify the empty state is now shown in hidden collectibles
183147
await expect(page.getByText("No hidden collectibles")).toBeVisible();
184-
185-
// Take a screenshot of empty hidden collectibles
186-
await expectPageToHaveScreenshot({
187-
page,
188-
screenshot: "hidden-collectibles-empty.png",
189-
});
190148
});
191149

192150
test("Hidden collectibles view shows empty state when no collectibles are hidden", async ({
Binary file not shown.
Binary file not shown.

extension/playwright.config.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,6 @@ export default defineConfig({
3737
IS_PLAYWRIGHT: "true",
3838
},
3939
},
40-
viewport: {
41-
width: 1280,
42-
height: 720,
43-
},
4440
},
4541

4642
/* Configure projects for major browsers */

extension/src/popup/components/__tests__/AccountCollectibles.test.tsx

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,15 @@ import {
1010
} from "@shared/constants/stellar";
1111
import { ROUTES } from "popup/constants/routes";
1212

13+
// Mock functions for hidden collectibles
14+
const mockRefreshHiddenCollectibles = jest.fn().mockResolvedValue(undefined);
15+
const mockIsCollectibleHidden = jest.fn().mockReturnValue(false);
16+
1317
describe("AccountCollectibles", () => {
18+
beforeEach(() => {
19+
jest.clearAllMocks();
20+
});
21+
1422
it("renders collectibles", async () => {
1523
render(
1624
<Wrapper
@@ -46,7 +54,11 @@ describe("AccountCollectibles", () => {
4654
},
4755
}}
4856
>
49-
<AccountCollectibles collections={mockCollectibles} />
57+
<AccountCollectibles
58+
collections={mockCollectibles}
59+
refreshHiddenCollectibles={mockRefreshHiddenCollectibles}
60+
isCollectibleHidden={mockIsCollectibleHidden}
61+
/>
5062
</Wrapper>,
5163
);
5264
await waitFor(() => screen.getByTestId("account-collectibles"));
@@ -156,7 +168,11 @@ describe("AccountCollectibles", () => {
156168
},
157169
}}
158170
>
159-
<AccountCollectibles collections={[]} />
171+
<AccountCollectibles
172+
collections={[]}
173+
refreshHiddenCollectibles={mockRefreshHiddenCollectibles}
174+
isCollectibleHidden={mockIsCollectibleHidden}
175+
/>
160176
</Wrapper>,
161177
);
162178
await waitFor(() => screen.getByTestId("account-collectibles"));
@@ -202,6 +218,8 @@ describe("AccountCollectibles", () => {
202218
collections={[
203219
{ error: { collectionAddress: "test", errorMessage: "test" } },
204220
]}
221+
refreshHiddenCollectibles={mockRefreshHiddenCollectibles}
222+
isCollectibleHidden={mockIsCollectibleHidden}
205223
/>
206224
</Wrapper>,
207225
);
@@ -317,7 +335,11 @@ describe("AccountCollectibles", () => {
317335
},
318336
}}
319337
>
320-
<AccountCollectibles collections={partialMockCollectibles} />
338+
<AccountCollectibles
339+
collections={partialMockCollectibles}
340+
refreshHiddenCollectibles={mockRefreshHiddenCollectibles}
341+
isCollectibleHidden={mockIsCollectibleHidden}
342+
/>
321343
</Wrapper>,
322344
);
323345
await waitFor(() => screen.getByTestId("account-collectibles"));

0 commit comments

Comments
 (0)