From b06ae9001ea89297ad6f3b403c390b9f2d98113e Mon Sep 17 00:00:00 2001 From: Belen Curcio Date: Wed, 25 Oct 2017 16:31:46 -0300 Subject: [PATCH 1/2] Adding missing classes --- client/coral-admin/src/components/Drawer.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/client/coral-admin/src/components/Drawer.js b/client/coral-admin/src/components/Drawer.js index 0385b1773..3aee31c95 100644 --- a/client/coral-admin/src/components/Drawer.js +++ b/client/coral-admin/src/components/Drawer.js @@ -5,6 +5,7 @@ import {IndexLink, Link} from 'react-router'; import styles from './Drawer.css'; import t from 'coral-framework/services/i18n'; import {can} from 'coral-framework/services/perms'; +import cn from 'classnames'; const CoralDrawer = ({handleLogout, auth = {}}) => ( @@ -12,7 +13,7 @@ const CoralDrawer = ({handleLogout, auth = {}}) => (
{t('configure.dashboard')} @@ -20,19 +21,21 @@ const CoralDrawer = ({handleLogout, auth = {}}) => ( { can(auth.user, 'MODERATE_COMMENTS') && ( {t('configure.moderate')} ) } - {t('configure.stories')} - {t('configure.community')} @@ -41,7 +44,7 @@ const CoralDrawer = ({handleLogout, auth = {}}) => ( can(auth.user, 'UPDATE_CONFIG') && ( {t('configure.configure')} From 59acdc5c02c6645bea49a868fa4acc88f7457bd5 Mon Sep 17 00:00:00 2001 From: Belen Curcio Date: Wed, 25 Oct 2017 16:53:18 -0300 Subject: [PATCH 2/2] new e2e test --- client/coral-admin/src/components/Drawer.js | 2 +- test/e2e/page_objects/admin.js | 6 ++++- test/e2e/specs/02_admin.js | 28 +++++++++++++-------- 3 files changed, 24 insertions(+), 12 deletions(-) diff --git a/client/coral-admin/src/components/Drawer.js b/client/coral-admin/src/components/Drawer.js index 3aee31c95..70da8ad5e 100644 --- a/client/coral-admin/src/components/Drawer.js +++ b/client/coral-admin/src/components/Drawer.js @@ -8,7 +8,7 @@ import {can} from 'coral-framework/services/perms'; import cn from 'classnames'; const CoralDrawer = ({handleLogout, auth = {}}) => ( - + { auth && auth.user && can(auth.user, 'ACCESS_ADMIN') ?
diff --git a/test/e2e/page_objects/admin.js b/test/e2e/page_objects/admin.js index ffdcf8a29..92f2ac0e1 100644 --- a/test/e2e/page_objects/admin.js +++ b/test/e2e/page_objects/admin.js @@ -15,9 +15,13 @@ module.exports = { 'passwordInput': '.talk-admin-login-sign-in #password', 'signInButton': '.talk-admin-login-sign-in-button', 'storiesNav': '.talk-admin-nav-stories', + 'storiesDrawerNav': '.talk-admin-drawer-nav .talk-admin-nav-stories', 'storiesSection': '.talk-admin-stories', 'communityNav': '.talk-admin-nav-community', + 'communityDrawerNav': '.talk-admin-drawer-nav .talk-admin-nav-community', 'communitySection': '.talk-admin-community', - 'moderationContainer': '.talk-admin-moderation-container' + 'moderationContainer': '.talk-admin-moderation-container', + 'drawerButton': '.mdl-layout__drawer-button', + 'drawerOverlay': 'div.mdl-layout__obfuscator.is-visible', } }; diff --git a/test/e2e/specs/02_admin.js b/test/e2e/specs/02_admin.js index 03f460c1b..4a60780bb 100644 --- a/test/e2e/specs/02_admin.js +++ b/test/e2e/specs/02_admin.js @@ -1,10 +1,9 @@ module.exports = { '@tags': ['admin', 'login'], - beforeEach: (client) => { - - // Testing Desktop - client.resizeWindow(1280, 800); - }, + beforeEach: (client) => { + + client.resizeWindow(1024, 800); + }, 'Admin logs in': (client) => { const adminPage = client.page.admin(); const {testData: {admin}} = client.globals; @@ -29,9 +28,14 @@ module.exports = { adminPage .navigate() - .waitForElementVisible('@storiesNav') - .click('@storiesNav') + .waitForElementVisible('@drawerButton') + .click('@drawerButton') + .waitForElementVisible('@storiesDrawerNav') + .click('@storiesDrawerNav') + .waitForElementVisible('@drawerOverlay') + .click('@drawerOverlay') .waitForElementVisible('@storiesSection'); + }, 'Admin goes to Community': (client) => { @@ -39,9 +43,13 @@ module.exports = { adminPage .navigate() - .waitForElementVisible('@communityNav') - .click('@communityNav') - .waitForElementVisible('@communitySection'); + .waitForElementVisible('@drawerButton') + .click('@drawerButton') + .waitForElementVisible('@communityDrawerNav') + .click('@communityDrawerNav') + .waitForElementVisible('@drawerOverlay') + .click('@drawerOverlay') + .waitForElementVisible('@communitySection'); }, after: (client) => { client.end();