Challenge - 5 Problems
Detox Mastery Badge
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ ui_behavior
intermediate2:00remaining
What does this Detox test check?
Given this Detox test code, what UI behavior is being verified?
React Native
describe('Login screen', () => { beforeEach(async () => { await device.reloadReactNative(); }); it('should show error on empty login', async () => { await element(by.id('loginButton')).tap(); await expect(element(by.text('Please enter username'))).toBeVisible(); }); });
Attempts:
2 left
💡 Hint
Look at what element is tapped and what text is expected to be visible.
✗ Incorrect
The test taps the login button without entering username and expects an error message 'Please enter username' to appear.
❓ lifecycle
intermediate1:30remaining
What does device.reloadReactNative() do in Detox?
In Detox tests, what is the purpose of calling device.reloadReactNative() before each test?
Attempts:
2 left
💡 Hint
Think about why tests need a clean start.
✗ Incorrect
device.reloadReactNative() reloads the React Native app to a fresh state before each test, ensuring no leftover state affects the next test.
📝 Syntax
advanced2:00remaining
Identify the syntax error in this Detox test snippet
What is the syntax error in this Detox test code?
React Native
it('should login successfully', async () => { await element(by.id('usernameInput')).typeText('user'); await element(by.id('passwordInput')).typeText('pass'); element(by.id('loginButton')).tap() await expect(element(by.id('welcomeMessage'))).toBeVisible(); });
Attempts:
2 left
💡 Hint
Check async calls and awaits carefully.
✗ Incorrect
The tap() call is asynchronous and must be awaited to ensure proper test flow.
🔧 Debug
advanced2:30remaining
Why does this Detox test fail with timeout?
This Detox test fails with a timeout error on the last expect statement. Why?
React Native
it('shows welcome after login', async () => { await element(by.id('usernameInput')).typeText('user'); await element(by.id('passwordInput')).typeText('pass'); await element(by.id('loginButton')).tap(); await expect(element(by.id('welcomeMessage'))).toBeVisible(); });
Attempts:
2 left
💡 Hint
Consider what happens if login does not succeed.
✗ Incorrect
If login fails silently, the welcomeMessage never appears, causing the expect to timeout waiting for it.
🧠 Conceptual
expert3:00remaining
Why use Detox for React Native E2E testing instead of Jest alone?
Which reason best explains why Detox is preferred for end-to-end testing in React Native apps over Jest unit tests?
Attempts:
2 left
💡 Hint
Think about what E2E testing means compared to unit testing.
✗ Incorrect
Detox tests the full app on devices or emulators, simulating real user actions, unlike Jest which tests code logic only.