diff --git a/client/coral-admin/src/components/Drawer.js b/client/coral-admin/src/components/Drawer.js index 25f21a455..2c463b28e 100644 --- a/client/coral-admin/src/components/Drawer.js +++ b/client/coral-admin/src/components/Drawer.js @@ -7,9 +7,9 @@ import t from 'coral-framework/services/i18n'; import { can } from 'coral-framework/services/perms'; import cn from 'classnames'; -const CoralDrawer = ({ handleLogout, currentUser }) => ( - - {currentUser && can(currentUser, 'ACCESS_ADMIN') ? ( +const CoralDrawer = ({ handleLogout, currentUser }) => + currentUser && can(currentUser, 'ACCESS_ADMIN') ? ( +
{can(currentUser, 'MODERATE_COMMENTS') && ( @@ -48,9 +48,8 @@ const CoralDrawer = ({ handleLogout, currentUser }) => ( {`v${process.env.VERSION}`}
- ) : null} -
-); +
+ ) : null; CoralDrawer.propTypes = { handleLogout: PropTypes.func.isRequired, diff --git a/test/e2e/page_objects/admin.js b/test/e2e/page_objects/admin.js index d436eddc7..4d540a7b4 100644 --- a/test/e2e/page_objects/admin.js +++ b/test/e2e/page_objects/admin.js @@ -30,6 +30,10 @@ module.exports = { .waitForElementVisible('@signOutButton') .click('@signOutButton'); }, + login(user) { + this.expect.section('@login').to.be.visible; + return this.section.login.login(user); + }, navigateAndLogin(user) { this.navigate().expect.section('@login').to.be.visible; return this.section.login.login(user); diff --git a/test/e2e/specs/02_admin.js b/test/e2e/specs/02_admin.js index 5acfd83f6..4fab8b157 100644 --- a/test/e2e/specs/02_admin.js +++ b/test/e2e/specs/02_admin.js @@ -20,13 +20,18 @@ module.exports = { client.end(); }, + 'Admin goes to login': client => { + const adminPage = client.page.admin(); + adminPage.navigate().expect.element('drawerButton').to.not.be.present; + }, + 'Admin logs in': client => { const adminPage = client.page.admin(); const { testData: { admin }, } = client.globals; - adminPage.navigateAndLogin(admin); + adminPage.login(admin); }, 'Admin goes to Stories': client => {