const { createMockApiServer } = require('./helpers/mockApiServer'); describe('profile network mock', () => { let api; beforeAll(async () => { api = await createMockApiServer(); if (device.getPlatform() === 'android') { await device.reverseTcpPort(api.port); } }); afterAll(async () => { if (device.getPlatform() === 'android') { await device.unreverseTcpPort(api.port); } await api.close(); }); beforeEach(async () => { api.reset(); api.route('GET', '/profile', { status: 200, body: { name: 'E2E Shopper', plan: 'Mock Plus', }, }); await device.launchApp({ newInstance: true, launchArgs: { e2e: 'true', e2eApiBaseUrl: api.baseUrl, }, }); }); it('renders profile data from the mock API', async () => { await element(by.id('profile-tab')).tap(); await expect(element(by.id('profile-name'))).toHaveText('E2E Shopper'); await expect(element(by.id('profile-plan'))).toHaveText('Mock Plus'); }); });