From 206627be17ad2124cd1bae4020b483f5a1f8e1d9 Mon Sep 17 00:00:00 2001 From: SleepWalker Date: Sun, 18 Feb 2018 20:09:32 +0200 Subject: [PATCH] #389: add e2e tests for invalid refreshToken case. Minor bug fixes --- .eslintignore | 1 + .flowconfig | 1 + .gitignore | 2 +- src/components/accounts/actions.test.js | 22 +- src/components/auth/PanelTransition.js | 1 + src/components/auth/actions.js | 7 +- .../refreshTokenMiddleware.test.js | 20 +- src/pages/auth/AuthPage.js | 2 +- src/pages/root/RootPage.js | 2 +- tests-e2e/cypress.json | 4 + tests-e2e/cypress/fixtures/accounts.json | 12 + tests-e2e/cypress/fixtures/example.json | 5 + .../integration/invalid-refreshToken.test.js | 150 +++ tests-e2e/cypress/integration/sign-in.test.js | 47 + tests-e2e/cypress/plugins/index.js | 17 + tests-e2e/cypress/screenshots/my-image.png | Bin 0 -> 189312 bytes tests-e2e/cypress/support/commands.js | 25 + tests-e2e/cypress/support/index.js | 28 + tests-e2e/package.json | 17 + tests-e2e/yarn.lock | 1022 +++++++++++++++++ 20 files changed, 1371 insertions(+), 14 deletions(-) create mode 100644 tests-e2e/cypress.json create mode 100644 tests-e2e/cypress/fixtures/accounts.json create mode 100644 tests-e2e/cypress/fixtures/example.json create mode 100644 tests-e2e/cypress/integration/invalid-refreshToken.test.js create mode 100644 tests-e2e/cypress/integration/sign-in.test.js create mode 100644 tests-e2e/cypress/plugins/index.js create mode 100644 tests-e2e/cypress/screenshots/my-image.png create mode 100644 tests-e2e/cypress/support/commands.js create mode 100644 tests-e2e/cypress/support/index.js create mode 100644 tests-e2e/package.json create mode 100644 tests-e2e/yarn.lock diff --git a/.eslintignore b/.eslintignore index c6417d9..7abc067 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1 +1,2 @@ flow-typed +tests-e2e diff --git a/.flowconfig b/.flowconfig index 434f791..031b7ad 100644 --- a/.flowconfig +++ b/.flowconfig @@ -1,6 +1,7 @@ [ignore] .*/node_modules/fbjs/lib/.* .*/node_modules/react-motion/lib/.* +.*/tests-e2e/.* [include] diff --git a/.gitignore b/.gitignore index 9f6aa39..586e528 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ -/node_modules +node_modules /dist /dll config/* diff --git a/src/components/accounts/actions.test.js b/src/components/accounts/actions.test.js index 999fc01..14bf959 100644 --- a/src/components/accounts/actions.test.js +++ b/src/components/accounts/actions.test.js @@ -53,7 +53,10 @@ describe('components/accounts/actions', () => { available: [], active: null }, - user: {} + auth: { + credentials: {}, + }, + user: {}, }); sinon.stub(authentication, 'validateToken').named('authentication.validateToken'); @@ -197,7 +200,10 @@ describe('components/accounts/actions', () => { active: account.id, available: [account] }, - user + auth: { + credentials: {}, + }, + user, }); }); @@ -279,7 +285,10 @@ describe('components/accounts/actions', () => { active: account2.id, available: [account, account2] }, - user + auth: { + credentials: {}, + }, + user, }); }); @@ -338,7 +347,7 @@ describe('components/accounts/actions', () => { active: foreignAccount.id, available: [account, foreignAccount, foreignAccount2] }, - user + user, }); }); @@ -409,7 +418,10 @@ describe('components/accounts/actions', () => { active: foreignAccount.id, available: [foreignAccount, foreignAccount2] }, - user + auth: { + credentials: {}, + }, + user, }); logoutStrangers()(dispatch, getState); diff --git a/src/components/auth/PanelTransition.js b/src/components/auth/PanelTransition.js index 8497003..7f64f52 100644 --- a/src/components/auth/PanelTransition.js +++ b/src/components/auth/PanelTransition.js @@ -373,6 +373,7 @@ class PanelTransition extends Component { const backButton = (