feat: add end-to-end tests for Agents, Chat, Navigation, and Settings screens

This commit is contained in:
Jonathan Atta
2026-03-03 14:47:44 +01:00
parent 41c7634b75
commit a213b1593a
11 changed files with 363 additions and 6 deletions

86
app/e2e/navigation.e2e.js Normal file
View File

@@ -0,0 +1,86 @@
/**
* e2e/navigation.e2e.js
*
* Verifies that every bottom-tab destination renders correctly.
*/
const { navigatePastSplash, tapTab } = require('./helpers');
describe('Tab Navigation', () => {
beforeAll(async () => {
await device.launchApp({ newInstance: true });
await navigatePastSplash();
});
// ─── Models (default tab) ────────────────────────────────────────────────
it('opens the Models tab by default', async () => {
// MaterialTopTabNavigator renders tab labels twice (tab bar + pager) — use atIndex(0)
await waitFor(element(by.text('Mod\u00e8les locaux')).atIndex(0))
.toBeVisible()
.withTimeout(5000);
});
it('shows the HuggingFace sub-tab inside Models', async () => {
await waitFor(element(by.text('HuggingFace')).atIndex(0))
.toBeVisible()
.withTimeout(5000);
});
// ─── Chat ────────────────────────────────────────────────────────────────
it('navigates to Chat tab and shows the message input', async () => {
await tapTab('Chat');
await waitFor(element(by.id('chat-input-field')))
.toBeVisible()
.withTimeout(5000);
});
it('shows the send button in Chat tab', async () => {
await waitFor(element(by.id('chat-send-btn')))
.toBeVisible()
.withTimeout(3000);
});
// ─── Agents ──────────────────────────────────────────────────────────────
it('navigates to Agents tab and shows the header', async () => {
await tapTab('Agents');
// Use testID to avoid matching the bottom tab bar label as well
await waitFor(element(by.id('agents-screen-title')))
.toBeVisible()
.withTimeout(5000);
});
it('shows the new-agent button in Agents tab', async () => {
await waitFor(element(by.id('new-agent-btn')))
.toBeVisible()
.withTimeout(3000);
});
// ─── Hardware ────────────────────────────────────────────────────────────
it('navigates to Matériel tab and shows hardware page title', async () => {
await tapTab('Matériel');
await waitFor(element(by.text('🖥 Matériel')))
.toBeVisible()
.withTimeout(5000);
});
// ─── Settings ────────────────────────────────────────────────────────────
it('navigates to Réglages tab and shows Settings title', async () => {
await tapTab('Réglages');
await waitFor(element(by.text('Settings')))
.toBeVisible()
.withTimeout(5000);
});
// ─── Back to Models ──────────────────────────────────────────────────────
it('navigates back to Models tab', async () => {
await tapTab('Modèles');
await waitFor(element(by.text('Mod\u00e8les locaux')).atIndex(0))
.toBeVisible()
.withTimeout(5000);
});
});