From 72ddeaa90ae3a8f871dfc136fa73045cb7709538 Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Wed, 25 Sep 2024 10:53:38 +0200 Subject: [PATCH] test: refs #8031 e2e --- src/components/UserPanel.vue | 20 ++++--- src/i18n/locale/en.yml | 1 + src/i18n/locale/es.yml | 1 + .../integration/vnComponent/UserPanel.spec.js | 58 +++++++++++++++++++ test/cypress/support/commands.js | 6 ++ 5 files changed, 78 insertions(+), 8 deletions(-) create mode 100644 test/cypress/integration/vnComponent/UserPanel.spec.js diff --git a/src/components/UserPanel.vue b/src/components/UserPanel.vue index 5276f9e20..810f63044 100644 --- a/src/components/UserPanel.vue +++ b/src/components/UserPanel.vue @@ -78,9 +78,9 @@ async function saveDarkMode(value) { darkMode: value, }); user.value.darkMode = value; - notify('globals.dataSaved', 'positive'); + onDataSaved(); } catch (error) { - console.error(error); + onDataError(); } } @@ -91,9 +91,9 @@ async function saveLanguage(value) { lang: value, }); user.value.lang = value; - notify('globals.dataSaved', 'positive'); + onDataSaved(); } catch (error) { - console.error(error); + onDataError(); } } @@ -110,19 +110,23 @@ function localUserData() { state.setUser(user.value); } -function saveUserData(param, value) { +async function saveUserData(param, value) { try { - axios.post('UserConfigs/setUserConfig', { [param]: value }); + await axios.post('UserConfigs/setUserConfig', { [param]: value }); localUserData(); - notify('globals.dataSaved', 'positive'); + onDataSaved(); } catch (error) { - console.error(error); + onDataError(); } } const onDataSaved = () => { notify('globals.dataSaved', 'positive'); }; + +const onDataError = () => { + notify('errors.updateUserConfig', 'negative'); +};