diff --git a/public/mobile-app/src/routes/+page.svelte b/public/mobile-app/src/routes/+page.svelte
index 2b7403203..e01e4a1e8 100644
--- a/public/mobile-app/src/routes/+page.svelte
+++ b/public/mobile-app/src/routes/+page.svelte
@@ -46,6 +46,10 @@
await initializeData(page.url.searchParams, userStore);
if (page.url.searchParams.get('user_first_login') === 'true') {
goto('/#/notifications-welcome-page');
+ /* to be replaced by:
+ * goto('/#/welcome/notifications');
+ * if app mobile is ready to intercept this new url
+ */
} else {
goto('/');
}
diff --git a/public/mobile-app/src/routes/notifications-welcome-page/+page.svelte b/public/mobile-app/src/routes/notifications-welcome-page/+page.svelte
index 642576172..a29e5d4b8 100644
--- a/public/mobile-app/src/routes/notifications-welcome-page/+page.svelte
+++ b/public/mobile-app/src/routes/notifications-welcome-page/+page.svelte
@@ -1,101 +1,10 @@
-
-
-
-

-
-
Activez les notifications pour suivre vos démarches
-
-
- Recevez des alertes de suivi et des rappels utiles quand vous en avez besoin. Vous
- pourrez les désactiver à tout moment.
-
-
-
-
-
-
-
-
-
-
diff --git a/public/mobile-app/src/routes/notifications-welcome-page/page.svelte.test.ts b/public/mobile-app/src/routes/notifications-welcome-page/page.svelte.test.ts
index 82f1b5dbb..b9f3cc255 100644
--- a/public/mobile-app/src/routes/notifications-welcome-page/page.svelte.test.ts
+++ b/public/mobile-app/src/routes/notifications-welcome-page/page.svelte.test.ts
@@ -1,108 +1,24 @@
-import { fireEvent, render, screen, waitFor } from '@testing-library/svelte';
-import { beforeEach, describe, expect, test, vi } from 'vitest';
+import { render, waitFor } from '@testing-library/svelte';
+import { describe, expect, test, vi } from 'vitest';
+import '@testing-library/jest-dom/vitest';
import * as navigationMethods from '$app/navigation';
-import * as notificationsMethods from '$lib/notifications';
-import { toastStore } from '$lib/state/toast.svelte';
-import { userStore } from '$lib/state/User.svelte';
-import { mockUserInfo } from '$tests/utils';
import Page from './+page.svelte';
describe('/+page.svelte', () => {
- beforeEach(() => {
- vi.mock('$lib/notifications', () => ({
- enableNotificationsAndUpdateLocalStorage: vi.fn().mockReturnValue(true),
- }));
- });
-
- test('user has to be connected', async () => {
- // Given
- const spy = vi
- .spyOn(navigationMethods, 'goto')
- .mockImplementation(() => Promise.resolve());
-
- // When
- render(Page);
-
- // Then
- await waitFor(() => {
- expect(spy).toHaveBeenCalledTimes(1);
- expect(spy).toHaveBeenCalledWith('/');
- });
- });
-
- test('should enable notifications when user clicks on Activer button', async () => {
- // Given
- await userStore.login(mockUserInfo);
- const spy = vi.spyOn(
- notificationsMethods,
- 'enableNotificationsAndUpdateLocalStorage'
- );
- render(Page);
-
- // When
- const button = screen.getByTestId('enable-button');
- await fireEvent.click(button);
-
- // Then
- await waitFor(async () => {
- expect(spy).toHaveBeenCalled();
- });
- });
-
- test('should add toast when user clicks on Activer button', async () => {
- // Given
- await userStore.login(mockUserInfo);
- const spy = vi.spyOn(toastStore, 'addToast');
- render(Page);
-
- // When
- const button = screen.getByTestId('enable-button');
- await fireEvent.click(button);
-
- // Then
- await waitFor(async () => {
- expect(spy).toHaveBeenCalledWith(
- 'Les notifications ont été activées',
- 'success',
- 3000,
- false
- );
- });
- });
-
- test('should navigate to the homepage when user clicks on Activer button', async () => {
+ test('should redirect to new page', async () => {
// Given
- await userStore.login(mockUserInfo);
const spy = vi
.spyOn(navigationMethods, 'goto')
.mockImplementation(() => Promise.resolve());
- render(Page);
// When
- const button = screen.getByTestId('enable-button');
- await fireEvent.click(button);
-
- // Then
- await waitFor(() => {
- expect(spy).toHaveBeenCalledWith('/');
- });
- });
-
- test('should navigate to the homepage when user clicks on Skip button', async () => {
- // Given
- await userStore.login(mockUserInfo);
- const spy = vi
- .spyOn(navigationMethods, 'goto')
- .mockImplementation(() => Promise.resolve());
render(Page);
- // When
- const button = screen.getByTestId('skip-button');
- await fireEvent.click(button);
-
// Then
await waitFor(() => {
- expect(spy).toHaveBeenCalledWith('/');
+ expect(spy).toHaveBeenCalledWith('/#/welcome/notifications', {
+ replaceState: true,
+ });
});
});
});
diff --git a/public/mobile-app/src/routes/welcome/notifications/+page.svelte b/public/mobile-app/src/routes/welcome/notifications/+page.svelte
new file mode 100644
index 000000000..2e7d35199
--- /dev/null
+++ b/public/mobile-app/src/routes/welcome/notifications/+page.svelte
@@ -0,0 +1,101 @@
+
+
+
+
+

+
+
Activez les notifications pour suivre vos démarches
+
+
+ Recevez des alertes de suivi et des rappels utiles quand vous en avez besoin. Vous
+ pourrez les désactiver à tout moment.
+
+
+
+
+
+
+
+
+
+
diff --git a/public/mobile-app/src/routes/welcome/notifications/page.svelte.test.ts b/public/mobile-app/src/routes/welcome/notifications/page.svelte.test.ts
new file mode 100644
index 000000000..f375c4dd7
--- /dev/null
+++ b/public/mobile-app/src/routes/welcome/notifications/page.svelte.test.ts
@@ -0,0 +1,108 @@
+import { fireEvent, render, screen, waitFor } from '@testing-library/svelte';
+import { beforeEach, describe, expect, test, vi } from 'vitest';
+import * as navigationMethods from '$app/navigation';
+import * as notificationsMethods from '$lib/notifications';
+import { toastStore } from '$lib/state/toast.svelte';
+import { userStore } from '$lib/state/User.svelte';
+import { mockUserInfo } from '$tests/utils';
+import Page from './+page.svelte';
+
+describe('/+page.svelte', () => {
+ beforeEach(() => {
+ vi.mock('$lib/notifications', () => ({
+ enableNotificationsAndUpdateLocalStorage: vi.fn().mockReturnValue(true),
+ }));
+ });
+
+ test('user has to be connected', async () => {
+ // Given
+ const spy = vi
+ .spyOn(navigationMethods, 'goto')
+ .mockImplementation(() => Promise.resolve());
+
+ // When
+ render(Page);
+
+ // Then
+ await waitFor(() => {
+ expect(spy).toHaveBeenCalledTimes(1);
+ expect(spy).toHaveBeenCalledWith('/');
+ });
+ });
+
+ test('should enable notifications when user clicks on Activer button', async () => {
+ // Given
+ await userStore.login(mockUserInfo);
+ const spy = vi.spyOn(
+ notificationsMethods,
+ 'enableNotificationsAndUpdateLocalStorage'
+ );
+ render(Page);
+
+ // When
+ const button = screen.getByTestId('enable-button');
+ await fireEvent.click(button);
+
+ // Then
+ await waitFor(async () => {
+ expect(spy).toHaveBeenCalled();
+ });
+ });
+
+ test('should add toast when user clicks on Activer button', async () => {
+ // Given
+ await userStore.login(mockUserInfo);
+ const spy = vi.spyOn(toastStore, 'addToast');
+ render(Page);
+
+ // When
+ const button = screen.getByTestId('enable-button');
+ await fireEvent.click(button);
+
+ // Then
+ await waitFor(async () => {
+ expect(spy).toHaveBeenCalledWith(
+ 'Les notifications ont été activées',
+ 'success',
+ 3000,
+ false
+ );
+ });
+ });
+
+ test('should navigate to zone preferences when user clicks on Activer button', async () => {
+ // Given
+ await userStore.login(mockUserInfo);
+ const spy = vi
+ .spyOn(navigationMethods, 'goto')
+ .mockImplementation(() => Promise.resolve());
+ render(Page);
+
+ // When
+ const button = screen.getByTestId('enable-button');
+ await fireEvent.click(button);
+
+ // Then
+ await waitFor(() => {
+ expect(spy).toHaveBeenCalledWith('/#/welcome/zones');
+ });
+ });
+
+ test('should navigate to zone preferences when user clicks on Skip button', async () => {
+ // Given
+ await userStore.login(mockUserInfo);
+ const spy = vi
+ .spyOn(navigationMethods, 'goto')
+ .mockImplementation(() => Promise.resolve());
+ render(Page);
+
+ // When
+ const button = screen.getByTestId('skip-button');
+ await fireEvent.click(button);
+
+ // Then
+ await waitFor(() => {
+ expect(spy).toHaveBeenCalledWith('/#/welcome/zones');
+ });
+ });
+});
diff --git a/public/mobile-app/src/routes/welcome/zones/+page.svelte b/public/mobile-app/src/routes/welcome/zones/+page.svelte
new file mode 100644
index 000000000..506ff629f
--- /dev/null
+++ b/public/mobile-app/src/routes/welcome/zones/+page.svelte
@@ -0,0 +1,52 @@
+
+
+