Skip to content
Snippets Groups Projects
Unverified Commit c497d3a9 authored by Matiss Janis Aboltins's avatar Matiss Janis Aboltins Committed by GitHub
Browse files

:test_tube: improve onboarding e2e test stability (#3503)

parent fe17c6ba
No related branches found
No related tags found
No related merge requests found
......@@ -31,6 +31,7 @@ import { TransactionEdit } from './mobile/transactions/TransactionEdit';
import { Notifications } from './Notifications';
import { ManagePayeesPage } from './payees/ManagePayeesPage';
import { Reports } from './reports';
import { LoadingIndicator } from './reports/LoadingIndicator';
import { NarrowAlternate, WideComponent } from './responsive';
import { Settings } from './settings';
import { FloatableSidebar } from './sidebar';
......@@ -65,19 +66,6 @@ function WideNotSupported({ children, redirectTo = '/budget' }) {
}
function RouterBehaviors() {
const navigate = useNavigate();
const accounts = useAccounts();
const accountsLoaded = useSelector(
(state: State) => state.queries.accountsLoaded,
);
useEffect(() => {
// If there are no accounts, we want to redirect the user to
// the All Accounts screen which will prompt them to add an account
if (accountsLoaded && accounts.length === 0) {
navigate('/accounts');
}
}, [accountsLoaded, accounts]);
const location = useLocation();
const href = useHref(location);
useEffect(() => {
......@@ -91,6 +79,11 @@ export function FinancesApp() {
const dispatch = useDispatch();
const { t } = useTranslation();
const accounts = useAccounts();
const accountsLoaded = useSelector(
(state: State) => state.queries.accountsLoaded,
);
const [lastUsedVersion, setLastUsedVersion] = useLocalPref(
'flags.updateNotificationShownForVersion',
);
......@@ -180,7 +173,22 @@ export function FinancesApp() {
<BankSyncStatus />
<Routes>
<Route path="/" element={<Navigate to="/budget" replace />} />
<Route
path="/"
element={
accountsLoaded ? (
accounts.length > 0 ? (
<Navigate to="/budget" replace />
) : (
// If there are no accounts, we want to redirect the user to
// the All Accounts screen which will prompt them to add an account
<Navigate to="/accounts" replace />
)
) : (
<LoadingIndicator />
)
}
/>
<Route path="/reports/*" element={<Reports />} />
......
---
category: Maintenance
authors: [MatissJanis]
---
e2e: improve onboarding test stability.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment