@@ -45,6 +45,7 @@ import { FadeTransition } from 'vue2-transitions'
import CONFIG from '@/config'
export default {
+ name: 'DashboardLayout',
components: {
Navbar,
Sidebar,
@@ -53,16 +54,19 @@ export default {
},
data() {
return {
- logo: 'img/brand/green.png',
balance: 0,
GdtBalance: 0,
transactions: [],
- bookedBalance: 0,
transactionCount: 0,
transactionLinkCount: 0,
pending: true,
visible: false,
- decayStartBlock: new Date(),
+ tunneledEmail: null,
+ }
+ },
+ provide() {
+ return {
+ getTunneledEmail: () => this.tunneledEmail,
}
},
methods: {
@@ -96,12 +100,13 @@ export default {
data: { transactionList },
} = result
this.GdtBalance =
- transactionList.balanceGDT === null ? null : Number(transactionList.balanceGDT)
+ transactionList.balance.balanceGDT === null
+ ? null
+ : Number(transactionList.balance.balanceGDT)
this.transactions = transactionList.transactions
- this.balance = Number(transactionList.balance)
- this.transactionCount = transactionList.count
- this.transactionLinkCount = transactionList.linkCount
- this.decayStartBlock = new Date(transactionList.decayStartBlock)
+ this.balance = Number(transactionList.balance.balance)
+ this.transactionCount = transactionList.balance.count
+ this.transactionLinkCount = transactionList.balance.linkCount
this.pending = false
})
.catch((error) => {
@@ -118,6 +123,9 @@ export default {
setVisible(bool) {
this.visible = bool
},
+ setTunneledEmail(email) {
+ this.tunneledEmail = email
+ },
},
computed: {
elopageUri() {
diff --git a/frontend/src/locales/de.json b/frontend/src/locales/de.json
index 35155ca79..3b4912a2f 100644
--- a/frontend/src/locales/de.json
+++ b/frontend/src/locales/de.json
@@ -1,5 +1,22 @@
{
+ "100": "100%",
+ "1000thanks": "1000 Dank, weil du bei uns bist!",
+ "125": "125%",
+ "85": "85%",
"advanced-calculation": "Vorausberechnung",
+ "auth": {
+ "left": {
+ "gratitude": "Dankbarkeit",
+ "hasAccount": "Du hast schon einen Account?",
+ "hereLogin": "Hier Anmelden",
+ "learnMore": "Erfahre mehr …",
+ "newCurrency": "Die neue Währung",
+ "oneAnotherNature": "FÜR EINANDER, FÜR ALLE, FÜR DIE NATUR"
+ },
+ "navbar": {
+ "aboutGradido": "Über Gradido"
+ }
+ },
"back": "Zurück",
"community": {
"choose-another-community": "Eine andere Gemeinschaft auswählen",
@@ -30,12 +47,17 @@
"delete": "Löschen",
"em-dash": "—",
"error": {
+ "email-already-sent": "Wir haben dir bereits eine E-Mail vor weniger als 10 Minuten geschickt.",
"empty-transactionlist": "Es gab einen Fehler mit der Übermittlung der Anzahl deiner Transaktionen.",
"error": "Fehler!",
- "no-account": "Leider konnten wir keinen Account mit diesen Daten finden.",
- "no-transactionlist": "Es gab leider einen Fehler. Es wurden keine Transaktionen vom Server übermittelt",
- "session-expired": "Die Sitzung wurde aus Sicherheitsgründen beendet."
+ "no-account": "Leider konnten wir keinen (aktivierten) Account mit diesen Daten finden.",
+ "no-transactionlist": "Es gab leider einen Fehler. Es wurden keine Transaktionen vom Server übermittelt.",
+ "no-user": "Kein Benutzer mit diesen Anmeldedaten.",
+ "session-expired": "Die Sitzung wurde aus Sicherheitsgründen beendet.",
+ "unknown-error": "Unbekanter Fehler: ",
+ "user-already-exists": "Ein Benutzer mit diesen Daten existiert bereits."
},
+ "followUs": "folge uns:",
"footer": {
"app_version": "App version {version}",
"copyright": {
@@ -51,6 +73,7 @@
"amount": "Betrag",
"at": "am",
"cancel": "Abbrechen",
+ "check_now": "Jetzt prüfen",
"close": "Schließen",
"current_balance": "Aktueller Kontostand",
"date": "Datum",
@@ -59,7 +82,7 @@
"email": "E-Mail",
"firstname": "Vorname",
"from": "Von",
- "generate_now": "jetzt generieren",
+ "generate_now": "Jetzt generieren",
"lastname": "Nachname",
"memo": "Nachricht",
"message": "Nachricht",
@@ -94,42 +117,46 @@
},
"GDD": "GDD",
"gdd_per_link": {
- "choose-amount": "Wähle einen Betrag aus, welchen du per Link versenden möchtest. Du kannst auch noch eine Nachricht eintragen. Beim Klick „jetzt generieren“ wird ein Link erstellt, den du versenden kannst.",
+ "choose-amount": "Wähle einen Betrag aus, welchen du per Link versenden möchtest. Du kannst auch noch eine Nachricht eintragen. Beim Klick „Jetzt generieren“ wird ein Link erstellt, den du versenden kannst.",
"copy": "kopieren",
"created": "Der Link wurde erstellt!",
"decay-14-day": "Vergänglichkeit für 14 Tage",
"delete-the-link": "Den Link löschen?",
"deleted": "Der Link wurde gelöscht!",
- "expired": "Abgelaufen",
- "has-account": "Du besitzt bereits ein Gradido Konto",
+ "expiredOn": "Abgelaufen am",
+ "has-account": "Du besitzt bereits ein Gradido Konto?",
"header": "Gradidos versenden per Link",
- "link-copied": "Link wurde in die Zwischenablage kopiert",
+ "isFree": "Gradido ist weltweit kostenfrei.",
+ "link-copied": "Link wurde in die Zwischenablage kopiert. Du kannst ihn jetzt in eine E-Mail oder Nachricht einfügen.",
"link-deleted": "Der Link wurde am {date} gelöscht.",
"link-expired": "Der Link ist nicht mehr gültig. Die Gültigkeit ist am {date} abgelaufen.",
"link-overview": "Linkübersicht",
"links_count": "Aktive Links",
- "links_sum": "Summe deiner versendeten Gradidos",
- "no-account": "Du besitzt noch kein Gradido Konto",
+ "links_sum": "Offene Links und QR-Codes",
+ "no-account": "Du besitzt noch kein Gradido Konto?",
"no-redeem": "Du darfst deinen eigenen Link nicht einlösen!",
- "not-copied": "Konnte den Link nicht kopieren: {err}",
+ "not-copied": "Dein Gerät lässt das Kopieren leider nicht zu! Bitte kopiere den Link von Hand!",
"redeem": "Einlösen",
"redeem-text": "Willst du den Betrag jetzt einlösen?",
"redeemed": "Erfolgreich eingelöst! Deinem Konto wurden {n} GDD gutgeschrieben.",
"redeemed-at": "Der Link wurde bereits am {date} eingelöst.",
+ "redeemed-title": "eingelöst",
"to-login": "Log dich ein",
- "to-register": "Registriere ein neues Konto"
+ "to-register": "Registriere ein neues Konto.",
+ "validUntil": "Gültig bis"
},
"gdt": {
- "calculation": "Berechnung der GradidoTransform",
+ "calculation": "Berechnung der Gradido Transform",
"contribution": "Beitrag",
"conversion": "Umrechnung",
- "conversion-gdt-euro": "Umrechnung Euro / GradidoTransform (GDT)",
+ "conversion-gdt-euro": "Umrechnung Euro / Gradido Transform (GDT)",
"credit": "Gutschrift",
"factor": "Faktor",
"formula": "Berechnungsformel",
"funding": "Zu den Förderbeiträgen",
- "gdt-received": "GradidoTransform (GDT) erhalten",
- "no-transactions": "Du hast noch keine GradidoTransform (GDT).",
+ "gdt": "Gradido Transform",
+ "gdt-received": "Gradido Transform (GDT) erhalten",
+ "no-transactions": "Du hast noch keine Gradido Transform (GDT).",
"not-reachable": "Der GDT Server ist nicht erreichbar.",
"publisher": "Dein geworbenes Mitglied hat einen Beitrag bezahlt",
"raise": "Erhöhung",
@@ -140,9 +167,9 @@
"login": "Anmeldung",
"math": {
"aprox": "~",
- "div": "/",
"equal": "=",
"exclaim": "!",
+ "minus": "−",
"pipe": "|"
},
"navigation": {
@@ -155,10 +182,7 @@
"support": "Support",
"transactions": "Transaktionen"
},
- "publisher": {
- "infoText": "Wenn dir dein Empfehlungsgeber seine Publisher-Id gegeben hat, trage sie hier ein, sonst lass das Feld bitte unverändert!",
- "publisherId": "Publisher-Id:"
- },
+ "qrCode": "QR Code",
"send_gdd": "GDD versenden",
"send_per_link": "GDD versenden per Link",
"settings": {
@@ -198,24 +222,28 @@
"subtitle": "Wenn du dein Passwort vergessen hast, kannst du es hier zurücksetzen."
}
},
+ "signin": "Anmelden",
"signup": "Registrieren",
"site": {
+ "forgotPassword": {
+ "heading": "Bitte gib deine E-Mail an mit der du bei Gradido angemeldet bist."
+ },
"login": {
- "community": "Tausend Dank, weil du bei uns bist!",
- "heading": "Gradido",
- "new_wallet": "Neues Konto erstellen",
- "signin": "Anmelden"
+ "heading": "Melde dich mit deinen Zugangsdaten an. Bewahre sie stets sicher auf!",
+ "saveLogin": "Anmeldung speichern"
+ },
+ "resetPassword": {
+ "heading": "Trage bitte dein Passwort ein und wiederhole es."
},
"signup": {
"agree": "Ich stimme der
Datenschutzerklärung zu.",
"dont_match": "Die Passwörter stimmen nicht überein.",
+ "heading": "Registriere dich indem du alle Daten vollständig und in die richtigen Felder eingibst.",
"lowercase": "Ein Kleinbuchstabe erforderlich.",
"minimum": "Mindestens 8 Zeichen.",
"no-whitespace": "Keine Leerzeichen und Tabulatoren",
"one_number": "Zahl erforderlich.",
"special-char": "Sonderzeichen erforderlich (z.B. _ oder ä)",
- "subtitle": "Werde Teil der Gemeinschaft!",
- "title": "Erstelle dein Gradido-Konto",
"uppercase": "Großbuchstabe erforderlich."
},
"thx": {
@@ -227,7 +255,8 @@
"register": "Du bist jetzt registriert, bitte überprüfe deine Emails und klicke auf den Aktivierungslink.",
"reset": "Dein Passwort wurde geändert.",
"resetPassword": "Den Code den Du genutzt hast ist zu alt bitte fordere ein neuen über die Passwort Reset Seite an.",
- "title": "Danke!"
+ "title": "Danke!",
+ "unsetPassword": "Dein Passwort wurde noch nicht gesetzt. Bitte setze es neu."
}
},
"success": "Erfolg",
@@ -249,5 +278,8 @@
},
"transaction-link": {
"send_you": "sendet dir"
- }
+ },
+ "via_link": "über einen Link",
+ "welcome": "Willkommen",
+ "WelcomeBy": "bei {name}"
}
diff --git a/frontend/src/locales/en.json b/frontend/src/locales/en.json
index af54f3b50..63f2510a3 100644
--- a/frontend/src/locales/en.json
+++ b/frontend/src/locales/en.json
@@ -1,5 +1,22 @@
{
+ "100": "100%",
+ "1000thanks": "1000 thanks for being with us!",
+ "125": "125%",
+ "85": "85%",
"advanced-calculation": "Advanced calculation",
+ "auth": {
+ "left": {
+ "gratitude": "Gratitude",
+ "hasAccount": "You already have an account?",
+ "hereLogin": "Log in here",
+ "learnMore": "Learn more …",
+ "newCurrency": "The new currency",
+ "oneAnotherNature": "FOR ONE ANOTHER, FOR ALL, FOR NATURE"
+ },
+ "navbar": {
+ "aboutGradido": "About Gradido"
+ }
+ },
"back": "Back",
"community": {
"choose-another-community": "Choose another community",
@@ -30,12 +47,17 @@
"delete": "Delete",
"em-dash": "—",
"error": {
+ "email-already-sent": "We already sent you an email less than 10 minutes ago.",
"empty-transactionlist": "There was an error with the transmission of the number of your transactions.",
"error": "Error!",
- "no-account": "Unfortunately we could not find an account to the given data!",
+ "no-account": "Unfortunately we could not find an (activated) account to the given data.",
"no-transactionlist": "Unfortunately, there was an error. No transactions have been sent from the server.",
- "session-expired": "The session was closed for security reasons."
+ "no-user": "No user with this credentials.",
+ "session-expired": "The session was closed for security reasons.",
+ "unknown-error": "Unknown error: ",
+ "user-already-exists": "A user with this data already exists."
},
+ "followUs": "follow us:",
"footer": {
"app_version": "App version {version}",
"copyright": {
@@ -51,6 +73,7 @@
"amount": "Amount",
"at": "at",
"cancel": "Cancel",
+ "check_now": "Check now",
"close": "Close",
"current_balance": "Current Balance",
"date": "Date",
@@ -100,36 +123,40 @@
"decay-14-day": "Decay for 14 days",
"delete-the-link": "Delete the link?",
"deleted": "The link was deleted!",
- "expired": "Expired",
- "has-account": "You already have a Gradido account",
+ "expiredOn": "Expired on",
+ "has-account": "You already have a Gradido account?",
"header": "Send Gradidos via link",
- "link-copied": "Link copied to clipboard",
+ "isFree": "Gradido is free of charge worldwide.",
+ "link-copied": "Link has been copied to the clipboard. You can now paste it into an email or message.",
"link-deleted": "The link was deleted on {date}.",
"link-expired": "The link is no longer valid. The validity expired on {date}.",
"link-overview": "Link overview",
"links_count": "Active links",
- "links_sum": "Total of your sent Gradidos",
- "no-account": "You don't have a Gradido account yet",
+ "links_sum": "Open links and QR codes",
+ "no-account": "You don't have a Gradido account yet?",
"no-redeem": "You not allowed to redeem your own link!",
- "not-copied": "Could not copy link: {err}",
+ "not-copied": "Unfortunately, your device does not allow copying! Please copy the link by hand!",
"redeem": "Redeem",
"redeem-text": "Do you want to redeem the amount now?",
"redeemed": "Successfully redeemed! Your account has been credited with {n} GDD.",
"redeemed-at": "The link was already redeemed on {date}.",
+ "redeemed-title": "redeemed",
"to-login": "Log in",
- "to-register": "Register a new account"
+ "to-register": "Register a new account.",
+ "validUntil": "Valid until"
},
"gdt": {
- "calculation": "Calculation of GradidoTransform",
+ "calculation": "Calculation of Gradido Transform",
"contribution": "Contribution",
"conversion": "Conversion",
- "conversion-gdt-euro": "Conversion Euro / GradidoTransform (GDT)",
+ "conversion-gdt-euro": "Conversion Euro / Gradido Transform (GDT)",
"credit": "Credit",
"factor": "Factor",
"formula": "Calculation formula",
"funding": "To the funding contributions",
- "gdt-received": "GradidoTransform (GDT) received",
- "no-transactions": "You do not have GradidoTransform (GDT) yet.",
+ "gdt": "Gradido Transform",
+ "gdt-received": "Gradido Transform (GDT) received",
+ "no-transactions": "You do not have Gradido Transform (GDT) yet.",
"not-reachable": "The GDT Server is not reachable.",
"publisher": "A member you referred has paid a contribution",
"raise": "Increase",
@@ -140,9 +167,9 @@
"login": "Login",
"math": {
"aprox": "~",
- "div": "/",
"equal": "=",
"exclaim": "!",
+ "minus": "−",
"pipe": "|"
},
"navigation": {
@@ -155,10 +182,7 @@
"support": "Support",
"transactions": "Transactions"
},
- "publisher": {
- "infoText": "If your referrer has given you his publisher id, enter it here, otherwise leave the field unchanged!",
- "publisherId": "PublisherID:"
- },
+ "qrCode": "QR Code",
"send_gdd": "GDD send",
"send_per_link": "GDD send via link",
"settings": {
@@ -198,28 +222,32 @@
"subtitle": "If you have forgotten your password, you can reset it here."
}
},
+ "signin": "Sign in",
"signup": "Sign up",
"site": {
+ "forgotPassword": {
+ "heading": "Please enter the email address by which you're registered here."
+ },
"login": {
- "community": "A thousand thanks for being with us!",
- "heading": "Gradido",
- "new_wallet": "Create new account",
- "signin": "Sign in"
+ "heading": "Log in with your access data. Keep them safe!",
+ "saveLogin": "Save login"
+ },
+ "resetPassword": {
+ "heading": "Please enter your password and repeat it."
},
"signup": {
"agree": "I agree to the
privacy policy.",
"dont_match": "Passwords don't match.",
+ "heading": "Register by entering all data completely and in the correct fields.",
"lowercase": "One lowercase letter required.",
"minimum": "8 characters minimum.",
"no-whitespace": "No white spaces and tabs",
"one_number": "One number required.",
"special-char": "One special character required (e.g. _ or ä)",
- "subtitle": "Become a part of the community!",
- "title": "Create your Gradido account",
"uppercase": "One uppercase letter required."
},
"thx": {
- "activateEmail": "Your account has not been activated yet, please check your emails and click the activation link or order a new activation link over the password reset page.",
+ "activateEmail": "Your account has not been activated yet. Please check your emails and click the activation link or order a new activation link over the password reset page.",
"checkEmail": "Your email has been successfully verified. You can sign in now.",
"email": "We have sent you an email.",
"emailActivated": "Thank you your email has been activated.",
@@ -227,7 +255,8 @@
"register": "You are registered now, please check your emails and click the activation link.",
"reset": "Your password has been changed.",
"resetPassword": "The code you used was to old please order a new on over the password reset page.",
- "title": "Thank you!"
+ "title": "Thank you!",
+ "unsetPassword": "Your password has not been set yet. Please set it again."
}
},
"success": "Success",
@@ -249,5 +278,8 @@
},
"transaction-link": {
"send_you": "wants to send you"
- }
+ },
+ "via_link": "via Link",
+ "welcome": "Welcome",
+ "WelcomeBy": "by {name}"
}
diff --git a/frontend/src/main.js b/frontend/src/main.js
index 585b603cb..0edcb7211 100755
--- a/frontend/src/main.js
+++ b/frontend/src/main.js
@@ -16,6 +16,8 @@ import router from './routes/router'
import { apolloProvider } from './plugins/apolloProvider'
+import 'clipboard-polyfill/overwrite-globals'
+
// plugin setup
Vue.use(DashboardPlugin)
Vue.config.productionTip = false
diff --git a/frontend/src/mixins/getCommunityInfo.js b/frontend/src/mixins/getCommunityInfo.js
deleted file mode 100644
index c6c021f9c..000000000
--- a/frontend/src/mixins/getCommunityInfo.js
+++ /dev/null
@@ -1,24 +0,0 @@
-import { communityInfo } from '../graphql/queries'
-
-export const getCommunityInfoMixin = {
- methods: {
- getCommunityInfo() {
- if (this.$store.state.community.name === '') {
- this.$apollo
- .query({
- query: communityInfo,
- })
- .then((result) => {
- this.$store.commit('community', result.data.getCommunityInfo)
- return result.data.getCommunityInfo
- })
- .catch((error) => {
- this.toastError(error.message)
- })
- }
- },
- },
- created() {
- this.getCommunityInfo()
- },
-}
diff --git a/frontend/src/pages/ForgotPassword.spec.js b/frontend/src/pages/ForgotPassword.spec.js
index a547f9cc1..ecfe5a1a9 100644
--- a/frontend/src/pages/ForgotPassword.spec.js
+++ b/frontend/src/pages/ForgotPassword.spec.js
@@ -1,5 +1,6 @@
import { mount, RouterLinkStub } from '@vue/test-utils'
import flushPromises from 'flush-promises'
+import { toastErrorSpy } from '@test/testSetup'
import ForgotPassword from './ForgotPassword'
const mockAPIcall = jest.fn()
@@ -21,7 +22,7 @@ const createMockObject = (comingFrom) => {
push: mockRouterPush,
},
$apollo: {
- query: mockAPIcall,
+ mutate: mockAPIcall,
},
$route: {
params: {
@@ -46,15 +47,7 @@ describe('ForgotPassword', () => {
})
it('renders the component', () => {
- expect(wrapper.find('div.forgot-password').exists()).toBeTruthy()
- })
-
- it('has a title', () => {
- expect(wrapper.find('h1').text()).toEqual('settings.password.reset')
- })
-
- it('has a subtitle', () => {
- expect(wrapper.find('p.text-lead').text()).toEqual('settings.password.subtitle')
+ expect(wrapper.find('div.forgot-password').exists()).toBe(true)
})
describe('back button', () => {
@@ -83,7 +76,7 @@ describe('ForgotPassword', () => {
})
it('has a submit button', () => {
- expect(form.find('button[type="submit"]').exists()).toBeTruthy()
+ expect(form.find('button[type="submit"]').exists()).toBe(true)
})
describe('invalid Email', () => {
@@ -116,15 +109,23 @@ describe('ForgotPassword', () => {
await flushPromises()
})
- it('pushes to "/thx/forgotPassword"', () => {
- expect(mockAPIcall).toBeCalledWith(
- expect.objectContaining({
- variables: {
- email: 'user@example.org',
- },
- }),
- )
- expect(mockRouterPush).toHaveBeenCalledWith('/thx/forgotPassword')
+ it('shows error title, subtitle, login button', () => {
+ expect(wrapper.vm.showPageMessage).toBe(true)
+ expect(wrapper.find('.test-message-headline').text()).toBe('site.thx.errorTitle')
+ expect(wrapper.find('.test-message-subtitle').text()).toBe('error.email-already-sent')
+ expect(wrapper.find('.test-message-button').text()).toBe('login')
+ })
+
+ it('button link directs to "/login"', () => {
+ expect(wrapper.find('.test-message-button').attributes('href')).toBe('/login')
+ })
+
+ it.skip('click redirects to "/login"', async () => {
+ expect(mockRouterPush).toBeCalledWith('/login')
+ })
+
+ it('toasts a standard error message', () => {
+ expect(toastErrorSpy).toBeCalledWith('error.email-already-sent')
})
})
@@ -141,29 +142,19 @@ describe('ForgotPassword', () => {
await flushPromises()
})
- it('pushes to "/thx/forgotPassword"', () => {
- expect(mockAPIcall).toBeCalledWith(
- expect.objectContaining({
- variables: {
- email: 'user@example.org',
- },
- }),
- )
- expect(mockRouterPush).toHaveBeenCalledWith('/thx/forgotPassword')
+ it('shows success title, subtitle, login button', () => {
+ expect(wrapper.vm.showPageMessage).toBe(true)
+ expect(wrapper.find('.test-message-headline').text()).toBe('site.thx.title')
+ expect(wrapper.find('.test-message-subtitle').text()).toBe('site.thx.email')
+ expect(wrapper.find('.test-message-button').text()).toBe('login')
+ })
+
+ it('button link redirects to "/login"', () => {
+ expect(wrapper.find('.test-message-button').attributes('href')).toBe('/login')
})
})
})
})
})
-
- describe('comingFrom login', () => {
- beforeEach(() => {
- wrapper = Wrapper(createMockObject('resetPassword'))
- })
-
- it('has another subtitle', () => {
- expect(wrapper.find('p.text-lead').text()).toEqual('settings.password.resend_subtitle')
- })
- })
})
})
diff --git a/frontend/src/pages/ForgotPassword.vue b/frontend/src/pages/ForgotPassword.vue
index 81121fbe7..74e5161f1 100644
--- a/frontend/src/pages/ForgotPassword.vue
+++ b/frontend/src/pages/ForgotPassword.vue
@@ -1,21 +1,9 @@
-
-
+
+ {{ $t('site.forgotPassword.heading') }}
-
+
@@ -36,47 +24,67 @@
{{ $t('back') }}
+
+
+
+
diff --git a/frontend/src/pages/Login.spec.js b/frontend/src/pages/Login.spec.js
index e26888d49..9158aaf42 100644
--- a/frontend/src/pages/Login.spec.js
+++ b/frontend/src/pages/Login.spec.js
@@ -1,22 +1,11 @@
import { RouterLinkStub, mount } from '@vue/test-utils'
import flushPromises from 'flush-promises'
-import Login from './Login'
-
import { toastErrorSpy } from '@test/testSetup'
+import Login from './Login'
const localVue = global.localVue
-const apolloQueryMock = jest.fn().mockResolvedValue({
- data: {
- getCommunityInfo: {
- name: 'test12',
- description: 'test community 12',
- url: 'http://test12.test12/',
- registerUrl: 'http://test12.test12/register',
- },
- },
-})
-
+const apolloQueryMock = jest.fn()
const mockStoreDispach = jest.fn()
const mockStoreCommit = jest.fn()
const mockRouterPush = jest.fn()
@@ -39,10 +28,6 @@ describe('Login', () => {
dispatch: mockStoreDispach,
commit: mockStoreCommit,
state: {
- community: {
- name: '',
- description: '',
- },
publisherId: 12345,
},
},
@@ -73,63 +58,8 @@ describe('Login', () => {
wrapper = Wrapper()
})
- it('commits the community info to the store', () => {
- expect(mockStoreCommit).toBeCalledWith('community', {
- name: 'test12',
- description: 'test community 12',
- url: 'http://test12.test12/',
- registerUrl: 'http://test12.test12/register',
- })
- })
-
it('renders the Login form', () => {
- expect(wrapper.find('div.login-form').exists()).toBeTruthy()
- })
-
- describe('communities gives back error', () => {
- beforeEach(() => {
- apolloQueryMock.mockRejectedValue({
- message: 'Failed to get communities',
- })
- wrapper = Wrapper()
- })
-
- it('toasts an error message', () => {
- expect(toastErrorSpy).toBeCalledWith('Failed to get communities')
- })
- })
-
- describe('Login header', () => {
- it('has a welcome message', () => {
- expect(wrapper.find('div.header').text()).toBe('site.login.heading site.login.community')
- })
- })
-
- describe('Community data already loaded', () => {
- beforeEach(() => {
- jest.clearAllMocks()
- mocks.$store.state.community = {
- name: 'Gradido Entwicklung',
- url: 'http://localhost/',
- registerUrl: 'http://localhost/register',
- description: 'Die lokale Entwicklungsumgebung von Gradido.',
- }
- wrapper = Wrapper()
- })
-
- it('has a Community name', () => {
- expect(wrapper.find('.test-communitydata b').text()).toBe('Gradido Entwicklung')
- })
-
- it('has a Community description', () => {
- expect(wrapper.find('.test-communitydata p').text()).toBe(
- 'Die lokale Entwicklungsumgebung von Gradido.',
- )
- })
-
- it('does not call community data update', () => {
- expect(apolloQueryMock).not.toBeCalled()
- })
+ expect(wrapper.find('div.login-form').exists()).toBe(true)
})
describe('links', () => {
@@ -138,37 +68,23 @@ describe('Login', () => {
'settings.password.forgot_pwd',
)
})
-
- it('links to /forgot-password when clicking "Forgot Password"', () => {
- expect(wrapper.findAllComponents(RouterLinkStub).at(0).props().to).toBe('/forgot-password')
- })
-
- it('has a link "Create new account"', () => {
- expect(wrapper.findAllComponents(RouterLinkStub).at(1).text()).toEqual(
- 'site.login.new_wallet',
- )
- })
-
- it('links to /register when clicking "Create new account"', () => {
- expect(wrapper.findAllComponents(RouterLinkStub).at(1).props().to).toBe('/register')
- })
})
describe('Login form', () => {
it('has a login form', () => {
- expect(wrapper.find('form').exists()).toBeTruthy()
+ expect(wrapper.find('form').exists()).toBe(true)
})
it('has an Email input field', () => {
- expect(wrapper.find('input[placeholder="Email"]').exists()).toBeTruthy()
+ expect(wrapper.find('input[placeholder="Email"]').exists()).toBe(true)
})
it('has an Password input field', () => {
- expect(wrapper.find('input[placeholder="form.password"]').exists()).toBeTruthy()
+ expect(wrapper.find('input[placeholder="form.password"]').exists()).toBe(true)
})
it('has a Submit button', () => {
- expect(wrapper.find('button[type="submit"]').exists()).toBeTruthy()
+ expect(wrapper.find('button[type="submit"]').exists()).toBe(true)
})
})
@@ -197,13 +113,13 @@ describe('Login', () => {
await wrapper.find('input[placeholder="Email"]').setValue('user@example.org')
await wrapper.find('input[placeholder="form.password"]').setValue('1234')
await flushPromises()
- await wrapper.find('form').trigger('submit')
- await flushPromises()
apolloQueryMock.mockResolvedValue({
data: {
login: 'token',
},
})
+ await wrapper.find('form').trigger('submit')
+ await flushPromises()
})
it('calls the API with the given data', () => {
@@ -255,58 +171,114 @@ describe('Login', () => {
})
})
})
+ })
- describe('login fails', () => {
- beforeEach(() => {
- apolloQueryMock.mockRejectedValue({
- message: '..No user with this credentials',
- })
+ describe('login fails', () => {
+ const createError = async (errorMessage) => {
+ apolloQueryMock.mockRejectedValue({
+ message: errorMessage,
+ })
+ wrapper = Wrapper()
+ jest.clearAllMocks()
+ await wrapper.find('input[placeholder="Email"]').setValue('user@example.org')
+ await wrapper.find('input[placeholder="form.password"]').setValue('1234')
+ await flushPromises()
+ await wrapper.find('form').trigger('submit')
+ await flushPromises()
+ }
+
+ describe('login fails with "User email not validated"', () => {
+ beforeEach(async () => {
+ await createError('GraphQL error: User email not validated.')
})
it('hides the spinner', () => {
expect(spinnerHideMock).toBeCalled()
})
- it('toasts an error message', () => {
+ it('shows error title, subtitle, login button', () => {
+ expect(wrapper.vm.showPageMessage).toBe(true)
+ expect(wrapper.find('.test-message-headline').text()).toBe('site.thx.errorTitle')
+ expect(wrapper.find('.test-message-subtitle').text()).toBe('site.thx.activateEmail')
+ expect(wrapper.find('.test-message-button').text()).toBe('settings.password.reset')
+ })
+
+ it('button link directs to "/forgot-password"', () => {
+ expect(wrapper.find('.test-message-button').attributes('href')).toBe('/forgot-password')
+ })
+
+ it.skip('click redirects to "/forgot-password"', async () => {
+ // wrapper.find('.test-message-button').trigger('click')
+ // await flushPromises()
+ // await wrapper.vm.$nextTick()
+ // expect(mockRouterPush).toBeCalledWith('/forgot-password')
+ })
+
+ it('toasts the error message', () => {
expect(toastErrorSpy).toBeCalledWith('error.no-account')
})
+ })
- describe('login fails with "User email not validated"', () => {
- beforeEach(async () => {
- apolloQueryMock.mockRejectedValue({
- message: 'User email not validated',
- })
- wrapper = Wrapper()
- jest.clearAllMocks()
- await wrapper.find('input[placeholder="Email"]').setValue('user@example.org')
- await wrapper.find('input[placeholder="form.password"]').setValue('1234')
- await flushPromises()
- await wrapper.find('form').trigger('submit')
- await flushPromises()
- })
-
- it('redirects to /thx/login', () => {
- expect(mockRouterPush).toBeCalledWith('/thx/login')
- })
+ describe('login fails with "User has no password set yet"', () => {
+ beforeEach(async () => {
+ await createError('GraphQL error: User has no password set yet.')
})
- describe('login fails with "User has no password set yet"', () => {
- beforeEach(async () => {
- apolloQueryMock.mockRejectedValue({
- message: 'User has no password set yet',
- })
- wrapper = Wrapper()
- jest.clearAllMocks()
- await wrapper.find('input[placeholder="Email"]').setValue('user@example.org')
- await wrapper.find('input[placeholder="form.password"]').setValue('1234')
- await flushPromises()
- await wrapper.find('form').trigger('submit')
- await flushPromises()
- })
+ it('shows error title, subtitle, login button', () => {
+ expect(wrapper.vm.showPageMessage).toBe(true)
+ expect(wrapper.find('.test-message-headline').text()).toBe('site.thx.errorTitle')
+ expect(wrapper.find('.test-message-subtitle').text()).toBe('site.thx.unsetPassword')
+ expect(wrapper.find('.test-message-button').text()).toBe('settings.password.reset')
+ })
- it('redirects to /reset-password/login', () => {
- expect(mockRouterPush).toBeCalledWith('/reset-password/login')
- })
+ it('button link directs to "/reset-password/login"', () => {
+ expect(wrapper.find('.test-message-button').attributes('href')).toBe(
+ '/reset-password/login',
+ )
+ })
+
+ it.skip('click redirects to "/reset-password/login"', () => {
+ // expect(mockRouterPush).toBeCalledWith('/reset-password/login')
+ })
+
+ it('toasts the error message', () => {
+ expect(toastErrorSpy).toBeCalledWith('error.no-account')
+ })
+ })
+
+ describe('login fails with "No user with this credentials"', () => {
+ beforeEach(async () => {
+ await createError('GraphQL error: No user with this credentials.')
+ })
+
+ it('shows no error message on the page', () => {
+ // don't show any error on the page! against boots
+ expect(wrapper.vm.showPageMessage).toBe(false)
+ expect(wrapper.find('.test-message-headline').exists()).toBe(false)
+ expect(wrapper.find('.test-message-subtitle').exists()).toBe(false)
+ expect(wrapper.find('.test-message-button').exists()).toBe(false)
+ })
+
+ it('toasts the error message', () => {
+ expect(toastErrorSpy).toBeCalledWith('error.no-user')
+ })
+ })
+
+ describe('login fails with an unknow error', () => {
+ beforeEach(async () => {
+ await createError(' – Unknow error')
+ })
+
+ it('shows no error message on the page', () => {
+ // don't show any error on the page! against boots
+ expect(wrapper.vm.showPageMessage).toBe(false)
+ expect(wrapper.find('.test-message-headline').exists()).toBe(false)
+ expect(wrapper.find('.test-message-subtitle').exists()).toBe(false)
+ expect(wrapper.find('.test-message-button').exists()).toBe(false)
+ })
+
+ it('toasts the error message', () => {
+ expect(toastErrorSpy).toBeCalledWith('error.unknown-error – Unknow error')
})
})
})
diff --git a/frontend/src/pages/Login.vue b/frontend/src/pages/Login.vue
index 79532cb21..208f7941f 100755
--- a/frontend/src/pages/Login.vue
+++ b/frontend/src/pages/Login.vue
@@ -1,77 +1,68 @@
+
diff --git a/frontend/src/pages/Overview.spec.js b/frontend/src/pages/Overview.spec.js
index af234801e..8f0dda01d 100644
--- a/frontend/src/pages/Overview.spec.js
+++ b/frontend/src/pages/Overview.spec.js
@@ -25,12 +25,6 @@ describe('Overview', () => {
wrapper = Wrapper()
})
- it('has a status gdd-status-gdd', () => {
- expect(wrapper.find('div.gdd-status-gdd').exists()).toBeTruthy()
- })
- it('has a status gdd-status-gdt', () => {
- expect(wrapper.find('div.gdd-status-gdt').exists()).toBeTruthy()
- })
it('has a transactions table', () => {
expect(wrapper.find('div.gdd-transaction-list').exists()).toBeTruthy()
})
diff --git a/frontend/src/pages/Overview.vue b/frontend/src/pages/Overview.vue
index 93344b3ee..15e140058 100644
--- a/frontend/src/pages/Overview.vue
+++ b/frontend/src/pages/Overview.vue
@@ -1,41 +1,27 @@
diff --git a/frontend/src/pages/RegisterCommunity.spec.js b/frontend/src/pages/RegisterCommunity.spec.js
index deb1d999d..05f9014f4 100644
--- a/frontend/src/pages/RegisterCommunity.spec.js
+++ b/frontend/src/pages/RegisterCommunity.spec.js
@@ -1,21 +1,8 @@
import { mount, RouterLinkStub } from '@vue/test-utils'
import RegisterCommunity from './RegisterCommunity'
-import { toastErrorSpy } from '@test/testSetup'
-
const localVue = global.localVue
-const apolloQueryMock = jest.fn().mockResolvedValue({
- data: {
- getCommunityInfo: {
- name: 'test12',
- description: 'test community 12',
- url: 'http://test12.test12/',
- registerUrl: 'http://test12.test12/register',
- },
- },
-})
-
const mockStoreCommit = jest.fn()
describe('RegisterCommunity', () => {
@@ -26,9 +13,6 @@ describe('RegisterCommunity', () => {
locale: 'en',
},
$t: jest.fn((t) => t),
- $apollo: {
- query: apolloQueryMock,
- },
$store: {
commit: mockStoreCommit,
state: {
@@ -53,32 +37,10 @@ describe('RegisterCommunity', () => {
wrapper = Wrapper()
})
- it('commits the community info to the store', () => {
- expect(mockStoreCommit).toBeCalledWith('community', {
- name: 'test12',
- description: 'test community 12',
- url: 'http://test12.test12/',
- registerUrl: 'http://test12.test12/register',
- })
- })
-
it('renders the Div Element "#register-community"', () => {
expect(wrapper.find('div#register-community').exists()).toBeTruthy()
})
- describe('communities gives back error', () => {
- beforeEach(() => {
- apolloQueryMock.mockRejectedValue({
- message: 'Failed to get communities',
- })
- wrapper = Wrapper()
- })
-
- it('toasts an error message', () => {
- expect(toastErrorSpy).toBeCalledWith('Failed to get communities')
- })
- })
-
describe('Community data already loaded', () => {
beforeEach(() => {
jest.clearAllMocks()
@@ -100,10 +62,6 @@ describe('RegisterCommunity', () => {
'Die lokale Entwicklungsumgebung von Gradido.',
)
})
-
- it('does not call community data update', () => {
- expect(apolloQueryMock).not.toBeCalled()
- })
})
describe('buttons and links', () => {
diff --git a/frontend/src/pages/RegisterCommunity.vue b/frontend/src/pages/RegisterCommunity.vue
index 736a4282f..1acc0827e 100644
--- a/frontend/src/pages/RegisterCommunity.vue
+++ b/frontend/src/pages/RegisterCommunity.vue
@@ -6,12 +6,12 @@
diff --git a/frontend/src/pages/ResetPassword.spec.js b/frontend/src/pages/ResetPassword.spec.js
index c43f71932..ac944e29a 100644
--- a/frontend/src/pages/ResetPassword.spec.js
+++ b/frontend/src/pages/ResetPassword.spec.js
@@ -79,36 +79,6 @@ describe('ResetPassword', () => {
expect(wrapper.find('div.resetpwd-form').exists()).toBeTruthy()
})
- describe('Register header', () => {
- describe('from reset', () => {
- beforeEach(() => {
- mocks.$route.path.mock = 'reset-password'
- wrapper = Wrapper()
- })
-
- it('has a welcome message', async () => {
- expect(wrapper.find('div.header').text()).toContain('settings.password.reset')
- expect(wrapper.find('div.header').text()).toContain(
- 'settings.password.reset-password.text',
- )
- })
- })
-
- describe('from checkEmail', () => {
- beforeEach(() => {
- mocks.$route.path.mock = 'checkEmail'
- wrapper = Wrapper()
- })
-
- it('has a welcome message', async () => {
- expect(wrapper.find('div.header').text()).toContain('settings.password.set')
- expect(wrapper.find('div.header').text()).toContain(
- 'settings.password.set-password.text',
- )
- })
- })
- })
-
describe('links', () => {
it('has a link "Back"', async () => {
expect(wrapper.findAllComponents(RouterLinkStub).at(0).text()).toEqual('back')
@@ -150,13 +120,18 @@ describe('ResetPassword', () => {
describe('server response with error code > 10min', () => {
beforeEach(async () => {
- apolloMutationMock.mockRejectedValue({ message: '...Code is older than 10 minutes' })
+ jest.clearAllMocks()
+ apolloMutationMock.mockRejectedValue({
+ message: '...email was sent more than 23 hours and 10 minutes ago',
+ })
await wrapper.find('form').trigger('submit')
await flushPromises()
})
it('toasts an error message', () => {
- expect(toastErrorSpy).toHaveBeenCalledWith('...Code is older than 10 minutes')
+ expect(toastErrorSpy).toHaveBeenCalledWith(
+ '...email was sent more than 23 hours and 10 minutes ago',
+ )
})
it('router pushes to /forgot-password/resetPassword', () => {
diff --git a/frontend/src/pages/ResetPassword.vue b/frontend/src/pages/ResetPassword.vue
index 7771be5f6..a8b21da65 100644
--- a/frontend/src/pages/ResetPassword.vue
+++ b/frontend/src/pages/ResetPassword.vue
@@ -1,51 +1,26 @@