-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #48 from eficode/feature/verification-email-required
Feature/verification email required
- Loading branch information
Showing
23 changed files
with
243 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
packages/game-app/cypress/integration/email_verification.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/// <reference types="Cypress" /> | ||
/// <reference types="../support" /> | ||
|
||
// @ts-ignore | ||
context("Email verification", () => { | ||
|
||
beforeEach(() => { | ||
cy.clearLocalStorage() | ||
cy.clearIndexedDB(); | ||
cy.visit(Cypress.config().baseUrl!); | ||
}); | ||
|
||
it("should show verification email required message", () => { | ||
const randomEmail = `testEmail${Math.floor(Math.random() * 1000)}@email.com`.toLocaleLowerCase(); | ||
cy.window().its('store').invoke('dispatch', { | ||
type: 'signup/start', payload: { | ||
email:randomEmail, | ||
password:'Aa1%sfesfsf', | ||
repeatPassword:'Aa1%sfesfsf', | ||
role:'endUser', | ||
devOpsMaturity:'veryImmature', | ||
} | ||
}); | ||
cy.get('body').should('contain.translationOf', 'signup.verificationRequired.message'); | ||
}); | ||
|
||
it("should resend verification email correctly", () => { | ||
const randomEmail = `testEmail${Math.floor(Math.random() * 1000)}@email.com`.toLocaleLowerCase(); | ||
cy.window().its('store').invoke('dispatch', { | ||
type: 'signup/start', payload: { | ||
email:randomEmail, | ||
password:'Aa1%sfesfsf', | ||
repeatPassword:'Aa1%sfesfsf', | ||
role:'endUser', | ||
devOpsMaturity:'veryImmature', | ||
} | ||
}); | ||
cy.containsTranslationOf('signup.verificationRequired.resend').click(); | ||
cy.get('body').should('contain.translationOf', 'signup.verificationRequired.resendSuccess'); | ||
}); | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/** | ||
* Chai assertion for containing translated string | ||
*/ | ||
chai.Assertion.addMethod('translationOf', function (key: string) { | ||
const $element = this._obj; | ||
const element = $element[0]; | ||
|
||
const doc = element.ownerDocument; | ||
const win = doc.defaultView || doc.parentWindow; | ||
|
||
const translation = win.i18n.t(key); | ||
|
||
const res = $element.text().indexOf(win.i18n.t(key)) !== -1; | ||
|
||
this.assert( | ||
res | ||
, "expected #{this} to contain #{exp}" | ||
, "expected #{this} to not contain #{exp}" | ||
, translation // expected | ||
); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,5 @@ | ||
import './commands' | ||
import '@cypress/code-coverage/support' | ||
import './customAssertions' | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { createRequestHook } from '@pipeline/requests-status'; | ||
import { actions } from './slice'; | ||
|
||
export const useResendVerificationEmail = createRequestHook( | ||
'auth.resendVerificationEmail', | ||
actions.resendEmailVerification, | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,8 @@ | ||
import { reducer, actions, name, selectors } from './slice'; | ||
import { reducer, actions, name, selectors, AuthUser } from './slice'; | ||
import saga from './saga'; | ||
import useLoggedUser from './useLoggedUser'; | ||
import { useResendVerificationEmail } from './hooks'; | ||
|
||
export { reducer, actions, name, saga, selectors }; | ||
export { reducer, actions, name, saga, selectors, useLoggedUser, useResendVerificationEmail }; | ||
|
||
export type { AuthUser }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { useSelector } from 'react-redux'; | ||
import { selectors } from './slice'; | ||
|
||
/** | ||
* Get current logged user info. null if not logged. | ||
*/ | ||
export default function useLoggedUser() { | ||
const loggedUser = useSelector(selectors.getCurrentUser); | ||
return loggedUser; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
import { RoutingPath } from './routingPath'; | ||
import PrivateRoute from './PrivateRoute'; | ||
import useNavigateOnCondition from './useNavigateOnCondition'; | ||
|
||
export { RoutingPath, PrivateRoute }; | ||
export { RoutingPath, PrivateRoute, useNavigateOnCondition }; |
Oops, something went wrong.