Skip to content

Commit 673459b

Browse files
committed
fix: minor fixes to explore tests
1 parent 41840d4 commit 673459b

1 file changed

Lines changed: 21 additions & 16 deletions

File tree

e2e/specs/explore.e2e.js

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -23,29 +23,33 @@ describe('Explore and Search Flow', () => {
2323

2424
// Helper to ensure we're on the Explore tab
2525
const ensureOnExplore = async () => {
26-
// First, make sure we're not stuck in search - go back if needed
26+
// Step 1: Check if we're in the Search screen (ROOT.SEARCH is separate from BottomTabs)
27+
// If search-back button is visible, we're in search and need to exit first
2728
try {
28-
const searchBack = await $('~search-back');
29-
if (await searchBack.isDisplayed()) {
30-
await searchBack.click();
31-
await driver.pause(500);
32-
}
29+
await SearchScreen.searchBack.waitForDisplayed();
30+
await SearchScreen.searchBack.click();
31+
await driver.pause(500);
3332
} catch {
34-
// Not in search results, continue
33+
// Not in search results screen, continue
3534
}
3635

37-
// Click the Explore tab bar button
36+
// Step 2: Also handle cancel-search button (for when in search input mode without results)
3837
try {
39-
const exploreTab = await $('~ExploreTab');
40-
if (await exploreTab.isDisplayed()) {
41-
await exploreTab.click();
42-
await driver.pause(500);
43-
}
38+
await SearchScreen.cancelSearch.waitForDisplayed();
39+
await SearchScreen.cancelSearch.click();
40+
await driver.pause(500);
4441
} catch {
45-
// Already on explore or error, continue
42+
// Not in search input mode, continue
4643
}
4744

48-
// Verify we're actually on the Explore screen by waiting for ForYouTab
45+
// Step 3: Wait for the ExploreTab to actually be present and visible
46+
// This ensures we're back in the BottomTabs navigator
47+
const exploreTab = await $('~ExploreTab');
48+
await exploreTab.waitForDisplayed({ timeout: 5000 });
49+
await exploreTab.click();
50+
await driver.pause(500);
51+
52+
// Step 4: Verify we're actually on the Explore screen by waiting for ForYouTab
4953
await ExploreScreen.forYouTab.waitForDisplayed({ timeout: 5000 });
5054
await ExploreScreen.waitForContentToLoad();
5155
};
@@ -203,7 +207,8 @@ describe('Explore and Search Flow', () => {
203207

204208
describe('Trending Tab', () => {
205209
before(async () => {
206-
await ensureOnExplore();
210+
await SearchScreen.goBack();
211+
await SearchScreen.goBack();
207212
});
208213

209214
it('should navigate to Trending tab', async () => {

0 commit comments

Comments
 (0)