From d51b6b31f666291fdd66bf5b54fbe418d5019016 Mon Sep 17 00:00:00 2001 From: Belen Curcio Date: Mon, 6 Nov 2017 23:53:19 -0300 Subject: [PATCH 01/42] Adding missing classes and proptypes --- .../client/components/ApproveCommentAction.js | 12 ++++++++++-- .../client/components/BanUserAction.js | 11 +++++++++-- .../client/components/Menu.js | 10 +++++++++- .../client/components/ModerationActions.js | 13 ++++++++++++- .../client/components/RejectCommentAction.js | 9 ++++++++- 5 files changed, 48 insertions(+), 7 deletions(-) diff --git a/plugins/talk-plugin-moderation-actions/client/components/ApproveCommentAction.js b/plugins/talk-plugin-moderation-actions/client/components/ApproveCommentAction.js index f683acae6..125a3589e 100644 --- a/plugins/talk-plugin-moderation-actions/client/components/ApproveCommentAction.js +++ b/plugins/talk-plugin-moderation-actions/client/components/ApproveCommentAction.js @@ -1,4 +1,5 @@ import React from 'react'; +import PropTypes from 'prop-types'; import styles from './styles.css'; import {t} from 'plugin-api/beta/client/services'; import {Icon} from 'plugin-api/beta/client/components/ui'; @@ -6,16 +7,23 @@ import cn from 'classnames'; const isApproved = (status) => (status === 'ACCEPTED'); -export default ({approveComment, comment: {status}}) => ( +const ApproveCommentAction = ({approveComment, comment: {status}}) => ( isApproved(status) ? ( {t('talk-plugin-moderation-actions.approved_comment')} ) : ( - ) ); + +ApproveCommentAction.propTypes = { + approveComment: PropTypes.func, + comment: PropTypes.object, +}; + +export default ApproveCommentAction; \ No newline at end of file diff --git a/plugins/talk-plugin-moderation-actions/client/components/BanUserAction.js b/plugins/talk-plugin-moderation-actions/client/components/BanUserAction.js index 36f9b1489..75956a0b6 100644 --- a/plugins/talk-plugin-moderation-actions/client/components/BanUserAction.js +++ b/plugins/talk-plugin-moderation-actions/client/components/BanUserAction.js @@ -1,14 +1,21 @@ import React from 'react'; +import PropTypes from 'prop-types'; import styles from './styles.css'; import {t} from 'plugin-api/beta/client/services'; import {Icon} from 'plugin-api/beta/client/components/ui'; import cn from 'classnames'; -export default ({onBanUser}) => ( +const BanUserAction = ({onBanUser}) => ( ); + +BanUserAction.propTypes = { + onBanUser: PropTypes.func, +}; + +export default BanUserAction; diff --git a/plugins/talk-plugin-moderation-actions/client/components/Menu.js b/plugins/talk-plugin-moderation-actions/client/components/Menu.js index 470349b69..29120423e 100644 --- a/plugins/talk-plugin-moderation-actions/client/components/Menu.js +++ b/plugins/talk-plugin-moderation-actions/client/components/Menu.js @@ -1,9 +1,10 @@ import React from 'react'; +import PropTypes from 'prop-types'; import cn from 'classnames'; import styles from './Menu.css'; import {t} from 'plugin-api/beta/client/services'; -export default ({className = '', children}) => ( +const Menu = ({className = '', children}) => (

{t('talk-plugin-moderation-actions.moderation_actions')} @@ -11,3 +12,10 @@ export default ({className = '', children}) => ( {children}

); + +Menu.propTypes = { + className: PropTypes.string, + children: PropTypes.node, +}; + +export default Menu; diff --git a/plugins/talk-plugin-moderation-actions/client/components/ModerationActions.js b/plugins/talk-plugin-moderation-actions/client/components/ModerationActions.js index fa12500de..e27626298 100644 --- a/plugins/talk-plugin-moderation-actions/client/components/ModerationActions.js +++ b/plugins/talk-plugin-moderation-actions/client/components/ModerationActions.js @@ -1,4 +1,5 @@ import React from 'react'; +import PropTypes from 'prop-types'; import cn from 'classnames'; import Menu from './Menu'; import styles from './ModerationActions.css'; @@ -21,7 +22,7 @@ export default class ModerationActions extends React.Component { } {menuVisible && ( - + ( +const RejectCommentAction = ({rejectComment}) => ( ); + +RejectCommentAction.propTypes = { + rejectComment: PropTypes.func, +}; + +export default RejectCommentAction; From 918ad915b8c6ee5ad3d67d0a74be26c301ba1264 Mon Sep 17 00:00:00 2001 From: Belen Curcio Date: Mon, 6 Nov 2017 23:53:33 -0300 Subject: [PATCH 02/42] Tests --- test/e2e/page_objects/embedStream.js | 8 ++++ test/e2e/specs/04_banUser.js | 37 +++++++++++++++++++ .../{04_userStatus.js => 05_userStatus.js} | 1 - 3 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 test/e2e/specs/04_banUser.js rename test/e2e/specs/{04_userStatus.js => 05_userStatus.js} (99%) diff --git a/test/e2e/page_objects/embedStream.js b/test/e2e/page_objects/embedStream.js index 85a0480da..b99faf341 100644 --- a/test/e2e/page_objects/embedStream.js +++ b/test/e2e/page_objects/embedStream.js @@ -59,6 +59,14 @@ module.exports = { popUpText: '.talk-plugin-flags-popup-text', } }, + mod: { + selector: '.talk-plugin-moderation-actions', + elements: { + arrow: '.talk-plugin-moderation-actions-arrow', + menu: '.talk-plugin-modetarion-actions-menu', + banButton: 'talk-plugin-moderation-actions-ban', + }, + }, profile: { selector: '.talk-embed-stream-profile-tab-pane', elements: { diff --git a/test/e2e/specs/04_banUser.js b/test/e2e/specs/04_banUser.js new file mode 100644 index 000000000..598460e30 --- /dev/null +++ b/test/e2e/specs/04_banUser.js @@ -0,0 +1,37 @@ +module.exports = { + 'admin logs in': (client) => { + const adminPage = client.page.admin(); + const {testData: {admin}} = client.globals; + + adminPage + .navigate() + .waitForElementVisible('@loginLayout') + .waitForElementVisible('@signInForm') + .setValue('@emailInput', admin.email) + .setValue('@passwordInput', admin.password) + .waitForElementVisible('@signInButton') + .click('@signInButton'); + + client.pause(3000); + + adminPage + .waitForElementVisible('@moderationContainer'); + }, + 'navigate to the embed stream': (client) => { + const embedStream = client.page.embedStream(); + + embedStream + .navigate() + .getEmbedSection(); + }, + 'ban': (client) => { + const modSection = client.page.embedStream().section.embed.section.mod; + + modSection + .waitForElementVisible('@arrow') + .click('@arrow') + .waitForElementVisible('@menu') + .waitForElementVisible('@banButton') + .click('@banButton'); + } +}; diff --git a/test/e2e/specs/04_userStatus.js b/test/e2e/specs/05_userStatus.js similarity index 99% rename from test/e2e/specs/04_userStatus.js rename to test/e2e/specs/05_userStatus.js index 32bf6b72a..46a87a2d1 100644 --- a/test/e2e/specs/04_userStatus.js +++ b/test/e2e/specs/05_userStatus.js @@ -125,7 +125,6 @@ module.exports = { embed .waitForElementVisible('@restrictedMessageBox'); }, - 'user picks another username': (client) => { const {testData: {user}} = client.globals; const embedStream = client.page.embedStream(); From 0fc810a7b1c8e2fa13a607f13fc53678bf92902a Mon Sep 17 00:00:00 2001 From: Chi Vinh Le Date: Tue, 7 Nov 2017 16:21:09 +0100 Subject: [PATCH 03/42] e2e v2 --- nightwatch-browserstack.conf.js | 1 + nightwatch.conf.js | 2 + package.json | 4 +- scripts/e2e-browserstack.js | 51 -------- scripts/e2e-ci.sh | 87 ++------------ scripts/e2e.js | 201 ++++++++++++++++++++++++++++++++ test/e2e/globals.js | 2 - 7 files changed, 212 insertions(+), 136 deletions(-) delete mode 100755 scripts/e2e-browserstack.js create mode 100755 scripts/e2e.js diff --git a/nightwatch-browserstack.conf.js b/nightwatch-browserstack.conf.js index d79f6917a..09900c321 100644 --- a/nightwatch-browserstack.conf.js +++ b/nightwatch-browserstack.conf.js @@ -22,6 +22,7 @@ const nightwatch_config = { 'browserstack.user': process.env.BROWSERSTACK_USER || 'coralproject2', 'browserstack.key': process.env.BROWSERSTACK_KEY, 'browserstack.local': true, + 'browserstack.localIdentifier': process.env.BROWSERSTACK_LOCAL_IDENTIFIER ? process.env.BROWSERSTACK_LOCAL_IDENTIFIER : undefined, 'browserstack.debug': true, // Disable this, as it makes bs slow and brittle. diff --git a/nightwatch.conf.js b/nightwatch.conf.js index 97eee0e81..e04cc04a8 100644 --- a/nightwatch.conf.js +++ b/nightwatch.conf.js @@ -40,6 +40,8 @@ module.exports = { path: process.env.REPORTS_FOLDER || './test/e2e/reports', }, }, + 'chrome': { + }, 'chrome-headless': { desiredCapabilities: { chromeOptions : { diff --git a/package.json b/package.json index 897efc819..69093c0c5 100644 --- a/package.json +++ b/package.json @@ -16,9 +16,7 @@ "lint-fix": "yarn lint --fix", "jest-watch": "TEST_MODE=unit NODE_ENV=test jest --watch", "e2e-ci": "./scripts/e2e-ci.sh", - "e2e-browserstack": "NODE_ENV=test ./scripts/e2e-browserstack.js --config nightwatch-browserstack.conf.js", - "pree2e": "selenium-standalone install", - "e2e": "NODE_ENV=test nightwatch", + "e2e": "./scripts/e2e.js", "test": "TEST_MODE=unit NODE_ENV=test jest && TEST_MODE=unit NODE_ENV=test mocha -R ${MOCHA_REPORTER:-spec}", "test-cover": "TEST_MODE=unit NODE_ENV=test istanbul cover _mocha --report text --check-coverage -- -R spec", "heroku-postbuild": "./bin/cli plugins reconcile && yarn build", diff --git a/scripts/e2e-browserstack.js b/scripts/e2e-browserstack.js deleted file mode 100755 index 103cd08fe..000000000 --- a/scripts/e2e-browserstack.js +++ /dev/null @@ -1,51 +0,0 @@ -#!/usr/bin/env node - -const Nightwatch = require('nightwatch'); -const browserstack = require('browserstack-local'); -const {onshutdown} = require('../bin/util'); - -async function start() { - try { - const bs_local = new browserstack.Local(); - process.mainModule.filename = './node_modules/.bin/nightwatch'; - - // Code to start browserstack local before start of test - console.log('Connecting local'); - Nightwatch.bs_local = bs_local; - - bs_local.start({ - 'key': process.env.BROWSERSTACK_KEY, - 'logFile': './test/e2e/bslocal.log' - }, function(error) { - if (error) { - console.error(error); - throw error; - } - - console.log('Connected. Now testing...'); - Nightwatch.cli(function(argv) { - Nightwatch.CliRunner(argv) - .setup(null, function(){ - - // Code to stop browserstack local after end of parallel test - bs_local.stop(function(){}); - }) - .runTests(function(){ - - // Code to stop browserstack local after end of single test - bs_local.stop(function(){}); - }); - }); - }); - - onshutdown([ - () => bs_local.stop(function(){}), - ]); - } catch (ex) { - console.log('There was an error while starting the test runner:\n\n'); - process.stderr.write(`${ex.stack}\n`); - process.exit(2); - } -} - -start(); diff --git a/scripts/e2e-ci.sh b/scripts/e2e-ci.sh index e72d1a6ce..5923ff682 100755 --- a/scripts/e2e-ci.sh +++ b/scripts/e2e-ci.sh @@ -1,92 +1,19 @@ #!/bin/bash -CIRCLE_TEST_REPORTS=${CIRCLE_TEST_REPORTS:-./test/e2e/reports} +REPORTS_FOLDER=${CIRCLE_TEST_REPORTS:-./test/e2e/reports} CIRCLE_BRANCH=${CIRCLE_BRANCH:-master} # Amount of retries before failure. E2E_MAX_RETRIES=${E2E_MAX_RETRIES:-1} -# Amount of seconds between tests. -E2E_SLEEP_BETWEEN_TESTS=${E2E_SLEEP_BETWEEN_TESTS:-1} - # Safari >= 8 has issues connecting to browserstack-local. Safari < 8 is too old. -BROWSERS="chrome firefox ie edge" #safari +BROWSERS="chrome,firefox,ie,edge" #safari -if [[ "${CIRCLE_BRANCH}" == "master" ]]; then - - # List of failed browsers. - failedBrowsers= - - # List of succeeded browsers. - succeededBrowsers= - - exitCode=0 - - browserstack() { - - # Current number of tries. - try=${2:-0} - - echo "-- Start e2e for $1 #$try --" - - REPORTS_FOLDER="$CIRCLE_TEST_REPORTS/$1" yarn e2e-browserstack --env "$1" - - # Determine exit code. - result=$? - if [ "$result" -ne "0" ]; then - echo "-- Failed e2e for $1 #$try --" - - # Try again until E2E_MAX_RETRIES is reached. - if [ "$try" -lt "$E2E_MAX_RETRIES" ]; then - let try=try+1 - - # Sleep a bit to let browserstack-local close properly. - sleep "$E2E_SLEEP_BETWEEN_TESTS" - - browserstack "$1" "$try" - return - fi - - # Failed, add to list of failed browsers. - failedBrowsers="$failedBrowsers $1" - - # Remember exit code. - exitCode=$result - else - echo "-- Success e2e for $1 #$try --" - - # Succeeded, add to list of succeeded browsers. - succeededBrowsers="$succeededBrowsers $1" - eval "browser_${1}_succeeded_at=$try" - fi - - # Sleep a bit to let browserstack-local close properly. - sleep "$E2E_SLEEP_BETWEEN_TESTS" - } - - # Test using browserstack. - for browser in $BROWSERS - do - browserstack "$browser" - done - - - # Print information about succeeded browsers. - for x in $succeededBrowsers - do - echo "Succeeded $x at try #$(eval "echo \$browser_${x}_succeeded_at")" - done - - # Print information about failed browsers. - for x in $failedBrowsers - do - echo "Failed $x" - done - exit $exitCode +if [[ "${CIRCLE_BRANCH}" == "master" && -n "$BROWSERSTACK_KEY" ]]; then + echo Testing on browserstack + yarn e2e --reports-folder "$REPORTS_FOLDER" --bs-key "$BROWSERSTACK_KEY" --retries "$E2E_MAX_RETRIES" --browsers $BROWSERS else # When browserstack is not available test locally using chrome headless. - REPORTS_FOLDER="$CIRCLE_TEST_REPORTS/chrome" yarn e2e -- --env chrome-headless - - # Will exit with status of last command. - exit $? + echo Testing locally + yarn e2e --reports-folder "$REPORTS_FOLDER" --retries "$E2E_MAX_RETRIES" --headless fi diff --git a/scripts/e2e.js b/scripts/e2e.js new file mode 100755 index 000000000..6cf97b2a6 --- /dev/null +++ b/scripts/e2e.js @@ -0,0 +1,201 @@ +#!/usr/bin/env node + +process.env['NODE_ENV'] = 'test'; + +const browserstack = require('browserstack-local'); +const {onshutdown, shutdown} = require('../bin/util'); +const program = require('commander'); +const Table = require('cli-table'); +const serve = require('../serve'); +const childProcess = require('child_process'); +const uuid = require('uuid').v4; + +// Make things colorful! +require('colors'); + +function startTunnel(key, localIdentifier) { + const bs_local = new browserstack.Local(); + + // Code to start browserstack local before start of test + console.log('Connecting local'); + + return new Promise((resolve, reject) => { + bs_local.start({ + key, + logFile: './test/e2e/bslocal.log', + verbose: 'true', + force: 'true', + onlyAutomate: 'true', + localIdentifier, + }, (error) => { + if (error) { + reject(error); + } + resolve(); + }); + onshutdown([ + () => bs_local.stop(function(){}), + ]); + }); +} + +function seleniumInstall() { + return new Promise((resolve, reject) => { + try { + const nw = childProcess.spawn( + './node_modules/.bin/selenium-standalone', + ['install'], + { + stdio: 'inherit', + }); + nw.on('close', (code) => { + code === 0 ? resolve() : reject(); + }); + } + catch (ex) { + reject(ex); + } + }); +} + +function nightwatch(env, config, reportsFolder, browserstack) { + return new Promise((resolve, reject) => { + try { + const nw = childProcess.spawn( + './node_modules/.bin/nightwatch', + ['--config', config, '--env', env], + { + env: Object.assign({}, process.env, { + 'BROWSERSTACK_LOCAL_IDENTIFIER': browserstack.localIdentifier, + 'BROWSERSTACK_KEY': browserstack.key, + 'BROWSERSTACK_USER': browserstack.user, + 'REPORTS_FOLDER': `${reportsFolder}/${env}`, + }), + stdio: 'inherit', + }); + nw.on('close', (code) => { + code === 0 ? resolve() : reject(); + }); + } + catch (ex) { + reject(ex); + } + }); +} + +function printResults(browsers, succeeded, retries) { + let table = new Table({ + head: [ + 'Browser'.cyan, + 'Status'.cyan, + 'Retries'.cyan, + ] + }); + + for (let browser of browsers) { + const wasSuccessful = browser in succeeded; + table.push([ + browser, + wasSuccessful ? 'success'.green : 'failed'.red, + wasSuccessful ? succeeded[browser] : retries, + ]); + } + + console.log(table.toString()); +} + +function printSection(txt) { + console.log('*****************************'.magenta); + console.log(`${'*'.magenta} ${txt.cyan}`); + console.log('*****************************'.magenta); +} + +async function runBrowserTests(browsers, config, retries = 1, reportsFolder, browserstack) { + const succeeded = {}; + for (let browser of browsers) { + for (let t = 0; t < retries + 1; t++) { + try { + printSection(`e2e test for ${browser} #${t}`); + await nightwatch(browser, config, reportsFolder, browserstack); + succeeded[browser] = t; + console.log(`==> Succeeded e2e for ${browser} #${t}\n`.green); + break; + } + catch (ex) { + if (ex) { + console.log('There was an error while starting the test runner:\n\n'); + process.stderr.write(`${ex.stack}\n`); + } + console.log(`==> Failed e2e for ${browser} #${t}\n`.red); + } + } + } + printResults(browsers, succeeded, retries); + return Object.keys(succeeded).length === browsers.length; +} + +async function start(program) { + const localIdentifier = uuid(); + let browsers = program.browsers.split(','); + const retries = Number.parseInt(program.retries); + const browserstack = {}; + const date = new Date().toISOString() + .replace(/[T.]/g, '-') + .replace(/:/g, ''); + const reportsFolder = `${program.reportsFolder}/${date}`; + let exitCode = 0; + let config = 'nightwatch.conf.js'; + try { + if (program.tunnel && program.bsKey) { + await startTunnel(program.bsKey, localIdentifier); + } + + await serve(); + + if (program.bsKey) { + config = 'nightwatch-browserstack.conf.js'; + browserstack.localIdentifier = localIdentifier; + browserstack.key = program.bsKey; + browserstack.user = program.bsUser; + } else { + await seleniumInstall(); + if (program.headless) { + browsers = browsers.map((b) => `${b}-headless`); + } + } + + const succeeded = await runBrowserTests( + browsers, + config, + retries, + reportsFolder, + browserstack, + ); + if (!succeeded) { + exitCode = 1; + } + } + catch (ex) { + console.log('There was an error:\n\n'); + process.stderr.write(`${ex.stack}\n`); + process.exit(2); + } + finally { + console.log('Shutting down'); + shutdown(); + } + process.exit(exitCode); +} + +program + .version('0.1.0') + .option('-u, --bs-user [user]', 'Browserstack user', 'coralproject2') + .option('-k, --bs-key [key]', 'Browserstack api key') + .option('--no-tunnel', 'Dont start browserstack-local') + .option('-b, --browsers [list of browsers]', 'Browsers to test', 'chrome,firefox,ie,edge') + .option('-r, --retries [number]', 'Number of retries before failing', '1') + .option('--headless', 'Start in headless mode for local e2e') + .option('--reports-folder [folder]', 'Reports folder', './test/e2e/reports') + .parse(process.argv); + +start(program); diff --git a/test/e2e/globals.js b/test/e2e/globals.js index a828804b4..5bb0a27fe 100644 --- a/test/e2e/globals.js +++ b/test/e2e/globals.js @@ -1,11 +1,9 @@ -const serve = require('../../serve'); const mongoose = require('../../services/mongoose'); const {shutdown} = require('../../bin/util'); module.exports = { before: async (done) => { await mongoose.connection.dropDatabase(); - await serve(); done(); }, after: (done) => { From 2a0f70f084a28a491aaaf2d02f9b3ca36a356f2b Mon Sep 17 00:00:00 2001 From: Chi Vinh Le Date: Tue, 7 Nov 2017 16:42:37 +0100 Subject: [PATCH 04/42] Clean DB before serve --- scripts/e2e.js | 5 ++++- test/e2e/globals.js | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/scripts/e2e.js b/scripts/e2e.js index 6cf97b2a6..0025710c5 100755 --- a/scripts/e2e.js +++ b/scripts/e2e.js @@ -9,6 +9,7 @@ const Table = require('cli-table'); const serve = require('../serve'); const childProcess = require('child_process'); const uuid = require('uuid').v4; +const mongoose = require('../services/mongoose'); // Make things colorful! require('colors'); @@ -150,6 +151,8 @@ async function start(program) { await startTunnel(program.bsKey, localIdentifier); } + console.log('Dropping test database'); + await mongoose.connection.dropDatabase(); await serve(); if (program.bsKey) { @@ -192,7 +195,7 @@ program .option('-u, --bs-user [user]', 'Browserstack user', 'coralproject2') .option('-k, --bs-key [key]', 'Browserstack api key') .option('--no-tunnel', 'Dont start browserstack-local') - .option('-b, --browsers [list of browsers]', 'Browsers to test', 'chrome,firefox,ie,edge') + .option('-b, --browsers [list of browsers]', 'Browsers to test', 'chrome') .option('-r, --retries [number]', 'Number of retries before failing', '1') .option('--headless', 'Start in headless mode for local e2e') .option('--reports-folder [folder]', 'Reports folder', './test/e2e/reports') diff --git a/test/e2e/globals.js b/test/e2e/globals.js index 5bb0a27fe..4d2740404 100644 --- a/test/e2e/globals.js +++ b/test/e2e/globals.js @@ -3,6 +3,7 @@ const {shutdown} = require('../../bin/util'); module.exports = { before: async (done) => { + console.log('Dropping test database'); await mongoose.connection.dropDatabase(); done(); }, From b09b56bd24f9fac061a9ae6119383bd14bf99af9 Mon Sep 17 00:00:00 2001 From: Chi Vinh Le Date: Tue, 7 Nov 2017 16:52:27 +0100 Subject: [PATCH 05/42] Temporarily enable browserstack --- scripts/e2e-ci.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/e2e-ci.sh b/scripts/e2e-ci.sh index 5923ff682..9a5439401 100755 --- a/scripts/e2e-ci.sh +++ b/scripts/e2e-ci.sh @@ -1,7 +1,7 @@ #!/bin/bash REPORTS_FOLDER=${CIRCLE_TEST_REPORTS:-./test/e2e/reports} -CIRCLE_BRANCH=${CIRCLE_BRANCH:-master} +CIRCLE_BRANCH=${CIRCLE_BRANCH__XX:-master} # Amount of retries before failure. E2E_MAX_RETRIES=${E2E_MAX_RETRIES:-1} From 0678ea0344045de39b47ad710a10c4e302e5a8a6 Mon Sep 17 00:00:00 2001 From: Chi Vinh Le Date: Tue, 7 Nov 2017 17:07:50 +0100 Subject: [PATCH 06/42] Small tweak --- scripts/e2e.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/e2e.js b/scripts/e2e.js index 0025710c5..0f0e71dcd 100755 --- a/scripts/e2e.js +++ b/scripts/e2e.js @@ -119,7 +119,7 @@ async function runBrowserTests(browsers, config, retries = 1, reportsFolder, bro printSection(`e2e test for ${browser} #${t}`); await nightwatch(browser, config, reportsFolder, browserstack); succeeded[browser] = t; - console.log(`==> Succeeded e2e for ${browser} #${t}\n`.green); + console.log(`\n==> Succeeded e2e for ${browser} #${t}\n`.green); break; } catch (ex) { @@ -127,7 +127,7 @@ async function runBrowserTests(browsers, config, retries = 1, reportsFolder, bro console.log('There was an error while starting the test runner:\n\n'); process.stderr.write(`${ex.stack}\n`); } - console.log(`==> Failed e2e for ${browser} #${t}\n`.red); + console.log(`\n==> Failed e2e for ${browser} #${t}\n`.red); } } } From c3e551deb5efdb131efae5d84426460c741b6ec4 Mon Sep 17 00:00:00 2001 From: Chi Vinh Le Date: Tue, 7 Nov 2017 17:47:56 +0100 Subject: [PATCH 07/42] Disable bs for branches --- scripts/e2e-ci.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/e2e-ci.sh b/scripts/e2e-ci.sh index 9a5439401..5923ff682 100755 --- a/scripts/e2e-ci.sh +++ b/scripts/e2e-ci.sh @@ -1,7 +1,7 @@ #!/bin/bash REPORTS_FOLDER=${CIRCLE_TEST_REPORTS:-./test/e2e/reports} -CIRCLE_BRANCH=${CIRCLE_BRANCH__XX:-master} +CIRCLE_BRANCH=${CIRCLE_BRANCH:-master} # Amount of retries before failure. E2E_MAX_RETRIES=${E2E_MAX_RETRIES:-1} From 4f89c1e1c3d838679b8f50abc791fb7d622db58b Mon Sep 17 00:00:00 2001 From: Chi Vinh Le Date: Tue, 7 Nov 2017 17:50:56 +0100 Subject: [PATCH 08/42] Add some comments and description --- scripts/e2e.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/e2e.js b/scripts/e2e.js index 0f0e71dcd..97e321310 100755 --- a/scripts/e2e.js +++ b/scripts/e2e.js @@ -161,6 +161,8 @@ async function start(program) { browserstack.key = program.bsKey; browserstack.user = program.bsUser; } else { + + // Install selenium standalone. await seleniumInstall(); if (program.headless) { browsers = browsers.map((b) => `${b}-headless`); @@ -192,6 +194,7 @@ async function start(program) { program .version('0.1.0') + .description('Perform e2e testing locally or if browserstack credentials are provided on browserstack.') .option('-u, --bs-user [user]', 'Browserstack user', 'coralproject2') .option('-k, --bs-key [key]', 'Browserstack api key') .option('--no-tunnel', 'Dont start browserstack-local') From 9b98e3cac9f33f0d9b7eaeb1ed21bc3ee15842a3 Mon Sep 17 00:00:00 2001 From: Belen Curcio Date: Tue, 7 Nov 2017 15:20:14 -0300 Subject: [PATCH 09/42] missing classes --- .../coral-admin/src/components/BanUserDialog.js | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/client/coral-admin/src/components/BanUserDialog.js b/client/coral-admin/src/components/BanUserDialog.js index 169afe043..032330833 100644 --- a/client/coral-admin/src/components/BanUserDialog.js +++ b/client/coral-admin/src/components/BanUserDialog.js @@ -1,4 +1,5 @@ import React from 'react'; +import cn from 'classnames'; import PropTypes from 'prop-types'; import {Dialog} from 'coral-ui'; import styles from './BanUserDialog.css'; @@ -8,7 +9,7 @@ import t from 'coral-framework/services/i18n'; const BanUserDialog = ({open, onCancel, onPerform, username, info}) => ( ( {info}
- -
From a2470fa01bf9d9d60f54ebf4e4055cab9d84dc6a Mon Sep 17 00:00:00 2001 From: Belen Curcio Date: Tue, 7 Nov 2017 16:43:58 -0300 Subject: [PATCH 10/42] More --- .../src/components/BanUserDialog.js | 46 +++++++++---------- client/coral-ui/components/Dialog.js | 4 +- .../client/components/BanUserDialog.js | 26 +++++++++-- test/e2e/page_objects/embedStream.js | 46 +++++++++++++++++-- test/e2e/specs/04_banUser.js | 28 +++++++++-- 5 files changed, 112 insertions(+), 38 deletions(-) diff --git a/client/coral-admin/src/components/BanUserDialog.js b/client/coral-admin/src/components/BanUserDialog.js index 032330833..61fa3ca9d 100644 --- a/client/coral-admin/src/components/BanUserDialog.js +++ b/client/coral-admin/src/components/BanUserDialog.js @@ -15,30 +15,28 @@ const BanUserDialog = ({open, onCancel, onPerform, username, info}) => ( onCancel={onCancel} title={t('bandialog.ban_user')}> × -
-
-

{t('bandialog.ban_user')}

-
-
-

{t('bandialog.are_you_sure', username)}

- {info} -
-
- - -
+
+

{t('bandialog.ban_user')}

+
+
+

{t('bandialog.are_you_sure', username)}

+ {info} +
+
+ +
); diff --git a/client/coral-ui/components/Dialog.js b/client/coral-ui/components/Dialog.js index 93431db4c..a7d34a512 100644 --- a/client/coral-ui/components/Dialog.js +++ b/client/coral-ui/components/Dialog.js @@ -10,12 +10,12 @@ export default class Dialog extends Component { onCancel: PropTypes.func, onClose: PropTypes.func, open: PropTypes.bool, - style: PropTypes.object + style: PropTypes.object, }; static defaultProps = { onCancel: (e) => e.preventDefault(), - onClose: (e) => e.preventDefault() + onClose: (e) => e.preventDefault(), }; componentDidMount(){ diff --git a/plugins/talk-plugin-moderation-actions/client/components/BanUserDialog.js b/plugins/talk-plugin-moderation-actions/client/components/BanUserDialog.js index 702ee4b10..c98e3e7c2 100644 --- a/plugins/talk-plugin-moderation-actions/client/components/BanUserDialog.js +++ b/plugins/talk-plugin-moderation-actions/client/components/BanUserDialog.js @@ -1,10 +1,12 @@ import React from 'react'; +import PropTypes from 'prop-types'; +import cn from 'classnames'; import styles from './BanUserDialog.css'; import {t} from 'plugin-api/beta/client/services'; import {Dialog, Button} from 'plugin-api/beta/client/components/ui'; -export default ({showBanDialog, closeBanDialog, banUser}) => ( - +const BanUserDialog = ({showBanDialog, closeBanDialog, banUser}) => ( + ×

{t('talk-plugin-moderation-actions.ban_user_dialog_headline')}

{t('talk-plugin-moderation-actions.ban_user_dialog_sub')}

@@ -12,12 +14,28 @@ export default ({showBanDialog, closeBanDialog, banUser}) => ( {t('talk-plugin-moderation-actions.ban_user_dialog_copy')}

- -
); + +BanUserDialog.propTypes = { + showBanDialog: PropTypes.func.isRequired, + closeBanDialog: PropTypes.func.isRequired, + banUser: PropTypes.func.isRequired, +}; + +export default BanUserDialog; \ No newline at end of file diff --git a/test/e2e/page_objects/embedStream.js b/test/e2e/page_objects/embedStream.js index b99faf341..a8648b890 100644 --- a/test/e2e/page_objects/embedStream.js +++ b/test/e2e/page_objects/embedStream.js @@ -2,16 +2,50 @@ const iframeId = 'coralStreamEmbed_iframe'; module.exports = { commands: [{ - navigateToAsset: function(asset) { + navigateToAsset(asset) { this.api.url(`${this.api.launchUrl}/assets/title/${asset}`); return this; }, - getEmbedSection: function() { + getEmbedSection() { this.waitForElementVisible('@iframe'); this.api.frame(iframeId); this.expect.section('@embed').to.be.present; return this.section.embed; }, + login(user = {}) { + const embedStream = this.page.embedStream(); + + const embed = embedStream + .navigate() + .getEmbedSection(); + + embed + .waitForElementVisible('@signInButton') + .click('@signInButton'); + + this.pause(3000); + + // Focusing on the Login PopUp + this.windowHandles((result) => { + const handle = result.value[1]; + this.switchWindow(handle); + }); + + const login = this.page.login(); + + login + .setValue('@emailInput', user.email) + .setValue('@passwordInput', user.password) + .waitForElementVisible('@signIn') + .waitForElementVisible('@loginButton') + .click('@loginButton'); + + // Focusing on the Embed Window + this.windowHandles((result) => { + const handle = result.value[0]; + this.switchWindow(handle); + }); + }, }], url: function() { return this.api.launchUrl; @@ -22,12 +56,12 @@ module.exports = { sections: { embed: { commands: [{ - getProfileSection: function() { + getProfileSection() { this.click('@profileTabButton'); this.expect.section('@profile').to.be.present; return this.section.profile; }, - getCommentsSection: function() { + getCommentsSection() { this.click('@commentsTabButton'); this.expect.section('@comments').to.be.present; return this.section.comments; @@ -64,7 +98,9 @@ module.exports = { elements: { arrow: '.talk-plugin-moderation-actions-arrow', menu: '.talk-plugin-modetarion-actions-menu', - banButton: 'talk-plugin-moderation-actions-ban', + banButton: '.talk-plugin-moderation-actions-ban', + banDialog: '.talk-ban-user-dialog', + banDialogbanButton: '.talk-ban-user-dialog-button-ban', }, }, profile: { diff --git a/test/e2e/specs/04_banUser.js b/test/e2e/specs/04_banUser.js index 598460e30..776093692 100644 --- a/test/e2e/specs/04_banUser.js +++ b/test/e2e/specs/04_banUser.js @@ -1,4 +1,5 @@ module.exports = { + 'admin logs in': (client) => { const adminPage = client.page.admin(); const {testData: {admin}} = client.globals; @@ -24,7 +25,7 @@ module.exports = { .navigate() .getEmbedSection(); }, - 'ban': (client) => { + 'admin bans user': (client) => { const modSection = client.page.embedStream().section.embed.section.mod; modSection @@ -32,6 +33,27 @@ module.exports = { .click('@arrow') .waitForElementVisible('@menu') .waitForElementVisible('@banButton') - .click('@banButton'); - } + .click('@banButton') + .waitForElementVisible('@banDialog') + .waitForElementVisible('@banDialogbanButton') + .click('@banDialogbanButton') + .waitForElementNotVisible('@banDialog'); + }, + 'user logs in': (client) => { + const {testData: {user}} = client.globals; + const embedStream = client.page.embedStream(); + + embedStream + .login(user); + }, + 'user account is banned, should see restricted message box': (client) => { + const embedStream = client.page.embedStream(); + + const embed = embedStream + .navigate() + .getEmbedSection(); + + embed + .waitForElementVisible('@restrictedMessageBox'); + }, }; From a394ba29b377f78509470227c3d333fc3e6bdac0 Mon Sep 17 00:00:00 2001 From: Jeff Nelson Date: Wed, 8 Nov 2017 07:11:03 -0500 Subject: [PATCH 11/42] Update 02-02-advanced-configuration.md Change TALK_SMTP_EMAIL to TALK_SMTP_FROM_EMAIL --- docs/_docs/02-02-advanced-configuration.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/_docs/02-02-advanced-configuration.md b/docs/_docs/02-02-advanced-configuration.md index 73e72e2cb..2f830a022 100644 --- a/docs/_docs/02-02-advanced-configuration.md +++ b/docs/_docs/02-02-advanced-configuration.md @@ -369,12 +369,12 @@ Then all the routes for the API will be expecting to be hit on `/talk/`, such as can perform the path stripping when serving an upstream proxy, but some CDN's cannot. You would use this option in the latter situation. -## TALK_SMTP_EMAIL +## TALK_SMTP_FROM_EMAIL The email address to send emails from using the SMTP provider in the format: ```plain -TALK_SMTP_EMAIL="The Coral Project" +TALK_SMTP_FROM_EMAIL="The Coral Project" ``` Including the name and email address. From e9bd5703f12ddd877c28156a25a372ba3ddc8a72 Mon Sep 17 00:00:00 2001 From: Belen Curcio Date: Wed, 8 Nov 2017 11:49:32 -0300 Subject: [PATCH 12/42] refactor --- test/e2e/page_objects/admin.js | 17 +++++++++++++++++ test/e2e/page_objects/embedStream.js | 13 +++++++++++++ test/e2e/specs/04_banUser.js | 20 +++++++------------- 3 files changed, 37 insertions(+), 13 deletions(-) diff --git a/test/e2e/page_objects/admin.js b/test/e2e/page_objects/admin.js index 94ce82826..17824ec8a 100644 --- a/test/e2e/page_objects/admin.js +++ b/test/e2e/page_objects/admin.js @@ -7,6 +7,23 @@ module.exports = { return this .waitForElementVisible('body'); }, + login(user = {}) { + const adminPage = this.page.admin(); + + adminPage + .navigate() + .waitForElementVisible('@loginLayout') + .waitForElementVisible('@signInForm') + .setValue('@emailInput', user.email) + .setValue('@passwordInput', user.password) + .waitForElementVisible('@signInButton') + .click('@signInButton'); + + this.pause(3000); + + adminPage + .waitForElementVisible('@moderationContainer'); + }, }], elements: { 'loginLayout': '.talk-admin-login', diff --git a/test/e2e/page_objects/embedStream.js b/test/e2e/page_objects/embedStream.js index a8648b890..92c662d79 100644 --- a/test/e2e/page_objects/embedStream.js +++ b/test/e2e/page_objects/embedStream.js @@ -46,6 +46,19 @@ module.exports = { this.switchWindow(handle); }); }, + logout() { + const embedStream = this.page.embedStream(); + + const embed = embedStream + .navigate() + .getEmbedSection(); + + embed + .waitForElementVisible('@commentsTabButton') + .click('@commentsTabButton') + .waitForElementVisible('@logoutButton') + .click('@logoutButton'); + } }], url: function() { return this.api.launchUrl; diff --git a/test/e2e/specs/04_banUser.js b/test/e2e/specs/04_banUser.js index 776093692..24561e1f1 100644 --- a/test/e2e/specs/04_banUser.js +++ b/test/e2e/specs/04_banUser.js @@ -1,22 +1,10 @@ module.exports = { - 'admin logs in': (client) => { const adminPage = client.page.admin(); const {testData: {admin}} = client.globals; adminPage - .navigate() - .waitForElementVisible('@loginLayout') - .waitForElementVisible('@signInForm') - .setValue('@emailInput', admin.email) - .setValue('@passwordInput', admin.password) - .waitForElementVisible('@signInButton') - .click('@signInButton'); - - client.pause(3000); - - adminPage - .waitForElementVisible('@moderationContainer'); + .login(admin); }, 'navigate to the embed stream': (client) => { const embedStream = client.page.embedStream(); @@ -39,6 +27,12 @@ module.exports = { .click('@banDialogbanButton') .waitForElementNotVisible('@banDialog'); }, + 'admin logs out': (client) => { + const embedStream = client.page.embedStream(); + + embedStream + .logout(); + }, 'user logs in': (client) => { const {testData: {user}} = client.globals; const embedStream = client.page.embedStream(); From 54ac2985ba6c4850f84324b8aacd7e078349488b Mon Sep 17 00:00:00 2001 From: Belen Curcio Date: Wed, 8 Nov 2017 12:23:29 -0300 Subject: [PATCH 13/42] Adding classes --- client/coral-admin/src/routes/Community/components/People.js | 3 ++- client/coral-admin/src/routes/Community/components/Table.js | 4 +++- client/coral-ui/components/Dropdown.js | 4 ++-- client/coral-ui/components/Option.js | 4 +++- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/client/coral-admin/src/routes/Community/components/People.js b/client/coral-admin/src/routes/Community/components/People.js index 75d08429a..b92bd679a 100644 --- a/client/coral-admin/src/routes/Community/components/People.js +++ b/client/coral-admin/src/routes/Community/components/People.js @@ -1,4 +1,5 @@ import React from 'react'; +import cn from 'classnames'; import styles from './styles.css'; import Table from './Table'; import {Icon} from 'coral-ui'; @@ -24,7 +25,7 @@ const People = (props) => { const hasResults = !!users.length; return ( -
+
diff --git a/client/coral-admin/src/routes/Community/components/Table.js b/client/coral-admin/src/routes/Community/components/Table.js index 22b02cfe4..aa2db6ff6 100644 --- a/client/coral-admin/src/routes/Community/components/Table.js +++ b/client/coral-admin/src/routes/Community/components/Table.js @@ -42,7 +42,7 @@ const Table = ({users, setRole, onHeaderClickHandler, setCommenterStatus, viewUs {users.map((row, i)=> ( - + {row.profiles.map(({id}) => id)} @@ -52,6 +52,7 @@ const Table = ({users, setRole, onHeaderClickHandler, setCommenterStatus, viewUs setCommenterStatus(row.id, status)}> @@ -61,6 +62,7 @@ const Table = ({users, setRole, onHeaderClickHandler, setCommenterStatus, viewUs setRole(row.id, role)}> diff --git a/client/coral-ui/components/Dropdown.js b/client/coral-ui/components/Dropdown.js index 2cad6e990..dddffbfa2 100644 --- a/client/coral-ui/components/Dropdown.js +++ b/client/coral-ui/components/Dropdown.js @@ -131,7 +131,7 @@ class Dropdown extends React.Component { const {containerClassName, toggleClassName, toggleOpenClassName} = this.props; return ( -
+
-
    +
      {React.Children.toArray(this.props.children) .map((child, i) => React.cloneElement(child, { diff --git a/client/coral-ui/components/Option.js b/client/coral-ui/components/Option.js index 5b752eb48..8fd92a904 100644 --- a/client/coral-ui/components/Option.js +++ b/client/coral-ui/components/Option.js @@ -16,8 +16,9 @@ class Option extends React.Component { render() { const {className, label = '', onClick, onKeyDown} = this.props; + const id = this.props.id ? this.props.id : this.props.value; return ( -
    • +
    • {label}
    • ); @@ -26,6 +27,7 @@ class Option extends React.Component { Option.propTypes = { className: PropTypes.string, + id: PropTypes.string, label: PropTypes.string, onClick: PropTypes.func, onKeyDown: PropTypes.func, From 81bf63836a83122af8bff6a90f588e321bdb0d15 Mon Sep 17 00:00:00 2001 From: Belen Curcio Date: Wed, 8 Nov 2017 12:23:40 -0300 Subject: [PATCH 14/42] tests --- test/e2e/page_objects/adminCommunity.js | 17 +++++++++++++++ test/e2e/specs/04_banUser.js | 29 +++++++++++++++++++++++++ 2 files changed, 46 insertions(+) diff --git a/test/e2e/page_objects/adminCommunity.js b/test/e2e/page_objects/adminCommunity.js index ef3ccbb4c..5bae03ae1 100644 --- a/test/e2e/page_objects/adminCommunity.js +++ b/test/e2e/page_objects/adminCommunity.js @@ -7,6 +7,10 @@ module.exports = { return this .waitForElementVisible('body'); }, + goToPeople() { + this + .navigate(`${this.url()}/people`); + }, }], elements: { container: '.talk-admin-community', @@ -18,5 +22,18 @@ module.exports = { usernameDialogButtons: '.talk-reject-username-dialog-buttons', usernameDialogSuspend: '.talk-reject-username-dialog-button-k', usernameDialogSuspensionMessage: '.talk-reject-username-dialog-suspension-message' + }, + sections: { + people: { + selector: '.talk-admin-community-people-container', + elements: { + row: '.talk-admin-community-people-row', + dropdownStatus: '.talk-admin-community-people-dd-status', + dropdownRole: '.talk-admin-community-people-dd-role', + dropdownStatusActive: '.talk-admin-community-people-dd-status .dd-list-active', + optionActive: '.dd-option#ACTIVE', + optionBanned: '.dd-option#BANNED', + } + } } }; diff --git a/test/e2e/specs/04_banUser.js b/test/e2e/specs/04_banUser.js index 24561e1f1..c7eab0c33 100644 --- a/test/e2e/specs/04_banUser.js +++ b/test/e2e/specs/04_banUser.js @@ -50,4 +50,33 @@ module.exports = { embed .waitForElementVisible('@restrictedMessageBox'); }, + 'user logs out': (client) => { + const embedStream = client.page.embedStream(); + + embedStream + .logout(); + }, + 'admin logs in (2)': (client) => { + const adminPage = client.page.admin(); + const {testData: {admin}} = client.globals; + + adminPage + .login(admin); + }, + 'admin goes to community': (client) => { + const community = client.page.adminCommunity(); + + community + .goToPeople(); + }, + 'admin removes ban from user': (client) => { + const modSection = client.page.adminCommunity().section.people; + + modSection + .waitForElementVisible('@row') + .waitForElementVisible('@dropdownStatus') + .click('@dropdownStatus') + .waitForElementVisible('@dropdownStatusActive') + .click('@optionActive'); + }, }; From 62d01cf2a0a3e141b46a81156e99159f68092976 Mon Sep 17 00:00:00 2001 From: Belen Curcio Date: Wed, 8 Nov 2017 12:31:33 -0300 Subject: [PATCH 15/42] perform login --- test/e2e/page_objects/admin.js | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/test/e2e/page_objects/admin.js b/test/e2e/page_objects/admin.js index 17824ec8a..e83e7b7df 100644 --- a/test/e2e/page_objects/admin.js +++ b/test/e2e/page_objects/admin.js @@ -7,10 +7,8 @@ module.exports = { return this .waitForElementVisible('body'); }, - login(user = {}) { - const adminPage = this.page.admin(); - - adminPage + login(user = {}) { + this .navigate() .waitForElementVisible('@loginLayout') .waitForElementVisible('@signInForm') @@ -19,9 +17,9 @@ module.exports = { .waitForElementVisible('@signInButton') .click('@signInButton'); - this.pause(3000); + this.api.pause(3000); - adminPage + this .waitForElementVisible('@moderationContainer'); }, }], From 5efdc9865f03cf5159488c1211b1dcd5f1c4b696 Mon Sep 17 00:00:00 2001 From: Belen Curcio Date: Wed, 8 Nov 2017 12:59:08 -0300 Subject: [PATCH 16/42] refacotr --- .../src/routes/Community/components/Table.js | 4 +-- test/e2e/page_objects/adminCommunity.js | 2 +- test/e2e/page_objects/embedStream.js | 27 +++++++++---------- .../{05_userStatus.js => 04_userStatus.js} | 0 .../specs/{04_banUser.js => 05_banUser.js} | 11 +++++--- 5 files changed, 22 insertions(+), 22 deletions(-) rename test/e2e/specs/{05_userStatus.js => 04_userStatus.js} (100%) rename test/e2e/specs/{04_banUser.js => 05_banUser.js} (89%) diff --git a/client/coral-admin/src/routes/Community/components/Table.js b/client/coral-admin/src/routes/Community/components/Table.js index aa2db6ff6..89d59131e 100644 --- a/client/coral-admin/src/routes/Community/components/Table.js +++ b/client/coral-admin/src/routes/Community/components/Table.js @@ -52,7 +52,7 @@ const Table = ({users, setRole, onHeaderClickHandler, setCommenterStatus, viewUs setCommenterStatus(row.id, status)}> @@ -62,7 +62,7 @@ const Table = ({users, setRole, onHeaderClickHandler, setCommenterStatus, viewUs setRole(row.id, role)}> diff --git a/test/e2e/page_objects/adminCommunity.js b/test/e2e/page_objects/adminCommunity.js index 5bae03ae1..0e063915a 100644 --- a/test/e2e/page_objects/adminCommunity.js +++ b/test/e2e/page_objects/adminCommunity.js @@ -27,7 +27,7 @@ module.exports = { people: { selector: '.talk-admin-community-people-container', elements: { - row: '.talk-admin-community-people-row', + firstRow: '.talk-admin-community-people-row:first-child', dropdownStatus: '.talk-admin-community-people-dd-status', dropdownRole: '.talk-admin-community-people-dd-role', dropdownStatusActive: '.talk-admin-community-people-dd-status .dd-list-active', diff --git a/test/e2e/page_objects/embedStream.js b/test/e2e/page_objects/embedStream.js index 92c662d79..55bc6f91c 100644 --- a/test/e2e/page_objects/embedStream.js +++ b/test/e2e/page_objects/embedStream.js @@ -13,9 +13,8 @@ module.exports = { return this.section.embed; }, login(user = {}) { - const embedStream = this.page.embedStream(); - - const embed = embedStream + + const embed = this .navigate() .getEmbedSection(); @@ -23,15 +22,15 @@ module.exports = { .waitForElementVisible('@signInButton') .click('@signInButton'); - this.pause(3000); + this.api.pause(3000); // Focusing on the Login PopUp - this.windowHandles((result) => { + this.api.windowHandles((result) => { const handle = result.value[1]; - this.switchWindow(handle); + this.api.switchWindow(handle); }); - const login = this.page.login(); + const login = this.api.page.login(); login .setValue('@emailInput', user.email) @@ -41,15 +40,13 @@ module.exports = { .click('@loginButton'); // Focusing on the Embed Window - this.windowHandles((result) => { + this.api.windowHandles((result) => { const handle = result.value[0]; - this.switchWindow(handle); + this.api.switchWindow(handle); }); }, - logout() { - const embedStream = this.page.embedStream(); - - const embed = embedStream + logout() { + const embed = this .navigate() .getEmbedSection(); @@ -95,6 +92,8 @@ module.exports = { restrictedMessageBox: '.talk-restricted-message-box', suspendedAccountInput: '.talk-suspended-account-username-input', suspendedAccountSubmitButton: '.talk-suspended-account-submit-button', + banDialog: '.talk-ban-user-dialog', + banDialogConfirmButton: '.talk-ban-user-dialog-button-confirm', }, sections: { flag: { @@ -112,8 +111,6 @@ module.exports = { arrow: '.talk-plugin-moderation-actions-arrow', menu: '.talk-plugin-modetarion-actions-menu', banButton: '.talk-plugin-moderation-actions-ban', - banDialog: '.talk-ban-user-dialog', - banDialogbanButton: '.talk-ban-user-dialog-button-ban', }, }, profile: { diff --git a/test/e2e/specs/05_userStatus.js b/test/e2e/specs/04_userStatus.js similarity index 100% rename from test/e2e/specs/05_userStatus.js rename to test/e2e/specs/04_userStatus.js diff --git a/test/e2e/specs/04_banUser.js b/test/e2e/specs/05_banUser.js similarity index 89% rename from test/e2e/specs/04_banUser.js rename to test/e2e/specs/05_banUser.js index c7eab0c33..8e5e33cd0 100644 --- a/test/e2e/specs/04_banUser.js +++ b/test/e2e/specs/05_banUser.js @@ -14,6 +14,7 @@ module.exports = { .getEmbedSection(); }, 'admin bans user': (client) => { + const embed = client.page.embedStream().section.embed; const modSection = client.page.embedStream().section.embed.section.mod; modSection @@ -21,10 +22,12 @@ module.exports = { .click('@arrow') .waitForElementVisible('@menu') .waitForElementVisible('@banButton') - .click('@banButton') + .click('@banButton'); + + embed .waitForElementVisible('@banDialog') - .waitForElementVisible('@banDialogbanButton') - .click('@banDialogbanButton') + .waitForElementVisible('@banDialogConfirmButton') + .click('@banDialogConfirmButton') .waitForElementNotVisible('@banDialog'); }, 'admin logs out': (client) => { @@ -73,7 +76,7 @@ module.exports = { const modSection = client.page.adminCommunity().section.people; modSection - .waitForElementVisible('@row') + .waitForElementVisible('@firstRow') .waitForElementVisible('@dropdownStatus') .click('@dropdownStatus') .waitForElementVisible('@dropdownStatusActive') From 9a651880a2fd4de4a362c23d8c7491df91ba6f0d Mon Sep 17 00:00:00 2001 From: Belen Curcio Date: Wed, 8 Nov 2017 14:00:01 -0300 Subject: [PATCH 17/42] Updated login --- test/e2e/page_objects/embedStream.js | 40 +++++++++++++++------ test/e2e/specs/03_embedStream.js | 52 ++-------------------------- 2 files changed, 31 insertions(+), 61 deletions(-) diff --git a/test/e2e/page_objects/embedStream.js b/test/e2e/page_objects/embedStream.js index f98dd7585..e31d5d72e 100644 --- a/test/e2e/page_objects/embedStream.js +++ b/test/e2e/page_objects/embedStream.js @@ -1,4 +1,5 @@ const iframeId = 'coralStreamEmbed_iframe'; +const SortedWindowHandler = require('../utils/SortedWindowHandler'); module.exports = { commands: [{ @@ -18,36 +19,53 @@ module.exports = { return this.section.embed; }, login(user = {}) { - const embed = this .navigate() .getEmbedSection(); + const windowHandler = new SortedWindowHandler(this); + embed .waitForElementVisible('@signInButton') .click('@signInButton'); - this.api.pause(3000); + // Wait for window to be created + // https://www.browserstack.com/automate/builds/1ceccf4efb4683b7feb890f45a32b5922b40ed3f/sessions/17b1a79682bef2498cb0be86eac317a08c976b0a#automate_button + this.api.pause(200); // Focusing on the Login PopUp - this.api.windowHandles((result) => { - const handle = result.value[1]; - this.api.switchWindow(handle); + windowHandler.windowHandles((handles) => { + this.api.switchWindow(handles[1]); }); - + const login = this.api.page.login(); - + login + .waitForElementVisible('@registerButton') + .click('@registerButton') .setValue('@emailInput', user.email) + .setValue('@usernameInput', user.username) .setValue('@passwordInput', user.password) + .setValue('@confirmPasswordInput', user.password) + .waitForElementVisible('@signUpButton') + .click('@signUpButton') .waitForElementVisible('@signIn') .waitForElementVisible('@loginButton') .click('@loginButton'); - + + // Give a tiny bit of time to let popup close. + this.api.pause(50); + + if (this.api.capabilities.browserName === 'MicrosoftEdge') { + + // More time for edge. + // https://www.browserstack.com/automate/builds/1ceccf4efb4683b7feb890f45a32b5922b40ed3f/sessions/7393dbfda8387e43b6d5851f359b0c07db414973 + this.api.pause(1000); + } + // Focusing on the Embed Window - this.api.windowHandles((result) => { - const handle = result.value[0]; - this.api.switchWindow(handle); + windowHandler.windowHandles((handles) => { + this.api.switchWindow(handles[0]); }); }, logout() { diff --git a/test/e2e/specs/03_embedStream.js b/test/e2e/specs/03_embedStream.js index 53da1e87d..a12b9820f 100644 --- a/test/e2e/specs/03_embedStream.js +++ b/test/e2e/specs/03_embedStream.js @@ -1,5 +1,3 @@ -const SortedWindowHandler = require('../utils/SortedWindowHandler'); - module.exports = { '@tags': ['embedStream', 'login'], 'creates a new asset': (client) => { @@ -16,54 +14,8 @@ module.exports = { const {testData: {user}} = client.globals; const embedStream = client.page.embedStream(); - const embed = embedStream - .navigate() - .getEmbedSection(); - - const windowHandler = new SortedWindowHandler(client); - - embed - .waitForElementVisible('@signInButton') - .click('@signInButton'); - - // Wait for window to be created - // https://www.browserstack.com/automate/builds/1ceccf4efb4683b7feb890f45a32b5922b40ed3f/sessions/17b1a79682bef2498cb0be86eac317a08c976b0a#automate_button - client.pause(200); - - // Focusing on the Login PopUp - windowHandler.windowHandles((handles) => { - client.switchWindow(handles[1]); - }); - - const login = client.page.login(); - - login - .waitForElementVisible('@registerButton') - .click('@registerButton') - .setValue('@emailInput', user.email) - .setValue('@usernameInput', user.username) - .setValue('@passwordInput', user.password) - .setValue('@confirmPasswordInput', user.password) - .waitForElementVisible('@signUpButton') - .click('@signUpButton') - .waitForElementVisible('@signIn') - .waitForElementVisible('@loginButton') - .click('@loginButton'); - - // Give a tiny bit of time to let popup close. - client.pause(50); - - if (client.capabilities.browserName === 'MicrosoftEdge') { - - // More time for edge. - // https://www.browserstack.com/automate/builds/1ceccf4efb4683b7feb890f45a32b5922b40ed3f/sessions/7393dbfda8387e43b6d5851f359b0c07db414973 - client.pause(1000); - } - - // Focusing on the Embed Window - windowHandler.windowHandles((handles) => { - client.switchWindow(handles[0]); - }); + embedStream + .login(user); }, 'user posts a comment': (client) => { const embedStream = client.page.embedStream(); From d7a88cdc2a27adf7255a02aada2330300e8c8e36 Mon Sep 17 00:00:00 2001 From: Kim Gardner Date: Thu, 9 Nov 2017 11:18:58 +0000 Subject: [PATCH 18/42] Fix config key --- docs/_docs/02-02-advanced-configuration.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/_docs/02-02-advanced-configuration.md b/docs/_docs/02-02-advanced-configuration.md index 2f830a022..6c37aab12 100644 --- a/docs/_docs/02-02-advanced-configuration.md +++ b/docs/_docs/02-02-advanced-configuration.md @@ -369,7 +369,7 @@ Then all the routes for the API will be expecting to be hit on `/talk/`, such as can perform the path stripping when serving an upstream proxy, but some CDN's cannot. You would use this option in the latter situation. -## TALK_SMTP_FROM_EMAIL +## TALK_SMTP_FROM_ADDRESS The email address to send emails from using the SMTP provider in the format: From 247e05383e922e111d3d15959a6af1ddaaac02da Mon Sep 17 00:00:00 2001 From: Kim Gardner Date: Thu, 9 Nov 2017 11:23:48 +0000 Subject: [PATCH 19/42] One more fix --- docs/_docs/02-02-advanced-configuration.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/_docs/02-02-advanced-configuration.md b/docs/_docs/02-02-advanced-configuration.md index 6c37aab12..74099258d 100644 --- a/docs/_docs/02-02-advanced-configuration.md +++ b/docs/_docs/02-02-advanced-configuration.md @@ -374,7 +374,7 @@ cannot. You would use this option in the latter situation. The email address to send emails from using the SMTP provider in the format: ```plain -TALK_SMTP_FROM_EMAIL="The Coral Project" +TALK_SMTP_FROM_ADDRESS="The Coral Project" ``` Including the name and email address. From 63b6315435801fdf911e36ecd591aaace8f1712b Mon Sep 17 00:00:00 2001 From: Chi Vinh Le Date: Thu, 9 Nov 2017 17:50:47 +0100 Subject: [PATCH 20/42] Refactor #1 --- test/e2e/page_objects/admin.js | 9 +- test/e2e/page_objects/embedStream.js | 169 ++++++++++++--------------- test/e2e/page_objects/login.js | 28 +++++ test/e2e/specs/02_admin.js | 13 +-- test/e2e/specs/03_embedStream.js | 73 ++++-------- test/e2e/specs/04_userStatus.js | 83 +++---------- test/e2e/specs/05_banUser.js | 36 +++--- 7 files changed, 167 insertions(+), 244 deletions(-) diff --git a/test/e2e/page_objects/admin.js b/test/e2e/page_objects/admin.js index e83e7b7df..36baaa3cb 100644 --- a/test/e2e/page_objects/admin.js +++ b/test/e2e/page_objects/admin.js @@ -7,19 +7,14 @@ module.exports = { return this .waitForElementVisible('body'); }, - login(user = {}) { + login(user) { this - .navigate() .waitForElementVisible('@loginLayout') .waitForElementVisible('@signInForm') .setValue('@emailInput', user.email) .setValue('@passwordInput', user.password) .waitForElementVisible('@signInButton') - .click('@signInButton'); - - this.api.pause(3000); - - this + .click('@signInButton') .waitForElementVisible('@moderationContainer'); }, }], diff --git a/test/e2e/page_objects/embedStream.js b/test/e2e/page_objects/embedStream.js index e31d5d72e..5b649fecb 100644 --- a/test/e2e/page_objects/embedStream.js +++ b/test/e2e/page_objects/embedStream.js @@ -3,11 +3,28 @@ const SortedWindowHandler = require('../utils/SortedWindowHandler'); module.exports = { commands: [{ - navigateToAsset(asset) { + ready: function() { + this.switchToIframe(); + this.expect.section('@comments').to.be.present; + return this.section.comments; + }, + goToProfileSection: function() { + this.waitForElementVisible('@profileTabButton'); + this.click('@profileTabButton'); + this.expect.section('@profile').to.be.present; + return this.section.profile; + }, + goToCommentsSection: function() { + this.waitForElementVisible('@commentsTabButton'); + this.click('@commentsTabButton'); + this.expect.section('@comments').to.be.present; + return this.section.comments; + }, + navigateToAsset: function(asset) { this.api.url(`${this.api.launchUrl}/assets/title/${asset}`); return this; }, - getEmbedSection() { + switchToIframe: function() { this.waitForElementVisible('@iframe'); // Pause a bit to let iframe initialize in the hope that it'll @@ -15,98 +32,66 @@ module.exports = { this.api.pause(200); this.api.frame(iframeId); - this.expect.section('@embed').to.be.present; - return this.section.embed; + return this; }, - login(user = {}) { - const embed = this - .navigate() - .getEmbedSection(); - - const windowHandler = new SortedWindowHandler(this); - - embed - .waitForElementVisible('@signInButton') - .click('@signInButton'); - - // Wait for window to be created - // https://www.browserstack.com/automate/builds/1ceccf4efb4683b7feb890f45a32b5922b40ed3f/sessions/17b1a79682bef2498cb0be86eac317a08c976b0a#automate_button - this.api.pause(200); - - // Focusing on the Login PopUp - windowHandler.windowHandles((handles) => { - this.api.switchWindow(handles[1]); - }); - - const login = this.api.page.login(); - - login - .waitForElementVisible('@registerButton') - .click('@registerButton') - .setValue('@emailInput', user.email) - .setValue('@usernameInput', user.username) - .setValue('@passwordInput', user.password) - .setValue('@confirmPasswordInput', user.password) - .waitForElementVisible('@signUpButton') - .click('@signUpButton') - .waitForElementVisible('@signIn') - .waitForElementVisible('@loginButton') - .click('@loginButton'); - - // Give a tiny bit of time to let popup close. - this.api.pause(50); - - if (this.api.capabilities.browserName === 'MicrosoftEdge') { - - // More time for edge. - // https://www.browserstack.com/automate/builds/1ceccf4efb4683b7feb890f45a32b5922b40ed3f/sessions/7393dbfda8387e43b6d5851f359b0c07db414973 - this.api.pause(1000); - } - - // Focusing on the Embed Window - windowHandler.windowHandles((handles) => { - this.api.switchWindow(handles[0]); - }); - }, - logout() { - const embed = this - .navigate() - .getEmbedSection(); - - embed - .waitForElementVisible('@commentsTabButton') - .click('@commentsTabButton') - .waitForElementVisible('@logoutButton') - .click('@logoutButton'); - } }], url: function() { return this.api.launchUrl; }, elements: { iframe: `#${iframeId}`, + commentsTabButton: '.talk-embed-stream-comments-tab > button', + profileTabButton: '.talk-embed-stream-profile-tab > button', + banDialog: '.talk-ban-user-dialog', + banDialogConfirmButton: '.talk-ban-user-dialog-button-confirm', }, sections: { - embed: { + comments: { commands: [{ - getProfileSection() { - this.waitForElementVisible('@profileTabButton'); - this.click('@profileTabButton'); - this.expect.section('@profile').to.be.present; - return this.section.profile; + openLoginPopup(callback) { + const windowHandler = new SortedWindowHandler(this.api); + + this + .waitForElementVisible('@signInButton') + .click('@signInButton'); + + // Wait for window to be created + // https://www.browserstack.com/automate/builds/1ceccf4efb4683b7feb890f45a32b5922b40ed3f/sessions/17b1a79682bef2498cb0be86eac317a08c976b0a#automate_button + this.api.pause(200); + + // Focusing on the Login PopUp + windowHandler.windowHandles((handles) => { + this.api.switchWindow(handles[1]); + }); + + const login = this.api.page.login().ready(); + callback(login); + + // Give a tiny bit of time to let popup close. + this.api.pause(50); + + if (this.api.capabilities.browserName === 'MicrosoftEdge') { + + // More time for edge. + // https://www.browserstack.com/automate/builds/1ceccf4efb4683b7feb890f45a32b5922b40ed3f/sessions/7393dbfda8387e43b6d5851f359b0c07db414973 + this.api.pause(1000); + } + + // Focusing on the Embed Window + windowHandler.windowHandles((handles) => { + this.api.switchWindow(handles[0]); + this.api.page.embedStream().switchToIframe(); + }); }, - getCommentsSection() { - this.waitForElementVisible('@commentsTabButton'); - this.click('@commentsTabButton'); - this.expect.section('@comments').to.be.present; - return this.section.comments; + logout() { + this + .waitForElementVisible('@logoutButton') + .click('@logoutButton'); }, }], - selector: '#talk-embed-stream-container', + selector: '.talk-embed-stream-comments-tab-pane', elements: { logoutButton: '.talk-stream-userbox-logout', - commentsTabButton: '.talk-embed-stream-comments-tab > button', - profileTabButton: '.talk-embed-stream-profile-tab > button', signInButton: '#coralSignInButton', commentBoxTextarea: '#commentText', commentBoxPostButton: '.talk-plugin-commentbox-button', @@ -117,8 +102,6 @@ module.exports = { restrictedMessageBox: '.talk-restricted-message-box', suspendedAccountInput: '.talk-suspended-account-username-input', suspendedAccountSubmitButton: '.talk-suspended-account-submit-button', - banDialog: '.talk-ban-user-dialog', - banDialogConfirmButton: '.talk-ban-user-dialog-button-confirm', }, sections: { flag: { @@ -138,20 +121,16 @@ module.exports = { banButton: '.talk-plugin-moderation-actions-ban', }, }, - profile: { - selector: '.talk-embed-stream-profile-tab-pane', - elements: { - notLoggedIn: '.talk-embed-stream-not-logged-in', - myCommentHistory: '.talk-my-profile-comment-history', - myCommentHistoryReactions: '.talk-my-profile-comment-history .comment-summary .comment-summary-reactions', - myCommentHistoryReactionCount: '.talk-my-profile-comment-history .comment-summary .comment-summary-reactions .comment-summary-reaction-count', - myCommentHistoryComment: '.talk-my-profile-comment-history .my-comment-body', - }, - }, - comments: { - selector: '.talk-embed-stream-comments-tab-pane', - elements: {}, - }, + }, + }, + profile: { + selector: '.talk-embed-stream-profile-tab-pane', + elements: { + notLoggedIn: '.talk-embed-stream-not-logged-in', + myCommentHistory: '.talk-my-profile-comment-history', + myCommentHistoryReactions: '.talk-my-profile-comment-history .comment-summary .comment-summary-reactions', + myCommentHistoryReactionCount: '.talk-my-profile-comment-history .comment-summary .comment-summary-reactions .comment-summary-reaction-count', + myCommentHistoryComment: '.talk-my-profile-comment-history .my-comment-body', }, }, }, diff --git a/test/e2e/page_objects/login.js b/test/e2e/page_objects/login.js index 1abc40aa8..89b071e9a 100644 --- a/test/e2e/page_objects/login.js +++ b/test/e2e/page_objects/login.js @@ -1,4 +1,32 @@ module.exports = { + commands: [{ + ready() { + return this + .waitForElementVisible('body'); + }, + login(user) { + this + .setValue('@emailInput', user.email) + .setValue('@passwordInput', user.password) + .waitForElementVisible('@signIn') + .waitForElementVisible('@loginButton') + .click('@loginButton'); + }, + register(user) { + this + .waitForElementVisible('@registerButton') + .click('@registerButton') + .setValue('@emailInput', user.email) + .setValue('@usernameInput', user.username) + .setValue('@passwordInput', user.password) + .setValue('@confirmPasswordInput', user.password) + .waitForElementVisible('@signUpButton') + .click('@signUpButton') + .waitForElementVisible('@signIn') + .waitForElementVisible('@loginButton') + .click('@loginButton'); + }, + }], elements: { registerButton: '#coralRegister', signInButton: '#coralSignInButton', diff --git a/test/e2e/specs/02_admin.js b/test/e2e/specs/02_admin.js index 1f56ef2b8..4973f24ab 100644 --- a/test/e2e/specs/02_admin.js +++ b/test/e2e/specs/02_admin.js @@ -10,22 +10,14 @@ module.exports = { adminPage .navigate() - .waitForElementVisible('@loginLayout') - .waitForElementVisible('@signInForm') - .setValue('@emailInput', admin.email) - .setValue('@passwordInput', admin.password) - .waitForElementVisible('@signInButton') - .click('@signInButton'); - - adminPage - .waitForElementVisible('@moderationContainer'); + .ready() + .login(admin); }, 'Admin goes to Stories': (client) => { const adminPage = client.page.admin(); adminPage - .navigate() .waitForElementVisible('@drawerButton') .click('@drawerButton') .waitForElementVisible('@storiesDrawerNav') @@ -40,7 +32,6 @@ module.exports = { const adminPage = client.page.admin(); adminPage - .navigate() .waitForElementVisible('@drawerButton') .click('@drawerButton') .waitForElementVisible('@communityDrawerNav') diff --git a/test/e2e/specs/03_embedStream.js b/test/e2e/specs/03_embedStream.js index a12b9820f..f4c1b94b6 100644 --- a/test/e2e/specs/03_embedStream.js +++ b/test/e2e/specs/03_embedStream.js @@ -7,46 +7,43 @@ module.exports = { embedStream .navigateToAsset(asset) .assert.title(asset) - .getEmbedSection(); + .ready(); }, 'creates an user and user logs in': (client) => { const {testData: {user}} = client.globals; const embedStream = client.page.embedStream(); - embedStream - .login(user); + // Go back to default asset. + const comments = + embedStream + .navigate() + .ready(); + + comments + .openLoginPopup((login) => { + login.register(user); + }); }, 'user posts a comment': (client) => { - const embedStream = client.page.embedStream(); + const comments = client.page.embedStream().section.comments; const {testData: {comment}} = client.globals; - const embed = embedStream - .navigate() - .getEmbedSection(); - - embed + comments .waitForElementVisible('@commentBoxTextarea') .setValue('@commentBoxTextarea', comment.body) .waitForElementVisible('@commentBoxPostButton') .click('@commentBoxPostButton') .waitForElementVisible('@firstCommentContent') .getText('@firstCommentContent', (result) => { - embed.assert.equal(result.value, comment.body); + comments.assert.equal(result.value, comment.body); }); }, 'signed in user sees comment history': (client) => { - const embedStream = client.page.embedStream(); + const profile = client.page.embedStream().goToProfileSection(); const {testData: {comment}} = client.globals; - const embed = embedStream - .navigate() - .getEmbedSection(); - - const profile = embed - .getProfileSection(); - profile .waitForElementVisible('@myCommentHistory') .waitForElementVisible('@myCommentHistoryComment') @@ -55,14 +52,7 @@ module.exports = { }); }, 'user sees replies and reactions to comments': (client) => { - const embedStream = client.page.embedStream(); - - const embed = embedStream - .navigate() - .getEmbedSection(); - - const profile = embed - .getProfileSection(); + const profile = client.page.embedStream().section.profile; profile .waitForElementVisible('@myCommentHistory') @@ -74,17 +64,12 @@ module.exports = { }, 'user goes to the stream and replies and reacts to comment': (client) => { const embedStream = client.page.embedStream(); - - const embed = embedStream - .navigate() - .getEmbedSection(); - - embed + const comments = embedStream.goToCommentsSection(); + comments .waitForElementVisible('@respectButton') .click('@respectButton'); - const profile = embed - .getProfileSection(); + const profile = embedStream.goToProfileSection(); profile .waitForElementVisible('@myCommentHistory') @@ -96,26 +81,14 @@ module.exports = { }, 'user logs out': (client) => { const embedStream = client.page.embedStream(); + const comments = embedStream.goToCommentsSection(); - const embed = embedStream - .navigate() - .getEmbedSection(); - - embed - .waitForElementVisible('@commentsTabButton') - .click('@commentsTabButton') - .waitForElementVisible('@logoutButton') - .click('@logoutButton'); + comments + .logout(); }, 'not logged in user clicks my profile tab': (client) => { const embedStream = client.page.embedStream(); - - const embed = embedStream - .navigate() - .getEmbedSection(); - - const profile = embed - .getProfileSection(); + const profile = embedStream.goToProfileSection(); profile .assert.visible('@notLoggedIn'); diff --git a/test/e2e/specs/04_userStatus.js b/test/e2e/specs/04_userStatus.js index 46a87a2d1..eeb7be6fd 100644 --- a/test/e2e/specs/04_userStatus.js +++ b/test/e2e/specs/04_userStatus.js @@ -5,32 +5,22 @@ module.exports = { adminPage .navigate() - .waitForElementVisible('@loginLayout') - .waitForElementVisible('@signInForm') - .setValue('@emailInput', admin.email) - .setValue('@passwordInput', admin.password) - .waitForElementVisible('@signInButton') - .click('@signInButton'); - - client.pause(3000); - - adminPage - .waitForElementVisible('@moderationContainer'); + .ready() + .login(admin); }, 'admin flags user\'s username as offensive': (client) => { const embedStream = client.page.embedStream(); - const flagSection = client.page.embedStream().section.embed.section.flag; - const embed = embedStream + const comments = embedStream .navigate() - .getEmbedSection(); + .ready(); - embed + comments .waitForElementVisible('@firstComment') .waitForElementVisible('@flagButton') .click('@flagButton'); - flagSection + comments.section.flag .waitForElementVisible('@flagUsernameRadio') .click('@flagUsernameRadio') .waitForElementVisible('@continueButton') @@ -54,14 +44,14 @@ module.exports = { }, 'admin rejects the user flag': (client) => { const community = client.page.adminCommunity(); - + community .waitForElementVisible('@flaggedUserRejectButton') .click('@flaggedUserRejectButton'); }, 'admin suspends the user': (client) => { const community = client.page.adminCommunity(); - + community .waitForElementVisible('@usernameDialog') .waitForElementVisible('@usernameDialogButtons') @@ -84,56 +74,24 @@ module.exports = { const {testData: {user}} = client.globals; const embedStream = client.page.embedStream(); - const embed = embedStream + embedStream .navigate() - .getEmbedSection(); - - embed - .waitForElementVisible('@signInButton') - .click('@signInButton'); - - client.pause(3000); - - // Focusing on the Login PopUp - client.windowHandles((result) => { - const handle = result.value[1]; - client.switchWindow(handle); - }); - - const login = client.page.login(); - - login - .setValue('@emailInput', user.email) - .setValue('@passwordInput', user.password) - .waitForElementVisible('@signIn') - .waitForElementVisible('@loginButton') - .click('@loginButton'); - - // Focusing on the Embed Window - client.windowHandles((result) => { - const handle = result.value[0]; - client.switchWindow(handle); - }); + .ready() + .openLoginPopup((popup) => popup.login(user)); }, 'user account is suspended, should see restricted message box': (client) => { const embedStream = client.page.embedStream(); + const comments = embedStream.section.comments; - const embed = embedStream - .navigate() - .getEmbedSection(); - - embed + comments .waitForElementVisible('@restrictedMessageBox'); }, 'user picks another username': (client) => { - const {testData: {user}} = client.globals; const embedStream = client.page.embedStream(); - - const embed = embedStream - .navigate() - .getEmbedSection(); + const comments = embedStream.section.comments; + const {testData: {user}} = client.globals; - embed + comments .waitForElementVisible('@suspendedAccountInput') .setValue('@suspendedAccountInput', `${user.username}-alternative`) .waitForElementVisible('@suspendedAccountSubmitButton') @@ -141,16 +99,13 @@ module.exports = { }, 'user should not be able to comment': (client) => { const embedStream = client.page.embedStream(); - - const embed = embedStream - .navigate() - .getEmbedSection(); + const comments = embedStream.section.comments; - embed + comments .waitForElementNotPresent('@commentBoxTextarea') .waitForElementNotPresent('@commentBoxPostButton'); }, after: (client) => { - client.end(); + client.end(); } }; diff --git a/test/e2e/specs/05_banUser.js b/test/e2e/specs/05_banUser.js index 8e5e33cd0..9d20a5305 100644 --- a/test/e2e/specs/05_banUser.js +++ b/test/e2e/specs/05_banUser.js @@ -4,6 +4,8 @@ module.exports = { const {testData: {admin}} = client.globals; adminPage + .navigate() + .ready() .login(admin); }, 'navigate to the embed stream': (client) => { @@ -11,52 +13,50 @@ module.exports = { embedStream .navigate() - .getEmbedSection(); + .ready(); }, 'admin bans user': (client) => { - const embed = client.page.embedStream().section.embed; - const modSection = client.page.embedStream().section.embed.section.mod; + const embedStream = client.page.embedStream(); + const comments = embedStream.section.comments; - modSection + comments.section.mod .waitForElementVisible('@arrow') .click('@arrow') .waitForElementVisible('@menu') .waitForElementVisible('@banButton') .click('@banButton'); - embed + embedStream .waitForElementVisible('@banDialog') .waitForElementVisible('@banDialogConfirmButton') .click('@banDialogConfirmButton') .waitForElementNotVisible('@banDialog'); }, 'admin logs out': (client) => { - const embedStream = client.page.embedStream(); + const comments = client.page.embedStream().section.comments; - embedStream + comments .logout(); }, 'user logs in': (client) => { const {testData: {user}} = client.globals; - const embedStream = client.page.embedStream(); + const comments = client.page.embedStream().section.comments; - embedStream - .login(user); + comments + .openLoginPopup((popup) => popup.login(user)); }, 'user account is banned, should see restricted message box': (client) => { const embedStream = client.page.embedStream(); + const comments = embedStream.section.comments; - const embed = embedStream - .navigate() - .getEmbedSection(); - - embed + comments .waitForElementVisible('@restrictedMessageBox'); }, 'user logs out': (client) => { const embedStream = client.page.embedStream(); + const comments = embedStream.section.comments; - embedStream + comments .logout(); }, 'admin logs in (2)': (client) => { @@ -64,11 +64,13 @@ module.exports = { const {testData: {admin}} = client.globals; adminPage + .navigate() + .ready() .login(admin); }, 'admin goes to community': (client) => { const community = client.page.adminCommunity(); - + community .goToPeople(); }, From e885178dfc540b295dcb6c93ae2fefcb35b73a5d Mon Sep 17 00:00:00 2001 From: Chi Vinh Le Date: Thu, 9 Nov 2017 19:03:01 +0100 Subject: [PATCH 21/42] Refactor 2 --- .../Community/components/CommunityMenu.js | 4 +- test/e2e/page_objects/admin.js | 148 +++++++++++++++--- test/e2e/page_objects/adminCommunity.js | 39 ----- test/e2e/page_objects/embedStream.js | 6 +- test/e2e/page_objects/{login.js => popup.js} | 0 test/e2e/specs/02_admin.js | 26 +-- test/e2e/specs/03_embedStream.js | 4 +- test/e2e/specs/04_userStatus.js | 30 ++-- test/e2e/specs/05_banUser.js | 21 ++- 9 files changed, 170 insertions(+), 108 deletions(-) delete mode 100644 test/e2e/page_objects/adminCommunity.js rename test/e2e/page_objects/{login.js => popup.js} (100%) diff --git a/client/coral-admin/src/routes/Community/components/CommunityMenu.js b/client/coral-admin/src/routes/Community/components/CommunityMenu.js index 3e13617fe..251762b43 100644 --- a/client/coral-admin/src/routes/Community/components/CommunityMenu.js +++ b/client/coral-admin/src/routes/Community/components/CommunityMenu.js @@ -13,11 +13,11 @@ const CommunityMenu = ({flaggedUsernamesCount = 0}) => {
      - + {t('community.flaggedaccounts')} - + {t('community.people')}
      diff --git a/test/e2e/page_objects/admin.js b/test/e2e/page_objects/admin.js index 36baaa3cb..751bd7d94 100644 --- a/test/e2e/page_objects/admin.js +++ b/test/e2e/page_objects/admin.js @@ -7,33 +7,139 @@ module.exports = { return this .waitForElementVisible('body'); }, - login(user) { + openDrawer() { this - .waitForElementVisible('@loginLayout') - .waitForElementVisible('@signInForm') - .setValue('@emailInput', user.email) - .setValue('@passwordInput', user.password) - .waitForElementVisible('@signInButton') - .click('@signInButton') - .waitForElementVisible('@moderationContainer'); + .waitForElementVisible('@drawerButton') + .click('@drawerButton'); + this.expect.section('@drawer').to.be.present; + return this.section.drawer; + }, + goToStories() { + this + .click('@storiesNav') + .expect.section('@stories').to.be.present; + return this.section.stories; + }, + goToCommunity() { + this + .click('@communityNav') + .expect.section('@community').to.be.present; + return this.section.community; + }, + logout() { + this + .waitForElementVisible('@settingsButton') + .click('@settingsButton') + .waitForElementVisible('@signOutButton') + .click('@signOutButton'); }, }], elements: { - 'loginLayout': '.talk-admin-login', - 'signInForm': '.talk-admin-login-sign-in', - 'emailInput': '.talk-admin-login-sign-in #email', - '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', 'drawerButton': '.mdl-layout__drawer-button', 'drawerOverlay': 'div.mdl-layout__obfuscator.is-visible', + 'storiesNav': '.talk-admin-nav-stories', + 'communityNav': '.talk-admin-nav-community', 'settingsButton': '.talk-admin-header-settings-button', 'signOutButton': '.talk-admin-header-sign-out', - } + }, + sections: { + moderate: { + selector: '.talk-admin-moderation-container', + }, + stories: { + selector: '.talk-admin-stories', + }, + community: { + selector: '.talk-admin-community', + commands: [{ + url: function() { + return `${this.api.launchUrl}/admin/community`; + }, + ready() { + return this + .waitForElementVisible('body'); + }, + goToPeople() { + this + .click('@peopleNav') + .expect.section('@people').to.be.present; + return this.section.people; + }, + }], + elements: { + peopleNav: '.talk-admin-nav-people', + flaggedAccountsNav: '.talk-admin-nav-flagged-accounts', + flaggedAccountsContainer: '.talk-adnin-community-flagged-accounts', + flaggedUser:'.talk-admin-community-flagged-user', + flaggedUserApproveButton: '.talk-admin-flagged-user-approve-button', + flaggedUserRejectButton: '.talk-admin-flagged-user-reject-button', + usernameDialog: '.talk-reject-username-dialog', + usernameDialogButtons: '.talk-reject-username-dialog-buttons', + usernameDialogSuspend: '.talk-reject-username-dialog-button-k', + usernameDialogSuspensionMessage: '.talk-reject-username-dialog-suspension-message' + }, + sections: { + people: { + selector: '.talk-admin-community-people-container', + elements: { + firstRow: '.talk-admin-community-people-row:first-child', + dropdownStatus: '.talk-admin-community-people-dd-status', + dropdownRole: '.talk-admin-community-people-dd-role', + dropdownStatusActive: '.talk-admin-community-people-dd-status .dd-list-active', + optionActive: '.dd-option#ACTIVE', + optionBanned: '.dd-option#BANNED', + } + } + } + }, + drawer: { + selector: '.talk-admin-drawer-nav', + commands: [{ + goToStories() { + this + .click('@storiesButton'); + this.parent.expect.section('@stories').to.be.present; + this.close(); + return this.parent.section.stories; + }, + goToCommunity() { + this + .click('@communityButton'); + this.parent.expect.section('@community').to.be.present; + this.close(); + return this.parent.section.stories; + }, + close() { + this.parent + .click('@drawerOverlay'); + }, + }], + elements: { + 'storiesButton': '.talk-admin-drawer-nav .talk-admin-nav-stories', + 'communityButton': '.talk-admin-drawer-nav .talk-admin-nav-community', + }, + }, + login: { + commands: [{ + login(user) { + this + .waitForElementVisible('@signInForm') + .setValue('@emailInput', user.email) + .setValue('@passwordInput', user.password) + .waitForElementVisible('@signInButton') + .click('@signInButton'); + const adminPage = this.api.page.admin(); + adminPage.expect.section('@moderate').to.be.present; + return adminPage.section.moderate; + }, + }], + selector: '.talk-admin-login', + elements: { + 'signInForm': '.talk-admin-login-sign-in', + 'emailInput': '.talk-admin-login-sign-in #email', + 'passwordInput': '.talk-admin-login-sign-in #password', + 'signInButton': '.talk-admin-login-sign-in-button', + } + }, + }, }; diff --git a/test/e2e/page_objects/adminCommunity.js b/test/e2e/page_objects/adminCommunity.js deleted file mode 100644 index 0e063915a..000000000 --- a/test/e2e/page_objects/adminCommunity.js +++ /dev/null @@ -1,39 +0,0 @@ -module.exports = { - commands: [{ - url: function() { - return `${this.api.launchUrl}/admin/community`; - }, - ready() { - return this - .waitForElementVisible('body'); - }, - goToPeople() { - this - .navigate(`${this.url()}/people`); - }, - }], - elements: { - container: '.talk-admin-community', - flaggedAccountsContainer: '.talk-adnin-community-flagged-accounts', - flaggedUser:'.talk-admin-community-flagged-user', - flaggedUserApproveButton: '.talk-admin-flagged-user-approve-button', - flaggedUserRejectButton: '.talk-admin-flagged-user-reject-button', - usernameDialog: '.talk-reject-username-dialog', - usernameDialogButtons: '.talk-reject-username-dialog-buttons', - usernameDialogSuspend: '.talk-reject-username-dialog-button-k', - usernameDialogSuspensionMessage: '.talk-reject-username-dialog-suspension-message' - }, - sections: { - people: { - selector: '.talk-admin-community-people-container', - elements: { - firstRow: '.talk-admin-community-people-row:first-child', - dropdownStatus: '.talk-admin-community-people-dd-status', - dropdownRole: '.talk-admin-community-people-dd-role', - dropdownStatusActive: '.talk-admin-community-people-dd-status .dd-list-active', - optionActive: '.dd-option#ACTIVE', - optionBanned: '.dd-option#BANNED', - } - } - } -}; diff --git a/test/e2e/page_objects/embedStream.js b/test/e2e/page_objects/embedStream.js index 5b649fecb..2f32ac2ed 100644 --- a/test/e2e/page_objects/embedStream.js +++ b/test/e2e/page_objects/embedStream.js @@ -64,8 +64,8 @@ module.exports = { this.api.switchWindow(handles[1]); }); - const login = this.api.page.login().ready(); - callback(login); + const popup = this.api.page.popup().ready(); + callback(popup); // Give a tiny bit of time to let popup close. this.api.pause(50); @@ -80,7 +80,7 @@ module.exports = { // Focusing on the Embed Window windowHandler.windowHandles((handles) => { this.api.switchWindow(handles[0]); - this.api.page.embedStream().switchToIframe(); + this.parent.switchToIframe(); }); }, logout() { diff --git a/test/e2e/page_objects/login.js b/test/e2e/page_objects/popup.js similarity index 100% rename from test/e2e/page_objects/login.js rename to test/e2e/page_objects/popup.js diff --git a/test/e2e/specs/02_admin.js b/test/e2e/specs/02_admin.js index 4973f24ab..be35653de 100644 --- a/test/e2e/specs/02_admin.js +++ b/test/e2e/specs/02_admin.js @@ -8,37 +8,25 @@ module.exports = { const adminPage = client.page.admin(); const {testData: {admin}} = client.globals; - adminPage - .navigate() - .ready() - .login(admin); + adminPage.navigate(); + adminPage.expect.section('@login').to.be.present; + adminPage.section.login.login(admin); }, 'Admin goes to Stories': (client) => { const adminPage = client.page.admin(); adminPage - .waitForElementVisible('@drawerButton') - .click('@drawerButton') - .waitForElementVisible('@storiesDrawerNav') - .click('@storiesDrawerNav') - .waitForElementVisible('@drawerOverlay') - .click('@drawerOverlay') - .waitForElementVisible('@storiesSection'); - + .openDrawer() + .goToStories(); }, 'Admin goes to Community': (client) => { const adminPage = client.page.admin(); adminPage - .waitForElementVisible('@drawerButton') - .click('@drawerButton') - .waitForElementVisible('@communityDrawerNav') - .click('@communityDrawerNav') - .waitForElementVisible('@drawerOverlay') - .click('@drawerOverlay') - .waitForElementVisible('@communitySection'); + .openDrawer() + .goToCommunity(); }, after: (client) => { diff --git a/test/e2e/specs/03_embedStream.js b/test/e2e/specs/03_embedStream.js index f4c1b94b6..58ef88918 100644 --- a/test/e2e/specs/03_embedStream.js +++ b/test/e2e/specs/03_embedStream.js @@ -21,8 +21,8 @@ module.exports = { .ready(); comments - .openLoginPopup((login) => { - login.register(user); + .openLoginPopup((popup) => { + popup.register(user); }); }, 'user posts a comment': (client) => { diff --git a/test/e2e/specs/04_userStatus.js b/test/e2e/specs/04_userStatus.js index eeb7be6fd..7a8a8ab6a 100644 --- a/test/e2e/specs/04_userStatus.js +++ b/test/e2e/specs/04_userStatus.js @@ -1,11 +1,16 @@ module.exports = { + beforeEach: (client) => { + client.resizeWindow(1600, 1200); + }, 'admin logs in': (client) => { const adminPage = client.page.admin(); const {testData: {admin}} = client.globals; adminPage .navigate() - .ready() + .expect.section('@login').to.be.present; + + adminPage.section.login .login(admin); }, 'admin flags user\'s username as offensive': (client) => { @@ -32,25 +37,26 @@ module.exports = { .click('@continueButton'); }, 'admin goes to Reported Usernames': (client) => { - const community = client.page.adminCommunity(); + const adminPage = client.page.admin(); + + const community = adminPage + .navigate() + .ready() + .goToCommunity(); community - .navigate(); - - community - .waitForElementVisible('@container') .waitForElementVisible('@flaggedAccountsContainer') .waitForElementVisible('@flaggedUser'); }, 'admin rejects the user flag': (client) => { - const community = client.page.adminCommunity(); + const community = client.page.admin().section.community; community .waitForElementVisible('@flaggedUserRejectButton') .click('@flaggedUserRejectButton'); }, 'admin suspends the user': (client) => { - const community = client.page.adminCommunity(); + const community = client.page.admin().section.community; community .waitForElementVisible('@usernameDialog') @@ -62,13 +68,7 @@ module.exports = { .waitForElementNotPresent('@flaggedUser'); }, 'admin logs out': (client) => { - const admin = client.page.admin(); - - admin - .waitForElementVisible('@settingsButton') - .click('@settingsButton') - .waitForElementVisible('@signOutButton') - .click('@signOutButton'); + client.page.admin().logout(); }, 'user logs in': (client) => { const {testData: {user}} = client.globals; diff --git a/test/e2e/specs/05_banUser.js b/test/e2e/specs/05_banUser.js index 9d20a5305..4c6c63437 100644 --- a/test/e2e/specs/05_banUser.js +++ b/test/e2e/specs/05_banUser.js @@ -5,7 +5,9 @@ module.exports = { adminPage .navigate() - .ready() + .expect.section('@login').to.be.present; + + adminPage.section.login .login(admin); }, 'navigate to the embed stream': (client) => { @@ -65,19 +67,24 @@ module.exports = { adminPage .navigate() - .ready() + .expect.section('@login').to.be.present; + + adminPage.section.login .login(admin); }, 'admin goes to community': (client) => { - const community = client.page.adminCommunity(); + const adminPage = client.page.admin(); - community - .goToPeople(); + adminPage + .goToCommunity() + .goToPeople(); }, 'admin removes ban from user': (client) => { - const modSection = client.page.adminCommunity().section.people; + const people = client.page.admin() + .section.community + .section.people; - modSection + people .waitForElementVisible('@firstRow') .waitForElementVisible('@dropdownStatus') .click('@dropdownStatus') From da35f39baf76cc710814aa0ca7a9350a8abe4349 Mon Sep 17 00:00:00 2001 From: Chi Vinh Le Date: Thu, 9 Nov 2017 19:19:47 +0100 Subject: [PATCH 22/42] Set resolution --- nightwatch-browserstack.conf.js | 2 +- test/e2e/specs/01_install.js | 4 ++++ test/e2e/specs/02_admin.js | 3 ++- test/e2e/specs/03_embedStream.js | 5 +++++ test/e2e/specs/04_userStatus.js | 2 ++ test/e2e/specs/05_banUser.js | 5 +++++ 6 files changed, 19 insertions(+), 2 deletions(-) diff --git a/nightwatch-browserstack.conf.js b/nightwatch-browserstack.conf.js index d79f6917a..53f8acba4 100644 --- a/nightwatch-browserstack.conf.js +++ b/nightwatch-browserstack.conf.js @@ -26,7 +26,7 @@ const nightwatch_config = { // Disable this, as it makes bs slow and brittle. 'browserstack.networkLogs': false, - 'browserstack.resolution': '1600x1200', + 'resolution': '1600x1200', }, screenshots : { enabled: true, diff --git a/test/e2e/specs/01_install.js b/test/e2e/specs/01_install.js index 25c902e0f..05db7f259 100644 --- a/test/e2e/specs/01_install.js +++ b/test/e2e/specs/01_install.js @@ -1,6 +1,10 @@ module.exports = { '@tags': ['install'], + beforeEach: (client) => { + client.resizeWindow(1600, 1200); + }, + 'User goes to install': (client) => { const install = client.page.install(); diff --git a/test/e2e/specs/02_admin.js b/test/e2e/specs/02_admin.js index be35653de..a3560f55f 100644 --- a/test/e2e/specs/02_admin.js +++ b/test/e2e/specs/02_admin.js @@ -1,9 +1,10 @@ module.exports = { '@tags': ['admin', 'login'], - beforeEach: (client) => { + beforeEach: (client) => { client.resizeWindow(1024, 800); }, + 'Admin logs in': (client) => { const adminPage = client.page.admin(); const {testData: {admin}} = client.globals; diff --git a/test/e2e/specs/03_embedStream.js b/test/e2e/specs/03_embedStream.js index 58ef88918..a4123f457 100644 --- a/test/e2e/specs/03_embedStream.js +++ b/test/e2e/specs/03_embedStream.js @@ -1,5 +1,10 @@ module.exports = { '@tags': ['embedStream', 'login'], + + beforeEach: (client) => { + client.resizeWindow(1600, 1200); + }, + 'creates a new asset': (client) => { const asset = 'newAssetTest'; const embedStream = client.page.embedStream(); diff --git a/test/e2e/specs/04_userStatus.js b/test/e2e/specs/04_userStatus.js index 7a8a8ab6a..09bb6ff6a 100644 --- a/test/e2e/specs/04_userStatus.js +++ b/test/e2e/specs/04_userStatus.js @@ -1,7 +1,9 @@ module.exports = { + beforeEach: (client) => { client.resizeWindow(1600, 1200); }, + 'admin logs in': (client) => { const adminPage = client.page.admin(); const {testData: {admin}} = client.globals; diff --git a/test/e2e/specs/05_banUser.js b/test/e2e/specs/05_banUser.js index 4c6c63437..5268f0133 100644 --- a/test/e2e/specs/05_banUser.js +++ b/test/e2e/specs/05_banUser.js @@ -1,4 +1,9 @@ module.exports = { + + beforeEach: (client) => { + client.resizeWindow(1600, 1200); + }, + 'admin logs in': (client) => { const adminPage = client.page.admin(); const {testData: {admin}} = client.globals; From 53461df2878916a7cb73e4a99cff344e7fa74891 Mon Sep 17 00:00:00 2001 From: Chi Vinh Le Date: Thu, 9 Nov 2017 19:30:22 +0100 Subject: [PATCH 23/42] Increase wait for iframe time --- test/e2e/page_objects/embedStream.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/e2e/page_objects/embedStream.js b/test/e2e/page_objects/embedStream.js index 2f32ac2ed..011f9bce2 100644 --- a/test/e2e/page_objects/embedStream.js +++ b/test/e2e/page_objects/embedStream.js @@ -29,7 +29,7 @@ module.exports = { // Pause a bit to let iframe initialize in the hope that it'll // fix https://www.browserstack.com/automate/builds/96419cf46e3d6376a36ae6d3f90934112df1ed91/sessions/224f1a1566c1c8c7859e2e76ece51862200f0173#automate_button - this.api.pause(200); + this.api.pause(1000); this.api.frame(iframeId); return this; From 42a477ae4104315df81d2fb32d3218dc5a7a344d Mon Sep 17 00:00:00 2001 From: Chi Vinh Le Date: Thu, 9 Nov 2017 21:51:03 +0100 Subject: [PATCH 24/42] Fix firefox popup bug e2e --- test/e2e/page_objects/embedStream.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/test/e2e/page_objects/embedStream.js b/test/e2e/page_objects/embedStream.js index 011f9bce2..476b16e04 100644 --- a/test/e2e/page_objects/embedStream.js +++ b/test/e2e/page_objects/embedStream.js @@ -80,8 +80,16 @@ module.exports = { // Focusing on the Embed Window windowHandler.windowHandles((handles) => { this.api.switchWindow(handles[0]); - this.parent.switchToIframe(); + + // For some reasons firefox does not automatically load auth after login. + // https://www.browserstack.com/automate/builds/37650cb4e66c6edce0ba0800a1c1b7e7f74bf991/sessions/7a4e9da69b0f9ecdf8b7fa9150639e47b1532cb0#automate_button + if (this.api.capabilities.browserName === 'firefox') { + this.parent.navigate().ready(); + } else { + this.parent.switchToIframe(); + } }); + return this; }, logout() { this From ca7b7909620a78d68a56c7a683cac5c2660cf029 Mon Sep 17 00:00:00 2001 From: Chi Vinh Le Date: Thu, 9 Nov 2017 21:51:31 +0100 Subject: [PATCH 25/42] Return this --- test/e2e/page_objects/popup.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/e2e/page_objects/popup.js b/test/e2e/page_objects/popup.js index 89b071e9a..4d2aee7b6 100644 --- a/test/e2e/page_objects/popup.js +++ b/test/e2e/page_objects/popup.js @@ -5,7 +5,7 @@ module.exports = { .waitForElementVisible('body'); }, login(user) { - this + return this .setValue('@emailInput', user.email) .setValue('@passwordInput', user.password) .waitForElementVisible('@signIn') @@ -13,7 +13,7 @@ module.exports = { .click('@loginButton'); }, register(user) { - this + return this .waitForElementVisible('@registerButton') .click('@registerButton') .setValue('@emailInput', user.email) From b2929e9a8339f4a88692781efe21ac56a696eff0 Mon Sep 17 00:00:00 2001 From: Chi Vinh Le Date: Thu, 9 Nov 2017 21:51:41 +0100 Subject: [PATCH 26/42] Fail fast --- test/e2e/specs/01_install.js | 9 ++++++++- test/e2e/specs/02_admin.js | 9 ++++++++- test/e2e/specs/03_embedStream.js | 9 ++++++++- test/e2e/specs/04_userStatus.js | 9 ++++++++- test/e2e/specs/05_banUser.js | 9 ++++++++- 5 files changed, 40 insertions(+), 5 deletions(-) diff --git a/test/e2e/specs/01_install.js b/test/e2e/specs/01_install.js index 05db7f259..929fb5d45 100644 --- a/test/e2e/specs/01_install.js +++ b/test/e2e/specs/01_install.js @@ -1,10 +1,17 @@ module.exports = { '@tags': ['install'], - beforeEach: (client) => { + before: (client) => { client.resizeWindow(1600, 1200); }, + afterEach: (client, done) => { + if (client.currentTest.results.failed) { + throw new Error('Test Case failed, skipping all the rest'); + } + done(); + }, + 'User goes to install': (client) => { const install = client.page.install(); diff --git a/test/e2e/specs/02_admin.js b/test/e2e/specs/02_admin.js index a3560f55f..5751ea1b9 100644 --- a/test/e2e/specs/02_admin.js +++ b/test/e2e/specs/02_admin.js @@ -1,10 +1,17 @@ module.exports = { '@tags': ['admin', 'login'], - beforeEach: (client) => { + before: (client) => { client.resizeWindow(1024, 800); }, + afterEach: (client, done) => { + if (client.currentTest.results.failed) { + throw new Error('Test Case failed, skipping all the rest'); + } + done(); + }, + 'Admin logs in': (client) => { const adminPage = client.page.admin(); const {testData: {admin}} = client.globals; diff --git a/test/e2e/specs/03_embedStream.js b/test/e2e/specs/03_embedStream.js index a4123f457..e29e063cf 100644 --- a/test/e2e/specs/03_embedStream.js +++ b/test/e2e/specs/03_embedStream.js @@ -1,10 +1,17 @@ module.exports = { '@tags': ['embedStream', 'login'], - beforeEach: (client) => { + before: (client) => { client.resizeWindow(1600, 1200); }, + afterEach: (client, done) => { + if (client.currentTest.results.failed) { + throw new Error('Test Case failed, skipping all the rest'); + } + done(); + }, + 'creates a new asset': (client) => { const asset = 'newAssetTest'; const embedStream = client.page.embedStream(); diff --git a/test/e2e/specs/04_userStatus.js b/test/e2e/specs/04_userStatus.js index 09bb6ff6a..e2ae864f4 100644 --- a/test/e2e/specs/04_userStatus.js +++ b/test/e2e/specs/04_userStatus.js @@ -1,9 +1,16 @@ module.exports = { - beforeEach: (client) => { + before: (client) => { client.resizeWindow(1600, 1200); }, + afterEach: (client, done) => { + if (client.currentTest.results.failed) { + throw new Error('Test Case failed, skipping all the rest'); + } + done(); + }, + 'admin logs in': (client) => { const adminPage = client.page.admin(); const {testData: {admin}} = client.globals; diff --git a/test/e2e/specs/05_banUser.js b/test/e2e/specs/05_banUser.js index 5268f0133..a9715c4bb 100644 --- a/test/e2e/specs/05_banUser.js +++ b/test/e2e/specs/05_banUser.js @@ -1,9 +1,16 @@ module.exports = { - beforeEach: (client) => { + before: (client) => { client.resizeWindow(1600, 1200); }, + afterEach: (client, done) => { + if (client.currentTest.results.failed) { + throw new Error('Test Case failed, skipping all the rest'); + } + done(); + }, + 'admin logs in': (client) => { const adminPage = client.page.admin(); const {testData: {admin}} = client.globals; From f0839c57df9df955878d7525f33e18f1749b1459 Mon Sep 17 00:00:00 2001 From: Chi Vinh Le Date: Thu, 9 Nov 2017 21:52:08 +0100 Subject: [PATCH 27/42] Change to allowed name --- test/e2e/specs/04_userStatus.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/test/e2e/specs/04_userStatus.js b/test/e2e/specs/04_userStatus.js index e2ae864f4..e2234ec59 100644 --- a/test/e2e/specs/04_userStatus.js +++ b/test/e2e/specs/04_userStatus.js @@ -102,9 +102,10 @@ module.exports = { comments .waitForElementVisible('@suspendedAccountInput') - .setValue('@suspendedAccountInput', `${user.username}-alternative`) + .setValue('@suspendedAccountInput', `${user.username}_alternative`) .waitForElementVisible('@suspendedAccountSubmitButton') - .click('@suspendedAccountSubmitButton'); + .click('@suspendedAccountSubmitButton') + .waitForElementVisible('@suspendedAccountInput'); }, 'user should not be able to comment': (client) => { const embedStream = client.page.embedStream(); From 9abb3d30dacb18a3365b0ab1d927644e9f8bcfb6 Mon Sep 17 00:00:00 2001 From: Chi Vinh Le Date: Thu, 9 Nov 2017 22:04:32 +0100 Subject: [PATCH 28/42] e2e fixes --- test/e2e/specs/01_install.js | 7 ++++--- test/e2e/specs/02_admin.js | 8 ++++---- test/e2e/specs/03_embedStream.js | 7 ++++--- test/e2e/specs/04_userStatus.js | 9 +++++---- test/e2e/specs/05_banUser.js | 4 ++++ 5 files changed, 21 insertions(+), 14 deletions(-) diff --git a/test/e2e/specs/01_install.js b/test/e2e/specs/01_install.js index 929fb5d45..684ad7a30 100644 --- a/test/e2e/specs/01_install.js +++ b/test/e2e/specs/01_install.js @@ -12,6 +12,10 @@ module.exports = { done(); }, + after: (client) => { + client.end(); + }, + 'User goes to install': (client) => { const install = client.page.install(); @@ -86,7 +90,4 @@ module.exports = { install .expect.section('@step5').to.be.present; }, - after: (client) => { - client.end(); - } }; diff --git a/test/e2e/specs/02_admin.js b/test/e2e/specs/02_admin.js index 5751ea1b9..5c921eab9 100644 --- a/test/e2e/specs/02_admin.js +++ b/test/e2e/specs/02_admin.js @@ -12,6 +12,10 @@ module.exports = { done(); }, + after: (client) => { + client.end(); + }, + 'Admin logs in': (client) => { const adminPage = client.page.admin(); const {testData: {admin}} = client.globals; @@ -36,8 +40,4 @@ module.exports = { .openDrawer() .goToCommunity(); }, - - after: (client) => { - client.end(); - } }; diff --git a/test/e2e/specs/03_embedStream.js b/test/e2e/specs/03_embedStream.js index e29e063cf..567596dd2 100644 --- a/test/e2e/specs/03_embedStream.js +++ b/test/e2e/specs/03_embedStream.js @@ -12,6 +12,10 @@ module.exports = { done(); }, + after: (client) => { + client.end(); + }, + 'creates a new asset': (client) => { const asset = 'newAssetTest'; const embedStream = client.page.embedStream(); @@ -105,7 +109,4 @@ module.exports = { profile .assert.visible('@notLoggedIn'); }, - after: (client) => { - client.end(); - } }; diff --git a/test/e2e/specs/04_userStatus.js b/test/e2e/specs/04_userStatus.js index e2234ec59..33454f3b9 100644 --- a/test/e2e/specs/04_userStatus.js +++ b/test/e2e/specs/04_userStatus.js @@ -11,6 +11,10 @@ module.exports = { done(); }, + after: (client) => { + client.end(); + }, + 'admin logs in': (client) => { const adminPage = client.page.admin(); const {testData: {admin}} = client.globals; @@ -105,7 +109,7 @@ module.exports = { .setValue('@suspendedAccountInput', `${user.username}_alternative`) .waitForElementVisible('@suspendedAccountSubmitButton') .click('@suspendedAccountSubmitButton') - .waitForElementVisible('@suspendedAccountInput'); + .waitForElementNotPresent('@suspendedAccountInput'); }, 'user should not be able to comment': (client) => { const embedStream = client.page.embedStream(); @@ -115,7 +119,4 @@ module.exports = { .waitForElementNotPresent('@commentBoxTextarea') .waitForElementNotPresent('@commentBoxPostButton'); }, - after: (client) => { - client.end(); - } }; diff --git a/test/e2e/specs/05_banUser.js b/test/e2e/specs/05_banUser.js index a9715c4bb..029957a48 100644 --- a/test/e2e/specs/05_banUser.js +++ b/test/e2e/specs/05_banUser.js @@ -11,6 +11,10 @@ module.exports = { done(); }, + after: (client) => { + client.end(); + }, + 'admin logs in': (client) => { const adminPage = client.page.admin(); const {testData: {admin}} = client.globals; From 0b18bb06e7ae9f2b27ada18fe4a8e7f558b1d916 Mon Sep 17 00:00:00 2001 From: Chi Vinh Le Date: Thu, 9 Nov 2017 22:31:53 +0100 Subject: [PATCH 29/42] More tests --- test/e2e/specs/05_banUser.js | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/test/e2e/specs/05_banUser.js b/test/e2e/specs/05_banUser.js index 029957a48..3eaf7f5e3 100644 --- a/test/e2e/specs/05_banUser.js +++ b/test/e2e/specs/05_banUser.js @@ -107,4 +107,29 @@ module.exports = { .waitForElementVisible('@dropdownStatusActive') .click('@optionActive'); }, + 'admin logs out 2': (client) => { + client.page.admin().logout(); + }, + 'navigate to the embed stream 2': (client) => { + const embedStream = client.page.embedStream(); + + embedStream + .navigate() + .ready(); + }, + 'user logs in 2': (client) => { + const {testData: {user}} = client.globals; + const comments = client.page.embedStream().section.comments; + + comments + .openLoginPopup((popup) => popup.login(user)); + }, + 'user should be able to comment': (client) => { + const embedStream = client.page.embedStream(); + const comments = embedStream.section.comments; + + comments + .waitForElementPresent('@commentBoxTextarea') + .waitForElementPresent('@commentBoxPostButton'); + }, }; From 31ee8139b6368f2e96d49ec641609743b6a589db Mon Sep 17 00:00:00 2001 From: Chi Vinh Le Date: Thu, 9 Nov 2017 23:32:03 +0100 Subject: [PATCH 30/42] Use visible were suitable and wait for drawer to dissappear --- test/e2e/page_objects/admin.js | 17 +++++++++-------- test/e2e/page_objects/embedStream.js | 6 +++--- test/e2e/specs/01_install.js | 10 +++++----- test/e2e/specs/02_admin.js | 2 +- test/e2e/specs/04_userStatus.js | 2 +- test/e2e/specs/05_banUser.js | 8 ++++---- 6 files changed, 23 insertions(+), 22 deletions(-) diff --git a/test/e2e/page_objects/admin.js b/test/e2e/page_objects/admin.js index 751bd7d94..a549df672 100644 --- a/test/e2e/page_objects/admin.js +++ b/test/e2e/page_objects/admin.js @@ -11,19 +11,19 @@ module.exports = { this .waitForElementVisible('@drawerButton') .click('@drawerButton'); - this.expect.section('@drawer').to.be.present; + this.expect.section('@drawer').to.be.visible; return this.section.drawer; }, goToStories() { this .click('@storiesNav') - .expect.section('@stories').to.be.present; + .expect.section('@stories').to.be.visible; return this.section.stories; }, goToCommunity() { this .click('@communityNav') - .expect.section('@community').to.be.present; + .expect.section('@community').to.be.visible; return this.section.community; }, logout() { @@ -62,7 +62,7 @@ module.exports = { goToPeople() { this .click('@peopleNav') - .expect.section('@people').to.be.present; + .expect.section('@people').to.be.visible; return this.section.people; }, }], @@ -98,20 +98,21 @@ module.exports = { goToStories() { this .click('@storiesButton'); - this.parent.expect.section('@stories').to.be.present; + this.parent.expect.section('@stories').to.be.visible; this.close(); return this.parent.section.stories; }, goToCommunity() { this .click('@communityButton'); - this.parent.expect.section('@community').to.be.present; + this.parent.expect.section('@community').to.be.visible; this.close(); return this.parent.section.stories; }, close() { this.parent - .click('@drawerOverlay'); + .click('@drawerOverlay') + .waitForElementNotPresent('@drawerOverlay'); }, }], elements: { @@ -129,7 +130,7 @@ module.exports = { .waitForElementVisible('@signInButton') .click('@signInButton'); const adminPage = this.api.page.admin(); - adminPage.expect.section('@moderate').to.be.present; + adminPage.expect.section('@moderate').to.be.visible; return adminPage.section.moderate; }, }], diff --git a/test/e2e/page_objects/embedStream.js b/test/e2e/page_objects/embedStream.js index 476b16e04..ccf7a8522 100644 --- a/test/e2e/page_objects/embedStream.js +++ b/test/e2e/page_objects/embedStream.js @@ -5,19 +5,19 @@ module.exports = { commands: [{ ready: function() { this.switchToIframe(); - this.expect.section('@comments').to.be.present; + this.expect.section('@comments').to.be.visible; return this.section.comments; }, goToProfileSection: function() { this.waitForElementVisible('@profileTabButton'); this.click('@profileTabButton'); - this.expect.section('@profile').to.be.present; + this.expect.section('@profile').to.be.visible; return this.section.profile; }, goToCommentsSection: function() { this.waitForElementVisible('@commentsTabButton'); this.click('@commentsTabButton'); - this.expect.section('@comments').to.be.present; + this.expect.section('@comments').to.be.visible; return this.section.comments; }, navigateToAsset: function(asset) { diff --git a/test/e2e/specs/01_install.js b/test/e2e/specs/01_install.js index 684ad7a30..078a22e50 100644 --- a/test/e2e/specs/01_install.js +++ b/test/e2e/specs/01_install.js @@ -21,7 +21,7 @@ module.exports = { install .navigate() - .expect.section('@step1').to.be.present; + .expect.section('@step1').to.be.visible; }, 'User clicks get started button': (client) => { @@ -35,7 +35,7 @@ module.exports = { const install = client.page.install(); install - .expect.section('@step2').to.be.present; + .expect.section('@step2').to.be.visible; }, 'User fills step 2': (client) => { const step2 = client.page.install().section.step2; @@ -51,7 +51,7 @@ module.exports = { const install = client.page.install(); install - .expect.section('@step3').to.be.present; + .expect.section('@step3').to.be.visible; }, 'User fills step 3': (client) => { const step3 = client.page.install().section.step3; @@ -69,7 +69,7 @@ module.exports = { const install = client.page.install(); install - .expect.section('@step4').to.be.present; + .expect.section('@step4').to.be.visible; }, 'User fills step 4': (client) => { const step4 = client.page.install().section.step4; @@ -88,6 +88,6 @@ module.exports = { const install = client.page.install(); install - .expect.section('@step5').to.be.present; + .expect.section('@step5').to.be.visible; }, }; diff --git a/test/e2e/specs/02_admin.js b/test/e2e/specs/02_admin.js index 5c921eab9..90b14934d 100644 --- a/test/e2e/specs/02_admin.js +++ b/test/e2e/specs/02_admin.js @@ -21,7 +21,7 @@ module.exports = { const {testData: {admin}} = client.globals; adminPage.navigate(); - adminPage.expect.section('@login').to.be.present; + adminPage.expect.section('@login').to.be.visible; adminPage.section.login.login(admin); }, diff --git a/test/e2e/specs/04_userStatus.js b/test/e2e/specs/04_userStatus.js index 33454f3b9..ce28a1e4d 100644 --- a/test/e2e/specs/04_userStatus.js +++ b/test/e2e/specs/04_userStatus.js @@ -21,7 +21,7 @@ module.exports = { adminPage .navigate() - .expect.section('@login').to.be.present; + .expect.section('@login').to.be.visible; adminPage.section.login .login(admin); diff --git a/test/e2e/specs/05_banUser.js b/test/e2e/specs/05_banUser.js index 3eaf7f5e3..512e2deed 100644 --- a/test/e2e/specs/05_banUser.js +++ b/test/e2e/specs/05_banUser.js @@ -21,7 +21,7 @@ module.exports = { adminPage .navigate() - .expect.section('@login').to.be.present; + .expect.section('@login').to.be.visible; adminPage.section.login .login(admin); @@ -83,7 +83,7 @@ module.exports = { adminPage .navigate() - .expect.section('@login').to.be.present; + .expect.section('@login').to.be.visible; adminPage.section.login .login(admin); @@ -129,7 +129,7 @@ module.exports = { const comments = embedStream.section.comments; comments - .waitForElementPresent('@commentBoxTextarea') - .waitForElementPresent('@commentBoxPostButton'); + .waitForElementVisible('@commentBoxTextarea') + .waitForElementVisible('@commentBoxPostButton'); }, }; From bcf83703597cdefb041ef1cb893b241360600da3 Mon Sep 17 00:00:00 2001 From: Chi Vinh Le Date: Fri, 10 Nov 2017 10:04:22 +0100 Subject: [PATCH 31/42] Temporarily enable bs testing on this branch --- scripts/e2e-ci.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/e2e-ci.sh b/scripts/e2e-ci.sh index e72d1a6ce..ffd17da40 100755 --- a/scripts/e2e-ci.sh +++ b/scripts/e2e-ci.sh @@ -1,7 +1,7 @@ #!/bin/bash CIRCLE_TEST_REPORTS=${CIRCLE_TEST_REPORTS:-./test/e2e/reports} -CIRCLE_BRANCH=${CIRCLE_BRANCH:-master} +CIRCLE_BRANCH=${CIRCLE_BRANCH_XX:-master} # Amount of retries before failure. E2E_MAX_RETRIES=${E2E_MAX_RETRIES:-1} From dd1fbf30ca37bbe6200c42be6aaceda58dae6897 Mon Sep 17 00:00:00 2001 From: Chi Vinh Le Date: Fri, 10 Nov 2017 10:51:30 +0100 Subject: [PATCH 32/42] Add navigateAndLogin --- test/e2e/page_objects/admin.js | 7 +++++++ test/e2e/specs/02_admin.js | 4 +--- test/e2e/specs/04_userStatus.js | 7 +------ test/e2e/specs/05_banUser.js | 14 ++------------ 4 files changed, 11 insertions(+), 21 deletions(-) diff --git a/test/e2e/page_objects/admin.js b/test/e2e/page_objects/admin.js index a549df672..b73c1f0e1 100644 --- a/test/e2e/page_objects/admin.js +++ b/test/e2e/page_objects/admin.js @@ -33,6 +33,12 @@ module.exports = { .waitForElementVisible('@signOutButton') .click('@signOutButton'); }, + navigateAndLogin(user) { + this + .navigate() + .expect.section('@login').to.be.visible; + return this.section.login.login(user); + }, }], elements: { 'drawerButton': '.mdl-layout__drawer-button', @@ -113,6 +119,7 @@ module.exports = { this.parent .click('@drawerOverlay') .waitForElementNotPresent('@drawerOverlay'); + return this.parent; }, }], elements: { diff --git a/test/e2e/specs/02_admin.js b/test/e2e/specs/02_admin.js index 90b14934d..29957e487 100644 --- a/test/e2e/specs/02_admin.js +++ b/test/e2e/specs/02_admin.js @@ -20,9 +20,7 @@ module.exports = { const adminPage = client.page.admin(); const {testData: {admin}} = client.globals; - adminPage.navigate(); - adminPage.expect.section('@login').to.be.visible; - adminPage.section.login.login(admin); + adminPage.navigateAndLogin(admin); }, 'Admin goes to Stories': (client) => { diff --git a/test/e2e/specs/04_userStatus.js b/test/e2e/specs/04_userStatus.js index ce28a1e4d..5a7593e53 100644 --- a/test/e2e/specs/04_userStatus.js +++ b/test/e2e/specs/04_userStatus.js @@ -19,12 +19,7 @@ module.exports = { const adminPage = client.page.admin(); const {testData: {admin}} = client.globals; - adminPage - .navigate() - .expect.section('@login').to.be.visible; - - adminPage.section.login - .login(admin); + adminPage.navigateAndLogin(admin); }, 'admin flags user\'s username as offensive': (client) => { const embedStream = client.page.embedStream(); diff --git a/test/e2e/specs/05_banUser.js b/test/e2e/specs/05_banUser.js index 512e2deed..da0d11e7a 100644 --- a/test/e2e/specs/05_banUser.js +++ b/test/e2e/specs/05_banUser.js @@ -19,12 +19,7 @@ module.exports = { const adminPage = client.page.admin(); const {testData: {admin}} = client.globals; - adminPage - .navigate() - .expect.section('@login').to.be.visible; - - adminPage.section.login - .login(admin); + adminPage.navigateAndLogin(admin); }, 'navigate to the embed stream': (client) => { const embedStream = client.page.embedStream(); @@ -81,12 +76,7 @@ module.exports = { const adminPage = client.page.admin(); const {testData: {admin}} = client.globals; - adminPage - .navigate() - .expect.section('@login').to.be.visible; - - adminPage.section.login - .login(admin); + adminPage.navigateAndLogin(admin); }, 'admin goes to community': (client) => { const adminPage = client.page.admin(); From 933903de2fe394e28a8ffb148d634326241eab1c Mon Sep 17 00:00:00 2001 From: Chi Vinh Le Date: Fri, 10 Nov 2017 14:05:43 +0100 Subject: [PATCH 33/42] Remove IE 64bit from ci until they fix the keyboard input issues --- scripts/e2e-ci.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/e2e-ci.sh b/scripts/e2e-ci.sh index b6f933528..a828073d9 100755 --- a/scripts/e2e-ci.sh +++ b/scripts/e2e-ci.sh @@ -7,7 +7,8 @@ CIRCLE_BRANCH=${CIRCLE_BRANCH_XX:-master} E2E_MAX_RETRIES=${E2E_MAX_RETRIES:-1} # Safari >= 8 has issues connecting to browserstack-local. Safari < 8 is too old. -BROWSERS="chrome,firefox,ie,edge" #safari +# IE 64bit has issues with receiving keyboard input. Let's wait for them to fix it. +BROWSERS="chrome,firefox,edge" #ie safari if [[ "${CIRCLE_BRANCH}" == "master" && -n "$BROWSERSTACK_KEY" ]]; then echo Testing on browserstack From b0573749ee9ec36960f5b8dde8125f861d342359 Mon Sep 17 00:00:00 2001 From: Belen Curcio Date: Fri, 10 Nov 2017 10:26:34 -0300 Subject: [PATCH 34/42] Adding classes and missingproptypes --- client/coral-admin/src/components/ActionsMenu.js | 4 +++- client/coral-admin/src/components/ActionsMenuItem.js | 6 ++++-- client/coral-admin/src/components/SuspendUserDialog.js | 7 ++++--- client/coral-admin/src/containers/SuspendUserDialog.js | 7 +++++++ .../src/routes/Moderation/components/Comment.js | 4 ++-- 5 files changed, 20 insertions(+), 8 deletions(-) diff --git a/client/coral-admin/src/components/ActionsMenu.js b/client/coral-admin/src/components/ActionsMenu.js index 25aee1fbc..6351afda7 100644 --- a/client/coral-admin/src/components/ActionsMenu.js +++ b/client/coral-admin/src/components/ActionsMenu.js @@ -32,8 +32,9 @@ class ActionsMenu extends React.Component { }; render() { + const {className = ''} = this.props; return ( -
      +
      -
      @@ -120,7 +121,7 @@ class SuspendUserDialog extends React.Component {