From dc3cc608d06d6aa27505a3699902dc151d49986f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ciar=C3=A1n?= Date: Tue, 11 Jul 2023 19:34:38 +1000 Subject: [PATCH 01/11] Add wdio mocha framework --- jsconfig.json | 22 ++++++++++++++++++++++ package.json | 1 + 2 files changed, 23 insertions(+) create mode 100644 jsconfig.json diff --git a/jsconfig.json b/jsconfig.json new file mode 100644 index 000000000..783186cca --- /dev/null +++ b/jsconfig.json @@ -0,0 +1,22 @@ +{ + "compilerOptions": { + "checkJs": true, + "allowJs": true, + "jsx": "react", + "baseUrl": ".", + "paths": { + "/*": [ + "./*" + ] + } + }, + "typeAcquisition": { + "include": [ + "meteor" + ] + }, + "exclude": [ + "node_modules", + ".meteor" + ] +} \ No newline at end of file diff --git a/package.json b/package.json index ec8dc64e6..995bcef23 100644 --- a/package.json +++ b/package.json @@ -88,6 +88,7 @@ "@wdio/allure-reporter": "^8.11.0", "@wdio/cli": "^8.11.2", "@wdio/local-runner": "^8.11.2", + "@wdio/mocha-framework": "^8.12.1", "@wdio/spec-reporter": "^8.11.2", "@wdio/sync": "^7.27.0", "chai": "^4.1.2", From 10e87b0e47cf3fb1f2444c363f89835c6fa258ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ciar=C3=A1n?= Date: Wed, 12 Jul 2023 13:50:08 +1000 Subject: [PATCH 02/11] replace mocha.opts --- tests/end2end/.mocharc.js | 5 +++++ tests/end2end/mocha.opts | 1 - 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 tests/end2end/.mocharc.js delete mode 100644 tests/end2end/mocha.opts diff --git a/tests/end2end/.mocharc.js b/tests/end2end/.mocharc.js new file mode 100644 index 000000000..443a33ade --- /dev/null +++ b/tests/end2end/.mocharc.js @@ -0,0 +1,5 @@ +"use strict"; + +module.exports = { + sort: true, +}; diff --git a/tests/end2end/mocha.opts b/tests/end2end/mocha.opts deleted file mode 100644 index 8c0a3f4d3..000000000 --- a/tests/end2end/mocha.opts +++ /dev/null @@ -1 +0,0 @@ ---sort From 4fcf4a0d737bd2b18219ae9df8b79008adc1e021 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ciar=C3=A1n?= Date: Wed, 12 Jul 2023 16:58:24 +1000 Subject: [PATCH 03/11] Config updates --- babel.config.json | 24 ++++++++---------------- wdio.conf.js | 2 -- 2 files changed, 8 insertions(+), 18 deletions(-) diff --git a/babel.config.json b/babel.config.json index 5aaae5982..e4396bfc8 100644 --- a/babel.config.json +++ b/babel.config.json @@ -1,17 +1,9 @@ -{ - "presets": [ - [ - "@babel/env", - { - "targets": { - "edge": "17", - "firefox": "60", - "chrome": "67", - "safari": "11.1" - }, - "useBuiltIns": "usage", - "corejs": "3.6.5" - } - ] +module.exports = { + presets: [ + ['@babel/preset-env', { + targets: { + node: '14' + } + }] ] -} +} \ No newline at end of file diff --git a/wdio.conf.js b/wdio.conf.js index 6d3a8b861..e523b1806 100644 --- a/wdio.conf.js +++ b/wdio.conf.js @@ -150,8 +150,6 @@ exports.config = { // Options to be passed to Mocha. // See the full list at http://mochajs.org/ mochaOpts: { - // This still uses the old babel? but the compilers flag has been deprecated, so I think this can be removed? - // compilers: ['js:babel-register'], ui: 'bdd', timeout: 60000, fullTrace: true, From 6556de969925b72015e6c0059e158fe43e81ddda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ciar=C3=A1n?= Date: Wed, 12 Jul 2023 17:38:50 +1000 Subject: [PATCH 04/11] various package updates --- package.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 995bcef23..f18b3b226 100644 --- a/package.json +++ b/package.json @@ -96,18 +96,18 @@ "ddp": "^0.9.4", "eslint": "^8.28.0", "faker": "^4.1.0", - "inject-loader": "^4.0.1", "js-yaml": "^3.13.1", "markdownlint-cli": "^0.32.2", "mocha": "^10.2.0", "mock-meteor-universe-i18n": "^0.2.1", "npm-license-crawler": "^0.1.5", "proxyquire": "^1.8.0", - "sinon": "^4.1.6", - "sinon-chai": "^2.14.0", + "sinon": "^15.2.0", + "sinon-chai": "^3.7.0", "tree-kill": "^1.2.0", "wdio-chromedriver-service": "^8.1.1", "webdriverio": "^8.11.2", + "webpack": "5.88.1", "xtend": "^4.0.1" } } From affac638498f310da42baf5e1dffa8d9a21c7403 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ciar=C3=A1n?= Date: Wed, 12 Jul 2023 17:53:32 +1000 Subject: [PATCH 05/11] Config + package updates --- babel.config.json | 10 ++-------- package.json | 4 ++-- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/babel.config.json b/babel.config.json index e4396bfc8..8aa924d7c 100644 --- a/babel.config.json +++ b/babel.config.json @@ -1,9 +1,3 @@ -module.exports = { - presets: [ - ['@babel/preset-env', { - targets: { - node: '14' - } - }] - ] +{ + "presets": ["@babel/preset-env"] } \ No newline at end of file diff --git a/package.json b/package.json index f18b3b226..9219ffeca 100644 --- a/package.json +++ b/package.json @@ -71,10 +71,10 @@ "mongodb": "^3.0.1", "node-cron": "^1.2.1", "node-getopt": "^0.2.3", - "node-sass": "6.0.1", + "node-sass": "^8.0.0", "path": "^0.12.7", "randomstring": "^1.1.5", - "semver": "^5.5.0", + "semver": "^5.7.2", "underscore": "^1.8.3" }, "devDependencies": { From cfa55c759d43bd4acf402c4856a39680c4c7d3d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ciar=C3=A1n?= Date: Wed, 12 Jul 2023 18:17:07 +1000 Subject: [PATCH 06/11] Replace deprecated sinon call --- .../finalize-minutes/finalizer.test.js | 50 +++++++++---------- .../imports/services/minutesFinder.test.js | 2 +- .../server/migrations/migrate_v18.test.js | 10 ++-- .../server/migrations/migrate_v21.test.js | 10 ++-- 4 files changed, 36 insertions(+), 36 deletions(-) diff --git a/tests/unit/imports/services/finalize-minutes/finalizer.test.js b/tests/unit/imports/services/finalize-minutes/finalizer.test.js index 1fc5f1f9b..4f1b48e6d 100644 --- a/tests/unit/imports/services/finalize-minutes/finalizer.test.js +++ b/tests/unit/imports/services/finalize-minutes/finalizer.test.js @@ -162,16 +162,16 @@ describe('workflow.finalizeMinute', function () { afterEach(function () { Meteor.isClient = true; - Minutes.reset(); - MinutesFinder.lastMinutesOfMeetingSeries.reset(); - MinutesSchema.update.reset(); - UserRoles.reset(); - Meteor.userId.reset(); - Meteor.user.reset(); + Minutes.resetHistory(); + MinutesFinder.lastMinutesOfMeetingSeries.resetHistory(); + MinutesSchema.update.resetHistory(); + UserRoles.resetHistory(); + Meteor.userId.resetHistory(); + Meteor.user.resetHistory(); }); it('throws an exception if the user is not logged in', function () { - Meteor.userId.reset(); + Meteor.userId.resetHistory(); Meteor.userId.returns(); try { @@ -185,7 +185,7 @@ describe('workflow.finalizeMinute', function () { }); it('throws an exception if the user is not authorized', function () { - UserRoles.reset(); + UserRoles.resetHistory(); UserRoles.returns({isModeratorOf: sinon.stub().returns(false)}); try { @@ -248,7 +248,7 @@ describe('workflow.finalizeMinute', function () { finalizeMeteorMethod(minutes._id, false, true); - FinalizeMailHandler.reset(); + FinalizeMailHandler.resetHistory(); sinon.assert.calledOnce(mailHandlerInstance.sendMails); sinon.assert.calledWith(mailHandlerInstance.sendMails, false, true); @@ -311,15 +311,15 @@ describe('workflow.unfinalizeMinute', function () { afterEach(function () { Meteor.isClient = true; - Minutes.reset(); - MinutesFinder.lastMinutesOfMeetingSeries.reset(); - MinutesFinder.secondLastMinutesOfMeetingSeries.reset(); - MinutesSchema.update.reset(); - MinutesSchema.findOne.reset(); - MeetingSeriesSchema.findOne.reset(); - UserRoles.reset(); - Meteor.userId.reset(); - Meteor.user.reset(); + Minutes.resetHistory(); + MinutesFinder.lastMinutesOfMeetingSeries.resetHistory(); + MinutesFinder.secondLastMinutesOfMeetingSeries.resetHistory(); + MinutesSchema.update.resetHistory(); + MinutesSchema.findOne.resetHistory(); + MeetingSeriesSchema.findOne.resetHistory(); + UserRoles.resetHistory(); + Meteor.userId.resetHistory(); + Meteor.user.resetHistory(); }); it('sets isFinalized to false', function () { @@ -341,7 +341,7 @@ describe('workflow.unfinalizeMinute', function () { }); it('throws an exception if the user is not logged in', function () { - Meteor.userId.reset(); + Meteor.userId.resetHistory(); Meteor.userId.returns(); try { @@ -355,7 +355,7 @@ describe('workflow.unfinalizeMinute', function () { }); it('throws an exception if the user is not authorized', function () { - UserRoles.reset(); + UserRoles.resetHistory(); UserRoles.returns({isModeratorOf: sinon.stub().returns(false)}); try { @@ -386,7 +386,7 @@ describe('Finalizer', function () { afterEach(function () { Meteor.call.resetHistory(); - Minutes.reset(); + Minutes.resetHistory(); }); describe('#finalize', function () { @@ -438,7 +438,7 @@ describe('Finalizer', function () { }); afterEach(function () { - MinutesSchema.findOne.reset(); + MinutesSchema.findOne.resetHistory(); }); it('returns that the minutes was never finalized if it was never finalized', function () { @@ -514,9 +514,9 @@ describe('Finalizer', function () { }); afterEach(function () { - MinutesSchema.findOne.reset(); - MeetingSeriesSchema.findOne.reset(); - MinutesFinder.lastMinutesOfMeetingSeries.reset(); + MinutesSchema.findOne.resetHistory(); + MeetingSeriesSchema.findOne.resetHistory(); + MinutesFinder.lastMinutesOfMeetingSeries.resetHistory(); }); it('returns true if the given minutes id belongs to the last minutes in the series', function () { diff --git a/tests/unit/imports/services/minutesFinder.test.js b/tests/unit/imports/services/minutesFinder.test.js index 82926f921..82b80de53 100644 --- a/tests/unit/imports/services/minutesFinder.test.js +++ b/tests/unit/imports/services/minutesFinder.test.js @@ -21,7 +21,7 @@ const clear = function (obj) { const clearAll = function () { clear(MinutesSchema); - Minutes.reset(); + Minutes.resetHistory(); }; describe('MinutesFinder', function() { diff --git a/tests/unit/server/migrations/migrate_v18.test.js b/tests/unit/server/migrations/migrate_v18.test.js index 9cf12949e..c3a2dfe30 100644 --- a/tests/unit/server/migrations/migrate_v18.test.js +++ b/tests/unit/server/migrations/migrate_v18.test.js @@ -85,11 +85,11 @@ describe('Migrate Version 18', function () { }); afterEach(function () { - MinutesSchema.find.reset(); - MinutesSchema.update.reset(); - TopicSchema.update.reset(); - MinutesFinder.firstMinutesOfMeetingSeries.reset(); - MinutesFinder.nextMinutes.reset(); + MinutesSchema.find.resetHistory(); + MinutesSchema.update.resetHistory(); + TopicSchema.update.resetHistory(); + MinutesFinder.firstMinutesOfMeetingSeries.resetHistory(); + MinutesFinder.nextMinutes.resetHistory(); }); describe('#up', function() { diff --git a/tests/unit/server/migrations/migrate_v21.test.js b/tests/unit/server/migrations/migrate_v21.test.js index 8b3d7eb6e..446b7876e 100644 --- a/tests/unit/server/migrations/migrate_v21.test.js +++ b/tests/unit/server/migrations/migrate_v21.test.js @@ -80,11 +80,11 @@ describe('Migrate Version 21', function() { }); afterEach(function() { - MeetingSeriesSchema.find.reset(); - TopicSchema.update.reset(); - MinutesFinder.firstMinutesOfMeetingSeries.reset(); - MinutesFinder.nextMinutes.reset(); - TopicsFinder.allTopicsOfMeetingSeries.reset(); + MeetingSeriesSchema.find.resetHistory(); + TopicSchema.update.resetHistory(); + MinutesFinder.firstMinutesOfMeetingSeries.resetHistory(); + MinutesFinder.nextMinutes.resetHistory(); + TopicsFinder.allTopicsOfMeetingSeries.resetHistory(); }); it('calls the update method of the topics collection for both topics', function() { From 9757a5b9b0007d58665f7464da7bf2ea7153964b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ciar=C3=A1n?= Date: Wed, 12 Jul 2023 18:35:45 +1000 Subject: [PATCH 07/11] More deprecated call replacement --- tests/unit/server/migrations/migrate_v1.test.js | 4 ++-- tests/unit/server/migrations/migrate_v10.test.js | 4 ++-- tests/unit/server/migrations/migrate_v12.test.js | 4 ++-- tests/unit/server/migrations/migrate_v13.test.js | 4 ++-- tests/unit/server/migrations/migrate_v15.test.js | 4 ++-- tests/unit/server/migrations/migrate_v16.test.js | 2 +- tests/unit/server/migrations/migrate_v20.test.js | 4 ++-- tests/unit/server/migrations/migrate_v22.test.js | 2 +- tests/unit/server/migrations/migrate_v23.test.js | 4 ++-- tests/unit/server/migrations/migrate_v24.test.js | 2 +- tests/unit/server/migrations/migrate_v3.test.js | 4 ++-- tests/unit/server/migrations/migrate_v4.test.js | 4 ++-- tests/unit/server/migrations/migrate_v5.test.js | 4 ++-- tests/unit/server/migrations/migrations.test.js | 2 +- 14 files changed, 24 insertions(+), 24 deletions(-) diff --git a/tests/unit/server/migrations/migrate_v1.test.js b/tests/unit/server/migrations/migrate_v1.test.js index 611c95986..7fc1771b0 100644 --- a/tests/unit/server/migrations/migrate_v1.test.js +++ b/tests/unit/server/migrations/migrate_v1.test.js @@ -139,8 +139,8 @@ describe('Migrate Version 1', function () { }); afterEach(function () { - MinutesSchema.update.reset(); - MeetingSeriesSchema.update.reset(); + MinutesSchema.update.resetHistory(); + MeetingSeriesSchema.update.resetHistory(); MeetingSeriesSchema.series = []; MinutesSchema.minutes = []; }); diff --git a/tests/unit/server/migrations/migrate_v10.test.js b/tests/unit/server/migrations/migrate_v10.test.js index bdcd5d534..3095bd482 100644 --- a/tests/unit/server/migrations/migrate_v10.test.js +++ b/tests/unit/server/migrations/migrate_v10.test.js @@ -90,9 +90,9 @@ describe('Migrate Version 10', function () { }); afterEach(function () { - MinutesSchema.update.reset(); + MinutesSchema.update.resetHistory(); MinutesSchema.find.reset(); - MeetingSeriesSchema.update.reset(); + MeetingSeriesSchema.update.resetHistory(); }); describe('#up', function () { diff --git a/tests/unit/server/migrations/migrate_v12.test.js b/tests/unit/server/migrations/migrate_v12.test.js index 31148994c..326f92ce1 100644 --- a/tests/unit/server/migrations/migrate_v12.test.js +++ b/tests/unit/server/migrations/migrate_v12.test.js @@ -150,8 +150,8 @@ describe('Migrate Version 12', function () { }); afterEach(function () { - MinutesSchema.update.reset(); - MeetingSeriesSchema.update.reset(); + MinutesSchema.update.resetHistory(); + MeetingSeriesSchema.update.resetHistory(); }); describe('#up', function () { diff --git a/tests/unit/server/migrations/migrate_v13.test.js b/tests/unit/server/migrations/migrate_v13.test.js index 62f96c6b1..4cb058cd4 100644 --- a/tests/unit/server/migrations/migrate_v13.test.js +++ b/tests/unit/server/migrations/migrate_v13.test.js @@ -85,8 +85,8 @@ describe('Migrate Version 13', function () { }); afterEach(function () { - MinutesSchema.update.reset(); - MeetingSeriesSchema.update.reset(); + MinutesSchema.update.resetHistory(); + MeetingSeriesSchema.update.resetHistory(); }); describe('#up', function () { diff --git a/tests/unit/server/migrations/migrate_v15.test.js b/tests/unit/server/migrations/migrate_v15.test.js index 2c5a66f99..1ba859d17 100644 --- a/tests/unit/server/migrations/migrate_v15.test.js +++ b/tests/unit/server/migrations/migrate_v15.test.js @@ -118,8 +118,8 @@ describe('Migrate Version 15', function () { }); afterEach(function () { - MinutesSchema.update.reset(); - MeetingSeriesSchema.update.reset(); + MinutesSchema.update.resetHistory(); + MeetingSeriesSchema.update.resetHistory(); MeetingSeriesSchema.series = []; MinutesSchema.minutes = []; }); diff --git a/tests/unit/server/migrations/migrate_v16.test.js b/tests/unit/server/migrations/migrate_v16.test.js index 8aa6fa766..66f210d13 100644 --- a/tests/unit/server/migrations/migrate_v16.test.js +++ b/tests/unit/server/migrations/migrate_v16.test.js @@ -46,7 +46,7 @@ describe('Migrate Version 16', function () { TopicSchema.insert.reset(); TopicSchema.find.reset(); TopicSchema.remove.reset(); - MeetingSeriesSchema.update.reset(); + MeetingSeriesSchema.update.resetHistory(); MeetingSeriesSchema.find.reset(); }); diff --git a/tests/unit/server/migrations/migrate_v20.test.js b/tests/unit/server/migrations/migrate_v20.test.js index a5049f5be..89482ec14 100644 --- a/tests/unit/server/migrations/migrate_v20.test.js +++ b/tests/unit/server/migrations/migrate_v20.test.js @@ -93,8 +93,8 @@ describe('Migrate Version 20', function () { }); afterEach(function () { - MinutesSchema.update.reset(); - TopicSchema.update.reset(); + MinutesSchema.update.resetHistory(); + TopicSchema.update.resetHistory(); }); diff --git a/tests/unit/server/migrations/migrate_v22.test.js b/tests/unit/server/migrations/migrate_v22.test.js index b2a9e221f..4ea04745e 100644 --- a/tests/unit/server/migrations/migrate_v22.test.js +++ b/tests/unit/server/migrations/migrate_v22.test.js @@ -44,7 +44,7 @@ describe('Migrate Version 22', function() { afterEach(function() { MeetingSeriesSchema.findOne.reset(); - TopicSchema.update.reset(); + TopicSchema.update.resetHistory(); TopicSchema.find.reset(); }); diff --git a/tests/unit/server/migrations/migrate_v23.test.js b/tests/unit/server/migrations/migrate_v23.test.js index a18cd9349..b1cb0d31f 100644 --- a/tests/unit/server/migrations/migrate_v23.test.js +++ b/tests/unit/server/migrations/migrate_v23.test.js @@ -46,11 +46,11 @@ describe('MigrateV23', function () { afterEach(function () { TopicSchemaCollection.find.reset(); - TopicSchemaCollection.update.reset(); + TopicSchemaCollection.update.resetHistory(); TopicSchema.getCollection.reset(); MinutesSchemaCollection.find.reset(); - MinutesSchemaCollection.update.reset(); + MinutesSchemaCollection.update.resetHistory(); MinutesSchema.getCollection.reset(); }); diff --git a/tests/unit/server/migrations/migrate_v24.test.js b/tests/unit/server/migrations/migrate_v24.test.js index 020fd9c21..5b5011f55 100644 --- a/tests/unit/server/migrations/migrate_v24.test.js +++ b/tests/unit/server/migrations/migrate_v24.test.js @@ -36,7 +36,7 @@ describe('MigrateV24', function () { afterEach(function () { MinutesSchema.find.reset(); - MinutesSchemaCollection.update.reset(); + MinutesSchemaCollection.update.resetHistory(); MinutesSchema.getCollection.reset(); }); diff --git a/tests/unit/server/migrations/migrate_v3.test.js b/tests/unit/server/migrations/migrate_v3.test.js index ab2c98c10..34f27dde6 100644 --- a/tests/unit/server/migrations/migrate_v3.test.js +++ b/tests/unit/server/migrations/migrate_v3.test.js @@ -89,8 +89,8 @@ describe('Migrate Version 3', function () { }); afterEach(function () { - MinutesSchema.update.reset(); - MeetingSeriesSchema.update.reset(); + MinutesSchema.update.resetHistory(); + MeetingSeriesSchema.update.resetHistory(); MeetingSeriesSchema.series = []; MinutesSchema.minutes = []; }); diff --git a/tests/unit/server/migrations/migrate_v4.test.js b/tests/unit/server/migrations/migrate_v4.test.js index 6e1741e78..eeee61b36 100644 --- a/tests/unit/server/migrations/migrate_v4.test.js +++ b/tests/unit/server/migrations/migrate_v4.test.js @@ -77,9 +77,9 @@ describe('MigrateV4', function() { afterEach(function () { MinutesSchema.find.reset(); - MinutesSchema.update.reset(); + MinutesSchema.update.resetHistory(); MeetingSeriesSchema.find.reset(); - MeetingSeriesSchema.update.reset(); + MeetingSeriesSchema.update.resetHistory(); }); describe('#up', function() { diff --git a/tests/unit/server/migrations/migrate_v5.test.js b/tests/unit/server/migrations/migrate_v5.test.js index 37ae87218..cdaa22d69 100644 --- a/tests/unit/server/migrations/migrate_v5.test.js +++ b/tests/unit/server/migrations/migrate_v5.test.js @@ -76,8 +76,8 @@ describe('Migrate Version 5', function () { }); afterEach(function () { - MinutesSchema.update.reset(); - MeetingSeriesSchema.update.reset(); + MinutesSchema.update.resetHistory(); + MeetingSeriesSchema.update.resetHistory(); MeetingSeriesSchema.series = []; MinutesSchema.minutes = []; }); diff --git a/tests/unit/server/migrations/migrations.test.js b/tests/unit/server/migrations/migrations.test.js index 02ba765d8..c5a49abe1 100644 --- a/tests/unit/server/migrations/migrations.test.js +++ b/tests/unit/server/migrations/migrations.test.js @@ -49,7 +49,7 @@ describe('Migrations', function () { } }; - backupMongo.reset(); + backupMongo.update.resetHistory(); Migrations.migrateTo.reset(); }); From 060dff52028dd9ffe624ed17068bb606cb19bf1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ciar=C3=A1n?= Date: Wed, 12 Jul 2023 19:06:17 +1000 Subject: [PATCH 08/11] add node 14 test, --- .github/workflows/runtests.js.yml | 53 +++++++++++++++++++ .../unit/server/migrations/migrations.test.js | 2 +- 2 files changed, 54 insertions(+), 1 deletion(-) diff --git a/.github/workflows/runtests.js.yml b/.github/workflows/runtests.js.yml index 55dbd60a5..cae744bec 100644 --- a/.github/workflows/runtests.js.yml +++ b/.github/workflows/runtests.js.yml @@ -234,3 +234,56 @@ jobs: with: name: E2E Mongodump path: tests/mongodump + + + + Node14: + runs-on: ubuntu-latest + strategy: + fail-fast: true # When set to true, GitHub cancels all in-progress jobs if any matrix job fails. Default: true + matrix: # max. 20 concurrent jobs https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#usage-limits + e2etest: + - tests/end2end/MeetingSeries-test.js + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v1 + with: + node-version: '14.21.3' + + - run: sudo apt-get install gcc-12 g++ build-essential -y --option Acquire::Retries=100 --option Acquire::http::Timeout="300" + - run: sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-12 50 + + - run: | + sudo wget -qO - https://www.mongodb.org/static/pgp/server-6.0.asc | sudo apt-key add - + sudo echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/6.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-6.0.list + sudo apt-get update + sudo apt-get install -y mongodb-org + mongodump --version + + - run: curl https://install.meteor.com | /bin/sh + - run: npm install chromedriver@^114.0.0 + - run: google-chrome --version + - run: npm install + + - run: mkdir ./tests/mongodump + + - run: ./tests/run_e2e.sh ${{ matrix.e2etest }} + + - name: Upload E2E screenshot artifacts + if: always() + uses: actions/upload-artifact@v1 + with: + name: E2E Screenshots + path: tests/snapshots + - name: Upload E2E log artifacts + if: always() + uses: actions/upload-artifact@v1 + with: + name: E2E Logs + path: tests/end2end/logs + - name: Upload E2E MongoDB artifacts + if: always() + uses: actions/upload-artifact@v1 + with: + name: E2E Mongodump + path: tests/mongodump diff --git a/tests/unit/server/migrations/migrations.test.js b/tests/unit/server/migrations/migrations.test.js index c5a49abe1..348ff33dc 100644 --- a/tests/unit/server/migrations/migrations.test.js +++ b/tests/unit/server/migrations/migrations.test.js @@ -50,7 +50,7 @@ describe('Migrations', function () { }; backupMongo.update.resetHistory(); - Migrations.migrateTo.reset(); + Migrations.migrateTo.resetHistory(); }); afterEach(function () { From 3f9db015dd9be34c8d59500bfacbd2ac753b787d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ciar=C3=A1n?= Date: Mon, 18 Sep 2023 17:00:05 +1000 Subject: [PATCH 09/11] test fix --- tests/unit/server/migrations/migrations.test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/unit/server/migrations/migrations.test.js b/tests/unit/server/migrations/migrations.test.js index 348ff33dc..05ab4b942 100644 --- a/tests/unit/server/migrations/migrations.test.js +++ b/tests/unit/server/migrations/migrations.test.js @@ -49,7 +49,7 @@ describe('Migrations', function () { } }; - backupMongo.update.resetHistory(); + backupMongo.resetHistory(); Migrations.migrateTo.resetHistory(); }); From 5d57cf4f5ae7b08737b21779dd30c21982220c19 Mon Sep 17 00:00:00 2001 From: Ciaran Welch Date: Tue, 26 Sep 2023 15:11:57 +1000 Subject: [PATCH 10/11] build: :heavy_minus_sign: @wdio/sync deprecated --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 9219ffeca..1b5128d40 100644 --- a/package.json +++ b/package.json @@ -49,6 +49,7 @@ "dependencies": { "@babel/polyfill": "^7.12.1", "@babel/runtime": "^7.22.5", + "@wdio/codemod": "^0.12.0", "arrive": "^2.4.1", "bcrypt": "^5.1.0", "bootstrap": "^3.3.7", @@ -90,7 +91,6 @@ "@wdio/local-runner": "^8.11.2", "@wdio/mocha-framework": "^8.12.1", "@wdio/spec-reporter": "^8.11.2", - "@wdio/sync": "^7.27.0", "chai": "^4.1.2", "clone": "^2.1.1", "ddp": "^0.9.4", From ab15d3e36f18dac7422a3b61503b9993912c7318 Mon Sep 17 00:00:00 2001 From: Ciaran Welch Date: Tue, 26 Sep 2023 15:57:44 +1000 Subject: [PATCH 11/11] test: :alien: Codemod transform of wdio to async --- tests/end2end/ActionItem-test.js | 176 +++--- tests/end2end/ActionItemResponsibles-test.js | 108 ++-- tests/end2end/Admin-test.js | 126 ++-- tests/end2end/Attachments-test.js | 228 +++---- tests/end2end/InfoItems-test.js | 164 ++--- tests/end2end/ItemDetails-test.js | 268 ++++---- tests/end2end/LDAP-test.js | 76 +-- tests/end2end/Labels-test.js | 96 +-- tests/end2end/MeSeTopicList-test.js | 400 ++++++------ tests/end2end/MeSetemsTab-test.js | 34 +- tests/end2end/MeetingSeries-test.js | 64 +- tests/end2end/MeetingSeriesEdit-test.js | 198 +++--- tests/end2end/MeetingSeriesEditUsers-test.js | 460 +++++++------- tests/end2end/MeetingSeriesItemList-test.js | 60 +- tests/end2end/MeetingSeriesSearch-test.js | 52 +- tests/end2end/MeetingSeries_security.js | 150 ++--- tests/end2end/Migrations-test.js | 58 +- tests/end2end/Minutes-test.js | 204 +++--- tests/end2end/MinutesFinalize-test.js | 300 ++++----- tests/end2end/MinutesParticipants-test.js | 234 +++---- tests/end2end/Minutes_security.js | 280 ++++----- tests/end2end/MyActionItemsTab-test.js | 86 +-- tests/end2end/Protocols-test.js | 156 ++--- tests/end2end/Routing-test.js | 82 +-- tests/end2end/SendAgenda.js | 134 ++-- tests/end2end/StickyInfoItems-test.js | 118 ++-- .../TemplateRendererIntegration-test.js | 22 +- tests/end2end/Topics-test.js | 594 +++++++++--------- tests/end2end/TopicsDelete-test.js | 80 +-- tests/end2end/TopicsResponsibles-test.js | 106 ++-- tests/end2end/TopicsSkip-test.js | 162 ++--- tests/end2end/Topics_security.js | 286 ++++----- tests/end2end/User-test.js | 224 +++---- tests/end2end/UserRoles_security.js | 98 +-- tests/end2end/helpers/E2EAdmin.js | 78 +-- tests/end2end/helpers/E2EApp.js | 182 +++--- tests/end2end/helpers/E2EAttachments.js | 60 +- tests/end2end/helpers/E2EGlobal.js | 86 +-- tests/end2end/helpers/E2EMails.js | 16 +- tests/end2end/helpers/E2EMeetingSeries.js | 116 ++-- .../end2end/helpers/E2EMeetingSeriesEditor.js | 82 +-- tests/end2end/helpers/E2EMinutes.js | 122 ++-- .../end2end/helpers/E2EMinutesParticipants.js | 60 +- tests/end2end/helpers/E2EProtocols.js | 22 +- tests/end2end/helpers/E2ESecurity.js | 186 +++--- tests/end2end/helpers/E2ETopics.js | 438 ++++++------- tests/end2end/helpers/E2EUser.js | 30 +- tests/end2end/helpers/Server.js | 26 +- tests/end2end/helpers/wdio_v4_to_v5.js | 6 +- tests/end2end/setup.js | 40 +- 50 files changed, 3717 insertions(+), 3717 deletions(-) diff --git a/tests/end2end/ActionItem-test.js b/tests/end2end/ActionItem-test.js index 44cab224a..6593758d3 100644 --- a/tests/end2end/ActionItem-test.js +++ b/tests/end2end/ActionItem-test.js @@ -18,23 +18,23 @@ describe('ActionItems', function () { let aAICounter = 0; let aAINameBase = "Action Item Name #"; - let getNewMeetingName = () => { + let getNewMeetingName = async () => { aMeetingCounter++; return aMeetingNameBase + aMeetingCounter; }; - let getNewTopicName = () => { + let getNewTopicName = async () => { aTopicCounter++; return aTopicNameBase + aTopicCounter; }; - let getNewAIName = () => { + let getNewAIName = async () => { aAICounter++; return aAINameBase + aAICounter; }; - function addActionItemToFirstTopic() { - let actionItemName = getNewAIName(); + async function addActionItemToFirstTopic() { + let actionItemName = await getNewAIName(); - E2ETopics.addInfoItemToTopic({ + await E2ETopics.addInfoItemToTopic({ subject: actionItemName, itemType: "actionItem" }, 1); @@ -43,92 +43,92 @@ describe('ActionItems', function () { } before("reload page and reset app", function () { - E2EGlobal.logTimestamp("Start test suite"); - E2EApp.resetMyApp(true); - E2EApp.launchApp(); + await E2EGlobal.logTimestamp("Start test suite"); + await E2EApp.resetMyApp(true); + await E2EApp.launchApp(); }); beforeEach("make sure test user is logged in, create series and add minutes", function () { - E2EApp.gotoStartPage(); - expect (E2EApp.isLoggedIn()).to.be.true; + await E2EApp.gotoStartPage(); + expect (await E2EApp.isLoggedIn()).to.be.true; - aMeetingName = getNewMeetingName(); + aMeetingName = await getNewMeetingName(); - E2EMeetingSeries.createMeetingSeries(aProjectName, aMeetingName); - E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName); + await E2EMeetingSeries.createMeetingSeries(aProjectName, aMeetingName); + await E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName); - aTopicName = getNewTopicName(); - E2ETopics.addTopicToMinutes(aTopicName); + aTopicName = await getNewTopicName(); + await E2ETopics.addTopicToMinutes(aTopicName); }); it('can add an info item', function () { let topicIndex = 1; - const actionItemName = getNewAIName(); + const actionItemName = await getNewAIName(); - E2ETopics.addInfoItemToTopic({ + await E2ETopics.addInfoItemToTopic({ subject: actionItemName, itemType: "actionItem" }, topicIndex); - E2EGlobal.waitSomeTime(); + await E2EGlobal.waitSomeTime(); let selector = "#topicPanel .well:nth-child(" + topicIndex + ") #headingOne"; - expect(browser.isVisible(selector), "Action item should be visible").to.be.true; + expect(await browser.isVisible(selector), "Action item should be visible").to.be.true; - let actionItemExpandElement = browser.element(selector).value.ELEMENT; - let actionItemExpandElementText = browser.elementIdText(actionItemExpandElement).value; + let actionItemExpandElement = (await browser.element(selector)).value.ELEMENT; + let actionItemExpandElementText = (await browser.elementIdText(actionItemExpandElement)).value; - expect(actionItemExpandElementText, "Action item visible text should match").to.have.string(actionItemName); + await expect(actionItemExpandElementText, "Action item visible text should match").to.have.string(actionItemName); }); it('can edit an existing action item', function() { let topicIndex = 1; - const actionItemName = getNewAIName(); + const actionItemName = await getNewAIName(); const updatedActionItemName = actionItemName + ' CHANGED!'; - E2ETopics.addInfoItemToTopic({ + await E2ETopics.addInfoItemToTopic({ subject: actionItemName, itemType: "actionItem", responsible: "user1" }, topicIndex); - E2EGlobal.waitSomeTime(); + await E2EGlobal.waitSomeTime(); - E2ETopics.editInfoItemForTopic(topicIndex, 1, {subject: updatedActionItemName}); + await E2ETopics.editInfoItemForTopic(topicIndex, 1, {subject: updatedActionItemName}); let selector = "#topicPanel .well:nth-child(" + topicIndex + ") #headingOne"; - expect(browser.isVisible(selector), "Action item should be visible").to.be.true; + expect(await browser.isVisible(selector), "Action item should be visible").to.be.true; - let actionItemExpandElement = browser.element(selector).value.ELEMENT; - let actionItemExpandElementText = browser.elementIdText(actionItemExpandElement).value; + let actionItemExpandElement = (await browser.element(selector)).value.ELEMENT; + let actionItemExpandElementText = (await browser.elementIdText(actionItemExpandElement)).value; - expect(actionItemExpandElementText, "AI text should have changed").to.have.string(updatedActionItemName); + await expect(actionItemExpandElementText, "AI text should have changed").to.have.string(updatedActionItemName); }); // This was broken before bugfix of github issue #228 it('can edit an existing action item after an info item was added', function() { let topicIndex = 1; - const actionItemName = getNewAIName(); + const actionItemName = await getNewAIName(); const updatedActionItemName = actionItemName + ' CHANGED!'; - E2ETopics.addInfoItemToTopic({ // create the initial action item + await E2ETopics.addInfoItemToTopic({ // create the initial action item subject: actionItemName, itemType: "actionItem", responsible: E2EGlobal.SETTINGS.e2eTestUsers[0], }, topicIndex); - E2EGlobal.waitSomeTime(); + await E2EGlobal.waitSomeTime(); - E2ETopics.addInfoItemToTopic({ // create a following info item (inserted BEFORE AI!) + await E2ETopics.addInfoItemToTopic({ // create a following info item (inserted BEFORE AI!) subject: "New Infoitem", itemType: "infoItem", label: "Proposal" }, topicIndex); - E2EGlobal.waitSomeTime(); + await E2EGlobal.waitSomeTime(); const newResponsible = E2EGlobal.SETTINGS.e2eTestUsers[1]; let actionItemIndex = 2; // II was inserted before AI! - E2ETopics.editInfoItemForTopic(topicIndex, actionItemIndex, + await E2ETopics.editInfoItemForTopic(topicIndex, actionItemIndex, { subject: updatedActionItemName, itemType: "actionItem", @@ -136,133 +136,133 @@ describe('ActionItems', function () { }); let selector = "#topicPanel .well:nth-child(" + topicIndex + ") .topicInfoItem:nth-child(" + actionItemIndex + ")"; - expect(browser.isVisible(selector), "Action item should be visible after edit").to.be.true; + expect(await browser.isVisible(selector), "Action item should be visible after edit").to.be.true; - let actionItemExpandElement = browser.element(selector).value.ELEMENT; - let actionItemExpandElementText = browser.elementIdText(actionItemExpandElement).value; - expect(actionItemExpandElementText, "AI subject text should have changed after edit").to.have.string(updatedActionItemName); - expect(actionItemExpandElementText, "AI responsible should have changed after edit").to.contain(newResponsible); + let actionItemExpandElement = (await browser.element(selector)).value.ELEMENT; + let actionItemExpandElementText = (await browser.elementIdText(actionItemExpandElement)).value; + await expect(actionItemExpandElementText, "AI subject text should have changed after edit").to.have.string(updatedActionItemName); + await expect(actionItemExpandElementText, "AI responsible should have changed after edit").to.contain(newResponsible); }); it('can add an action item by pressing enter in the topic field', function () { let topicIndex = 1; - E2ETopics.openInfoItemDialog(topicIndex, "actionItem"); + await E2ETopics.openInfoItemDialog(topicIndex, "actionItem"); - const actionItemName = getNewAIName(); - E2ETopics.insertInfoItemDataIntoDialog({ + const actionItemName = await getNewAIName(); + await E2ETopics.insertInfoItemDataIntoDialog({ subject: actionItemName, itemType: "actionItem" }); - const subjectInput = browser.$('#id_item_subject'); - subjectInput.keys('Enter'); + const subjectInput = await browser.$('#id_item_subject'); + await subjectInput.keys('Enter'); - E2EGlobal.waitSomeTime(); + await E2EGlobal.waitSomeTime(); let selector = "#topicPanel .well:nth-child(" + topicIndex + ") #headingOne"; - expect(browser.isVisible(selector), "Action item should be visible").to.be.true; + expect(await browser.isVisible(selector), "Action item should be visible").to.be.true; - let actionItemExpandElement = browser.element(selector).value.ELEMENT; - let actionItemExpandElementText = browser.elementIdText(actionItemExpandElement).value; + let actionItemExpandElement = (await browser.element(selector)).value.ELEMENT; + let actionItemExpandElementText = (await browser.elementIdText(actionItemExpandElement)).value; - expect(actionItemExpandElementText, "Action item visible text should match").to.have.string(actionItemName); + await expect(actionItemExpandElementText, "Action item visible text should match").to.have.string(actionItemName); }); it('can add an action item and set the priority field', function () { let topicIndex = 1; - const actionItemName = getNewAIName(); - E2ETopics.addInfoItemToTopic({ + const actionItemName = await getNewAIName(); + await E2ETopics.addInfoItemToTopic({ subject: actionItemName, priority: 5, itemType: "actionItem" }, topicIndex); let selector = "#topicPanel .well:nth-child(" + topicIndex + ") #headingOne"; - browser.waitForVisible(selector); - expect(browser.isVisible(selector), "Action item should be visible").to.be.true; + await browser.waitForVisible(selector); + expect(await browser.isVisible(selector), "Action item should be visible").to.be.true; - let actionItemExpandElement = browser.element(selector).value.ELEMENT; - let actionItemExpandElementText = browser.elementIdText(actionItemExpandElement).value; + let actionItemExpandElement = (await browser.element(selector)).value.ELEMENT; + let actionItemExpandElementText = (await browser.elementIdText(actionItemExpandElement)).value; - expect(actionItemExpandElementText, "Action item visible text should match").to.have.string(actionItemName); + await expect(actionItemExpandElementText, "Action item visible text should match").to.have.string(actionItemName); }); it('toggles the open-state of the first AI', function () { - addActionItemToFirstTopic(); + await addActionItemToFirstTopic(); - E2ETopics.toggleActionItem(1, 1); + await E2ETopics.toggleActionItem(1, 1); - expect(E2ETopics.isActionItemClosed(1, 1), "the AI should be closed").to.be.true; + expect(await E2ETopics.isActionItemClosed(1, 1), "the AI should be closed").to.be.true; }); it('toggles the open-state of the second AI', function () { - addActionItemToFirstTopic(); + await addActionItemToFirstTopic(); - E2ETopics.addInfoItemToTopic({ - subject: getNewAIName(), + await E2ETopics.addInfoItemToTopic({ + subject: await getNewAIName(), itemType: "actionItem" }, 1); - E2ETopics.toggleActionItem(1, 2); + await E2ETopics.toggleActionItem(1, 2); - expect(E2ETopics.isActionItemClosed(1, 2), "the AI should be closed").to.be.true; + expect(await E2ETopics.isActionItemClosed(1, 2), "the AI should be closed").to.be.true; }); it('shows security question before deleting action items', function () { - let actionItemName = addActionItemToFirstTopic(); + let actionItemName = await addActionItemToFirstTopic(); - E2ETopics.deleteInfoItem(1, 1); + await E2ETopics.deleteInfoItem(1, 1); let selectorDialog = "#confirmDialog"; - E2EGlobal.waitSomeTime(750); // give dialog animation time - expect(browser.isVisible(selectorDialog), "Dialog should be visible").to.be.true; + await E2EGlobal.waitSomeTime(750); // give dialog animation time + expect(await browser.isVisible(selectorDialog), "Dialog should be visible").to.be.true; - let dialogContentElement = browser.element(selectorDialog + " .modal-body").value.ELEMENT; - let dialogContentText = browser.elementIdText(dialogContentElement).value; + let dialogContentElement = (await browser.element(selectorDialog + " .modal-body")).value.ELEMENT; + let dialogContentText = (await browser.elementIdText(dialogContentElement)).value; - expect(dialogContentText, 'dialog content should display the title of the to-be-deleted object').to.have.string(actionItemName); - expect(dialogContentText, 'dialog content should display the correct type of the to-be-deleted object').to.have.string("action item"); + await expect(dialogContentText, 'dialog content should display the title of the to-be-deleted object').to.have.string(actionItemName); + await expect(dialogContentText, 'dialog content should display the correct type of the to-be-deleted object').to.have.string("action item"); // close dialog otherwise beforeEach-hook will fail! - E2EApp.confirmationDialogAnswer(false); + await E2EApp.confirmationDialogAnswer(false); }); it('can delete an action item', function () { let topicIndex = 1; - const infoItemName = getNewAIName(); - E2ETopics.addInfoItemToTopic({ + const infoItemName = await getNewAIName(); + await E2ETopics.addInfoItemToTopic({ subject: infoItemName, itemType: "actionItem" }, topicIndex); - E2EGlobal.waitSomeTime(); + await E2EGlobal.waitSomeTime(); let selector = "#topicPanel .well:nth-child(" + topicIndex + ") #headingOne"; - expect(browser.isVisible(selector), "Info item should be visible").to.be.true; + expect(await browser.isVisible(selector), "Info item should be visible").to.be.true; - E2ETopics.deleteInfoItem(1, 1, true); - expect(browser.isVisible(selector), "Info item should be deleted").to.be.false; + await E2ETopics.deleteInfoItem(1, 1, true); + expect(await browser.isVisible(selector), "Info item should be deleted").to.be.false; }); it('can cancel a "delete action item"', function () { let topicIndex = 1; - const infoItemName = getNewAIName(); - E2ETopics.addInfoItemToTopic({ + const infoItemName = await getNewAIName(); + await E2ETopics.addInfoItemToTopic({ subject: infoItemName, itemType: "actionItem" }, topicIndex); - E2EGlobal.waitSomeTime(); + await E2EGlobal.waitSomeTime(); let selector = "#topicPanel .well:nth-child(" + topicIndex + ") #headingOne"; - expect(browser.isVisible(selector), "Info item should be visible").to.be.true; + expect(await browser.isVisible(selector), "Info item should be visible").to.be.true; - E2ETopics.deleteInfoItem(1, 1, false); - expect(browser.isVisible(selector), "Info item should still exist").to.be.true; + await E2ETopics.deleteInfoItem(1, 1, false); + expect(await browser.isVisible(selector), "Info item should still exist").to.be.true; }); }); \ No newline at end of file diff --git a/tests/end2end/ActionItemResponsibles-test.js b/tests/end2end/ActionItemResponsibles-test.js index 622306e42..92c2b30df 100644 --- a/tests/end2end/ActionItemResponsibles-test.js +++ b/tests/end2end/ActionItemResponsibles-test.js @@ -19,23 +19,23 @@ describe('ActionItems Responsibles', function () { let aAICounter = 0; let aAINameBase = "Action Item Name #"; - let getNewMeetingName = () => { + let getNewMeetingName = async () => { aMeetingCounter++; return aMeetingNameBase + aMeetingCounter; }; - let getNewTopicName = () => { + let getNewTopicName = async () => { aTopicCounter++; return aTopicNameBase + aTopicCounter; }; - let getNewAIName = () => { + let getNewAIName = async () => { aAICounter++; return aAINameBase + aAICounter; }; - function addActionItemToFirstTopic() { - let actionItemName = getNewAIName(); + async function addActionItemToFirstTopic() { + let actionItemName = await getNewAIName(); - E2ETopics.addInfoItemToTopic({ + await E2ETopics.addInfoItemToTopic({ subject: actionItemName, itemType: "actionItem" }, 1); @@ -44,44 +44,44 @@ describe('ActionItems Responsibles', function () { } before("reload page and reset app", function () { - E2EGlobal.logTimestamp("Start test suite"); - E2EApp.resetMyApp(true); - E2EApp.launchApp(); + await E2EGlobal.logTimestamp("Start test suite"); + await E2EApp.resetMyApp(true); + await E2EApp.launchApp(); }); beforeEach("make sure test user is logged in, create series and add minutes", function () { - E2EApp.gotoStartPage(); - expect (E2EApp.isLoggedIn()).to.be.true; + await E2EApp.gotoStartPage(); + expect (await E2EApp.isLoggedIn()).to.be.true; - aMeetingName = getNewMeetingName(); + aMeetingName = await getNewMeetingName(); - E2EMeetingSeries.createMeetingSeries(aProjectName, aMeetingName); - E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName); + await E2EMeetingSeries.createMeetingSeries(aProjectName, aMeetingName); + await E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName); - aTopicName = getNewTopicName(); - E2ETopics.addTopicToMinutes(aTopicName); + aTopicName = await getNewTopicName(); + await E2ETopics.addTopicToMinutes(aTopicName); }); it('can add an action item with a responsible', function () { let topicIndex = 1; let user1 = E2EGlobal.SETTINGS.e2eTestUsers[0]; - E2ETopics.openInfoItemDialog(topicIndex, "actionItem"); + await E2ETopics.openInfoItemDialog(topicIndex, "actionItem"); - const actionItemName = getNewAIName(); - E2ETopics.insertInfoItemDataIntoDialog({ + const actionItemName = await getNewAIName(); + await E2ETopics.insertInfoItemDataIntoDialog({ subject: actionItemName, itemType: "actionItem", responsible: user1 }); - browser.element("#btnInfoItemSave").click(); - E2EGlobal.waitSomeTime(); + await (await browser.element("#btnInfoItemSave")).click(); + await E2EGlobal.waitSomeTime(); let selector = "#topicPanel .well:nth-child(" + topicIndex + ") #headingOne"; - let actionItemExpandElement = browser.element(selector).value.ELEMENT; - let actionItemExpandElementText = browser.elementIdText(actionItemExpandElement).value; + let actionItemExpandElement = (await browser.element(selector)).value.ELEMENT; + let actionItemExpandElementText = (await browser.elementIdText(actionItemExpandElement)).value; - expect(actionItemExpandElementText, "user1 shall be responsible").to.have.string(user1); + await expect(actionItemExpandElementText, "user1 shall be responsible").to.have.string(user1); }); @@ -90,56 +90,56 @@ describe('ActionItems Responsibles', function () { let user1 = E2EGlobal.SETTINGS.e2eTestUsers[0]; let user2 = E2EGlobal.SETTINGS.e2eTestUsers[1]; - E2ETopics.openInfoItemDialog(topicIndex, "actionItem"); + await E2ETopics.openInfoItemDialog(topicIndex, "actionItem"); - const actionItemName = getNewAIName(); - E2ETopics.insertInfoItemDataIntoDialog({ + const actionItemName = await getNewAIName(); + await E2ETopics.insertInfoItemDataIntoDialog({ subject: actionItemName, itemType: "actionItem", responsible: user1+","+user2 }); - browser.element("#btnInfoItemSave").click(); - E2EGlobal.waitSomeTime(); + await (await browser.element("#btnInfoItemSave")).click(); + await E2EGlobal.waitSomeTime(); let selector = "#topicPanel .well:nth-child(" + topicIndex + ") #headingOne"; - let actionItemExpandElement = browser.element(selector).value.ELEMENT; - let actionItemExpandElementText = browser.elementIdText(actionItemExpandElement).value; + let actionItemExpandElement = (await browser.element(selector)).value.ELEMENT; + let actionItemExpandElementText = (await browser.elementIdText(actionItemExpandElement)).value; - expect(actionItemExpandElementText, "user1 shall be responsible").to.have.string(user1); - expect(actionItemExpandElementText, "user2 shall be responsible").to.have.string(user2); + await expect(actionItemExpandElementText, "user1 shall be responsible").to.have.string(user1); + await expect(actionItemExpandElementText, "user2 shall be responsible").to.have.string(user2); }); it('can add an action item with a free-text EMail-responsible', function () { let topicIndex = 1; let emailUser = "noreply@4minitz.com"; - E2ETopics.openInfoItemDialog(topicIndex, "actionItem"); + await E2ETopics.openInfoItemDialog(topicIndex, "actionItem"); - const actionItemName = getNewAIName(); - E2ETopics.insertInfoItemDataIntoDialog({ + const actionItemName = await getNewAIName(); + await E2ETopics.insertInfoItemDataIntoDialog({ subject: actionItemName, itemType: "actionItem", responsible: emailUser }); - browser.element("#btnInfoItemSave").click(); - E2EGlobal.waitSomeTime(); + await (await browser.element("#btnInfoItemSave")).click(); + await E2EGlobal.waitSomeTime(); let selector = "#topicPanel .well:nth-child(" + topicIndex + ") #headingOne"; - let actionItemExpandElement = browser.element(selector).value.ELEMENT; - let actionItemExpandElementText = browser.elementIdText(actionItemExpandElement).value; + let actionItemExpandElement = (await browser.element(selector)).value.ELEMENT; + let actionItemExpandElementText = (await browser.elementIdText(actionItemExpandElement)).value; - expect(actionItemExpandElementText, "user1 shall be responsible").to.have.string(emailUser); - E2EGlobal.waitSomeTime(); + await expect(actionItemExpandElementText, "user1 shall be responsible").to.have.string(emailUser); + await E2EGlobal.waitSomeTime(); }); it('prohibits non-email-string as free-text responsible', function () { let topicIndex = 1; let illegalUserName = "NonEMailResponsible"; - E2ETopics.openInfoItemDialog(topicIndex, "actionItem"); + await E2ETopics.openInfoItemDialog(topicIndex, "actionItem"); - const actionItemName = getNewAIName(); - E2ETopics.insertInfoItemDataIntoDialog({ + const actionItemName = await getNewAIName(); + await E2ETopics.insertInfoItemDataIntoDialog({ subject: actionItemName, itemType: "actionItem", responsible: illegalUserName @@ -148,19 +148,19 @@ describe('ActionItems Responsibles', function () { // check if 'Invalid Responsible' modal info dialog shows up // Hint: browser.getText("h4.modal-title") delivers an array // where we are only interested in the *last* element - thus we pop() - E2EGlobal.waitSomeTime(); - expect(browser.getText("h4.modal-title").pop(), "'Invalid Responsible' modal should be visible").to.have.string("Invalid Responsible"); + await E2EGlobal.waitSomeTime(); + await expect((await browser.getText("h4.modal-title")).pop(), "'Invalid Responsible' modal should be visible").to.have.string("Invalid Responsible"); - E2EApp.confirmationDialogAnswer(true); // click info modal "OK" - E2EGlobal.waitSomeTime(); + await E2EApp.confirmationDialogAnswer(true); // click info modal "OK" + await E2EGlobal.waitSomeTime(); - browser.element("#btnInfoItemSave").click(); // save AI - E2EGlobal.waitSomeTime(); + await (await browser.element("#btnInfoItemSave")).click(); // save AI + await E2EGlobal.waitSomeTime(); let selector = "#topicPanel .well:nth-child(" + topicIndex + ") #headingOne"; - let actionItemExpandElement = browser.element(selector).value.ELEMENT; - let actionItemExpandElementText = browser.elementIdText(actionItemExpandElement).value; + let actionItemExpandElement = (await browser.element(selector)).value.ELEMENT; + let actionItemExpandElementText = (await browser.elementIdText(actionItemExpandElement)).value; - expect(actionItemExpandElementText, "no illegal responsible added").not.to.have.string(illegalUserName); + await expect(actionItemExpandElementText, "no illegal responsible added").not.to.have.string(illegalUserName); }); }); diff --git a/tests/end2end/Admin-test.js b/tests/end2end/Admin-test.js index a19b32ae5..41ad8a704 100644 --- a/tests/end2end/Admin-test.js +++ b/tests/end2end/Admin-test.js @@ -7,136 +7,136 @@ import { E2EAdmin } from './helpers/E2EAdmin'; describe('Admin View', function () { before('reload page and reset app', function () { - E2EGlobal.logTimestamp("Start test suite"); - E2EApp.resetMyApp(true); - E2EApp.launchApp(); + await E2EGlobal.logTimestamp("Start test suite"); + await E2EApp.resetMyApp(true); + await E2EApp.launchApp(); }); beforeEach('goto start page and make sure test user is logged in', function () { - server.call('e2e.removeAllBroadcasts'); - E2EApp.launchApp(); - E2EApp.loginUser(0); - expect(E2EApp.isLoggedIn()).to.be.true; + await server.call('e2e.removeAllBroadcasts'); + await E2EApp.launchApp(); + await E2EApp.loginUser(0); + expect(await E2EApp.isLoggedIn()).to.be.true; }); after('log in user1', function () { - server.call('e2e.removeAllBroadcasts'); - E2EApp.launchApp(); - E2EApp.loginUser(0, true); + await server.call('e2e.removeAllBroadcasts'); + await E2EApp.launchApp(); + await E2EApp.loginUser(0, true); }); it('can not access admin menu or route for non-admin user', function () { - expect(E2EAdmin.clickAdminMenu(), 'click admin menu').to.be.false; + expect(await E2EAdmin.clickAdminMenu(), 'click admin menu').to.be.false; - browser.url(browser.getUrl()+E2EAdmin.getAdminRoute()); - E2EGlobal.waitSomeTime(); - expect(E2EAdmin.isOnAdminView(), "! isOnAdminView").to.be.false; + await browser.url((await browser.getUrl())+(await E2EAdmin.getAdminRoute())); + await E2EGlobal.waitSomeTime(); + expect(await E2EAdmin.isOnAdminView(), "! isOnAdminView").to.be.false; }); it('can access admin menu for admin user', function () { - E2EApp.loginUser(4, true); - expect(E2EAdmin.clickAdminMenu(), 'click admin menu').to.be.true; - expect(E2EAdmin.isOnAdminView(), "isOnAdminView").to.be.true; - E2EApp.loginUser(0, true); + await E2EApp.loginUser(4, true); + expect(await E2EAdmin.clickAdminMenu(), 'click admin menu').to.be.true; + expect(await E2EAdmin.isOnAdminView(), "isOnAdminView").to.be.true; + await E2EApp.loginUser(0, true); }); // #Security: Inactive users shall not be able to log in. it('can toggle a user to in-active. In-active user cannot sign in.', function () { - E2EApp.loginUser("admin", true); - E2EAdmin.clickAdminMenu(); - E2EAdmin.switchToTab("Users"); - E2EAdmin.setShowInactive(true); + await E2EApp.loginUser("admin", true); + await E2EAdmin.clickAdminMenu(); + await E2EAdmin.switchToTab("Users"); + await E2EAdmin.setShowInactive(true); let testUser = "user2"; - E2EAdmin.filterForUser(testUser+"@4min"); // the '@' actually searches in mail address. This prevents 'ldapuser1' to show up - expect (browser.getText('#id_adminUserTable tbody tr')).to.contain('Active'); - E2EAdmin.toggleUserActiveState(1); // toggle 1st visible user! - expect (browser.getText('#id_adminUserTable tbody tr')).to.contain('Inactive'); + await E2EAdmin.filterForUser(testUser+"@4min"); // the '@' actually searches in mail address. This prevents 'ldapuser1' to show up + await expect (await browser.getText('#id_adminUserTable tbody tr')).to.contain('Active'); + await E2EAdmin.toggleUserActiveState(1); // toggle 1st visible user! + await expect (await browser.getText('#id_adminUserTable tbody tr')).to.contain('Inactive'); let loginSuccess = false; try { - E2EApp.loginUser(testUser, true); + await E2EApp.loginUser(testUser, true); loginSuccess = true; } catch (e) { - expect(e+"").to.contain("wrong password"); + await expect(e+"").to.contain("wrong password"); } expect(loginSuccess, "loginSuccess should be false, as user is in-active").to.be.false; }); it('can toggle a user back to active. Active user can sign in, again.', function () { - E2EApp.loginUser("admin", true); - E2EAdmin.clickAdminMenu(); - E2EAdmin.switchToTab("Users"); - E2EAdmin.setShowInactive(true); + await E2EApp.loginUser("admin", true); + await E2EAdmin.clickAdminMenu(); + await E2EAdmin.switchToTab("Users"); + await E2EAdmin.setShowInactive(true); let testUser = "user2"; - E2EAdmin.filterForUser(testUser+"@4min"); // the '@' actually searches in mail address. This prevents 'ldapuser1' to show up - expect (browser.getText('#id_adminUserTable tbody tr')).to.contain('Inactive'); - E2EAdmin.toggleUserActiveState(1); // toggle 1st visible user! - expect (browser.getText('#id_adminUserTable tbody tr')).to.contain('Active'); + await E2EAdmin.filterForUser(testUser+"@4min"); // the '@' actually searches in mail address. This prevents 'ldapuser1' to show up + await expect (await browser.getText('#id_adminUserTable tbody tr')).to.contain('Inactive'); + await E2EAdmin.toggleUserActiveState(1); // toggle 1st visible user! + await expect (await browser.getText('#id_adminUserTable tbody tr')).to.contain('Active'); - E2EApp.loginUser(testUser, true); - expect(E2EApp.isLoggedIn(), "user is logged in").to.be.true; + await E2EApp.loginUser(testUser, true); + expect(await E2EApp.isLoggedIn(), "user is logged in").to.be.true; }); it('can broadcast a message and dismiss it', function () { - E2EApp.loginUser("admin", true); - E2EAdmin.clickAdminMenu(); + await E2EApp.loginUser("admin", true); + await E2EAdmin.clickAdminMenu(); // admin sends broadcast message let message = 'Hello from admin!'; - expect(browser.isVisible(E2EAdmin.selectorMap.dlgAllMessages) + expect(await browser.isVisible(E2EAdmin.selectorMap.dlgAllMessages) , "message dialog should be invisible for admin").to.be.false; - E2EAdmin.sendNewBroadcastMessage(message); - browser.waitForVisible(E2EAdmin.selectorMap.dlgAllMessages, 2000); - expect(browser.isVisible(E2EAdmin.selectorMap.dlgAllMessages) + await E2EAdmin.sendNewBroadcastMessage(message); + await browser.waitForVisible(E2EAdmin.selectorMap.dlgAllMessages, 2000); + expect(await browser.isVisible(E2EAdmin.selectorMap.dlgAllMessages) , "message dialog should be visible for admin").to.be.true; - expect(browser.getText(E2EAdmin.selectorMap.dlgAllMessages) + await expect(await browser.getText(E2EAdmin.selectorMap.dlgAllMessages) , "check broadcast message text").to.contain(message); // Dismiss by admin user - E2EGlobal.clickWithRetry(E2EAdmin.selectorMap.btnDismissAllMessages); + await E2EGlobal.clickWithRetry(E2EAdmin.selectorMap.btnDismissAllMessages); const isNotVisible = true; - browser.waitForVisible(E2EAdmin.selectorMap.dlgAllMessages, 2000, isNotVisible); - expect(browser.isVisible(E2EAdmin.selectorMap.dlgAllMessages) + await browser.waitForVisible(E2EAdmin.selectorMap.dlgAllMessages, 2000, isNotVisible); + expect(await browser.isVisible(E2EAdmin.selectorMap.dlgAllMessages) , "message dialog should be invisible for admin after dismiss").to.be.false; // Now check display & dismiss by normal user - E2EApp.loginUser("user1", true); - browser.waitForVisible(E2EAdmin.selectorMap.dlgAllMessages, 3000); - E2EGlobal.clickWithRetry(E2EAdmin.selectorMap.btnDismissAllMessages); + await E2EApp.loginUser("user1", true); + await browser.waitForVisible(E2EAdmin.selectorMap.dlgAllMessages, 3000); + await E2EGlobal.clickWithRetry(E2EAdmin.selectorMap.btnDismissAllMessages); const waitForInvisible = true; - browser.waitForVisible(E2EAdmin.selectorMap.dlgAllMessages, 3000, waitForInvisible); - expect(browser.isVisible(E2EAdmin.selectorMap.dlgAllMessages) + await browser.waitForVisible(E2EAdmin.selectorMap.dlgAllMessages, 3000, waitForInvisible); + expect(await browser.isVisible(E2EAdmin.selectorMap.dlgAllMessages) , "message dialog should be visible for admin").to.be.false; }); it('can register a new user', function () { - E2EApp.loginUser("admin", true); - E2EAdmin.clickAdminMenu(); + await E2EApp.loginUser("admin", true); + await E2EAdmin.clickAdminMenu(); let username = "newuser"; let longname = "New User"; let email = "newuser@4minitz.com"; let password = "NewNew1"; - E2EAdmin.registerNewUser(username, longname, email, password); + await E2EAdmin.registerNewUser(username, longname, email, password); // check EMail sent to new user - let sentMails = E2EMails.getAllSentMails(); + let sentMails = await E2EMails.getAllSentMails(); expect(sentMails, 'one mail should be sent').to.have.length(1); let sentMail = sentMails[0]; - expect(sentMail.to, 'the email should contain to: mail').to.equal(email); - expect(sentMail.text, 'the email should contain username').to.contain(username); - expect(sentMail.text, 'the email should contain long name').to.contain(longname); - expect(sentMail.text, 'the email should contain password').to.contain(password); + await expect(sentMail.to, 'the email should contain to: mail').to.equal(email); + await expect(sentMail.text, 'the email should contain username').to.contain(username); + await expect(sentMail.text, 'the email should contain long name').to.contain(longname); + await expect(sentMail.text, 'the email should contain password').to.contain(password); // check if new user can sign in - E2EApp.loginUserWithCredentials(username, password, true); - expect(E2EApp.isLoggedIn(), "user is logged in").to.be.true; + await E2EApp.loginUserWithCredentials(username, password, true); + expect(await E2EApp.isLoggedIn(), "user is logged in").to.be.true; }); }); diff --git a/tests/end2end/Attachments-test.js b/tests/end2end/Attachments-test.js index c3d36c2a5..8635fe5ec 100644 --- a/tests/end2end/Attachments-test.js +++ b/tests/end2end/Attachments-test.js @@ -18,47 +18,47 @@ describe('Attachments', function () { let _localPublicDir; let _staticLocalFilename = ""; - let getNewMeetingName = () => { + let getNewMeetingName = async () => { _meetingCounter++; return _meetingNameBase + _meetingCounter; }; before("reload page and reset app", function () { - E2EGlobal.logTimestamp("Start test suite"); - E2EApp.resetMyApp(true); - E2EApp.launchApp(); + await E2EGlobal.logTimestamp("Start test suite"); + await E2EApp.resetMyApp(true); + await E2EApp.launchApp(); - _localPublicDir = server.call('e2e.getServerCurrentWorkingDir'); // call meteor server method + _localPublicDir = await server.call('e2e.getServerCurrentWorkingDir'); // call meteor server method _localPublicDir += "/../web.browser/app/"; // location of files from "/public" directory _staticLocalFilename = _localPublicDir + "favicon.ico"; }); beforeEach("goto start page and make sure test user is logged in", function () { - E2EApp.gotoStartPage(); - expect (E2EApp.isLoggedIn()).to.be.true; + await E2EApp.gotoStartPage(); + expect (await E2EApp.isLoggedIn()).to.be.true; - _lastMeetingName = getNewMeetingName(); - _lastMeetingSeriesID = E2EMeetingSeries.createMeetingSeries(_projectName, _lastMeetingName); - _lastMinutesID = E2EMinutes.addMinutesToMeetingSeries(_projectName, _lastMeetingName); + _lastMeetingName = await getNewMeetingName(); + _lastMeetingSeriesID = await E2EMeetingSeries.createMeetingSeries(_projectName, _lastMeetingName); + _lastMinutesID = await E2EMinutes.addMinutesToMeetingSeries(_projectName, _lastMeetingName); }); // ****************** // * MODERATOR TESTS // ****************** it('can upload an attachment to the server (as moderator)', function () { - expect(E2EAttachments.countAttachmentsGlobally(), + await expect(await E2EAttachments.countAttachmentsGlobally(), "Number of attachments before upload").to.equal(0); - E2EAttachments.uploadFile(_staticLocalFilename); + await E2EAttachments.uploadFile(_staticLocalFilename); // check we have one attachment now in database - expect(E2EAttachments.countAttachmentsGlobally(), + await expect(await E2EAttachments.countAttachmentsGlobally(), "Number of attachments after upload").to.equal(1); // check if the server file exists after upload - let attachment = E2EAttachments.getAttachmentDocsForMinuteID(_lastMinutesID)[0]; - let serverAttachmentDir = server.call('e2e.getServerAttachmentsDir'); + let attachment = (await E2EAttachments.getAttachmentDocsForMinuteID(_lastMinutesID))[0]; + let serverAttachmentDir = await server.call('e2e.getServerAttachmentsDir'); let serverAttachmentFilename = serverAttachmentDir + "/" + _lastMeetingSeriesID + "/" + attachment._id + @@ -68,9 +68,9 @@ describe('Attachments', function () { .to.be.ok; // check if local and server files have same MD5 checksum - const md5local = md5File.sync(_staticLocalFilename); - const md5server = md5File.sync(serverAttachmentFilename); - expect(md5local, + const md5local = await md5File.sync(_staticLocalFilename); + const md5server = await md5File.sync(serverAttachmentFilename); + await expect(md5local, "Local file should have same MD5 checksum as server file") .to.equal(md5server); }); @@ -78,58 +78,58 @@ describe('Attachments', function () { it('can not upload illegal files (as moderator)', function () { // wrong extension let fileWithDeniedExtension = _localPublicDir + "loading-gears.gif"; - E2EAttachments.uploadFile(fileWithDeniedExtension); - E2EApp.confirmationDialogCheckMessage("Error: Denied file extension: \"gif\"."); - E2EApp.confirmationDialogAnswer(true); + await E2EAttachments.uploadFile(fileWithDeniedExtension); + await E2EApp.confirmationDialogCheckMessage("Error: Denied file extension: \"gif\"."); + await E2EApp.confirmationDialogAnswer(true); // to big file size let fileWithTooBigSize = _localPublicDir + "mstile-310x310.png"; - E2EAttachments.uploadFile(fileWithTooBigSize); - E2EApp.confirmationDialogCheckMessage("Error: Please upload file with max."); - E2EApp.confirmationDialogAnswer(true); + await E2EAttachments.uploadFile(fileWithTooBigSize); + await E2EApp.confirmationDialogCheckMessage("Error: Please upload file with max."); + await E2EApp.confirmationDialogAnswer(true); }); it('can remove an attachment (as moderator)', function () { - let removeBtns = E2EAttachments.getRemoveButtons(); - expect(removeBtns.length, "Initially zero remove attachment buttons").to.equal(0); + let removeBtns = await E2EAttachments.getRemoveButtons(); + await expect(removeBtns.length, "Initially zero remove attachment buttons").to.equal(0); - E2EAttachments.uploadFile(_staticLocalFilename); + await E2EAttachments.uploadFile(_staticLocalFilename); - let attachmentCountInMin = E2EAttachments.getAttachmentDocsForMinuteID(_lastMinutesID).length; - expect(attachmentCountInMin, "One attachment after upload").to.equal(1); - removeBtns = E2EAttachments.getRemoveButtons(); - expect(removeBtns.length, "One remove attachment buttons after upload").to.equal(1); + let attachmentCountInMin = (await E2EAttachments.getAttachmentDocsForMinuteID(_lastMinutesID)).length; + await expect(attachmentCountInMin, "One attachment after upload").to.equal(1); + removeBtns = await E2EAttachments.getRemoveButtons(); + await expect(removeBtns.length, "One remove attachment buttons after upload").to.equal(1); // REMOVE ATTACHMENT! - removeBtns[0].click(); + await removeBtns[0].click(); // check for security question pop up - E2EApp.confirmationDialogCheckMessage("Do you really want to delete the attachment"); - E2EApp.confirmationDialogAnswer(true); + await E2EApp.confirmationDialogCheckMessage("Do you really want to delete the attachment"); + await E2EApp.confirmationDialogAnswer(true); // check attachment is really removed - from UI and in MongoDB - attachmentCountInMin = E2EAttachments.getAttachmentDocsForMinuteID(_lastMinutesID).length; - expect(attachmentCountInMin, "Zero attachments after remove").to.equal(0); - removeBtns = E2EAttachments.getRemoveButtons(); - expect(removeBtns.length, "Zero remove attachment buttons after remove").to.equal(0); + attachmentCountInMin = (await E2EAttachments.getAttachmentDocsForMinuteID(_lastMinutesID)).length; + await expect(attachmentCountInMin, "Zero attachments after remove").to.equal(0); + removeBtns = await E2EAttachments.getRemoveButtons(); + await expect(removeBtns.length, "Zero remove attachment buttons after remove").to.equal(0); }); it('has correct UI on finalized minutes with attachments (as moderator)', function () { - E2EAttachments.uploadFile(_staticLocalFilename); - expect(E2EAttachments.isUploadButtonVisible(), "Upload button visible after upload") + await E2EAttachments.uploadFile(_staticLocalFilename); + expect(await E2EAttachments.isUploadButtonVisible(), "Upload button visible after upload") .to.be.true; - let removeBtns = E2EAttachments.getRemoveButtons(); - expect(removeBtns.length, "One remove attachment button after upload") + let removeBtns = await E2EAttachments.getRemoveButtons(); + await expect(removeBtns.length, "One remove attachment button after upload") .to.equal(1); - let downloadlinks = E2EAttachments.getDownloadLinks(); - expect(downloadlinks.length, "One download link after upload") + let downloadlinks = await E2EAttachments.getDownloadLinks(); + await expect(downloadlinks.length, "One download link after upload") .to.equal(1); - E2EMinutes.finalizeCurrentMinutes(); - expect(E2EAttachments.isUploadButtonVisible(), "No Upload button visible after finalize") + await E2EMinutes.finalizeCurrentMinutes(); + expect(await E2EAttachments.isUploadButtonVisible(), "No Upload button visible after finalize") .to.be.false; - removeBtns = E2EAttachments.getRemoveButtons(); - expect(removeBtns.length, "One remove attachment buttons after finalize") + removeBtns = await E2EAttachments.getRemoveButtons(); + await expect(removeBtns.length, "One remove attachment buttons after finalize") .to.equal(0); - downloadlinks = E2EAttachments.getDownloadLinks(); - expect(downloadlinks.length, "Still one download link after finalize") + downloadlinks = await E2EAttachments.getDownloadLinks(); + await expect(downloadlinks.length, "Still one download link after finalize") .to.equal(1); }); @@ -138,52 +138,52 @@ describe('Attachments', function () { // * UPLOADER TESTS // ****************** it('can upload an attachment to the server (as uploader)', function () { - E2EAttachments.switchToUserWithDifferentRole(E2EGlobal.USERROLES.Uploader, _projectName, _lastMeetingName); - let countAttachmentsBeforeUpload = E2EAttachments.countAttachmentsGlobally(); + await E2EAttachments.switchToUserWithDifferentRole(E2EGlobal.USERROLES.Uploader, _projectName, _lastMeetingName); + let countAttachmentsBeforeUpload = await E2EAttachments.countAttachmentsGlobally(); - E2EAttachments.uploadFile(_staticLocalFilename); + await E2EAttachments.uploadFile(_staticLocalFilename); - expect(E2EAttachments.countAttachmentsGlobally(), + await expect(await E2EAttachments.countAttachmentsGlobally(), "Number of attachments after upload").to.equal(countAttachmentsBeforeUpload +1); - E2EApp.loginUser(0); + await E2EApp.loginUser(0); }); it('can remove only my own attachment (as uploader)', function () { // 1st Upload by Moderator - E2EAttachments.uploadFile(_staticLocalFilename); - let attDocBefore = E2EAttachments.getAttachmentDocsForMinuteID(_lastMinutesID); - E2EAttachments.switchToUserWithDifferentRole(E2EGlobal.USERROLES.Uploader, _projectName, _lastMeetingName); + await E2EAttachments.uploadFile(_staticLocalFilename); + let attDocBefore = await E2EAttachments.getAttachmentDocsForMinuteID(_lastMinutesID); + await E2EAttachments.switchToUserWithDifferentRole(E2EGlobal.USERROLES.Uploader, _projectName, _lastMeetingName); // 2nd upload by "Uploader". We expect two attachments but only one remove button - E2EAttachments.uploadFile(_staticLocalFilename); - let attachmentCountInMin = E2EAttachments.getAttachmentDocsForMinuteID(_lastMinutesID).length; - expect(attachmentCountInMin, "Two attachment after 2nd upload") + await E2EAttachments.uploadFile(_staticLocalFilename); + let attachmentCountInMin = (await E2EAttachments.getAttachmentDocsForMinuteID(_lastMinutesID)).length; + await expect(attachmentCountInMin, "Two attachment after 2nd upload") .to.equal(2); - expect(E2EAttachments.getRemoveButtons().length, "One remove attachment buttons after upload") + await expect((await E2EAttachments.getRemoveButtons()).length, "One remove attachment buttons after upload") .to.equal(1); // REMOVE 2nd UPLOAD by Uploader! - let removeBtns = E2EAttachments.getRemoveButtons(); - removeBtns[0].click(); - E2EApp.confirmationDialogAnswer(true); - let attDocAfter = E2EAttachments.getAttachmentDocsForMinuteID(_lastMinutesID); - expect(attDocBefore, "1st upload is still there after remove").to.deep.equal(attDocAfter); - E2EApp.loginUser(0); + let removeBtns = await E2EAttachments.getRemoveButtons(); + await removeBtns[0].click(); + await E2EApp.confirmationDialogAnswer(true); + let attDocAfter = await E2EAttachments.getAttachmentDocsForMinuteID(_lastMinutesID); + await expect(attDocBefore, "1st upload is still there after remove").to.deep.equal(attDocAfter); + await E2EApp.loginUser(0); }); // ****************** // * INVITED TESTS // ****************** it('can not upload but sees download links (as invited)', function () { - E2EAttachments.uploadFile(_staticLocalFilename); - E2EAttachments.switchToUserWithDifferentRole(E2EGlobal.USERROLES.Invited, _projectName, _lastMeetingName); + await E2EAttachments.uploadFile(_staticLocalFilename); + await E2EAttachments.switchToUserWithDifferentRole(E2EGlobal.USERROLES.Invited, _projectName, _lastMeetingName); // no need for "expanding"... it is still expanded from user1... - expect(E2EAttachments.isUploadButtonVisible()).to.be.false; - expect(E2EAttachments.getDownloadLinks().length, "One download link after upload by moderator") + expect(await E2EAttachments.isUploadButtonVisible()).to.be.false; + await expect((await E2EAttachments.getDownloadLinks()).length, "One download link after upload by moderator") .to.equal(1); - E2EApp.loginUser(0); + await E2EApp.loginUser(0); }); @@ -192,30 +192,30 @@ describe('Attachments', function () { // This only works in Chrome. Chrome is configured via .meteor/chimp_config.js to // show no pop up dialog on saving, but instead save directly to a known target directory it('can download attachment via URL (as invited) - DESKTOP-CHROME-ONLY', function () { - if (!E2EGlobal.browserIsPhantomJS() && !E2EGlobal.browserIsHeadlessChrome()) { - E2EAttachments.uploadFile(_staticLocalFilename); - E2EAttachments.switchToUserWithDifferentRole(E2EGlobal.USERROLES.Invited, _projectName, _lastMeetingName); + if (!(await E2EGlobal.browserIsPhantomJS()) && !(await E2EGlobal.browserIsHeadlessChrome())) { + await E2EAttachments.uploadFile(_staticLocalFilename); + await E2EAttachments.switchToUserWithDifferentRole(E2EGlobal.USERROLES.Invited, _projectName, _lastMeetingName); let fileShort = path.basename(_staticLocalFilename); // => e.g. "favicon.ico" - let downloadDir = E2EAttachments.getChromeDownloadDirectory(); + let downloadDir = await E2EAttachments.getChromeDownloadDirectory(); let downloadTargetFile = path.join(downloadDir, fileShort); if (fs.existsSync(downloadTargetFile)) { fs.unlinkSync(downloadTargetFile); } expect(fs.existsSync(downloadTargetFile)).to.be.false; // No file there! - let links = E2EAttachments.getDownloadLinks(); - links[0].click(); // now download via chrome desktop - E2EGlobal.waitSomeTime(2000); + let links = await E2EAttachments.getDownloadLinks(); + await links[0].click(); // now download via chrome desktop + await E2EGlobal.waitSomeTime(2000); expect(fs.existsSync(downloadTargetFile)).to.be.true; // File should be there // check if local pre-upload and local post-download files have same MD5 checksum - const md5localPre = md5File.sync(_staticLocalFilename); - const md5localPost = md5File.sync(downloadTargetFile); - expect(md5localPre, + const md5localPre = await md5File.sync(_staticLocalFilename); + const md5localPost = await md5File.sync(downloadTargetFile); + await expect(md5localPre, "Local pre-upload file should have same MD5 checksum as local post-download file") .to.equal(md5localPost); - E2EApp.loginUser(0); + await E2EApp.loginUser(0); } }); @@ -225,50 +225,50 @@ describe('Attachments', function () { // ****************** it('has no published attachment if not invited', function () { - E2EAttachments.uploadFile(_staticLocalFilename); - expect(E2EAttachments.countAttachmentsOnClientForCurrentUser() > 0, "How many attachments are published to the client for user1") + await E2EAttachments.uploadFile(_staticLocalFilename); + expect((await E2EAttachments.countAttachmentsOnClientForCurrentUser()) > 0, "How many attachments are published to the client for user1") .to.be.true; - E2EApp.loginUser(2); // switch to non-invited user - expect(E2EAttachments.countAttachmentsOnClientForCurrentUser(), "How many attachments are published to the client for user3") + await E2EApp.loginUser(2); // switch to non-invited user + await expect(await E2EAttachments.countAttachmentsOnClientForCurrentUser(), "How many attachments are published to the client for user3") .to.equal(0); - E2EApp.loginUser(0); + await E2EApp.loginUser(0); }); it('has no published attachment if not logged in', function () { - E2EAttachments.uploadFile(_staticLocalFilename); - expect(E2EAttachments.countAttachmentsOnClientForCurrentUser() > 0, "How many attachments are published to the client for user1") + await E2EAttachments.uploadFile(_staticLocalFilename); + expect((await E2EAttachments.countAttachmentsOnClientForCurrentUser()) > 0, "How many attachments are published to the client for user1") .to.be.true; - E2EApp.logoutUser(); // log out user - expect(E2EAttachments.countAttachmentsOnClientForCurrentUser(), "How many attachments are published to the client for non-logged in user") + await E2EApp.logoutUser(); // log out user + await expect(await E2EAttachments.countAttachmentsOnClientForCurrentUser(), "How many attachments are published to the client for non-logged in user") .to.equal(0); - E2EApp.loginUser(0); + await E2EApp.loginUser(0); }); it('can not download attachment via URL if user not invited', function () { - E2EAttachments.uploadFile(_staticLocalFilename); - let links = E2EAttachments.getDownloadLinks(); - let attachmentURL = links[0].getAttribute("href"); - - E2EApp.loginUser(2); // switch to non-invited user - browser.url(attachmentURL); // try to access download URL - let htmlSource = browser.getSource(); - expect(htmlSource).to.contain("File Not Found :("); - E2EApp.launchApp(); - E2EApp.loginUser(0); + await E2EAttachments.uploadFile(_staticLocalFilename); + let links = await E2EAttachments.getDownloadLinks(); + let attachmentURL = await links[0].getAttribute("href"); + + await E2EApp.loginUser(2); // switch to non-invited user + await browser.url(attachmentURL); // try to access download URL + let htmlSource = await browser.getSource(); + await expect(htmlSource).to.contain("File Not Found :("); + await E2EApp.launchApp(); + await E2EApp.loginUser(0); }); it('can not download attachment via URL if user not logged in', function () { - E2EAttachments.uploadFile(_staticLocalFilename); - let links = E2EAttachments.getDownloadLinks(); - let attachmentURL = links[0].getAttribute("href"); - - E2EApp.logoutUser(); // log out user - browser.url(attachmentURL); // try to access download URL - let htmlSource = browser.getSource(); - expect(htmlSource).to.contain("File Not Found :("); - E2EApp.launchApp(); - E2EApp.loginUser(0); + await E2EAttachments.uploadFile(_staticLocalFilename); + let links = await E2EAttachments.getDownloadLinks(); + let attachmentURL = await links[0].getAttribute("href"); + + await E2EApp.logoutUser(); // log out user + await browser.url(attachmentURL); // try to access download URL + let htmlSource = await browser.getSource(); + await expect(htmlSource).to.contain("File Not Found :("); + await E2EApp.launchApp(); + await E2EApp.loginUser(0); }); }); diff --git a/tests/end2end/InfoItems-test.js b/tests/end2end/InfoItems-test.js index c5afc95ae..70ab62d4d 100644 --- a/tests/end2end/InfoItems-test.js +++ b/tests/end2end/InfoItems-test.js @@ -16,211 +16,211 @@ describe('Info Items', function () { let aAICounter = 0; let aAINameBase = "Info Item Name #"; - let getNewMeetingName = () => { + let getNewMeetingName = async () => { aMeetingCounter++; return aMeetingNameBase + aMeetingCounter; }; - let getNewTopicName = () => { + let getNewTopicName = async () => { aTopicCounter++; return aTopicNameBase + aTopicCounter; }; - let getNewAIName = () => { + let getNewAIName = async () => { aAICounter++; return aAINameBase + aAICounter; }; before("reload page and reset app", function () { - E2EGlobal.logTimestamp("Start test suite"); - E2EApp.resetMyApp(true); - E2EApp.launchApp(); + await E2EGlobal.logTimestamp("Start test suite"); + await E2EApp.resetMyApp(true); + await E2EApp.launchApp(); }); beforeEach("make sure test user is logged in, create series and add minutes", function () { - E2EApp.gotoStartPage(); - expect (E2EApp.isLoggedIn()).to.be.true; + await E2EApp.gotoStartPage(); + expect (await E2EApp.isLoggedIn()).to.be.true; - aMeetingName = getNewMeetingName(); + aMeetingName = await getNewMeetingName(); - E2EMeetingSeries.createMeetingSeries(aProjectName, aMeetingName); - E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName); + await E2EMeetingSeries.createMeetingSeries(aProjectName, aMeetingName); + await E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName); - aTopicName = getNewTopicName(); - E2ETopics.addTopicToMinutes(aTopicName); + aTopicName = await getNewTopicName(); + await E2ETopics.addTopicToMinutes(aTopicName); }); it('can add an info item', function () { let topicIndex = 1; - const infoItemName = getNewAIName(); - E2ETopics.addInfoItemToTopic({ + const infoItemName = await getNewAIName(); + await E2ETopics.addInfoItemToTopic({ subject: infoItemName, itemType: "infoItem" }, topicIndex); - E2EGlobal.waitSomeTime(); + await E2EGlobal.waitSomeTime(); let selector = "#topicPanel .well:nth-child(" + topicIndex + ") #headingOne"; - expect(browser.isVisible(selector), "Info item should be visible").to.be.true; + expect(await browser.isVisible(selector), "Info item should be visible").to.be.true; - let infoItemExpandElement = browser.element(selector).value.ELEMENT; - let infoItemExpandElementText = browser.elementIdText(infoItemExpandElement).value; + let infoItemExpandElement = (await browser.element(selector)).value.ELEMENT; + let infoItemExpandElementText = (await browser.elementIdText(infoItemExpandElement)).value; - expect(infoItemExpandElementText, "Info item visible text should match").to.have.string(infoItemName); + await expect(infoItemExpandElementText, "Info item visible text should match").to.have.string(infoItemName); }); it('shows security question before deleting info items', function () { - const infoItemName = getNewAIName(); - E2ETopics.addInfoItemToTopic({ + const infoItemName = await getNewAIName(); + await E2ETopics.addInfoItemToTopic({ subject: infoItemName, itemType: "infoItem" }, 1); - E2ETopics.deleteInfoItem(1, 1); + await E2ETopics.deleteInfoItem(1, 1); let selectorDialog = "#confirmDialog"; - E2EGlobal.waitSomeTime(750); // give dialog animation time - expect(browser.isVisible(selectorDialog), "Dialog should be visible").to.be.true; + await E2EGlobal.waitSomeTime(750); // give dialog animation time + expect(await browser.isVisible(selectorDialog), "Dialog should be visible").to.be.true; - let dialogContentElement = browser.element(selectorDialog + " .modal-body").value.ELEMENT; - let dialogContentText = browser.elementIdText(dialogContentElement).value; + let dialogContentElement = (await browser.element(selectorDialog + " .modal-body")).value.ELEMENT; + let dialogContentText = (await browser.elementIdText(dialogContentElement)).value; - expect(dialogContentText, 'dialog content should display the title of the to-be-deleted object').to.have.string(infoItemName); - expect(dialogContentText, 'dialog content should display the correct type of the to-be-deleted object').to.have.string("information"); + await expect(dialogContentText, 'dialog content should display the title of the to-be-deleted object').to.have.string(infoItemName); + await expect(dialogContentText, 'dialog content should display the correct type of the to-be-deleted object').to.have.string("information"); // close dialog otherwise beforeEach-hook will fail! - E2EApp.confirmationDialogAnswer(false); + await E2EApp.confirmationDialogAnswer(false); }); it('can delete an info item', function () { let topicIndex = 1; - const infoItemName = getNewAIName(); - E2ETopics.addInfoItemToTopic({ + const infoItemName = await getNewAIName(); + await E2ETopics.addInfoItemToTopic({ subject: infoItemName, itemType: "infoItem" }, topicIndex); - E2EGlobal.waitSomeTime(); + await E2EGlobal.waitSomeTime(); let selector = "#topicPanel .well:nth-child(" + topicIndex + ") #headingOne"; - expect(browser.isVisible(selector), "Info item should be visible").to.be.true; + expect(await browser.isVisible(selector), "Info item should be visible").to.be.true; - E2ETopics.deleteInfoItem(1, 1, true); - expect(browser.isVisible(selector), "Info item should be deleted").to.be.false; + await E2ETopics.deleteInfoItem(1, 1, true); + expect(await browser.isVisible(selector), "Info item should be deleted").to.be.false; }); it('can cancel a "delete info item"', function () { let topicIndex = 1; - const infoItemName = getNewAIName(); - E2ETopics.addInfoItemToTopic({ + const infoItemName = await getNewAIName(); + await E2ETopics.addInfoItemToTopic({ subject: infoItemName, itemType: "infoItem" }, topicIndex); - E2EGlobal.waitSomeTime(); + await E2EGlobal.waitSomeTime(); let selector = "#topicPanel .well:nth-child(" + topicIndex + ") #headingOne"; - expect(browser.isVisible(selector), "Info item should be visible").to.be.true; + expect(await browser.isVisible(selector), "Info item should be visible").to.be.true; - E2ETopics.deleteInfoItem(1, 1, false); - expect(browser.isVisible(selector), "Info item should still exist").to.be.true; + await E2ETopics.deleteInfoItem(1, 1, false); + expect(await browser.isVisible(selector), "Info item should still exist").to.be.true; }); it('can submit an info item by pressing enter in the topic field', function () { let topicIndex = 1; - E2ETopics.openInfoItemDialog(topicIndex, "infoItem"); + await E2ETopics.openInfoItemDialog(topicIndex, "infoItem"); - const infoItemName = getNewAIName(); - E2ETopics.insertInfoItemDataIntoDialog({ + const infoItemName = await getNewAIName(); + await E2ETopics.insertInfoItemDataIntoDialog({ subject: infoItemName, itemType: "infoItem" }); - const subjectInput = browser.$('#id_item_subject'); - subjectInput.keys('Enter'); + const subjectInput = await browser.$('#id_item_subject'); + await subjectInput.keys('Enter'); - E2EGlobal.waitSomeTime(); + await E2EGlobal.waitSomeTime(); let selector = "#topicPanel .well:nth-child(" + topicIndex + ") #headingOne"; - expect(browser.isVisible(selector), "Info item should be visible").to.be.true; + expect(await browser.isVisible(selector), "Info item should be visible").to.be.true; - let infoItemExpandElement = browser.element(selector).value.ELEMENT; - let infoItemExpandElementText = browser.elementIdText(infoItemExpandElement).value; + let infoItemExpandElement = (await browser.element(selector)).value.ELEMENT; + let infoItemExpandElementText = (await browser.elementIdText(infoItemExpandElement)).value; - expect(infoItemExpandElementText, "Info item visible text should match").to.have.string(infoItemName); + await expect(infoItemExpandElementText, "Info item visible text should match").to.have.string(infoItemName); }); it('can edit an info item', function () { let topicIndex = 1; - E2ETopics.addInfoItemToTopic({ + await E2ETopics.addInfoItemToTopic({ subject: "Old Item Subject", itemType: "infoItem", label: "Proposal" }, topicIndex); - E2EGlobal.waitSomeTime(); + await E2EGlobal.waitSomeTime(); - E2ETopics.openInfoItemEditor(topicIndex, 1); - E2EGlobal.waitSomeTime(); - E2ETopics.insertInfoItemDataIntoDialog({ + await E2ETopics.openInfoItemEditor(topicIndex, 1); + await E2EGlobal.waitSomeTime(); + await E2ETopics.insertInfoItemDataIntoDialog({ subject: "New Item Subject", itemType: "infoItem", label: "Decision" }); - E2ETopics.submitInfoItemDialog(); + await E2ETopics.submitInfoItemDialog(); // Check new subject text let selector = "#topicPanel .well:nth-child(" + topicIndex + ") #headingOne"; - expect(browser.isVisible(selector), "Info item should be visible after edit").to.be.true; - let infoItemExpandElement = browser.element(selector).value.ELEMENT; - let infoItemExpandElementText = browser.elementIdText(infoItemExpandElement).value; - expect(infoItemExpandElementText, "Info item subject text should match after edit").to.have.string("New Item Subject"); + expect(await browser.isVisible(selector), "Info item should be visible after edit").to.be.true; + let infoItemExpandElement = (await browser.element(selector)).value.ELEMENT; + let infoItemExpandElementText = (await browser.elementIdText(infoItemExpandElement)).value; + await expect(infoItemExpandElementText, "Info item subject text should match after edit").to.have.string("New Item Subject"); // Check new label let newLabelSelector = "#topicPanel .well:nth-child(" + topicIndex + ") .label:nth-child(1)"; - expect(browser.isVisible(newLabelSelector), "New label should be visible").to.be.true; - infoItemExpandElement = browser.element(newLabelSelector).value.ELEMENT; - infoItemExpandElementText = browser.elementIdText(infoItemExpandElement).value; - expect(infoItemExpandElementText, "New label text should match").to.have.string("Decision"); + expect(await browser.isVisible(newLabelSelector), "New label should be visible").to.be.true; + infoItemExpandElement = (await browser.element(newLabelSelector)).value.ELEMENT; + infoItemExpandElementText = (await browser.elementIdText(infoItemExpandElement)).value; + await expect(infoItemExpandElementText, "New label text should match").to.have.string("Decision"); }); it('can edit the 2nd info item after creating three of them', function() { let topicIndex = 1; for (let i=1; i<4; i++) { - E2ETopics.addInfoItemToTopic({ + await E2ETopics.addInfoItemToTopic({ subject: `Info Item #${i}`, itemType: "infoItem" }, topicIndex); - E2EGlobal.waitSomeTime(); + await E2EGlobal.waitSomeTime(); if (i === 2) { // edit the first (last added) entry after adding the 2nd one. - E2ETopics.openInfoItemEditor(topicIndex, 1); - E2EGlobal.waitSomeTime(); - E2ETopics.submitInfoItemDialog(); + await E2ETopics.openInfoItemEditor(topicIndex, 1); + await E2EGlobal.waitSomeTime(); + await E2ETopics.submitInfoItemDialog(); } } for (let i=1; i>4; i++) { // Check new subject text const selector = `#topicPanel .well:nth-child(${topicIndex}) .topicInfoItem:nth-child(${i})`; - expect(browser.isVisible(selector), `Info Item ${i} should be visible`).to.be.true; - let infoItemExpandElement = browser.element(selector).value.ELEMENT; - let infoItemExpandElementText = browser.elementIdText(infoItemExpandElement).value; - expect(infoItemExpandElementText, `Info Item ${i} should be added correctly`).to.have.string(`Info Item #${i}`); + expect(await browser.isVisible(selector), `Info Item ${i} should be visible`).to.be.true; + let infoItemExpandElement = (await browser.element(selector)).value.ELEMENT; + let infoItemExpandElementText = (await browser.elementIdText(infoItemExpandElement)).value; + await expect(infoItemExpandElementText, `Info Item ${i} should be added correctly`).to.have.string(`Info Item #${i}`); } // Check if the 2nd item can be edited correctly - E2ETopics.openInfoItemEditor(topicIndex, 2); - E2EGlobal.waitSomeTime(); - E2ETopics.insertInfoItemDataIntoDialog({ + await E2ETopics.openInfoItemEditor(topicIndex, 2); + await E2EGlobal.waitSomeTime(); + await E2ETopics.insertInfoItemDataIntoDialog({ subject: 'Info Item #2 - changed', itemType: 'infoItem' }); - E2ETopics.submitInfoItemDialog(); + await E2ETopics.submitInfoItemDialog(); const selector = `#topicPanel .well:nth-child(${topicIndex}) .topicInfoItem:nth-child(2)`; - let infoItemExpandElement = browser.element(selector).value.ELEMENT; - let infoItemExpandElementText = browser.elementIdText(infoItemExpandElement).value; - expect(infoItemExpandElementText, `Info Item 2 should be edited correctly`).to.have.string('Info Item #2 - changed'); + let infoItemExpandElement = (await browser.element(selector)).value.ELEMENT; + let infoItemExpandElementText = (await browser.elementIdText(infoItemExpandElement)).value; + await expect(infoItemExpandElementText, `Info Item 2 should be edited correctly`).to.have.string('Info Item #2 - changed'); }); }); diff --git a/tests/end2end/ItemDetails-test.js b/tests/end2end/ItemDetails-test.js index fe986e129..8198f4d86 100644 --- a/tests/end2end/ItemDetails-test.js +++ b/tests/end2end/ItemDetails-test.js @@ -21,38 +21,38 @@ describe('Item Details', function () { let infoItemName; - let getNewMeetingName = () => { + let getNewMeetingName = async () => { aMeetingCounter++; return aMeetingNameBase + aMeetingCounter; }; - let getNewTopicName = () => { + let getNewTopicName = async () => { aTopicCounter++; return aTopicNameBase + aTopicCounter; }; - let getNewAIName = () => { + let getNewAIName = async () => { aAICounter++; return aAINameBase + aAICounter; }; before("reload page and reset app", function () { - E2EGlobal.logTimestamp("Start test suite"); - E2EApp.resetMyApp(true); - E2EApp.launchApp(); + await E2EGlobal.logTimestamp("Start test suite"); + await E2EApp.resetMyApp(true); + await E2EApp.launchApp(); }); beforeEach("make sure test user is logged in, create series and add minutes", function () { - E2EApp.gotoStartPage(); - expect (E2EApp.isLoggedIn()).to.be.true; + await E2EApp.gotoStartPage(); + expect (await E2EApp.isLoggedIn()).to.be.true; - aMeetingName = getNewMeetingName(); + aMeetingName = await getNewMeetingName(); - E2EMeetingSeries.createMeetingSeries(aProjectName, aMeetingName); - E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName); + await E2EMeetingSeries.createMeetingSeries(aProjectName, aMeetingName); + await E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName); - infoItemName = getNewAIName(); - aTopicName = getNewTopicName(); - E2ETopics.addTopicToMinutes(aTopicName); - E2ETopics.addInfoItemToTopic({ + infoItemName = await getNewAIName(); + aTopicName = await getNewTopicName(); + await E2ETopics.addTopicToMinutes(aTopicName); + await E2ETopics.addInfoItemToTopic({ subject: infoItemName, itemType: "actionItem" }, 1); @@ -60,252 +60,252 @@ describe('Item Details', function () { it('can add first details to a new Info Item', function() { const detailsText = 'First Details for Info Item'; - E2ETopics.addFirstDetailsToNewInfoItem({ - subject: getNewAIName(), + await E2ETopics.addFirstDetailsToNewInfoItem({ + subject: await getNewAIName(), itemType: "infoItem" },1 , detailsText); - E2EGlobal.waitSomeTime(); - browser.element(".expandDetails ").click(); - E2EGlobal.waitSomeTime(); + await E2EGlobal.waitSomeTime(); + await (await browser.element(".expandDetails ")).click(); + await E2EGlobal.waitSomeTime(); - let itemsOfNewTopic = E2ETopics.getItemsForTopic(1); + let itemsOfNewTopic = await E2ETopics.getItemsForTopic(1); let firstItemOfNewTopic = itemsOfNewTopic[0].ELEMENT; - expect(browser.elementIdText(firstItemOfNewTopic).value) - .to.have.string(formatDateISO8601(new Date()) + ' New' + '\n' + detailsText); + await expect((await browser.elementIdText(firstItemOfNewTopic)).value) + .to.have.string((await formatDateISO8601(new Date())) + ' New' + '\n' + detailsText); }); it('can add details to an Action Item', function() { - E2ETopics.addDetailsToActionItem(1, 1, 'New Details'); + await E2ETopics.addDetailsToActionItem(1, 1, 'New Details'); - let itemsOfNewTopic = E2ETopics.getItemsForTopic(1); + let itemsOfNewTopic = await E2ETopics.getItemsForTopic(1); let firstItemOfNewTopic = itemsOfNewTopic[0].ELEMENT; - expect(browser.elementIdText(firstItemOfNewTopic).value) - .to.have.string(formatDateISO8601(new Date()) + ' New' + '\nNew Details'); + await expect((await browser.elementIdText(firstItemOfNewTopic)).value) + .to.have.string((await formatDateISO8601(new Date())) + ' New' + '\nNew Details'); }); it('can add details to an Info Item, too', function() { const detailsText = 'New Details for Info Item'; - E2ETopics.addInfoItemToTopic({ - subject: getNewAIName(), + await E2ETopics.addInfoItemToTopic({ + subject: await getNewAIName(), itemType: 'infoItem' }, 1); - E2ETopics.addDetailsToActionItem(1, 1, detailsText); + await E2ETopics.addDetailsToActionItem(1, 1, detailsText); - let itemsOfNewTopic = E2ETopics.getItemsForTopic(1); + let itemsOfNewTopic = await E2ETopics.getItemsForTopic(1); let firstItemOfNewTopic = itemsOfNewTopic[0].ELEMENT; - expect(browser.elementIdText(firstItemOfNewTopic).value) - .to.have.string(formatDateISO8601(new Date()) + ' New' + '\n' + detailsText); + await expect((await browser.elementIdText(firstItemOfNewTopic)).value) + .to.have.string((await formatDateISO8601(new Date())) + ' New' + '\n' + detailsText); }); it('can add a second detail to an Action Item', function () { - E2ETopics.addDetailsToActionItem(1, 1, 'First Details'); - E2ETopics.addDetailsToActionItem(1, 1, 'Second Details'); + await E2ETopics.addDetailsToActionItem(1, 1, 'First Details'); + await E2ETopics.addDetailsToActionItem(1, 1, 'Second Details'); - let itemsOfNewTopic = E2ETopics.getItemsForTopic(1); + let itemsOfNewTopic = await E2ETopics.getItemsForTopic(1); let firstItemOfNewTopic = itemsOfNewTopic[0].ELEMENT; - expect(browser.elementIdText(firstItemOfNewTopic).value, "First added detail should be displayed") - .to.have.string(formatDateISO8601(new Date()) + ' New' + '\nFirst Details'); - expect(browser.elementIdText(firstItemOfNewTopic).value, "2nd added detail should be displayed, too") - .to.have.string(formatDateISO8601(new Date()) + ' New' + '\nSecond Details'); + await expect((await browser.elementIdText(firstItemOfNewTopic)).value, "First added detail should be displayed") + .to.have.string((await formatDateISO8601(new Date())) + ' New' + '\nFirst Details'); + await expect((await browser.elementIdText(firstItemOfNewTopic)).value, "2nd added detail should be displayed, too") + .to.have.string((await formatDateISO8601(new Date())) + ' New' + '\nSecond Details'); }); it('can add details to the 2nd AI of the same topic persistent', function() { - E2ETopics.addInfoItemToTopic({ - subject: getNewAIName(), + await E2ETopics.addInfoItemToTopic({ + subject: await getNewAIName(), itemType: "actionItem" }, 1); - E2ETopics.addDetailsToActionItem(1, 1, 'First Details'); + await E2ETopics.addDetailsToActionItem(1, 1, 'First Details'); const detailsText = 'Details for the 2nd AI'; - E2ETopics.addDetailsToActionItem(1, 2, detailsText); + await E2ETopics.addDetailsToActionItem(1, 2, detailsText); - browser.refresh(); - E2EGlobal.waitSomeTime(1500); // phantom.js needs some time here... + await browser.refresh(); + await E2EGlobal.waitSomeTime(1500); // phantom.js needs some time here... - E2ETopics.expandDetailsForActionItem(1, 2); + await E2ETopics.expandDetailsForActionItem(1, 2); - E2EGlobal.waitSomeTime(100); // phantom.js needs some time here, too... + await E2EGlobal.waitSomeTime(100); // phantom.js needs some time here, too... - let itemsOfNewTopic = E2ETopics.getItemsForTopic(1); + let itemsOfNewTopic = await E2ETopics.getItemsForTopic(1); let sndItemOfNewTopic = itemsOfNewTopic[1].ELEMENT; - expect(browser.elementIdText(sndItemOfNewTopic).value) - .to.have.string(formatDateISO8601(new Date()) + ' New' + '\n' + detailsText); + await expect((await browser.elementIdText(sndItemOfNewTopic)).value) + .to.have.string((await formatDateISO8601(new Date())) + ' New' + '\n' + detailsText); }); it('can edit the details of the 2nd AI of the same topic', function() { - E2ETopics.addDetailsToActionItem(1, 1, 'First Details'); + await E2ETopics.addDetailsToActionItem(1, 1, 'First Details'); - E2ETopics.addInfoItemToTopic({ - subject: getNewAIName(), + await E2ETopics.addInfoItemToTopic({ + subject: await getNewAIName(), itemType: "actionItem" }, 1); - E2ETopics.addDetailsToActionItem(1, 1, '2nd Details'); + await E2ETopics.addDetailsToActionItem(1, 1, '2nd Details'); - E2ETopics.editDetailsForActionItem(1, 2, 1, "Updated Details"); - let itemsOfNewTopic = E2ETopics.getItemsForTopic(1); + await E2ETopics.editDetailsForActionItem(1, 2, 1, "Updated Details"); + let itemsOfNewTopic = await E2ETopics.getItemsForTopic(1); let sndItemOfNewTopic = itemsOfNewTopic[1].ELEMENT; - expect(browser.elementIdText(sndItemOfNewTopic).value) - .to.have.string(formatDateISO8601(new Date()) + ' New' + '\n' + "Updated Details"); + await expect((await browser.elementIdText(sndItemOfNewTopic)).value) + .to.have.string((await formatDateISO8601(new Date())) + ' New' + '\n' + "Updated Details"); }); it('does not remove details when AI will be updated with the edit dialog', function () { const newSubject = "AI - changed subject"; - E2ETopics.addDetailsToActionItem(1, 1, 'New Details'); + await E2ETopics.addDetailsToActionItem(1, 1, 'New Details'); - E2ETopics.editInfoItemForTopic(1, 1, { subject: newSubject }); + await E2ETopics.editInfoItemForTopic(1, 1, { subject: newSubject }); - let itemsOfNewTopic = E2ETopics.getItemsForTopic(1, 1); + let itemsOfNewTopic = await E2ETopics.getItemsForTopic(1, 1); let firstItemOfNewTopic = itemsOfNewTopic[0].ELEMENT; - let completeAIText = browser.elementIdText(firstItemOfNewTopic).value; - expect(completeAIText, "Subject of AI should have changed").to.have.string(newSubject); - expect(completeAIText, "AI should still contain the details").to.have.string(formatDateISO8601(new Date()) + ' New' + '\nNew Details'); + let completeAIText = (await browser.elementIdText(firstItemOfNewTopic)).value; + await expect(completeAIText, "Subject of AI should have changed").to.have.string(newSubject); + await expect(completeAIText, "AI should still contain the details").to.have.string((await formatDateISO8601(new Date())) + ' New' + '\nNew Details'); }); it('does not revert changes when input field receives click-event during input', function () { - let doBeforeSubmit = (inputElement) => { + let doBeforeSubmit = async inputElement => { // perform click event on the input field after setting the text and before submitting the changes - E2EGlobal.clickWithRetry(inputElement); + await E2EGlobal.clickWithRetry(inputElement); }; - E2ETopics.addDetailsToActionItem(1, 1, 'First Details', doBeforeSubmit); + await E2ETopics.addDetailsToActionItem(1, 1, 'First Details', doBeforeSubmit); - let itemsOfNewTopic = E2ETopics.getItemsForTopic(1); + let itemsOfNewTopic = await E2ETopics.getItemsForTopic(1); let firstItemOfNewTopic = itemsOfNewTopic[0].ELEMENT; - expect(browser.elementIdText(firstItemOfNewTopic).value, "Added detail should be displayed") - .to.have.string(formatDateISO8601(new Date()) + ' New' +'\nFirst Details'); + await expect((await browser.elementIdText(firstItemOfNewTopic)).value, "Added detail should be displayed") + .to.have.string((await formatDateISO8601(new Date())) + ' New' +'\nFirst Details'); }); it('can change existing details', function () { - E2ETopics.addDetailsToActionItem(1, 1, 'New Details'); + await E2ETopics.addDetailsToActionItem(1, 1, 'New Details'); - E2ETopics.editDetailsForActionItem(1, 1, 1, 'New Details (changed)'); + await E2ETopics.editDetailsForActionItem(1, 1, 1, 'New Details (changed)'); - let itemsOfNewTopic = E2ETopics.getItemsForTopic(1); + let itemsOfNewTopic = await E2ETopics.getItemsForTopic(1); let firstItemOfNewTopic = itemsOfNewTopic[0].ELEMENT; - expect(browser.elementIdText(firstItemOfNewTopic).value) - .to.have.string(formatDateISO8601(new Date()) + ' New' + '\nNew Details (changed)'); + await expect((await browser.elementIdText(firstItemOfNewTopic)).value) + .to.have.string((await formatDateISO8601(new Date())) + ' New' + '\nNew Details (changed)'); }); it('shows an confirmation dialog when removing existing details', function() { - E2ETopics.addDetailsToActionItem(1, 1, 'New Details'); + await E2ETopics.addDetailsToActionItem(1, 1, 'New Details'); - E2ETopics.editDetailsForActionItem(1, 1, 1, ''); // empty text will remove the detail + await E2ETopics.editDetailsForActionItem(1, 1, 1, ''); // empty text will remove the detail let selectorDialog = "#confirmDialog"; - E2EGlobal.waitSomeTime(750); // give dialog animation time - expect(browser.isVisible(selectorDialog), "Dialog should be visible").to.be.true; + await E2EGlobal.waitSomeTime(750); // give dialog animation time + expect(await browser.isVisible(selectorDialog), "Dialog should be visible").to.be.true; - let dialogContentElement = browser.element(selectorDialog + " .modal-body").value.ELEMENT; - let dialogContentText = browser.elementIdText(dialogContentElement).value; + let dialogContentElement = (await browser.element(selectorDialog + " .modal-body")).value.ELEMENT; + let dialogContentText = (await browser.elementIdText(dialogContentElement)).value; - expect(dialogContentText, 'dialog content should display the subject of the to-be-deleted parent item') + await expect(dialogContentText, 'dialog content should display the subject of the to-be-deleted parent item') .to.have.string(infoItemName); // close dialog otherwise beforeEach-hook will fail! - E2EApp.confirmationDialogAnswer(false); + await E2EApp.confirmationDialogAnswer(false); }); it('should remove the details if the input field of the new item will be submitted empty', function() { - E2ETopics.addDetailsToActionItem(1, 1, ''); + await E2ETopics.addDetailsToActionItem(1, 1, ''); let selectorDialog = "#confirmDialog"; - E2EGlobal.waitSomeTime(750); // give dialog animation time - expect(browser.isVisible(selectorDialog), "Dialog should be visible").to.be.false; + await E2EGlobal.waitSomeTime(750); // give dialog animation time + expect(await browser.isVisible(selectorDialog), "Dialog should be visible").to.be.false; - let itemsOfNewTopic = E2ETopics.getItemsForTopic(1); + let itemsOfNewTopic = await E2ETopics.getItemsForTopic(1); let firstItemOfNewTopic = itemsOfNewTopic[0].ELEMENT; - expect(browser.elementIdText(firstItemOfNewTopic).value, 'the item should have not have any details') - .to.not.have.string(formatDateISO8601(new Date())); + await expect((await browser.elementIdText(firstItemOfNewTopic)).value, 'the item should have not have any details') + .to.not.have.string(await formatDateISO8601(new Date())); }); it('saves details persistent', function () { - E2ETopics.addDetailsToActionItem(1, 1, 'New Details'); + await E2ETopics.addDetailsToActionItem(1, 1, 'New Details'); - browser.refresh(); - E2EGlobal.waitSomeTime(1500); // phantom.js needs some time here... + await browser.refresh(); + await E2EGlobal.waitSomeTime(1500); // phantom.js needs some time here... - E2ETopics.expandDetailsForActionItem(1, 1); + await E2ETopics.expandDetailsForActionItem(1, 1); - E2EGlobal.waitSomeTime(100); // phantom.js needs some time here, too... + await E2EGlobal.waitSomeTime(100); // phantom.js needs some time here, too... - let itemsOfNewTopic = E2ETopics.getItemsForTopic(1); + let itemsOfNewTopic = await E2ETopics.getItemsForTopic(1); let firstItemOfNewTopic = itemsOfNewTopic[0].ELEMENT; - expect(browser.elementIdText(firstItemOfNewTopic).value) - .to.have.string(formatDateISO8601(new Date()) + ' New' + '\nNew Details'); + await expect((await browser.elementIdText(firstItemOfNewTopic)).value) + .to.have.string((await formatDateISO8601(new Date())) + ' New' + '\nNew Details'); }); it('ensures that only moderator can add details', function () { - E2EMeetingSeries.gotoMeetingSeries(aProjectName, aMeetingName); - E2EMeetingSeriesEditor.openMeetingSeriesEditor(aProjectName, aMeetingName, "invited"); + await E2EMeetingSeries.gotoMeetingSeries(aProjectName, aMeetingName); + await E2EMeetingSeriesEditor.openMeetingSeriesEditor(aProjectName, aMeetingName, "invited"); let user2 = E2EGlobal.SETTINGS.e2eTestUsers[1]; - browser.setValue('#edt_AddUser', user2); - browser.keys(['Enter']); + await browser.setValue('#edt_AddUser', user2); + await browser.keys(['Enter']); let selector = "select.user-role-select"; - let usrRoleOption = browser.selectByValue(selector, "Invited"); - E2EMeetingSeriesEditor.closeMeetingSeriesEditor(); // close with save + let usrRoleOption = await browser.selectByValue(selector, "Invited"); + await E2EMeetingSeriesEditor.closeMeetingSeriesEditor(); // close with save - E2EApp.loginUser(1); - E2EMeetingSeries.gotoMeetingSeries(aProjectName, aMeetingName); - E2EGlobal.waitSomeTime(); + await E2EApp.loginUser(1); + await E2EMeetingSeries.gotoMeetingSeries(aProjectName, aMeetingName); + await E2EGlobal.waitSomeTime(); - E2EMinutes.gotoLatestMinutes(); + await E2EMinutes.gotoLatestMinutes(); - E2ETopics.addDetailsToActionItem(1, 1, 'New Details'); + await E2ETopics.addDetailsToActionItem(1, 1, 'New Details'); - let itemsOfNewTopic = E2ETopics.getItemsForTopic(1); + let itemsOfNewTopic = await E2ETopics.getItemsForTopic(1); let firstItemOfNewTopic = itemsOfNewTopic[0].ELEMENT; - expect(browser.elementIdText(firstItemOfNewTopic).value) - .to.not.have.string(formatDateISO8601(new Date()) + ' New' + '\nNew Details'); + await expect((await browser.elementIdText(firstItemOfNewTopic)).value) + .to.not.have.string((await formatDateISO8601(new Date())) + ' New' + '\nNew Details'); - E2EApp.loginUser(); + await E2EApp.loginUser(); }); it('ensures that only moderator can change details', function () { - E2ETopics.addDetailsToActionItem(1, 1, 'Old Details'); + await E2ETopics.addDetailsToActionItem(1, 1, 'Old Details'); - E2EMeetingSeries.gotoMeetingSeries(aProjectName, aMeetingName); - E2EMeetingSeriesEditor.openMeetingSeriesEditor(aProjectName, aMeetingName, "invited"); + await E2EMeetingSeries.gotoMeetingSeries(aProjectName, aMeetingName); + await E2EMeetingSeriesEditor.openMeetingSeriesEditor(aProjectName, aMeetingName, "invited"); let user2 = E2EGlobal.SETTINGS.e2eTestUsers[1]; - browser.setValue('#edt_AddUser', user2); - browser.keys(['Enter']); + await browser.setValue('#edt_AddUser', user2); + await browser.keys(['Enter']); let selector = "select.user-role-select"; - let usrRoleOption = browser.selectByValue(selector, "Invited"); - E2EMeetingSeriesEditor.closeMeetingSeriesEditor(); // close with save + let usrRoleOption = await browser.selectByValue(selector, "Invited"); + await E2EMeetingSeriesEditor.closeMeetingSeriesEditor(); // close with save - E2EApp.loginUser(1); - E2EMeetingSeries.gotoMeetingSeries(aProjectName, aMeetingName); - E2EGlobal.waitSomeTime(); + await E2EApp.loginUser(1); + await E2EMeetingSeries.gotoMeetingSeries(aProjectName, aMeetingName); + await E2EGlobal.waitSomeTime(); - E2EMinutes.gotoLatestMinutes(); + await E2EMinutes.gotoLatestMinutes(); - E2ETopics.editDetailsForActionItem(1, 1, 1, 'Changed Details'); + await E2ETopics.editDetailsForActionItem(1, 1, 1, 'Changed Details'); - let itemsOfNewTopic = E2ETopics.getItemsForTopic(1); + let itemsOfNewTopic = await E2ETopics.getItemsForTopic(1); let firstItemOfNewTopic = itemsOfNewTopic[0].ELEMENT; - expect(browser.elementIdText(firstItemOfNewTopic).value) - .to.have.string(formatDateISO8601(new Date()) + ' New' + '\nOld Details'); + await expect((await browser.elementIdText(firstItemOfNewTopic)).value) + .to.have.string((await formatDateISO8601(new Date())) + ' New' + '\nOld Details'); - E2EApp.loginUser(); + await E2EApp.loginUser(); }); it('can follow a-hyperlink in details', function() { - E2ETopics.addDetailsToActionItem(1, 1, 'New Details with link to http://www.google.com'); + await E2ETopics.addDetailsToActionItem(1, 1, 'New Details with link to http://www.google.com'); - E2EGlobal.clickWithRetry(".detailText a"); - E2EGlobal.waitSomeTime(); - console.log("new URL after click:"+browser.getUrl()); - expect(browser.getUrl()).to.contain.string("google"); + await E2EGlobal.clickWithRetry(".detailText a"); + await E2EGlobal.waitSomeTime(); + console.log("new URL after click:"+(await browser.getUrl())); + await expect(await browser.getUrl()).to.contain.string("google"); }); }); \ No newline at end of file diff --git a/tests/end2end/LDAP-test.js b/tests/end2end/LDAP-test.js index e854f8f1e..2209fcc5d 100644 --- a/tests/end2end/LDAP-test.js +++ b/tests/end2end/LDAP-test.js @@ -8,93 +8,93 @@ describe('LDAP', function () { let aMeetingNameBase = "Meeting Name #"; let aMeetingName; - let getNewMeetingName = () => { + let getNewMeetingName = async () => { aMeetingCounter++; return aMeetingNameBase + aMeetingCounter; }; before("reload page and reset app", function () { - E2EGlobal.logTimestamp("Start test suite"); - E2EApp.resetMyApp(true); - E2EApp.launchApp(); + await E2EGlobal.logTimestamp("Start test suite"); + await E2EApp.resetMyApp(true); + await E2EApp.launchApp(); }); beforeEach("make sure test user is logged out and on the start page", function () { - E2EApp.logoutUser(); - expect(E2EApp.isNotLoggedIn()).to.be.true; + await E2EApp.logoutUser(); + expect(await E2EApp.isNotLoggedIn()).to.be.true; }); after("clear database and login user", function () { - E2EApp.launchApp(); - E2EApp.loginUser(); - expect(E2EApp.isLoggedIn()).to.be.true; + await E2EApp.launchApp(); + await E2EApp.loginUser(); + expect(await E2EApp.isLoggedIn()).to.be.true; }); xit('import cronjob does not produce errors', function () { - const numberOfUsersWithoutLdap = server.call('e2e.removeLdapUsersFromDb'); + const numberOfUsersWithoutLdap = await server.call('e2e.removeLdapUsersFromDb'); - server.call('e2e.importLdapUsers'); + await server.call('e2e.importLdapUsers'); - const numberOfUsersAfterImport = server.call('e2e.countUsers'); - expect(numberOfUsersAfterImport).to.be.greaterThan(numberOfUsersWithoutLdap); + const numberOfUsersAfterImport = await server.call('e2e.countUsers'); + await expect(numberOfUsersAfterImport).to.be.greaterThan(numberOfUsersWithoutLdap); }); it('ldap user can login with his credentials', function () { - E2EApp.loginLdapUserWithCredentials('ldapUser1', 'ldapPwd1', false); + await E2EApp.loginLdapUserWithCredentials('ldapUser1', 'ldapPwd1', false); - expect(E2EApp.isLoggedIn()).to.be.true; + expect(await E2EApp.isLoggedIn()).to.be.true; }); it('ldap user can NOT reset password', function () { - E2EApp.loginLdapUserWithCredentials('ldapUser1', 'ldapPwd1', false); - E2EApp.logoutUser(); - - E2EGlobal.clickWithRetry('#tab_standard'); - E2EGlobal.waitSomeTime(600); - if (browser.isVisible('#at-forgotPwd')) { - E2EApp.resetPassword('ldapUser1@example.com'); - E2EGlobal.waitSomeTime(1500); - expect(browser.isVisible('.at-error'), 'Error should be visible').to.be.true; + await E2EApp.loginLdapUserWithCredentials('ldapUser1', 'ldapPwd1', false); + await E2EApp.logoutUser(); + + await E2EGlobal.clickWithRetry('#tab_standard'); + await E2EGlobal.waitSomeTime(600); + if (await browser.isVisible('#at-forgotPwd')) { + await E2EApp.resetPassword('ldapUser1@example.com'); + await E2EGlobal.waitSomeTime(1500); + expect(await browser.isVisible('.at-error'), 'Error should be visible').to.be.true; } else { - expect(browser.isVisible('#at-forgotPwd'), 'Change password should be invisible').to.be.false; + expect(await browser.isVisible('#at-forgotPwd'), 'Change password should be invisible').to.be.false; } }); it('ldap user can create meeting series', function () { - E2EApp.loginLdapUserWithCredentials('ldapUser1', 'ldapPwd1', false); + await E2EApp.loginLdapUserWithCredentials('ldapUser1', 'ldapPwd1', false); - let initialCount = E2EMeetingSeries.countMeetingSeries(); + let initialCount = await E2EMeetingSeries.countMeetingSeries(); - aMeetingName = getNewMeetingName(); - E2EMeetingSeries.createMeetingSeries(aProjectName, aMeetingName); + aMeetingName = await getNewMeetingName(); + await E2EMeetingSeries.createMeetingSeries(aProjectName, aMeetingName); - expect(E2EMeetingSeries.countMeetingSeries()).to.equal(initialCount + 1); - expect(E2EMeetingSeries.getMeetingSeriesId(aProjectName, aMeetingName)).to.be.ok; + await expect(await E2EMeetingSeries.countMeetingSeries()).to.equal(initialCount + 1); + expect(await E2EMeetingSeries.getMeetingSeriesId(aProjectName, aMeetingName)).to.be.ok; }); it('ldap user will be rejected if the password is wrong', function () { let loginUnexpectedlySucceeded = false; try { - E2EApp.loginLdapUserWithCredentials('ldapUser1', 'wrongPassword', false); + await E2EApp.loginLdapUserWithCredentials('ldapUser1', 'wrongPassword', false); loginUnexpectedlySucceeded = true; } catch (e) { - expect(e.toString()).to.include('Unknown user or wrong password.'); + await expect(e.toString()).to.include('Unknown user or wrong password.'); } expect(loginUnexpectedlySucceeded).to.be.false; - expect(E2EApp.isNotLoggedIn()).to.be.true; + expect(await E2EApp.isNotLoggedIn()).to.be.true; }); it('ldap user can not log in with the standard login form', function () { let message = 'Login failed for user ldapUser1 with ldapPwd1\nwith Error: Unknown user or wrong password.'; - let login = () => { - E2EApp.loginUserWithCredentials('ldapUser1', 'ldapPwd1', false); + let login = async () => { + await E2EApp.loginUserWithCredentials('ldapUser1', 'ldapPwd1', false); }; - expect(login).to.throw(message); + await expect(login).to.throw(message); - expect(E2EApp.isNotLoggedIn()).to.be.true; + expect(await E2EApp.isNotLoggedIn()).to.be.true; }); }); \ No newline at end of file diff --git a/tests/end2end/Labels-test.js b/tests/end2end/Labels-test.js index 8b4de3ac9..a8cc56c5e 100644 --- a/tests/end2end/Labels-test.js +++ b/tests/end2end/Labels-test.js @@ -17,36 +17,36 @@ describe('Labels', function () { let aAICounter = 0; let aAINameBase = "Action Item Name #"; - let getNewMeetingName = () => { + let getNewMeetingName = async () => { aMeetingCounter++; return aMeetingNameBase + aMeetingCounter; }; - let getNewTopicName = () => { + let getNewTopicName = async () => { aTopicCounter++; return aTopicNameBase + aTopicCounter; }; - let getNewAIName = () => { + let getNewAIName = async () => { aAICounter++; return aAINameBase + aAICounter; }; before("reload page and reset app", function () { - E2EGlobal.logTimestamp("Start test suite"); - E2EApp.resetMyApp(true); - E2EApp.launchApp(); + await E2EGlobal.logTimestamp("Start test suite"); + await E2EApp.resetMyApp(true); + await E2EApp.launchApp(); }); beforeEach("make sure test user is logged in, create series and add minutes", function () { - E2EApp.gotoStartPage(); - expect(E2EApp.isLoggedIn()).to.be.true; + await E2EApp.gotoStartPage(); + expect(await E2EApp.isLoggedIn()).to.be.true; - aMeetingName = getNewMeetingName(); + aMeetingName = await getNewMeetingName(); - E2EMeetingSeries.createMeetingSeries(aProjectName, aMeetingName); - E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName); + await E2EMeetingSeries.createMeetingSeries(aProjectName, aMeetingName); + await E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName); - aTopicName = getNewTopicName(); - E2ETopics.addTopicToMinutes(aTopicName); + aTopicName = await getNewTopicName(); + await E2ETopics.addTopicToMinutes(aTopicName); }); describe("Labels for Action- / Info Items", function () { @@ -55,62 +55,62 @@ describe('Labels', function () { const labelName = "MyCustomLabel"; const labelColor = "#ff0000"; - E2ETopics.addInfoItemToTopic({ - subject: getNewAIName(), + await E2ETopics.addInfoItemToTopic({ + subject: await getNewAIName(), itemType: "actionItem" }, 1); - E2ETopics.addLabelToItem(1, 1, labelName + labelColor); + await E2ETopics.addLabelToItem(1, 1, labelName + labelColor); - var items = E2ETopics.getItemsForTopic(1); + var items = await E2ETopics.getItemsForTopic(1); let firstActionITem = items[0].ELEMENT; - let visibleText = browser.elementIdText(firstActionITem).value; - expect(visibleText).to.have.string(labelName); - expect(visibleText).to.not.have.string(labelColor); + let visibleText = (await browser.elementIdText(firstActionITem)).value; + await expect(visibleText).to.have.string(labelName); + await expect(visibleText).to.not.have.string(labelColor); }); it('can add a default label to an info item', function () { const defaultLabel = E2EGlobal.SETTINGS.defaultLabels[0].name; - E2ETopics.addInfoItemToTopic({ - subject: getNewAIName(), + await E2ETopics.addInfoItemToTopic({ + subject: await getNewAIName(), itemType: "infoItem" }, 1); - E2ETopics.addLabelToItem(1, 1, defaultLabel); + await E2ETopics.addLabelToItem(1, 1, defaultLabel); - var items = E2ETopics.getItemsForTopic(1); + var items = await E2ETopics.getItemsForTopic(1); let firstActionItem = items[0].ELEMENT; - let visibleText = browser.elementIdText(firstActionItem).value; - expect(visibleText).to.have.string(defaultLabel); + let visibleText = (await browser.elementIdText(firstActionItem)).value; + await expect(visibleText).to.have.string(defaultLabel); }); it('changes the labels text in finalized minutes if the label will be renamed', function () { const labelName = 'Decision'; const renamedLabel = 'Entscheidung'; - E2ETopics.addInfoItemToTopic({ - subject: getNewAIName(), + await E2ETopics.addInfoItemToTopic({ + subject: await getNewAIName(), itemType: "infoItem" }, 1); - E2ETopics.addLabelToItem(1, 1, labelName); + await E2ETopics.addLabelToItem(1, 1, labelName); - let items = E2ETopics.getItemsForTopic(1); + let items = await E2ETopics.getItemsForTopic(1); let firstActionItem = items[0].ELEMENT; - let visibleText = browser.elementIdText(firstActionItem).value; - expect(visibleText, 'setting the label failed').to.have.string(labelName); + let visibleText = (await browser.elementIdText(firstActionItem)).value; + await expect(visibleText, 'setting the label failed').to.have.string(labelName); - E2EMinutes.finalizeCurrentMinutes(); + await E2EMinutes.finalizeCurrentMinutes(); - E2EMeetingSeriesEditor.openMeetingSeriesEditor(aProjectName, aMeetingName, "labels"); - E2EMeetingSeriesEditor.changeLabel(labelName, renamedLabel); - E2EMinutes.gotoLatestMinutes(); + await E2EMeetingSeriesEditor.openMeetingSeriesEditor(aProjectName, aMeetingName, "labels"); + await E2EMeetingSeriesEditor.changeLabel(labelName, renamedLabel); + await E2EMinutes.gotoLatestMinutes(); - items = E2ETopics.getItemsForTopic(1); + items = await E2ETopics.getItemsForTopic(1); firstActionItem = items[0].ELEMENT; - visibleText = browser.elementIdText(firstActionItem).value; - expect(visibleText, 'label name should have changed').to.have.string(renamedLabel); + visibleText = (await browser.elementIdText(firstActionItem)).value; + await expect(visibleText, 'label name should have changed').to.have.string(renamedLabel); }); it('resets the labels name if editing will be canceled', function() { @@ -118,21 +118,21 @@ describe('Labels', function () { const renamedLabel = 'Test'; const changedColor = 'ffffff'; - E2EMeetingSeriesEditor.openMeetingSeriesEditor(aProjectName, aMeetingName, "labels"); + await E2EMeetingSeriesEditor.openMeetingSeriesEditor(aProjectName, aMeetingName, "labels"); - let labelId = E2EMeetingSeriesEditor.changeLabel(labelName, renamedLabel, changedColor, false); + let labelId = await E2EMeetingSeriesEditor.changeLabel(labelName, renamedLabel, changedColor, false); let selLabelRow = '#row-label-' + labelId; - E2EGlobal.clickWithRetry(selLabelRow + ' .evt-btn-edit-cancel'); + await E2EGlobal.clickWithRetry(selLabelRow + ' .evt-btn-edit-cancel'); // open editor again - E2EGlobal.clickWithRetry(selLabelRow + ' .evt-btn-edit-label'); - let newLabelNameValue = browser.getValue(selLabelRow + " [name='labelName']"); - expect(newLabelNameValue, "label name should be restored").to.equal(labelName); + await E2EGlobal.clickWithRetry(selLabelRow + ' .evt-btn-edit-label'); + let newLabelNameValue = await browser.getValue(selLabelRow + " [name='labelName']"); + await expect(newLabelNameValue, "label name should be restored").to.equal(labelName); - let newLabelColorValue = browser.getValue(selLabelRow + " [name='labelColor-" + labelId + "']"); - expect(newLabelColorValue, "label color should be restored").to.not.equal(changedColor); + let newLabelColorValue = await browser.getValue(selLabelRow + " [name='labelColor-" + labelId + "']"); + await expect(newLabelColorValue, "label color should be restored").to.not.equal(changedColor); - E2EMeetingSeriesEditor.closeMeetingSeriesEditor(false); + await E2EMeetingSeriesEditor.closeMeetingSeriesEditor(false); }); }); diff --git a/tests/end2end/MeSeTopicList-test.js b/tests/end2end/MeSeTopicList-test.js index 450956495..b4fcf4396 100644 --- a/tests/end2end/MeSeTopicList-test.js +++ b/tests/end2end/MeSeTopicList-test.js @@ -12,288 +12,288 @@ describe('MeetingSeries complete Topic list', function () { let aMeetingName; before("reload page and reset app", function () { - E2EGlobal.logTimestamp("Start test suite"); - E2EApp.resetMyApp(true); - E2EApp.launchApp(); + await E2EGlobal.logTimestamp("Start test suite"); + await E2EApp.resetMyApp(true); + await E2EApp.launchApp(); }); beforeEach("goto start page and make sure test user is logged in", function () { - E2EApp.gotoStartPage(); - expect(E2EApp.isLoggedIn()).to.be.true; + await E2EApp.gotoStartPage(); + expect(await E2EApp.isLoggedIn()).to.be.true; aMeetingCounter++; aMeetingName = aMeetingNameBase + aMeetingCounter; - E2EMeetingSeries.createMeetingSeries(aProjectName, aMeetingName); - E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName); + await E2EMeetingSeries.createMeetingSeries(aProjectName, aMeetingName); + await E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName); }); it("copies all topics of the first minute to the parent series including both all info- and actionItems.", function () { - E2ETopics.addTopicToMinutes('some topic'); - E2ETopics.addInfoItemToTopic({subject: 'some information'}, 1); - E2ETopics.addInfoItemToTopic({subject: 'some action item', itemType: "actionItem"}, 1); + await E2ETopics.addTopicToMinutes('some topic'); + await E2ETopics.addInfoItemToTopic({subject: 'some information'}, 1); + await E2ETopics.addInfoItemToTopic({subject: 'some action item', itemType: "actionItem"}, 1); - E2EMinutes.finalizeCurrentMinutes(); + await E2EMinutes.finalizeCurrentMinutes(); - E2EMinutes.gotoParentMeetingSeries(); + await E2EMinutes.gotoParentMeetingSeries(); - E2EMeetingSeries.gotoTabTopics(); + await E2EMeetingSeries.gotoTabTopics(); - expect(E2ETopics.countTopicsForMinute(), "Meeting Series should have one topic").to.equal(1); + await expect(await E2ETopics.countTopicsForMinute(), "Meeting Series should have one topic").to.equal(1); - expect(E2ETopics.countItemsForTopic(1), "Topic should have two items").to.equal(2); + await expect(await E2ETopics.countItemsForTopic(1), "Topic should have two items").to.equal(2); - let items = E2ETopics.getItemsForTopic(1); + let items = await E2ETopics.getItemsForTopic(1); let firstItemElement = items[0].ELEMENT; - expect(browser.elementIdText(firstItemElement).value, "fist element should be the action item").to.have.string('some action item'); + await expect((await browser.elementIdText(firstItemElement)).value, "fist element should be the action item").to.have.string('some action item'); let sndElement = items[1].ELEMENT; - expect(browser.elementIdText(sndElement).value, "2nd element should be the info item").to.have.string('some information'); + await expect((await browser.elementIdText(sndElement)).value, "2nd element should be the info item").to.have.string('some information'); }); it('closes the topic if it were discussed and has no open AI', function () { - E2ETopics.addTopicToMinutes('some topic'); - E2ETopics.addInfoItemToTopic({subject: 'some information'}, 1); - E2ETopics.addInfoItemToTopic({subject: 'some action item', itemType: "actionItem"}, 1); + await E2ETopics.addTopicToMinutes('some topic'); + await E2ETopics.addInfoItemToTopic({subject: 'some information'}, 1); + await E2ETopics.addInfoItemToTopic({subject: 'some action item', itemType: "actionItem"}, 1); - E2ETopics.toggleActionItem(1, 1); - E2ETopics.toggleTopic(1); + await E2ETopics.toggleActionItem(1, 1); + await E2ETopics.toggleTopic(1); - E2EMinutes.finalizeCurrentMinutes(); + await E2EMinutes.finalizeCurrentMinutes(); - E2EMinutes.gotoParentMeetingSeries(); + await E2EMinutes.gotoParentMeetingSeries(); - E2EMeetingSeries.gotoTabTopics(); + await E2EMeetingSeries.gotoTabTopics(); - expect(E2ETopics.isTopicClosed(1), "Topic should be closed").to.be.true; + expect(await E2ETopics.isTopicClosed(1), "Topic should be closed").to.be.true; }); it('remains the topic open if it were neither discussed nor has open AI', function () { - E2ETopics.addTopicToMinutes('some topic'); - E2ETopics.addInfoItemToTopic({subject: 'some information'}, 1); - E2ETopics.addInfoItemToTopic({subject: 'some action item', itemType: "actionItem"}, 1); + await E2ETopics.addTopicToMinutes('some topic'); + await E2ETopics.addInfoItemToTopic({subject: 'some information'}, 1); + await E2ETopics.addInfoItemToTopic({subject: 'some action item', itemType: "actionItem"}, 1); - E2EMinutes.finalizeCurrentMinutes(); + await E2EMinutes.finalizeCurrentMinutes(); - E2EMinutes.gotoParentMeetingSeries(); + await E2EMinutes.gotoParentMeetingSeries(); - E2EMeetingSeries.gotoTabTopics(); + await E2EMeetingSeries.gotoTabTopics(); - expect(E2ETopics.isTopicClosed(1), "Topic should remain open").to.be.false; + expect(await E2ETopics.isTopicClosed(1), "Topic should remain open").to.be.false; }); it('remains the topic open if it were not discussed but has no open AI', function () { - E2ETopics.addTopicToMinutes('some topic'); - E2ETopics.addInfoItemToTopic({subject: 'some information'}, 1); - E2ETopics.addInfoItemToTopic({subject: 'some action item', itemType: "actionItem"}, 1); + await E2ETopics.addTopicToMinutes('some topic'); + await E2ETopics.addInfoItemToTopic({subject: 'some information'}, 1); + await E2ETopics.addInfoItemToTopic({subject: 'some action item', itemType: "actionItem"}, 1); - E2ETopics.toggleTopic(1); + await E2ETopics.toggleTopic(1); - E2EMinutes.finalizeCurrentMinutes(); + await E2EMinutes.finalizeCurrentMinutes(); - E2EMinutes.gotoParentMeetingSeries(); + await E2EMinutes.gotoParentMeetingSeries(); - E2EMeetingSeries.gotoTabTopics(); + await E2EMeetingSeries.gotoTabTopics(); - expect(E2ETopics.isTopicClosed(1), "Topic should remain open").to.be.false; + expect(await E2ETopics.isTopicClosed(1), "Topic should remain open").to.be.false; }); it('remains the topic open if it were discussed but has open AI', function () { - E2ETopics.addTopicToMinutes('some topic'); - E2ETopics.addInfoItemToTopic({subject: 'some information'}, 1); - E2ETopics.addInfoItemToTopic({subject: 'some action item', itemType: "actionItem"}, 1); + await E2ETopics.addTopicToMinutes('some topic'); + await E2ETopics.addInfoItemToTopic({subject: 'some information'}, 1); + await E2ETopics.addInfoItemToTopic({subject: 'some action item', itemType: "actionItem"}, 1); - E2ETopics.toggleActionItem(1, 1); + await E2ETopics.toggleActionItem(1, 1); - E2EMinutes.finalizeCurrentMinutes(); + await E2EMinutes.finalizeCurrentMinutes(); - E2EMinutes.gotoParentMeetingSeries(); + await E2EMinutes.gotoParentMeetingSeries(); - E2EMeetingSeries.gotoTabTopics(); + await E2EMeetingSeries.gotoTabTopics(); - expect(E2ETopics.isTopicClosed(1), "Topic should remain open").to.be.false; + expect(await E2ETopics.isTopicClosed(1), "Topic should remain open").to.be.false; }); it('Closed Topics have a Re-open Button, open ones not', function () { - E2ETopics.addTopicToMinutes('some open topic'); - E2ETopics.addTopicToMinutes('some closed topic'); - E2ETopics.toggleTopic(1); + await E2ETopics.addTopicToMinutes('some open topic'); + await E2ETopics.addTopicToMinutes('some closed topic'); + await E2ETopics.toggleTopic(1); - E2EMinutes.finalizeCurrentMinutes(); - E2EMinutes.gotoParentMeetingSeries(); - E2EMeetingSeries.gotoTabTopics(); + await E2EMinutes.finalizeCurrentMinutes(); + await E2EMinutes.gotoParentMeetingSeries(); + await E2EMeetingSeries.gotoTabTopics(); - expect(E2ETopics.isTopicClosed(2), "Topic should be open").to.be.false; - expect(E2ETopics.isTopicClosed(1), "Topic should be closed").to.be.true; + expect(await E2ETopics.isTopicClosed(2), "Topic should be open").to.be.false; + expect(await E2ETopics.isTopicClosed(1), "Topic should be closed").to.be.true; - expect(E2ETopics.hasDropDownMenuButton(2, '#btnReopenTopic')).to.be.false; - expect(E2ETopics.hasDropDownMenuButton(1, '#btnReopenTopic')).to.be.true; + expect(await E2ETopics.hasDropDownMenuButton(2, '#btnReopenTopic')).to.be.false; + expect(await E2ETopics.hasDropDownMenuButton(1, '#btnReopenTopic')).to.be.true; }); it('Only Moderator can Re-Open a closed Topic', function () { - E2ETopics.addTopicToMinutes('some closed topic'); - E2ETopics.toggleTopic(1); - E2EMinutes.finalizeCurrentMinutes(); + await E2ETopics.addTopicToMinutes('some closed topic'); + await E2ETopics.toggleTopic(1); + await E2EMinutes.finalizeCurrentMinutes(); - E2EMeetingSeriesEditor.openMeetingSeriesEditor(aProjectName, aMeetingName, "invited"); - E2EGlobal.waitSomeTime(750); + await E2EMeetingSeriesEditor.openMeetingSeriesEditor(aProjectName, aMeetingName, "invited"); + await E2EGlobal.waitSomeTime(750); let user2 = E2EGlobal.SETTINGS.e2eTestUsers[1]; - E2EMeetingSeriesEditor.addUserToMeetingSeries(user2); - E2EMeetingSeriesEditor.closeMeetingSeriesEditor(); // close with save + await E2EMeetingSeriesEditor.addUserToMeetingSeries(user2); + await E2EMeetingSeriesEditor.closeMeetingSeriesEditor(); // close with save - E2EApp.loginUser(1); - E2EMeetingSeries.gotoMeetingSeries(aProjectName, aMeetingName); - E2EMeetingSeries.gotoTabTopics(); + await E2EApp.loginUser(1); + await E2EMeetingSeries.gotoMeetingSeries(aProjectName, aMeetingName); + await E2EMeetingSeries.gotoTabTopics(); - expect(E2ETopics.isTopicClosed(1), "Topic should be closed").to.be.true; - expect(E2ETopics.hasDropDownMenuButton(1, '#btnReopenTopic')).to.be.false; - E2EApp.loginUser(); + expect(await E2ETopics.isTopicClosed(1), "Topic should be closed").to.be.true; + expect(await E2ETopics.hasDropDownMenuButton(1, '#btnReopenTopic')).to.be.false; + await E2EApp.loginUser(); }); it('Reopen a Topic if there is no currently unfinalized Minute', function () { - E2ETopics.addTopicToMinutes('some closed topic'); - E2ETopics.toggleTopic(1); - E2EMinutes.finalizeCurrentMinutes(); + await E2ETopics.addTopicToMinutes('some closed topic'); + await E2ETopics.toggleTopic(1); + await E2EMinutes.finalizeCurrentMinutes(); - E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName); - E2EMinutes.finalizeCurrentMinutes(); + await E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName); + await E2EMinutes.finalizeCurrentMinutes(); - E2EMinutes.gotoParentMeetingSeries(); - E2EMeetingSeries.gotoTabTopics(); - expect(E2ETopics.isTopicClosed(1), "Topic should be closed").to.be.true; + await E2EMinutes.gotoParentMeetingSeries(); + await E2EMeetingSeries.gotoTabTopics(); + expect(await E2ETopics.isTopicClosed(1), "Topic should be closed").to.be.true; //try to reopen the topic - E2ETopics.reOpenTopic(1); - expect(E2ETopics.isTopicClosed(1), "Topic should be reopened").to.be.false; + await E2ETopics.reOpenTopic(1); + expect(await E2ETopics.isTopicClosed(1), "Topic should be reopened").to.be.false; // currently finalized minute should not get the reopened Topic - E2EMeetingSeries.gotoTabMinutes(); - E2EMinutes.gotoLatestMinutes(); - expect(E2ETopics.countTopicsForMinute()).to.equal(0); + await E2EMeetingSeries.gotoTabMinutes(); + await E2EMinutes.gotoLatestMinutes(); + await expect(await E2ETopics.countTopicsForMinute()).to.equal(0); //a minute which is opened after reopening the topic should contain the topic - E2EMinutes.gotoParentMeetingSeries(); - E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName); - E2EMinutes.gotoLatestMinutes(); - expect(E2ETopics.countTopicsForMinute()).to.equal(1); + await E2EMinutes.gotoParentMeetingSeries(); + await E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName); + await E2EMinutes.gotoLatestMinutes(); + await expect(await E2ETopics.countTopicsForMinute()).to.equal(1); }); it('Reopen a Topic if there is a currently unfinalized Minute', function () { - E2ETopics.addTopicToMinutes('some closed topic'); - E2ETopics.toggleTopic(1); - E2EMinutes.finalizeCurrentMinutes(); + await E2ETopics.addTopicToMinutes('some closed topic'); + await E2ETopics.toggleTopic(1); + await E2EMinutes.finalizeCurrentMinutes(); - E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName); - expect(E2ETopics.countTopicsForMinute()).to.equal(0); + await E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName); + await expect(await E2ETopics.countTopicsForMinute()).to.equal(0); - E2EMinutes.gotoParentMeetingSeries(); - E2EMeetingSeries.gotoTabTopics(); - E2ETopics.reOpenTopic(1); + await E2EMinutes.gotoParentMeetingSeries(); + await E2EMeetingSeries.gotoTabTopics(); + await E2ETopics.reOpenTopic(1); // the topic should have been copied to the latest minute - E2EMeetingSeries.gotoTabMinutes(); - E2EMinutes.gotoLatestMinutes(); - E2EGlobal.waitSomeTime(); - expect(E2ETopics.countTopicsForMinute()).to.equal(1); + await E2EMeetingSeries.gotoTabMinutes(); + await E2EMinutes.gotoLatestMinutes(); + await E2EGlobal.waitSomeTime(); + await expect(await E2ETopics.countTopicsForMinute()).to.equal(1); }); describe('merge topics', function () { beforeEach('Create and finalize a first minute', function() { - E2ETopics.addTopicToMinutes('some topic'); - E2ETopics.addInfoItemToTopic({subject: 'some information'}, 1); - E2ETopics.addInfoItemToTopic({subject: 'some action item', itemType: "actionItem"}, 1); + await E2ETopics.addTopicToMinutes('some topic'); + await E2ETopics.addInfoItemToTopic({subject: 'some information'}, 1); + await E2ETopics.addInfoItemToTopic({subject: 'some action item', itemType: "actionItem"}, 1); - E2EMinutes.finalizeCurrentMinutes(); + await E2EMinutes.finalizeCurrentMinutes(); - E2EMinutes.gotoParentMeetingSeries(); + await E2EMinutes.gotoParentMeetingSeries(); }); it('clears the topic list if the first minute will be un-finalized.', function() { - E2EMinutes.gotoLatestMinutes(); + await E2EMinutes.gotoLatestMinutes(); - E2EMinutes.unfinalizeCurrentMinutes(); + await E2EMinutes.unfinalizeCurrentMinutes(); - E2EMinutes.gotoParentMeetingSeries(); + await E2EMinutes.gotoParentMeetingSeries(); - E2EMeetingSeries.gotoTabTopics(); + await E2EMeetingSeries.gotoTabTopics(); - expect(E2ETopics.countTopicsForMinute()).to.equal(0); + await expect(await E2ETopics.countTopicsForMinute()).to.equal(0); }); it("adds new topics and AIs/IIs to the topic list of the meeting series", function () { // add a second minute - E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName); + await E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName); // add new items (AI and II) to existing topic - E2ETopics.addInfoItemToTopic({subject: 'some other information'}, 1); - E2ETopics.addInfoItemToTopic({subject: 'some other action item', itemType: "actionItem"}, 1); + await E2ETopics.addInfoItemToTopic({subject: 'some other information'}, 1); + await E2ETopics.addInfoItemToTopic({subject: 'some other action item', itemType: "actionItem"}, 1); // add a new topic - E2ETopics.addTopicToMinutes('some other topic'); - E2ETopics.addInfoItemToTopic({subject: 'with information'}, 1); - E2ETopics.addInfoItemToTopic({subject: 'with an action item', itemType: "actionItem"}, 1); + await E2ETopics.addTopicToMinutes('some other topic'); + await E2ETopics.addInfoItemToTopic({subject: 'with information'}, 1); + await E2ETopics.addInfoItemToTopic({subject: 'with an action item', itemType: "actionItem"}, 1); - E2EMinutes.finalizeCurrentMinutes(); + await E2EMinutes.finalizeCurrentMinutes(); - E2EMinutes.gotoParentMeetingSeries(); + await E2EMinutes.gotoParentMeetingSeries(); - E2EMeetingSeries.gotoTabTopics(); + await E2EMeetingSeries.gotoTabTopics(); - expect(E2ETopics.countTopicsForMinute(), "Meeting Series should have now two topics").to.equal(2); + await expect(await E2ETopics.countTopicsForMinute(), "Meeting Series should have now two topics").to.equal(2); // check the first topic (this should be the new one) - expect(E2ETopics.countItemsForTopic(1), "New Topic should have two items").to.equal(2); - let itemsOfNewTopic = E2ETopics.getItemsForTopic(1); + await expect(await E2ETopics.countItemsForTopic(1), "New Topic should have two items").to.equal(2); + let itemsOfNewTopic = await E2ETopics.getItemsForTopic(1); let firstItemOfNewTopic = itemsOfNewTopic[0].ELEMENT; - expect(browser.elementIdText(firstItemOfNewTopic).value, "first item of new topic should be the action item") + await expect((await browser.elementIdText(firstItemOfNewTopic)).value, "first item of new topic should be the action item") .to.have.string('with an action item'); let sndItemOfNewTopic = itemsOfNewTopic[1].ELEMENT; - expect(browser.elementIdText(sndItemOfNewTopic).value, "2nd item of new topic should be the info item") + await expect((await browser.elementIdText(sndItemOfNewTopic)).value, "2nd item of new topic should be the info item") .to.have.string('with information'); // check the 2nd topic (the merged one) - expect(E2ETopics.countItemsForTopic(2), "Merged Topic should now have four items").to.equal(4); + await expect(await E2ETopics.countItemsForTopic(2), "Merged Topic should now have four items").to.equal(4); }); it('closes an existing open AI but remains the topic open if it were not discussed', function () { // add a second minute - E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName); + await E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName); - E2ETopics.toggleActionItem(1, 1); + await E2ETopics.toggleActionItem(1, 1); - E2EMinutes.finalizeCurrentMinutes(); + await E2EMinutes.finalizeCurrentMinutes(); - E2EMinutes.gotoParentMeetingSeries(); + await E2EMinutes.gotoParentMeetingSeries(); - E2EMeetingSeries.gotoTabTopics(); + await E2EMeetingSeries.gotoTabTopics(); - expect(E2ETopics.countTopicsForMinute(), "Meeting Series should still have only one topic").to.equal(1); + await expect(await E2ETopics.countTopicsForMinute(), "Meeting Series should still have only one topic").to.equal(1); - expect(E2ETopics.isTopicClosed(1), "Topic should remain open").to.be.false; - expect(E2ETopics.isActionItemClosed(1, 1), "AI should be closed").to.be.true; + expect(await E2ETopics.isTopicClosed(1), "Topic should remain open").to.be.false; + expect(await E2ETopics.isActionItemClosed(1, 1), "AI should be closed").to.be.true; }); it('closes an existing open AI and closes the topic if it were discussed', function () { // add a second minute - E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName); + await E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName); - E2ETopics.toggleActionItem(1, 1); - E2ETopics.toggleTopic(1); + await E2ETopics.toggleActionItem(1, 1); + await E2ETopics.toggleTopic(1); - E2EMinutes.finalizeCurrentMinutes(); + await E2EMinutes.finalizeCurrentMinutes(); - E2EMinutes.gotoParentMeetingSeries(); + await E2EMinutes.gotoParentMeetingSeries(); - E2EMeetingSeries.gotoTabTopics(); + await E2EMeetingSeries.gotoTabTopics(); - expect(E2ETopics.countTopicsForMinute(), "Meeting Series should still have only one topic").to.equal(1); + await expect(await E2ETopics.countTopicsForMinute(), "Meeting Series should still have only one topic").to.equal(1); - expect(E2ETopics.isTopicClosed(1), "Topic should be closed").to.be.true; - expect(E2ETopics.isActionItemClosed(1, 1), "AI should be closed").to.be.true; + expect(await E2ETopics.isTopicClosed(1), "Topic should be closed").to.be.true; + expect(await E2ETopics.isActionItemClosed(1, 1), "AI should be closed").to.be.true; }); it('changes the properties (subject/responsible) of an existing Topic', function () { @@ -301,20 +301,20 @@ describe('MeetingSeries complete Topic list', function () { const newResponsible = "user1"; // add a second minute - E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName); + await E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName); - E2ETopics.editTopicForMinutes(1, newTopicSubject, newResponsible); + await E2ETopics.editTopicForMinutes(1, newTopicSubject, newResponsible); - E2EMinutes.finalizeCurrentMinutes(); + await E2EMinutes.finalizeCurrentMinutes(); - E2EMinutes.gotoParentMeetingSeries(); + await E2EMinutes.gotoParentMeetingSeries(); - E2EMeetingSeries.gotoTabTopics(); + await E2EMeetingSeries.gotoTabTopics(); - let topicItems = E2ETopics.getTopicsForMinute(); + let topicItems = await E2ETopics.getTopicsForMinute(); let topicEl = topicItems[0].ELEMENT; - expect(browser.elementIdText(topicEl).value, "the topic subject should have changed").to.have.string(newTopicSubject); - expect(browser.elementIdText(topicEl).value, "the topic responsible should have changed").to.have.string(newResponsible); + await expect((await browser.elementIdText(topicEl)).value, "the topic subject should have changed").to.have.string(newTopicSubject); + await expect((await browser.elementIdText(topicEl)).value, "the topic responsible should have changed").to.have.string(newResponsible); }); it('reverts property changes (subject/responsible) of a Topic if the minute will be un-finalized', function () { @@ -322,21 +322,21 @@ describe('MeetingSeries complete Topic list', function () { const newResponsible = "user1"; // add a second minute - E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName); + await E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName); - E2ETopics.editTopicForMinutes(1, newTopicSubject, newResponsible); + await E2ETopics.editTopicForMinutes(1, newTopicSubject, newResponsible); - E2EMinutes.finalizeCurrentMinutes(); - E2EMinutes.unfinalizeCurrentMinutes(); + await E2EMinutes.finalizeCurrentMinutes(); + await E2EMinutes.unfinalizeCurrentMinutes(); - E2EMinutes.gotoParentMeetingSeries(); + await E2EMinutes.gotoParentMeetingSeries(); - E2EMeetingSeries.gotoTabTopics(); + await E2EMeetingSeries.gotoTabTopics(); - let topicItems = E2ETopics.getTopicsForMinute(); + let topicItems = await E2ETopics.getTopicsForMinute(); let topicEl = topicItems[0].ELEMENT; - expect(browser.elementIdText(topicEl).value, "the topic subject should have changed").to.not.have.string(newTopicSubject); - expect(browser.elementIdText(topicEl).value, "the topic responsible should have changed").to.not.have.string(newResponsible); + await expect((await browser.elementIdText(topicEl)).value, "the topic subject should have changed").to.not.have.string(newTopicSubject); + await expect((await browser.elementIdText(topicEl)).value, "the topic responsible should have changed").to.not.have.string(newResponsible); }); it('changes the properties (subject/responsible) of an existing AI', function () { @@ -344,20 +344,20 @@ describe('MeetingSeries complete Topic list', function () { const newResponsible = "user1"; // add a second minute - E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName); + await E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName); - E2ETopics.editInfoItemForTopic(1, 1, { subject: newSubject, responsible: newResponsible }); + await E2ETopics.editInfoItemForTopic(1, 1, { subject: newSubject, responsible: newResponsible }); - E2EMinutes.finalizeCurrentMinutes(); + await E2EMinutes.finalizeCurrentMinutes(); - E2EMinutes.gotoParentMeetingSeries(); + await E2EMinutes.gotoParentMeetingSeries(); - E2EMeetingSeries.gotoTabTopics(); + await E2EMeetingSeries.gotoTabTopics(); - let items = E2ETopics.getItemsForTopic(1); + let items = await E2ETopics.getItemsForTopic(1); let firstItemElement = items[0].ELEMENT; - expect(browser.elementIdText(firstItemElement).value, "the action item subject should have changed").to.have.string(newSubject); - expect(browser.elementIdText(firstItemElement).value, "the action item responsible should have changed").to.have.string(newResponsible); + await expect((await browser.elementIdText(firstItemElement)).value, "the action item subject should have changed").to.have.string(newSubject); + await expect((await browser.elementIdText(firstItemElement)).value, "the action item responsible should have changed").to.have.string(newResponsible); }); it('reverts property changes (subject/responsible) of an AI if the minute will be un-finalized', function () { @@ -365,68 +365,68 @@ describe('MeetingSeries complete Topic list', function () { const newResponsible = "user1"; // add a second minute - E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName); + await E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName); - E2ETopics.editInfoItemForTopic(1, 1, { subject: newSubject, responsible: newResponsible }); + await E2ETopics.editInfoItemForTopic(1, 1, { subject: newSubject, responsible: newResponsible }); - E2EMinutes.finalizeCurrentMinutes(); - E2EMinutes.unfinalizeCurrentMinutes(); + await E2EMinutes.finalizeCurrentMinutes(); + await E2EMinutes.unfinalizeCurrentMinutes(); - E2EMinutes.gotoParentMeetingSeries(); + await E2EMinutes.gotoParentMeetingSeries(); - E2EMeetingSeries.gotoTabTopics(); + await E2EMeetingSeries.gotoTabTopics(); - let items = E2ETopics.getItemsForTopic(1); + let items = await E2ETopics.getItemsForTopic(1); let firstItemElement = items[0].ELEMENT; - expect(browser.elementIdText(firstItemElement).value, "the action item subject should have changed").to.not.have.string(newSubject); - expect(browser.elementIdText(firstItemElement).value, "the action item responsible should have changed").to.not.have.string("Resp: " + newResponsible); + await expect((await browser.elementIdText(firstItemElement)).value, "the action item subject should have changed").to.not.have.string(newSubject); + await expect((await browser.elementIdText(firstItemElement)).value, "the action item responsible should have changed").to.not.have.string("Resp: " + newResponsible); }); it('removes the is-New-Flag of an existing topic after finalizing the 2nd minute', function () { // add a second minute - E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName); - E2EMinutes.finalizeCurrentMinutes(); - E2EMinutes.gotoParentMeetingSeries(); + await E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName); + await E2EMinutes.finalizeCurrentMinutes(); + await E2EMinutes.gotoParentMeetingSeries(); - E2EMeetingSeries.gotoTabTopics(); + await E2EMeetingSeries.gotoTabTopics(); - let items = E2ETopics.getItemsForTopic(1); + let items = await E2ETopics.getItemsForTopic(1); let firstItemElement = items[0].ELEMENT; - expect(browser.elementIdText(firstItemElement).value).to.not.have.string("New"); + await expect((await browser.elementIdText(firstItemElement)).value).to.not.have.string("New"); }); it('restores the is-New-Flag of an existing topic after un-finalizing the 2nd minute', function () { // add a second minute - E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName); - E2EMinutes.finalizeCurrentMinutes(); - E2EMinutes.unfinalizeCurrentMinutes(); + await E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName); + await E2EMinutes.finalizeCurrentMinutes(); + await E2EMinutes.unfinalizeCurrentMinutes(); - E2EMinutes.gotoParentMeetingSeries(); + await E2EMinutes.gotoParentMeetingSeries(); - E2EMeetingSeries.gotoTabTopics(); + await E2EMeetingSeries.gotoTabTopics(); - let items = E2ETopics.getItemsForTopic(1); + let items = await E2ETopics.getItemsForTopic(1); let firstItemElement = items[0].ELEMENT; - expect(browser.elementIdText(firstItemElement).value).to.have.string("New"); + await expect((await browser.elementIdText(firstItemElement)).value).to.have.string("New"); }); it('removes the topic from the meeting series topics list if it was created int the un-finalized minutes', function() { // add a second minute - E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName); + await E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName); // add a new topic - E2ETopics.addTopicToMinutes('some other topic'); - E2ETopics.addInfoItemToTopic({subject: 'with information'}, 1); - E2ETopics.addInfoItemToTopic({subject: 'with an action item', itemType: "actionItem"}, 1); + await E2ETopics.addTopicToMinutes('some other topic'); + await E2ETopics.addInfoItemToTopic({subject: 'with information'}, 1); + await E2ETopics.addInfoItemToTopic({subject: 'with an action item', itemType: "actionItem"}, 1); - E2EMinutes.finalizeCurrentMinutes(); - E2EMinutes.unfinalizeCurrentMinutes(); + await E2EMinutes.finalizeCurrentMinutes(); + await E2EMinutes.unfinalizeCurrentMinutes(); - E2EMinutes.gotoParentMeetingSeries(); + await E2EMinutes.gotoParentMeetingSeries(); - E2EMeetingSeries.gotoTabTopics(); + await E2EMeetingSeries.gotoTabTopics(); - expect(E2ETopics.countTopicsForMinute()).to.equal(1); + await expect(await E2ETopics.countTopicsForMinute()).to.equal(1); }); }); diff --git a/tests/end2end/MeSetemsTab-test.js b/tests/end2end/MeSetemsTab-test.js index f14e437ef..06c2e3de9 100644 --- a/tests/end2end/MeSetemsTab-test.js +++ b/tests/end2end/MeSetemsTab-test.js @@ -12,39 +12,39 @@ describe('MeetingSeries Items Tab', function () { let aMeetingName; before("reload page and reset app", function () { - E2EGlobal.logTimestamp("Start test suite"); - E2EApp.resetMyApp(true); - E2EApp.launchApp(); + await E2EGlobal.logTimestamp("Start test suite"); + await E2EApp.resetMyApp(true); + await E2EApp.launchApp(); }); beforeEach("goto start page and make sure test user is logged in", function () { - E2EApp.gotoStartPage(); - expect(E2EApp.isLoggedIn()).to.be.true; + await E2EApp.gotoStartPage(); + expect(await E2EApp.isLoggedIn()).to.be.true; aMeetingCounter++; aMeetingName = aMeetingNameBase + aMeetingCounter; - E2EMeetingSeries.createMeetingSeries(aProjectName, aMeetingName); - E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName); + await E2EMeetingSeries.createMeetingSeries(aProjectName, aMeetingName); + await E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName); }); it("can filter the list of items", function () { - E2ETopics.addTopicToMinutes('some topic'); - E2ETopics.addInfoItemToTopic({subject: 'some information'}, 1); - E2ETopics.addInfoItemToTopic({subject: 'some action item', itemType: "actionItem"}, 1); - E2ETopics.addInfoItemToTopic({subject: 'some action item with information', itemType: "actionItem"}, 1); + await E2ETopics.addTopicToMinutes('some topic'); + await E2ETopics.addInfoItemToTopic({subject: 'some information'}, 1); + await E2ETopics.addInfoItemToTopic({subject: 'some action item', itemType: "actionItem"}, 1); + await E2ETopics.addInfoItemToTopic({subject: 'some action item with information', itemType: "actionItem"}, 1); - E2EMinutes.finalizeCurrentMinutes(); + await E2EMinutes.finalizeCurrentMinutes(); - E2EMinutes.gotoParentMeetingSeries(); + await E2EMinutes.gotoParentMeetingSeries(); - E2EMeetingSeries.gotoTabItems(); + await E2EMeetingSeries.gotoTabItems(); - expect(E2ETopics.countItemsForTopic('#itemPanel'), "Items list should have three items").to.equal(3); + await expect(await E2ETopics.countItemsForTopic('#itemPanel'), "Items list should have three items").to.equal(3); - browser.setValue('#inputFilter', 'information'); - expect(E2ETopics.countItemsForTopic('#itemPanel'), "Items list should have now two items").to.equal(2); + await browser.setValue('#inputFilter', 'information'); + await expect(await E2ETopics.countItemsForTopic('#itemPanel'), "Items list should have now two items").to.equal(2); }); diff --git a/tests/end2end/MeetingSeries-test.js b/tests/end2end/MeetingSeries-test.js index 807742e4f..6f0928abd 100644 --- a/tests/end2end/MeetingSeries-test.js +++ b/tests/end2end/MeetingSeries-test.js @@ -8,75 +8,75 @@ import { E2EMeetingSeries } from './helpers/E2EMeetingSeries'; describe('MeetingSeries', function () { before('reload page and reset app', function () { - console.log('Executing: '+E2EGlobal.getTestSpecFilename()); - server.connect(); - E2EGlobal.logTimestamp('Start test suite'); - E2EApp.resetMyApp(); - E2EApp.launchApp(); + console.log('Executing: '+(await E2EGlobal.getTestSpecFilename())); + await server.connect(); + await E2EGlobal.logTimestamp('Start test suite'); + await E2EApp.resetMyApp(); + await E2EApp.launchApp(); }); beforeEach('goto start page and make sure test user is logged in', function () { - E2EApp.gotoStartPage(); - expect (E2EApp.isLoggedIn()).to.be.true; + await E2EApp.gotoStartPage(); + expect (await E2EApp.isLoggedIn()).to.be.true; }); it('can create a first meeting series', function () { const aProjectName = 'E2E Project'; const aMeetingName = 'Meeting Name #1'; - const initialCount = E2EMeetingSeries.countMeetingSeries(); - E2EMeetingSeries.createMeetingSeries(aProjectName, aMeetingName); - expect(E2EMeetingSeries.countMeetingSeries()).to.equal(initialCount + 1); - expect(E2EMeetingSeries.getMeetingSeriesId(aProjectName, aMeetingName)).to.be.ok; + const initialCount = await E2EMeetingSeries.countMeetingSeries(); + await E2EMeetingSeries.createMeetingSeries(aProjectName, aMeetingName); + await expect(await E2EMeetingSeries.countMeetingSeries()).to.equal(initialCount + 1); + expect(await E2EMeetingSeries.getMeetingSeriesId(aProjectName, aMeetingName)).to.be.ok; }); it('can create a further meeting series', function () { const aProjectName = 'E2E Project'; const aMeetingName = 'Meeting Name #2'; - const initialCount = E2EMeetingSeries.countMeetingSeries(); - E2EMeetingSeries.createMeetingSeries(aProjectName, aMeetingName); - expect(E2EMeetingSeries.countMeetingSeries()).to.equal(initialCount + 1); - expect(E2EMeetingSeries.getMeetingSeriesId(aProjectName, aMeetingName)).to.be.ok; + const initialCount = await E2EMeetingSeries.countMeetingSeries(); + await E2EMeetingSeries.createMeetingSeries(aProjectName, aMeetingName); + await expect(await E2EMeetingSeries.countMeetingSeries()).to.equal(initialCount + 1); + expect(await E2EMeetingSeries.getMeetingSeriesId(aProjectName, aMeetingName)).to.be.ok; }); it('can submit the form by pressing enter in the meetingname input', function () { const aProjectName = 'E2E Project'; const aMeetingName = 'Meeting Name #2.7182818284'; - const initialCount = E2EMeetingSeries.countMeetingSeries(); + const initialCount = await E2EMeetingSeries.countMeetingSeries(); - E2EMeetingSeries.editMeetingSeriesForm(aProjectName, aMeetingName + '\n'); - E2EGlobal.waitSomeTime(500); - E2EGlobal.clickWithRetry('#btnMeetinSeriesEditCancel'); + await E2EMeetingSeries.editMeetingSeriesForm(aProjectName, aMeetingName + '\n'); + await E2EGlobal.waitSomeTime(500); + await E2EGlobal.clickWithRetry('#btnMeetinSeriesEditCancel'); - expect(E2EMeetingSeries.countMeetingSeries()).to.equal(initialCount + 1); - expect(E2EMeetingSeries.getMeetingSeriesId(aProjectName, aMeetingName)).to.be.ok; + await expect(await E2EMeetingSeries.countMeetingSeries()).to.equal(initialCount + 1); + expect(await E2EMeetingSeries.getMeetingSeriesId(aProjectName, aMeetingName)).to.be.ok; }); it('can not create meeting series with empty project', function () { const aProjectName = ''; const aMeetingName = 'Meeting Name #2.1'; - const initialCount = E2EMeetingSeries.countMeetingSeries(); - E2EMeetingSeries.createMeetingSeries(aProjectName, aMeetingName); - expect(E2EMeetingSeries.countMeetingSeries()).to.equal(initialCount); - expect(E2EMeetingSeries.getMeetingSeriesId(aProjectName, aMeetingName)).not.to.be.ok; + const initialCount = await E2EMeetingSeries.countMeetingSeries(); + await E2EMeetingSeries.createMeetingSeries(aProjectName, aMeetingName); + await expect(await E2EMeetingSeries.countMeetingSeries()).to.equal(initialCount); + expect(await E2EMeetingSeries.getMeetingSeriesId(aProjectName, aMeetingName)).not.to.be.ok; }); it('can not create meeting series with empty name', function () { const aProjectName = 'E2E Project - Unknown series'; const aMeetingName = ''; - const initialCount = E2EMeetingSeries.countMeetingSeries(); - E2EMeetingSeries.createMeetingSeries(aProjectName, aMeetingName); - expect(E2EMeetingSeries.countMeetingSeries()).to.equal(initialCount); - expect(E2EMeetingSeries.getMeetingSeriesId(aProjectName, aMeetingName)).not.to.be.ok; + const initialCount = await E2EMeetingSeries.countMeetingSeries(); + await E2EMeetingSeries.createMeetingSeries(aProjectName, aMeetingName); + await expect(await E2EMeetingSeries.countMeetingSeries()).to.equal(initialCount); + expect(await E2EMeetingSeries.getMeetingSeriesId(aProjectName, aMeetingName)).not.to.be.ok; }); it('can goto meeting series details', function () { const aProjectName = 'E2E Project'; const aMeetingName = 'Meeting Name #4'; - E2EMeetingSeries.createMeetingSeries(aProjectName, aMeetingName); - E2EMeetingSeries.gotoMeetingSeries(aProjectName, aMeetingName); - expect(E2EApp.isOnStartPage()).to.be.false; + await E2EMeetingSeries.createMeetingSeries(aProjectName, aMeetingName); + await E2EMeetingSeries.gotoMeetingSeries(aProjectName, aMeetingName); + expect(await E2EApp.isOnStartPage()).to.be.false; }); }); diff --git a/tests/end2end/MeetingSeriesEdit-test.js b/tests/end2end/MeetingSeriesEdit-test.js index e53160c76..923763696 100644 --- a/tests/end2end/MeetingSeriesEdit-test.js +++ b/tests/end2end/MeetingSeriesEdit-test.js @@ -15,175 +15,175 @@ describe('MeetingSeries Editor', function () { let aMeetingName; before('reload page and reset app', function () { - console.log('Executing: ',E2EGlobal.getTestSpecFilename()); - server.connect(); - E2EGlobal.logTimestamp('Start test suite'); - E2EApp.resetMyApp(); - E2EApp.launchApp(); + console.log('Executing: ',await E2EGlobal.getTestSpecFilename()); + await server.connect(); + await E2EGlobal.logTimestamp('Start test suite'); + await E2EApp.resetMyApp(); + await E2EApp.launchApp(); }); beforeEach('goto start page and make sure test user is logged in', function () { - E2EApp.gotoStartPage(); - expect (E2EApp.isLoggedIn()).to.be.true; + await E2EApp.gotoStartPage(); + expect (await E2EApp.isLoggedIn()).to.be.true; aMeetingCounter++; aMeetingName = aMeetingNameBase + aMeetingCounter; - E2EMeetingSeries.createMeetingSeries(aProjectName, aMeetingName); + await E2EMeetingSeries.createMeetingSeries(aProjectName, aMeetingName); }); it('can open and close meeting series editor without changing data', function () { - E2EMeetingSeriesEditor.openMeetingSeriesEditor(aProjectName, aMeetingName); + await E2EMeetingSeriesEditor.openMeetingSeriesEditor(aProjectName, aMeetingName); // Now dialog should be there - expect(browser.isVisible('#btnMeetingSeriesSave')).to.be.true; - E2EMeetingSeriesEditor.closeMeetingSeriesEditor(false); // close with cancel + expect(await browser.isVisible('#btnMeetingSeriesSave')).to.be.true; + await E2EMeetingSeriesEditor.closeMeetingSeriesEditor(false); // close with cancel // Now dialog should be gone - expect(browser.isVisible('#btnMeetingSeriesSave')).to.be.false; - expect(E2EMeetingSeries.getMeetingSeriesId(aProjectName, aMeetingName)).not.to.be.false; + expect(await browser.isVisible('#btnMeetingSeriesSave')).to.be.false; + expect(await E2EMeetingSeries.getMeetingSeriesId(aProjectName, aMeetingName)).not.to.be.false; }); it('can open and cancel meeting series editor without changing data', function () { - E2EMeetingSeriesEditor.openMeetingSeriesEditor(aProjectName, aMeetingName); + await E2EMeetingSeriesEditor.openMeetingSeriesEditor(aProjectName, aMeetingName); // Now dialog should be there - expect(browser.isVisible('#btnMeetinSeriesEditCancel')).to.be.true; - E2EGlobal.clickWithRetry('#btnMeetinSeriesEditCancel'); - E2EGlobal.waitSomeTime(); // give dialog animation time + expect(await browser.isVisible('#btnMeetinSeriesEditCancel')).to.be.true; + await E2EGlobal.clickWithRetry('#btnMeetinSeriesEditCancel'); + await E2EGlobal.waitSomeTime(); // give dialog animation time // Now dialog should be gone - expect(browser.isVisible('#btnMeetinSeriesEditCancel')).to.be.false; - expect(E2EMeetingSeries.getMeetingSeriesId(aProjectName, aMeetingName)).not.to.be.false; + expect(await browser.isVisible('#btnMeetinSeriesEditCancel')).to.be.false; + expect(await E2EMeetingSeries.getMeetingSeriesId(aProjectName, aMeetingName)).not.to.be.false; }); it('can delete an empty meeting series', function () { - let countAfterCreate = E2EMeetingSeries.countMeetingSeries(); - expect(E2EMeetingSeries.getMeetingSeriesId(aProjectName, aMeetingName)).to.be.ok; - E2EMeetingSeriesEditor.openMeetingSeriesEditor(aProjectName, aMeetingName); + let countAfterCreate = await E2EMeetingSeries.countMeetingSeries(); + expect(await E2EMeetingSeries.getMeetingSeriesId(aProjectName, aMeetingName)).to.be.ok; + await E2EMeetingSeriesEditor.openMeetingSeriesEditor(aProjectName, aMeetingName); - E2EGlobal.clickWithRetry('#deleteMeetingSeries'); - E2EApp.confirmationDialogAnswer(true); + await E2EGlobal.clickWithRetry('#deleteMeetingSeries'); + await E2EApp.confirmationDialogAnswer(true); - expect(E2EMeetingSeries.countMeetingSeries()).to.equal(countAfterCreate -1); - expect(E2EMeetingSeries.getMeetingSeriesId(aProjectName, aMeetingName)).not.to.be.ok; + await expect(await E2EMeetingSeries.countMeetingSeries()).to.equal(countAfterCreate -1); + expect(await E2EMeetingSeries.getMeetingSeriesId(aProjectName, aMeetingName)).not.to.be.ok; }); it('can cancel delete of meeting series', function () { - let countAfterCreate = E2EMeetingSeries.countMeetingSeries(); - expect(E2EMeetingSeries.getMeetingSeriesId(aProjectName, aMeetingName)).to.be.ok; - E2EMeetingSeriesEditor.openMeetingSeriesEditor(aProjectName, aMeetingName); + let countAfterCreate = await E2EMeetingSeries.countMeetingSeries(); + expect(await E2EMeetingSeries.getMeetingSeriesId(aProjectName, aMeetingName)).to.be.ok; + await E2EMeetingSeriesEditor.openMeetingSeriesEditor(aProjectName, aMeetingName); - E2EGlobal.clickWithRetry('#deleteMeetingSeries'); - E2EApp.confirmationDialogAnswer(false); + await E2EGlobal.clickWithRetry('#deleteMeetingSeries'); + await E2EApp.confirmationDialogAnswer(false); - expect(E2EMeetingSeries.countMeetingSeries()).to.equal(countAfterCreate); - expect(E2EMeetingSeries.getMeetingSeriesId(aProjectName, aMeetingName)).to.be.ok; + await expect(await E2EMeetingSeries.countMeetingSeries()).to.equal(countAfterCreate); + expect(await E2EMeetingSeries.getMeetingSeriesId(aProjectName, aMeetingName)).to.be.ok; }); it('can clean up child minutes on deleting meeting series', function () { let aMeetingName = 'Meeting Name (with Minute)'; - let countDBMeetingSeriesBefore = server.call('e2e.countMeetingSeriesInMongDB'); - let countDBMinutesBefore = server.call('e2e.countMinutesInMongoDB'); - E2EMeetingSeries.createMeetingSeries(aProjectName, aMeetingName); - E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName); - E2EMinutes.finalizeCurrentMinutes(); - E2EMeetingSeries.gotoMeetingSeries(aProjectName, aMeetingName); + let countDBMeetingSeriesBefore = await server.call('e2e.countMeetingSeriesInMongDB'); + let countDBMinutesBefore = await server.call('e2e.countMinutesInMongoDB'); + await E2EMeetingSeries.createMeetingSeries(aProjectName, aMeetingName); + await E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName); + await E2EMinutes.finalizeCurrentMinutes(); + await E2EMeetingSeries.gotoMeetingSeries(aProjectName, aMeetingName); // One more Meeting series and one more minutes - expect(server.call('e2e.countMeetingSeriesInMongDB')).to.equal(countDBMeetingSeriesBefore +1); - expect(server.call('e2e.countMinutesInMongoDB')).to.equal(countDBMinutesBefore +1); + await expect(await server.call('e2e.countMeetingSeriesInMongDB')).to.equal(countDBMeetingSeriesBefore +1); + await expect(await server.call('e2e.countMinutesInMongoDB')).to.equal(countDBMinutesBefore +1); // Now delete meeting series with attached Minutes - E2EMeetingSeriesEditor.openMeetingSeriesEditor(aProjectName, aMeetingName); - E2EGlobal.clickWithRetry('#deleteMeetingSeries'); - E2EApp.confirmationDialogAnswer(true); + await E2EMeetingSeriesEditor.openMeetingSeriesEditor(aProjectName, aMeetingName); + await E2EGlobal.clickWithRetry('#deleteMeetingSeries'); + await E2EApp.confirmationDialogAnswer(true); // Meeting series and attached minutes should be gone - expect(server.call('e2e.countMeetingSeriesInMongDB')).to.equal(countDBMeetingSeriesBefore); - expect(server.call('e2e.countMinutesInMongoDB')).to.equal(countDBMinutesBefore); - expect(E2EMeetingSeries.getMeetingSeriesId(aProjectName, aMeetingName)).not.to.be.ok; + await expect(await server.call('e2e.countMeetingSeriesInMongDB')).to.equal(countDBMeetingSeriesBefore); + await expect(await server.call('e2e.countMinutesInMongoDB')).to.equal(countDBMinutesBefore); + expect(await E2EMeetingSeries.getMeetingSeriesId(aProjectName, aMeetingName)).not.to.be.ok; }); it('can not save meeting series without project or name', function () { - E2EMeetingSeriesEditor.openMeetingSeriesEditor(aProjectName, aMeetingName); - browser.setValue('input[id="id_meetingproject"]', ''); // empty input - browser.setValue('input[id="id_meetingname"]', ''); // empty input - E2EGlobal.clickWithRetry('#btnMeetingSeriesSave'); // try to save - expect(browser.isVisible('#btnMeetingSeriesSave')).to.be.true; // dialog still open! - - browser.setValue('input[id="id_meetingproject"]', 'XXX'); - browser.setValue('input[id="id_meetingname"]', ''); // empty input - E2EGlobal.clickWithRetry('#btnMeetingSeriesSave'); // try to save - expect(browser.isVisible('#btnMeetingSeriesSave')).to.be.true; // dialog still open! - - browser.setValue('input[id="id_meetingproject"]', ''); // empty input - browser.setValue('input[id="id_meetingname"]', 'XXX'); - E2EGlobal.clickWithRetry('#btnMeetingSeriesSave'); // try to save - expect(browser.isVisible('#btnMeetingSeriesSave')).to.be.true; // dialog still open! - - E2EMeetingSeriesEditor.closeMeetingSeriesEditor(false); // close with cancel - E2EApp.gotoStartPage(); - expect(E2EMeetingSeries.getMeetingSeriesId(aProjectName, aMeetingName)).to.be.ok; // prj/name should be unchanged + await E2EMeetingSeriesEditor.openMeetingSeriesEditor(aProjectName, aMeetingName); + await browser.setValue('input[id="id_meetingproject"]', ''); // empty input + await browser.setValue('input[id="id_meetingname"]', ''); // empty input + await E2EGlobal.clickWithRetry('#btnMeetingSeriesSave'); // try to save + expect(await browser.isVisible('#btnMeetingSeriesSave')).to.be.true; // dialog still open! + + await browser.setValue('input[id="id_meetingproject"]', 'XXX'); + await browser.setValue('input[id="id_meetingname"]', ''); // empty input + await E2EGlobal.clickWithRetry('#btnMeetingSeriesSave'); // try to save + expect(await browser.isVisible('#btnMeetingSeriesSave')).to.be.true; // dialog still open! + + await browser.setValue('input[id="id_meetingproject"]', ''); // empty input + await browser.setValue('input[id="id_meetingname"]', 'XXX'); + await E2EGlobal.clickWithRetry('#btnMeetingSeriesSave'); // try to save + expect(await browser.isVisible('#btnMeetingSeriesSave')).to.be.true; // dialog still open! + + await E2EMeetingSeriesEditor.closeMeetingSeriesEditor(false); // close with cancel + await E2EApp.gotoStartPage(); + expect(await E2EMeetingSeries.getMeetingSeriesId(aProjectName, aMeetingName)).to.be.ok; // prj/name should be unchanged }); it('can save meeting series with new project name and meeting name', function () { - E2EMeetingSeriesEditor.openMeetingSeriesEditor(aProjectName, aMeetingName); + await E2EMeetingSeriesEditor.openMeetingSeriesEditor(aProjectName, aMeetingName); let aNewProjectName = 'E2E New Project'; let aNewMeetingName = 'New Meeting Name'; - browser.setValue('input[id="id_meetingproject"]', aNewProjectName); - browser.setValue('input[id="id_meetingname"]', aNewMeetingName); - E2EMeetingSeriesEditor.closeMeetingSeriesEditor(); // close with save + await browser.setValue('input[id="id_meetingproject"]', aNewProjectName); + await browser.setValue('input[id="id_meetingname"]', aNewMeetingName); + await E2EMeetingSeriesEditor.closeMeetingSeriesEditor(); // close with save - E2EApp.gotoStartPage(); - expect(E2EMeetingSeries.getMeetingSeriesId(aProjectName, aMeetingName)).not.to.be.ok; - expect(E2EMeetingSeries.getMeetingSeriesId(aNewProjectName, aNewMeetingName)).to.be.ok; + await E2EApp.gotoStartPage(); + expect(await E2EMeetingSeries.getMeetingSeriesId(aProjectName, aMeetingName)).not.to.be.ok; + expect(await E2EMeetingSeries.getMeetingSeriesId(aNewProjectName, aNewMeetingName)).to.be.ok; }); it('can restore fields after close and re-open', function () { - E2EMeetingSeriesEditor.openMeetingSeriesEditor(aProjectName, aMeetingName); - browser.setValue('input[id="id_meetingproject"]', aProjectName+' Changed!'); - browser.setValue('input[id="id_meetingname"]', aMeetingName + ' Changed!'); + await E2EMeetingSeriesEditor.openMeetingSeriesEditor(aProjectName, aMeetingName); + await browser.setValue('input[id="id_meetingproject"]', aProjectName+' Changed!'); + await browser.setValue('input[id="id_meetingname"]', aMeetingName + ' Changed!'); - E2EGlobal.clickWithRetry('#btnEditMSClose'); // Don't store new values! - E2EGlobal.waitSomeTime(); // give dialog animation time + await E2EGlobal.clickWithRetry('#btnEditMSClose'); // Don't store new values! + await E2EGlobal.waitSomeTime(); // give dialog animation time - E2EMeetingSeriesEditor.openMeetingSeriesEditor(aProjectName, aMeetingName, 'base', true); - expect(browser.getValue('input[id="id_meetingproject"]')).to.equal(aProjectName); - expect(browser.getValue('input[id="id_meetingname"]')).to.equal(aMeetingName); + await E2EMeetingSeriesEditor.openMeetingSeriesEditor(aProjectName, aMeetingName, 'base', true); + await expect(await browser.getValue('input[id="id_meetingproject"]')).to.equal(aProjectName); + await expect(await browser.getValue('input[id="id_meetingname"]')).to.equal(aMeetingName); - E2EGlobal.clickWithRetry('#btnEditMSClose'); - E2EGlobal.waitSomeTime(); // give dialog animation time + await E2EGlobal.clickWithRetry('#btnEditMSClose'); + await E2EGlobal.waitSomeTime(); // give dialog animation time }); it('can restore fields after cancel and re-open', function () { - E2EMeetingSeriesEditor.openMeetingSeriesEditor(aProjectName, aMeetingName); - browser.setValue('input[id="id_meetingproject"]', aProjectName+' Changed!'); - browser.setValue('input[id="id_meetingname"]', aMeetingName + ' Changed!'); + await E2EMeetingSeriesEditor.openMeetingSeriesEditor(aProjectName, aMeetingName); + await browser.setValue('input[id="id_meetingproject"]', aProjectName+' Changed!'); + await browser.setValue('input[id="id_meetingname"]', aMeetingName + ' Changed!'); - E2EGlobal.clickWithRetry('#btnMeetinSeriesEditCancel'); - E2EGlobal.waitSomeTime(); // give dialog animation time + await E2EGlobal.clickWithRetry('#btnMeetinSeriesEditCancel'); + await E2EGlobal.waitSomeTime(); // give dialog animation time - E2EMeetingSeriesEditor.openMeetingSeriesEditor(aProjectName, aMeetingName, 'base', true); - expect(browser.getValue('input[id="id_meetingproject"]')).to.equal(aProjectName); - expect(browser.getValue('input[id="id_meetingname"]')).to.equal(aMeetingName); + await E2EMeetingSeriesEditor.openMeetingSeriesEditor(aProjectName, aMeetingName, 'base', true); + await expect(await browser.getValue('input[id="id_meetingproject"]')).to.equal(aProjectName); + await expect(await browser.getValue('input[id="id_meetingname"]')).to.equal(aMeetingName); - E2EGlobal.clickWithRetry('#btnMeetinSeriesEditCancel'); - E2EGlobal.waitSomeTime(); // give dialog animation time + await E2EGlobal.clickWithRetry('#btnMeetinSeriesEditCancel'); + await E2EGlobal.waitSomeTime(); // give dialog animation time }); it('can delete a meeting series', function() { - const initialCount = E2EMeetingSeries.countMeetingSeries(); + const initialCount = await E2EMeetingSeries.countMeetingSeries(); - E2EMeetingSeriesEditor.openMeetingSeriesEditor(aProjectName, aMeetingName); - E2EGlobal.clickWithRetry('#deleteMeetingSeries'); - E2EGlobal.waitSomeTime(); // give dialog animation time - E2EApp.confirmationDialogAnswer(true); + await E2EMeetingSeriesEditor.openMeetingSeriesEditor(aProjectName, aMeetingName); + await E2EGlobal.clickWithRetry('#deleteMeetingSeries'); + await E2EGlobal.waitSomeTime(); // give dialog animation time + await E2EApp.confirmationDialogAnswer(true); - expect(E2EMeetingSeries.countMeetingSeries()).to.equal(initialCount - 1); + await expect(await E2EMeetingSeries.countMeetingSeries()).to.equal(initialCount - 1); }); }); diff --git a/tests/end2end/MeetingSeriesEditUsers-test.js b/tests/end2end/MeetingSeriesEditUsers-test.js index 6fc3c24f8..19db57c82 100644 --- a/tests/end2end/MeetingSeriesEditUsers-test.js +++ b/tests/end2end/MeetingSeriesEditUsers-test.js @@ -16,48 +16,48 @@ describe('MeetingSeries Editor Users', function () { before("reload page and reset app", function () { - E2EGlobal.logTimestamp("Start test suite"); - E2EApp.resetMyApp(true); - E2EApp.launchApp(); + await E2EGlobal.logTimestamp("Start test suite"); + await E2EApp.resetMyApp(true); + await E2EApp.launchApp(); }); beforeEach("goto start page and make sure test user is logged in", function () { if (aMeetingCounter % 10 === 0) { - E2EApp.resetMyApp(false); - E2EApp.launchApp(); + await E2EApp.resetMyApp(false); + await E2EApp.launchApp(); } - E2EApp.gotoStartPage(); - expect (E2EApp.isLoggedIn()).to.be.true; + await E2EApp.gotoStartPage(); + expect (await E2EApp.isLoggedIn()).to.be.true; aMeetingCounter++; aMeetingName = aMeetingNameBase + aMeetingCounter; - E2EMeetingSeries.createMeetingSeries(aProjectName, aMeetingName); - E2EMeetingSeriesEditor.openMeetingSeriesEditor(aProjectName, aMeetingName, "invited"); + await E2EMeetingSeries.createMeetingSeries(aProjectName, aMeetingName); + await E2EMeetingSeriesEditor.openMeetingSeriesEditor(aProjectName, aMeetingName, "invited"); }); it('has one moderator per default', function () { - let usersAndRoles = E2EMeetingSeriesEditor.getUsersAndRoles(0,1,2); - E2EMeetingSeriesEditor.closeMeetingSeriesEditor(); // close with save + let usersAndRoles = await E2EMeetingSeriesEditor.getUsersAndRoles(0,1,2); + await E2EMeetingSeriesEditor.closeMeetingSeriesEditor(); // close with save expect(Object.keys(usersAndRoles)).to.have.length(1); - let currentUser = E2EApp.getCurrentUser(); + let currentUser = await E2EApp.getCurrentUser(); expect(usersAndRoles[currentUser]).to.be.ok; - expect(usersAndRoles[currentUser].role).to.equal(E2EGlobal.USERROLES.Moderator); + await expect(usersAndRoles[currentUser].role).to.equal(E2EGlobal.USERROLES.Moderator); }); it('can add a further user, which defaults to "Invited" role', function () { let user2 = E2EGlobal.SETTINGS.e2eTestUsers[1]; - E2EMeetingSeriesEditor.addUserToMeetingSeries(user2); + await E2EMeetingSeriesEditor.addUserToMeetingSeries(user2); - let usersAndRoles = E2EMeetingSeriesEditor.getUsersAndRoles(0,1,2); - E2EMeetingSeriesEditor.closeMeetingSeriesEditor(); // close with save + let usersAndRoles = await E2EMeetingSeriesEditor.getUsersAndRoles(0,1,2); + await E2EMeetingSeriesEditor.closeMeetingSeriesEditor(); // close with save expect(Object.keys(usersAndRoles)).to.have.length(2); expect(usersAndRoles[user2]).to.be.ok; - expect(usersAndRoles[user2].role).to.equal(E2EGlobal.USERROLES.Invited); + await expect(usersAndRoles[user2].role).to.equal(E2EGlobal.USERROLES.Invited); expect(usersAndRoles[user2].isDeletable).to.be.true; expect(usersAndRoles[user2].isReadOnly).to.be.false; }); @@ -65,207 +65,207 @@ describe('MeetingSeries Editor Users', function () { it('can not add user twice', function () { let user2 = E2EGlobal.SETTINGS.e2eTestUsers[1]; - E2EMeetingSeriesEditor.addUserToMeetingSeries(user2); - E2EMeetingSeriesEditor.addUserToMeetingSeries(user2); // try to add same user again! + await E2EMeetingSeriesEditor.addUserToMeetingSeries(user2); + await E2EMeetingSeriesEditor.addUserToMeetingSeries(user2); // try to add same user again! - let usersAndRoles = E2EMeetingSeriesEditor.getUsersAndRoles(0,1,2); + let usersAndRoles = await E2EMeetingSeriesEditor.getUsersAndRoles(0,1,2); expect(Object.keys(usersAndRoles)).to.have.length(2); // still two! - E2EGlobal.clickWithRetry("#btnMeetinSeriesEditCancel"); // cancel & close editor dialog - E2EGlobal.waitSomeTime(); // wait for dialog's animation + await E2EGlobal.clickWithRetry("#btnMeetinSeriesEditCancel"); // cancel & close editor dialog + await E2EGlobal.waitSomeTime(); // wait for dialog's animation }); it('can delete other user', function () { let user2 = E2EGlobal.SETTINGS.e2eTestUsers[1]; - E2EMeetingSeriesEditor.addUserToMeetingSeries(user2); + await E2EMeetingSeriesEditor.addUserToMeetingSeries(user2); - let usersAndRoles = E2EMeetingSeriesEditor.getUsersAndRoles(0,1,2); + let usersAndRoles = await E2EMeetingSeriesEditor.getUsersAndRoles(0,1,2); expect(Object.keys(usersAndRoles)).to.have.length(2); // two users // Click on the delete button for user2 - browser.elementIdClick(usersAndRoles[user2].deleteElemId); - usersAndRoles = E2EMeetingSeriesEditor.getUsersAndRoles(0,1,2); + await browser.elementIdClick(usersAndRoles[user2].deleteElemId); + usersAndRoles = await E2EMeetingSeriesEditor.getUsersAndRoles(0,1,2); expect(Object.keys(usersAndRoles)).to.have.length(1); // back to one user - let currentUser = E2EApp.getCurrentUser(); // but current user should still be there + let currentUser = await E2EApp.getCurrentUser(); // but current user should still be there expect(usersAndRoles[currentUser]).to.be.ok; - E2EGlobal.clickWithRetry("#btnMeetinSeriesEditCancel"); // cancel & close editor dialog - E2EGlobal.waitSomeTime(); // wait for dialog's animation + await E2EGlobal.clickWithRetry("#btnMeetinSeriesEditCancel"); // cancel & close editor dialog + await E2EGlobal.waitSomeTime(); // wait for dialog's animation }); it('can not delete own user', function () { - let usersAndRoles = E2EMeetingSeriesEditor.getUsersAndRoles(0,1,2); + let usersAndRoles = await E2EMeetingSeriesEditor.getUsersAndRoles(0,1,2); expect(Object.keys(usersAndRoles)).to.have.length(1); - let currentUser = E2EApp.getCurrentUser(); + let currentUser = await E2EApp.getCurrentUser(); expect(usersAndRoles[currentUser]).to.be.ok; expect(usersAndRoles[currentUser].isDeletable).to.be.false; - E2EGlobal.clickWithRetry("#btnMeetinSeriesEditCancel"); // cancel & close editor dialog - E2EGlobal.waitSomeTime(); // wait for dialog's animation + await E2EGlobal.clickWithRetry("#btnMeetinSeriesEditCancel"); // cancel & close editor dialog + await E2EGlobal.waitSomeTime(); // wait for dialog's animation }); it('can not change role of own user', function () { - let usersAndRoles = E2EMeetingSeriesEditor.getUsersAndRoles(0,1,2); + let usersAndRoles = await E2EMeetingSeriesEditor.getUsersAndRoles(0,1,2); expect(Object.keys(usersAndRoles)).to.have.length(1); - let currentUser = E2EApp.getCurrentUser(); + let currentUser = await E2EApp.getCurrentUser(); expect(usersAndRoles[currentUser]).to.be.ok; expect(usersAndRoles[currentUser].isReadOnly).to.be.true; - E2EGlobal.clickWithRetry("#btnMeetinSeriesEditCancel"); // cancel & close editor dialog - E2EGlobal.waitSomeTime(); // wait for dialog's animation + await E2EGlobal.clickWithRetry("#btnMeetinSeriesEditCancel"); // cancel & close editor dialog + await E2EGlobal.waitSomeTime(); // wait for dialog's animation }); it('can promote other user to moderator', function () { let user2 = E2EGlobal.SETTINGS.e2eTestUsers[1]; - E2EMeetingSeriesEditor.addUserToMeetingSeries(user2, E2EGlobal.USERROLES.Moderator); + await E2EMeetingSeriesEditor.addUserToMeetingSeries(user2, E2EGlobal.USERROLES.Moderator); - let usersAndRoles = E2EMeetingSeriesEditor.getUsersAndRoles(0,1,2); + let usersAndRoles = await E2EMeetingSeriesEditor.getUsersAndRoles(0,1,2); expect(Object.keys(usersAndRoles)).to.have.length(2); expect(usersAndRoles[user2]).to.be.ok; - expect(usersAndRoles[user2].role).to.equal(E2EGlobal.USERROLES.Moderator); + await expect(usersAndRoles[user2].role).to.equal(E2EGlobal.USERROLES.Moderator); expect(usersAndRoles[user2].isDeletable).to.be.true; expect(usersAndRoles[user2].isReadOnly).to.be.false; - E2EGlobal.clickWithRetry("#btnMeetinSeriesEditCancel"); // cancel & close editor dialog - E2EGlobal.waitSomeTime(); // wait for dialog's animation + await E2EGlobal.clickWithRetry("#btnMeetinSeriesEditCancel"); // cancel & close editor dialog + await E2EGlobal.waitSomeTime(); // wait for dialog's animation }); it('can configure other user back to invited role after save', function () { let user2 = E2EGlobal.SETTINGS.e2eTestUsers[1]; - E2EMeetingSeriesEditor.addUserToMeetingSeries(user2, E2EGlobal.USERROLES.Moderator); + await E2EMeetingSeriesEditor.addUserToMeetingSeries(user2, E2EGlobal.USERROLES.Moderator); - let usersAndRoles = E2EMeetingSeriesEditor.getUsersAndRoles(0,1,2); + let usersAndRoles = await E2EMeetingSeriesEditor.getUsersAndRoles(0,1,2); expect(Object.keys(usersAndRoles)).to.have.length(2); expect(usersAndRoles[user2]).to.be.ok; - expect(usersAndRoles[user2].role).to.equal(E2EGlobal.USERROLES.Moderator); + await expect(usersAndRoles[user2].role).to.equal(E2EGlobal.USERROLES.Moderator); expect(usersAndRoles[user2].isDeletable).to.be.true; expect(usersAndRoles[user2].isReadOnly).to.be.false; - E2EMeetingSeriesEditor.closeMeetingSeriesEditor(); // close with save - E2EMeetingSeriesEditor.openMeetingSeriesEditor(aProjectName, aMeetingName, "invited"); + await E2EMeetingSeriesEditor.closeMeetingSeriesEditor(); // close with save + await E2EMeetingSeriesEditor.openMeetingSeriesEditor(aProjectName, aMeetingName, "invited"); let roleSelector = "select.user-role-select"; - browser.selectByValue(roleSelector, E2EGlobal.USERROLES.Invited); - usersAndRoles = E2EMeetingSeriesEditor.getUsersAndRoles(0,1,2); + await browser.selectByValue(roleSelector, E2EGlobal.USERROLES.Invited); + usersAndRoles = await E2EMeetingSeriesEditor.getUsersAndRoles(0,1,2); expect(Object.keys(usersAndRoles)).to.have.length(2); expect(usersAndRoles[user2]).to.be.ok; - expect(usersAndRoles[user2].role).to.equal(E2EGlobal.USERROLES.Invited); + await expect(usersAndRoles[user2].role).to.equal(E2EGlobal.USERROLES.Invited); expect(usersAndRoles[user2].isDeletable).to.be.true; expect(usersAndRoles[user2].isReadOnly).to.be.false; - E2EGlobal.clickWithRetry("#btnMeetinSeriesEditCancel"); // cancel & close editor dialog - E2EGlobal.waitSomeTime(); // wait for dialog's animation + await E2EGlobal.clickWithRetry("#btnMeetinSeriesEditCancel"); // cancel & close editor dialog + await E2EGlobal.waitSomeTime(); // wait for dialog's animation }); it('can persist edited user roles to database', function () { - let currentUser = E2EApp.getCurrentUser(); + let currentUser = await E2EApp.getCurrentUser(); let user2 = E2EGlobal.SETTINGS.e2eTestUsers[1]; let user3 = E2EGlobal.SETTINGS.e2eTestUsers[2]; - E2EMeetingSeriesEditor.addUserToMeetingSeries(user2, E2EGlobal.USERROLES.Moderator); - E2EMeetingSeriesEditor.addUserToMeetingSeries(user3); + await E2EMeetingSeriesEditor.addUserToMeetingSeries(user2, E2EGlobal.USERROLES.Moderator); + await E2EMeetingSeriesEditor.addUserToMeetingSeries(user3); - let usersAndRoles = E2EMeetingSeriesEditor.getUsersAndRoles(0,1,2); + let usersAndRoles = await E2EMeetingSeriesEditor.getUsersAndRoles(0,1,2); expect(Object.keys(usersAndRoles)).to.have.length(3); - E2EMeetingSeriesEditor.closeMeetingSeriesEditor(); // close with save - E2EMeetingSeriesEditor.openMeetingSeriesEditor(aProjectName, aMeetingName, "invited"); + await E2EMeetingSeriesEditor.closeMeetingSeriesEditor(); // close with save + await E2EMeetingSeriesEditor.openMeetingSeriesEditor(aProjectName, aMeetingName, "invited"); // after save and re-open, check what was persisted - usersAndRoles = E2EMeetingSeriesEditor.getUsersAndRoles(0,1,2); + usersAndRoles = await E2EMeetingSeriesEditor.getUsersAndRoles(0,1,2); expect(Object.keys(usersAndRoles)).to.have.length(3); expect(usersAndRoles[currentUser], "current user").to.be.ok; // ... for current user - expect(usersAndRoles[currentUser].role, "current user").to.equal(E2EGlobal.USERROLES.Moderator); + await expect(usersAndRoles[currentUser].role, "current user").to.equal(E2EGlobal.USERROLES.Moderator); expect(usersAndRoles[currentUser].isDeletable, "current user").to.be.false; expect(usersAndRoles[currentUser].isReadOnly, "current user").to.be.true; expect(usersAndRoles[user2], "user2").to.be.ok; // ... for user#2 - expect(usersAndRoles[user2].role, "user2").to.equal(E2EGlobal.USERROLES.Moderator); + await expect(usersAndRoles[user2].role, "user2").to.equal(E2EGlobal.USERROLES.Moderator); expect(usersAndRoles[user2].isDeletable, "user2").to.be.true; expect(usersAndRoles[user2].isReadOnly, "user2").to.be.false; expect(usersAndRoles[user3], "user3").to.be.ok; // ... for user#3 - expect(usersAndRoles[user3].role, "user3").to.equal(E2EGlobal.USERROLES.Invited); + await expect(usersAndRoles[user3].role, "user3").to.equal(E2EGlobal.USERROLES.Invited); expect(usersAndRoles[user3].isDeletable, "user3").to.be.true; expect(usersAndRoles[user3].isReadOnly, "user3").to.be.false; - E2EGlobal.clickWithRetry("#btnMeetinSeriesEditCancel"); // cancel & close editor dialog - E2EGlobal.waitSomeTime(); // wait for dialog's animation + await E2EGlobal.clickWithRetry("#btnMeetinSeriesEditCancel"); // cancel & close editor dialog + await E2EGlobal.waitSomeTime(); // wait for dialog's animation }); it('ensures invited user can see but not edit new meeting series', function () { - let currentUser = E2EApp.getCurrentUser(); + let currentUser = await E2EApp.getCurrentUser(); let user2 = E2EGlobal.SETTINGS.e2eTestUsers[1]; - E2EMeetingSeriesEditor.addUserToMeetingSeries(user2, E2EGlobal.USERROLES.Invited); - E2EMeetingSeriesEditor.closeMeetingSeriesEditor(); // close with save + await E2EMeetingSeriesEditor.addUserToMeetingSeries(user2, E2EGlobal.USERROLES.Invited); + await E2EMeetingSeriesEditor.closeMeetingSeriesEditor(); // close with save - E2EApp.loginUser(1); - expect(E2EMeetingSeries.getMeetingSeriesId(aProjectName, aMeetingName)).to.be.ok; + await E2EApp.loginUser(1); + expect(await E2EMeetingSeries.getMeetingSeriesId(aProjectName, aMeetingName)).to.be.ok; - E2EMeetingSeries.gotoMeetingSeries(aProjectName, aMeetingName); - E2EGlobal.waitSomeTime(); - expect(browser.isExisting("#btnAddMinutes")).to.be.false; + await E2EMeetingSeries.gotoMeetingSeries(aProjectName, aMeetingName); + await E2EGlobal.waitSomeTime(); + expect(await browser.isExisting("#btnAddMinutes")).to.be.false; - E2EApp.loginUser(); + await E2EApp.loginUser(); }); it('ensures additional moderator user can see & edit new meeting series', function () { - let currentUser = E2EApp.getCurrentUser(); + let currentUser = await E2EApp.getCurrentUser(); let user2 = E2EGlobal.SETTINGS.e2eTestUsers[1]; - E2EMeetingSeriesEditor.addUserToMeetingSeries(user2, E2EGlobal.USERROLES.Moderator); - E2EMeetingSeriesEditor.closeMeetingSeriesEditor(); // close with save + await E2EMeetingSeriesEditor.addUserToMeetingSeries(user2, E2EGlobal.USERROLES.Moderator); + await E2EMeetingSeriesEditor.closeMeetingSeriesEditor(); // close with save - E2EApp.loginUser(1); - expect(E2EMeetingSeries.getMeetingSeriesId(aProjectName, aMeetingName)).to.be.ok; + await E2EApp.loginUser(1); + expect(await E2EMeetingSeries.getMeetingSeriesId(aProjectName, aMeetingName)).to.be.ok; - E2EMeetingSeries.gotoMeetingSeries(aProjectName, aMeetingName); - E2EGlobal.waitSomeTime(); - expect(browser.isExisting("#btnAddMinutes")).to.be.true; + await E2EMeetingSeries.gotoMeetingSeries(aProjectName, aMeetingName); + await E2EGlobal.waitSomeTime(); + expect(await browser.isExisting("#btnAddMinutes")).to.be.true; - E2EApp.loginUser(); + await E2EApp.loginUser(); }); it('ensures moderator role can be revoked by deleting', function () { - let currentUser = E2EApp.getCurrentUser(); + let currentUser = await E2EApp.getCurrentUser(); let user2 = E2EGlobal.SETTINGS.e2eTestUsers[1]; - E2EMeetingSeriesEditor.addUserToMeetingSeries(user2, E2EGlobal.USERROLES.Moderator); - E2EMeetingSeriesEditor.closeMeetingSeriesEditor(); // close with save + await E2EMeetingSeriesEditor.addUserToMeetingSeries(user2, E2EGlobal.USERROLES.Moderator); + await E2EMeetingSeriesEditor.closeMeetingSeriesEditor(); // close with save - E2EMeetingSeriesEditor.openMeetingSeriesEditor(aProjectName, aMeetingName, "invited"); - let usersAndRoles = E2EMeetingSeriesEditor.getUsersAndRoles(0,1,2); - browser.elementIdClick(usersAndRoles[user2].deleteElemId); - E2EMeetingSeriesEditor.closeMeetingSeriesEditor(); // close with save + await E2EMeetingSeriesEditor.openMeetingSeriesEditor(aProjectName, aMeetingName, "invited"); + let usersAndRoles = await E2EMeetingSeriesEditor.getUsersAndRoles(0,1,2); + await browser.elementIdClick(usersAndRoles[user2].deleteElemId); + await E2EMeetingSeriesEditor.closeMeetingSeriesEditor(); // close with save - E2EApp.loginUser(1); - expect(E2EMeetingSeries.getMeetingSeriesId(aProjectName, aMeetingName)).not.to.be.ok; - E2EApp.loginUser(); + await E2EApp.loginUser(1); + expect(await E2EMeetingSeries.getMeetingSeriesId(aProjectName, aMeetingName)).not.to.be.ok; + await E2EApp.loginUser(); }); it('ensures that roles do not change on dialog cancel', function () { - let currentUser = E2EApp.getCurrentUser(); + let currentUser = await E2EApp.getCurrentUser(); let user2 = E2EGlobal.SETTINGS.e2eTestUsers[1]; let user3 = E2EGlobal.SETTINGS.e2eTestUsers[2]; - E2EMeetingSeriesEditor.addUserToMeetingSeries(user2, E2EGlobal.USERROLES.Moderator); - E2EMeetingSeriesEditor.addUserToMeetingSeries(user3); + await E2EMeetingSeriesEditor.addUserToMeetingSeries(user2, E2EGlobal.USERROLES.Moderator); + await E2EMeetingSeriesEditor.addUserToMeetingSeries(user3); - E2EMeetingSeriesEditor.closeMeetingSeriesEditor(false); - E2EGlobal.waitSomeTime(); // wait for dialog's animation + await E2EMeetingSeriesEditor.closeMeetingSeriesEditor(false); + await E2EGlobal.waitSomeTime(); // wait for dialog's animation - E2EMeetingSeriesEditor.openMeetingSeriesEditor(aProjectName, aMeetingName, "invited"); - let usersAndRoles = E2EMeetingSeriesEditor.getUsersAndRoles(0,1,2); - E2EMeetingSeriesEditor.closeMeetingSeriesEditor(false); - E2EGlobal.waitSomeTime(); // wait for dialog's animation + await E2EMeetingSeriesEditor.openMeetingSeriesEditor(aProjectName, aMeetingName, "invited"); + let usersAndRoles = await E2EMeetingSeriesEditor.getUsersAndRoles(0,1,2); + await E2EMeetingSeriesEditor.closeMeetingSeriesEditor(false); + await E2EGlobal.waitSomeTime(); // wait for dialog's animation expect(Object.keys(usersAndRoles)).to.have.length(1); expect(usersAndRoles[currentUser]).to.be.ok; @@ -275,31 +275,31 @@ describe('MeetingSeries Editor Users', function () { it('allows new invited user to access old minutes', function () { let myDate = "2015-03-17"; // date of first project commit ;-) - E2EMeetingSeriesEditor.closeMeetingSeriesEditor(false); - E2EGlobal.waitSomeTime(); - E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName, myDate); + await E2EMeetingSeriesEditor.closeMeetingSeriesEditor(false); + await E2EGlobal.waitSomeTime(); + await E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName, myDate); - E2EMeetingSeriesEditor.openMeetingSeriesEditor(aProjectName, aMeetingName, "invited"); + await E2EMeetingSeriesEditor.openMeetingSeriesEditor(aProjectName, aMeetingName, "invited"); let user2 = E2EGlobal.SETTINGS.e2eTestUsers[1]; - E2EMeetingSeriesEditor.addUserToMeetingSeries(user2, E2EGlobal.USERROLES.Invited); - E2EMeetingSeriesEditor.closeMeetingSeriesEditor(); // close with save + await E2EMeetingSeriesEditor.addUserToMeetingSeries(user2, E2EGlobal.USERROLES.Invited); + await E2EMeetingSeriesEditor.closeMeetingSeriesEditor(); // close with save - E2EApp.loginUser(1); - E2EMeetingSeries.gotoMeetingSeries(aProjectName, aMeetingName); - expect(E2EMinutes.countMinutesForSeries(aProjectName, aMeetingName)).to.equal(1); - expect(E2EMinutes.getMinutesId(myDate)).to.be.ok; + await E2EApp.loginUser(1); + await E2EMeetingSeries.gotoMeetingSeries(aProjectName, aMeetingName); + await expect(await E2EMinutes.countMinutesForSeries(aProjectName, aMeetingName)).to.equal(1); + expect(await E2EMinutes.getMinutesId(myDate)).to.be.ok; - E2EApp.loginUser(); + await E2EApp.loginUser(); }); it('prohibits user with no access role to see meeting series', function () { - E2EMeetingSeriesEditor.closeMeetingSeriesEditor(false); - E2EGlobal.waitSomeTime(); // wait for dialog's animation + await E2EMeetingSeriesEditor.closeMeetingSeriesEditor(false); + await E2EGlobal.waitSomeTime(); // wait for dialog's animation - E2EApp.loginUser(1); - expect(E2EMeetingSeries.getMeetingSeriesId(aProjectName, aMeetingName)).not.to.be.ok; - E2EApp.loginUser(); + await E2EApp.loginUser(1); + expect(await E2EMeetingSeries.getMeetingSeriesId(aProjectName, aMeetingName)).not.to.be.ok; + await E2EApp.loginUser(); }); @@ -310,237 +310,237 @@ describe('MeetingSeries Editor Users', function () { E2EGlobal.SETTINGS.e2eTestUsers[3] ]; // enter prefix of multiple users, to provoke twitter typeahead.js suggestions - browser.setValue('#edt_AddUser', "us"); - const userSuggestions = browser.elements('.tt-selectable'); + await browser.setValue('#edt_AddUser', "us"); + const userSuggestions = await browser.elements('.tt-selectable'); let suggestedUserArray = []; for (let usrIndex in userSuggestions.value) { let elemId = userSuggestions.value[usrIndex].ELEMENT; - let usrName = browser.elementIdText(elemId).value; + let usrName = (await browser.elementIdText(elemId)).value; suggestedUserArray.push(usrName); } - expect(suggestedUserArray).to.include.members(otherRegisteredUsers); + await expect(suggestedUserArray).to.include.members(otherRegisteredUsers); - E2EMeetingSeriesEditor.closeMeetingSeriesEditor(false); - E2EGlobal.waitSomeTime(); // wait for dialog's animation + await E2EMeetingSeriesEditor.closeMeetingSeriesEditor(false); + await E2EGlobal.waitSomeTime(); // wait for dialog's animation }); it('can add other users via suggestion drop-down', function () { // enter prefix of multiple users, to provoke twitter typeahead.js suggestions - browser.setValue('#edt_AddUser', "us"); - const userSuggestions = browser.elements('.tt-selectable'); + await browser.setValue('#edt_AddUser', "us"); + const userSuggestions = await browser.elements('.tt-selectable'); let addedUserElemId = userSuggestions.value[0].ELEMENT; // first user in suggestion list - let addedUserName = browser.elementIdText(addedUserElemId).value; - browser.elementIdClick(addedUserElemId); + let addedUserName = (await browser.elementIdText(addedUserElemId)).value; + await browser.elementIdClick(addedUserElemId); - let usersAndRoles = E2EMeetingSeriesEditor.getUsersAndRoles(0,1,2); + let usersAndRoles = await E2EMeetingSeriesEditor.getUsersAndRoles(0,1,2); expect(Object.keys(usersAndRoles)).to.have.length(2); expect(usersAndRoles[addedUserName]).to.be.ok; - expect(usersAndRoles[addedUserName].role).to.equal(E2EGlobal.USERROLES.Invited); + await expect(usersAndRoles[addedUserName].role).to.equal(E2EGlobal.USERROLES.Invited); expect(usersAndRoles[addedUserName].isDeletable).to.be.true; expect(usersAndRoles[addedUserName].isReadOnly).to.be.false; - E2EGlobal.clickWithRetry("#btnMeetinSeriesEditCancel"); // cancel & close editor dialog - E2EGlobal.waitSomeTime(); // wait for dialog's animation + await E2EGlobal.clickWithRetry("#btnMeetinSeriesEditCancel"); // cancel & close editor dialog + await E2EGlobal.waitSomeTime(); // wait for dialog's animation }); it('can only pick not-already added users from drop-down', function () { - let currentUser = E2EApp.getCurrentUser(); + let currentUser = await E2EApp.getCurrentUser(); let user2 = E2EGlobal.SETTINGS.e2eTestUsers[1]; - E2EMeetingSeriesEditor.addUserToMeetingSeries(user2); + await E2EMeetingSeriesEditor.addUserToMeetingSeries(user2); // enter prefix of multiple users, to provoke twitter typeahead.js suggestions - browser.setValue('#edt_AddUser', "us"); - const userSuggestions = browser.elements('.tt-selectable'); + await browser.setValue('#edt_AddUser', "us"); + const userSuggestions = await browser.elements('.tt-selectable'); for (let usrIndex in userSuggestions.value) { let elemId = userSuggestions.value[usrIndex].ELEMENT; - let usrName = browser.elementIdText(elemId).value; - expect(usrName).not.to.equal(currentUser); - expect(usrName).not.to.equal(user2); + let usrName = (await browser.elementIdText(elemId)).value; + await expect(usrName).not.to.equal(currentUser); + await expect(usrName).not.to.equal(user2); } - E2EGlobal.clickWithRetry("#btnMeetinSeriesEditCancel"); // cancel & close editor dialog - E2EGlobal.waitSomeTime(); // wait for dialog's animation + await E2EGlobal.clickWithRetry("#btnMeetinSeriesEditCancel"); // cancel & close editor dialog + await E2EGlobal.waitSomeTime(); // wait for dialog's animation }); it('can pick recently deleted user from drop-down', function () { let user2 = E2EGlobal.SETTINGS.e2eTestUsers[1]; - E2EMeetingSeriesEditor.addUserToMeetingSeries(user2); + await E2EMeetingSeriesEditor.addUserToMeetingSeries(user2); - let usersAndRoles = E2EMeetingSeriesEditor.getUsersAndRoles(0,1,2); + let usersAndRoles = await E2EMeetingSeriesEditor.getUsersAndRoles(0,1,2); // Click on the delete button for user2 - browser.elementIdClick(usersAndRoles[user2].deleteElemId); + await browser.elementIdClick(usersAndRoles[user2].deleteElemId); // enter prefix of multiple users, to provoke twitter typeahead.js suggestions - browser.setValue('#edt_AddUser', "us"); - const userSuggestions = browser.elements('.tt-selectable'); + await browser.setValue('#edt_AddUser', "us"); + const userSuggestions = await browser.elements('.tt-selectable'); let suggestedUserArray = []; for (let usrIndex in userSuggestions.value) { let elemId = userSuggestions.value[usrIndex].ELEMENT; - let usrName = browser.elementIdText(elemId).value; + let usrName = (await browser.elementIdText(elemId)).value; suggestedUserArray.push(usrName); } - expect(suggestedUserArray).to.include(user2); + await expect(suggestedUserArray).to.include(user2); - E2EGlobal.clickWithRetry("#btnMeetinSeriesEditCancel"); // cancel & close editor dialog - E2EGlobal.waitSomeTime(); // wait for dialog's animation + await E2EGlobal.clickWithRetry("#btnMeetinSeriesEditCancel"); // cancel & close editor dialog + await E2EGlobal.waitSomeTime(); // wait for dialog's animation }); it('ensures sync of invited users to participants of un-finalized minutes', function () { - let currentUser = E2EApp.getCurrentUser(); + let currentUser = await E2EApp.getCurrentUser(); let user2 = E2EGlobal.SETTINGS.e2eTestUsers[1]; let user3 = E2EGlobal.SETTINGS.e2eTestUsers[2]; - E2EMeetingSeriesEditor.addUserToMeetingSeries(user2, E2EGlobal.USERROLES.Moderator); - E2EMeetingSeriesEditor.closeMeetingSeriesEditor(); // close with save + await E2EMeetingSeriesEditor.addUserToMeetingSeries(user2, E2EGlobal.USERROLES.Moderator); + await E2EMeetingSeriesEditor.closeMeetingSeriesEditor(); // close with save - E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName); + await E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName); let participantsInfo = new E2EMinutesParticipants(); - expect(participantsInfo.getParticipantsCount(), "initial setup with 2 users").to.equal(2); - expect(participantsInfo.getParticipantInfo(E2EApp.getCurrentUser()), "initial setup with user1").to.be.ok; - expect(participantsInfo.getParticipantInfo(user2), "initial setup with user2").to.be.ok; + await expect(await participantsInfo.getParticipantsCount(), "initial setup with 2 users").to.equal(2); + expect(await participantsInfo.getParticipantInfo(E2EApp.getCurrentUser()), "initial setup with user1").to.be.ok; + expect(await participantsInfo.getParticipantInfo(user2), "initial setup with user2").to.be.ok; // Now remove user2 and add user3 - E2EMeetingSeriesEditor.openMeetingSeriesEditor(aProjectName, aMeetingName, "invited"); - E2EMeetingSeriesEditor.addUserToMeetingSeries(user3, E2EGlobal.USERROLES.Moderator); - let usersAndRoles = E2EMeetingSeriesEditor.getUsersAndRoles(0,1,2); - browser.elementIdClick(usersAndRoles[user2].deleteElemId); - E2EMeetingSeriesEditor.closeMeetingSeriesEditor(); // close with save + await E2EMeetingSeriesEditor.openMeetingSeriesEditor(aProjectName, aMeetingName, "invited"); + await E2EMeetingSeriesEditor.addUserToMeetingSeries(user3, E2EGlobal.USERROLES.Moderator); + let usersAndRoles = await E2EMeetingSeriesEditor.getUsersAndRoles(0,1,2); + await browser.elementIdClick(usersAndRoles[user2].deleteElemId); + await E2EMeetingSeriesEditor.closeMeetingSeriesEditor(); // close with save - E2EMinutes.gotoLatestMinutes(); + await E2EMinutes.gotoLatestMinutes(); participantsInfo = new E2EMinutesParticipants(); - expect(participantsInfo.getParticipantsCount(), "after edit still 2 users").to.equal(2); - expect(participantsInfo.getParticipantInfo(E2EApp.getCurrentUser()), "after edit still with user1").to.be.ok; - expect(participantsInfo.getParticipantInfo(user3), "after edit now with user3").to.be.ok; + await expect(await participantsInfo.getParticipantsCount(), "after edit still 2 users").to.equal(2); + expect(await participantsInfo.getParticipantInfo(E2EApp.getCurrentUser()), "after edit still with user1").to.be.ok; + expect(await participantsInfo.getParticipantInfo(user3), "after edit now with user3").to.be.ok; }); it('allows an invited user to leave a meeting series', function () { - let currentUser = E2EApp.getCurrentUser(); + let currentUser = await E2EApp.getCurrentUser(); let user2 = E2EGlobal.SETTINGS.e2eTestUsers[1]; - E2EMeetingSeriesEditor.addUserToMeetingSeries(user2, E2EGlobal.USERROLES.Invited); - E2EMeetingSeriesEditor.closeMeetingSeriesEditor(); // close with save + await E2EMeetingSeriesEditor.addUserToMeetingSeries(user2, E2EGlobal.USERROLES.Invited); + await E2EMeetingSeriesEditor.closeMeetingSeriesEditor(); // close with save - E2EApp.loginUser(1); - E2EGlobal.waitSomeTime(100); - let initialMSCount = E2EMeetingSeries.countMeetingSeries(); + await E2EApp.loginUser(1); + await E2EGlobal.waitSomeTime(100); + let initialMSCount = await E2EMeetingSeries.countMeetingSeries(); - E2EMeetingSeries.gotoMeetingSeries(aProjectName, aMeetingName); - E2EGlobal.waitSomeTime(); + await E2EMeetingSeries.gotoMeetingSeries(aProjectName, aMeetingName); + await E2EGlobal.waitSomeTime(); - E2EGlobal.clickWithRetry("#btnLeaveMeetingSeries"); // leave meeting series - E2EApp.confirmationDialogAnswer(true); - expect(E2EMeetingSeries.countMeetingSeries(), + await E2EGlobal.clickWithRetry("#btnLeaveMeetingSeries"); // leave meeting series + await E2EApp.confirmationDialogAnswer(true); + await expect(await E2EMeetingSeries.countMeetingSeries(), "minus-one visible series after leave").to.equal(initialMSCount -1); - expect(E2EMeetingSeries.getMeetingSeriesId(aProjectName, aMeetingName), + expect(await E2EMeetingSeries.getMeetingSeriesId(aProjectName, aMeetingName), "Series shall be invisible after leave").not.to.be.ok; - E2EApp.loginUser(); + await E2EApp.loginUser(); }); // this test does only make sense if mail delivery is enabled if (E2EGlobal.SETTINGS.email && E2EGlobal.SETTINGS.email.enableMailDelivery) { it('ensures informed user gets minutes email', function () { - E2EMails.resetSentMailsDb(); - let currentUser = E2EApp.getCurrentUser(); + await E2EMails.resetSentMailsDb(); + let currentUser = await E2EApp.getCurrentUser(); let user2 = E2EGlobal.SETTINGS.e2eTestUsers[1]; - E2EMeetingSeriesEditor.disableEmailForRoleChange(); - E2EMeetingSeriesEditor.addUserToMeetingSeries(user2, E2EGlobal.USERROLES.Informed); - E2EMeetingSeriesEditor.closeMeetingSeriesEditor(); // close with save + await E2EMeetingSeriesEditor.disableEmailForRoleChange(); + await E2EMeetingSeriesEditor.addUserToMeetingSeries(user2, E2EGlobal.USERROLES.Informed); + await E2EMeetingSeriesEditor.closeMeetingSeriesEditor(); // close with save - E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName); - E2ETopics.addTopicToMinutes('some topic'); - E2EMinutes.finalizeCurrentMinutes(/*autoConfirmDialog*/true); - E2EGlobal.waitSomeTime(1000); + await E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName); + await E2ETopics.addTopicToMinutes('some topic'); + await E2EMinutes.finalizeCurrentMinutes(/*autoConfirmDialog*/true); + await E2EGlobal.waitSomeTime(1000); - let recipients = E2EMails.getAllRecipients(); + let recipients = await E2EMails.getAllRecipients(); expect(recipients).to.have.length(2); - expect(recipients).to.include.members( + await expect(recipients).to.include.members( [E2EGlobal.SETTINGS.e2eTestEmails[0], E2EGlobal.SETTINGS.e2eTestEmails[1]]); }); } it('ensures informed user can not see meeting series', function () { - this.timeout(100000); + await this.timeout(100000); - E2EMeetingSeriesEditor.closeMeetingSeriesEditor(false); // close with cancel - E2EApp.loginUser(1); - let initialMScount = E2EMeetingSeries.countMeetingSeries(); - E2EGlobal.waitSomeTime(500); - E2EApp.loginUser(); + await E2EMeetingSeriesEditor.closeMeetingSeriesEditor(false); // close with cancel + await E2EApp.loginUser(1); + let initialMScount = await E2EMeetingSeries.countMeetingSeries(); + await E2EGlobal.waitSomeTime(500); + await E2EApp.loginUser(); - E2EMeetingSeriesEditor.openMeetingSeriesEditor(aProjectName, aMeetingName, "invited"); + await E2EMeetingSeriesEditor.openMeetingSeriesEditor(aProjectName, aMeetingName, "invited"); let user2 = E2EGlobal.SETTINGS.e2eTestUsers[1]; - E2EMeetingSeriesEditor.addUserToMeetingSeries(user2, E2EGlobal.USERROLES.Informed); - E2EMeetingSeriesEditor.closeMeetingSeriesEditor(); // close with save + await E2EMeetingSeriesEditor.addUserToMeetingSeries(user2, E2EGlobal.USERROLES.Informed); + await E2EMeetingSeriesEditor.closeMeetingSeriesEditor(); // close with save - E2EApp.loginUser(1); - expect(E2EMeetingSeries.countMeetingSeries()).to.equal(initialMScount); + await E2EApp.loginUser(1); + await expect(await E2EMeetingSeries.countMeetingSeries()).to.equal(initialMScount); - E2EGlobal.waitSomeTime(500); - E2EApp.loginUser(); + await E2EGlobal.waitSomeTime(500); + await E2EApp.loginUser(); }); it('ensures downgraded to informed user can not see meeting series anymore', function () { - this.timeout(100000); + await this.timeout(100000); - let currentUser = E2EApp.getCurrentUser(); + let currentUser = await E2EApp.getCurrentUser(); let user2 = E2EGlobal.SETTINGS.e2eTestUsers[1]; - E2EMeetingSeriesEditor.addUserToMeetingSeries(user2, E2EGlobal.USERROLES.Invited); - E2EMeetingSeriesEditor.closeMeetingSeriesEditor(); // close with save - E2EApp.loginUser(1); - let initialMScount = E2EMeetingSeries.countMeetingSeries(); - E2EGlobal.waitSomeTime(500); - - E2EApp.loginUser(); - E2EMeetingSeriesEditor.openMeetingSeriesEditor(aProjectName, aMeetingName, "invited"); + await E2EMeetingSeriesEditor.addUserToMeetingSeries(user2, E2EGlobal.USERROLES.Invited); + await E2EMeetingSeriesEditor.closeMeetingSeriesEditor(); // close with save + await E2EApp.loginUser(1); + let initialMScount = await E2EMeetingSeries.countMeetingSeries(); + await E2EGlobal.waitSomeTime(500); + + await E2EApp.loginUser(); + await E2EMeetingSeriesEditor.openMeetingSeriesEditor(aProjectName, aMeetingName, "invited"); let roleSelector = "select.user-role-select"; - browser.selectByValue(roleSelector, E2EGlobal.USERROLES.Informed); - E2EMeetingSeriesEditor.closeMeetingSeriesEditor(); // close with save - E2EApp.loginUser(1); - expect(E2EMeetingSeries.countMeetingSeries(), "MS count should be minus one").to.equal(initialMScount - 1); - E2EGlobal.waitSomeTime(500); + await browser.selectByValue(roleSelector, E2EGlobal.USERROLES.Informed); + await E2EMeetingSeriesEditor.closeMeetingSeriesEditor(); // close with save + await E2EApp.loginUser(1); + await expect(await E2EMeetingSeries.countMeetingSeries(), "MS count should be minus one").to.equal(initialMScount - 1); + await E2EGlobal.waitSomeTime(500); - E2EApp.loginUser(); + await E2EApp.loginUser(); }); it('ensures participants gets E-Mail on role change', function () { // Clear mails - E2EMails.resetSentMailsDb(); + await E2EMails.resetSentMailsDb(); // Add user let user2 = E2EGlobal.SETTINGS.e2eTestUsers[1]; - E2EMeetingSeriesEditor.addUserToMeetingSeries(user2); - E2EMeetingSeriesEditor.closeMeetingSeriesEditor(); + await E2EMeetingSeriesEditor.addUserToMeetingSeries(user2); + await E2EMeetingSeriesEditor.closeMeetingSeriesEditor(); //check emais - let recipients = E2EMails.getAllRecipients(); + let recipients = await E2EMails.getAllRecipients(); expect(recipients).to.have.length(1); }); it('ensures participants does not get an E-Mail if roles stay the same', function () { // Clear mails - E2EMails.resetSentMailsDb(); + await E2EMails.resetSentMailsDb(); // Add user - E2EMeetingSeriesEditor.openMeetingSeriesEditor(aProjectName, aMeetingName, "invited"); - E2EMeetingSeriesEditor.disableEmailForRoleChange(); + await E2EMeetingSeriesEditor.openMeetingSeriesEditor(aProjectName, aMeetingName, "invited"); + await E2EMeetingSeriesEditor.disableEmailForRoleChange(); let user2 = E2EGlobal.SETTINGS.e2eTestUsers[1]; - E2EMeetingSeriesEditor.addUserToMeetingSeries(user2); - E2EMeetingSeriesEditor.closeMeetingSeriesEditor(); + await E2EMeetingSeriesEditor.addUserToMeetingSeries(user2); + await E2EMeetingSeriesEditor.closeMeetingSeriesEditor(); // open the dialog without saving roles and save - E2EMeetingSeriesEditor.openMeetingSeriesEditor(aProjectName, aMeetingName, "invited"); - E2EMeetingSeriesEditor.closeMeetingSeriesEditor(); + await E2EMeetingSeriesEditor.openMeetingSeriesEditor(aProjectName, aMeetingName, "invited"); + await E2EMeetingSeriesEditor.closeMeetingSeriesEditor(); //check emails - let recipients = E2EMails.getAllRecipients(); + let recipients = await E2EMails.getAllRecipients(); expect(recipients).to.have.length(0); }); diff --git a/tests/end2end/MeetingSeriesItemList-test.js b/tests/end2end/MeetingSeriesItemList-test.js index 1104633d2..04ca2bc91 100644 --- a/tests/end2end/MeetingSeriesItemList-test.js +++ b/tests/end2end/MeetingSeriesItemList-test.js @@ -13,61 +13,61 @@ describe('MeetingSeries Items list', function () { let aMeetingName; before("reload page and reset app", function () { - E2EGlobal.logTimestamp("Start test suite"); - E2EApp.resetMyApp(true); - E2EApp.launchApp(); + await E2EGlobal.logTimestamp("Start test suite"); + await E2EApp.resetMyApp(true); + await E2EApp.launchApp(); }); beforeEach("goto start page and make sure test user is logged in", function () { - E2EApp.gotoStartPage(); - expect(E2EApp.isLoggedIn()).to.be.true; + await E2EApp.gotoStartPage(); + expect(await E2EApp.isLoggedIn()).to.be.true; aMeetingCounter++; aMeetingName = aMeetingNameBase + aMeetingCounter; - E2EMeetingSeries.createMeetingSeries(aProjectName, aMeetingName); - E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName); + await E2EMeetingSeries.createMeetingSeries(aProjectName, aMeetingName); + await E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName); }); it("displays all info- and action-items of all topics", function () { - E2ETopics.addTopicToMinutes('some topic'); - E2ETopics.addInfoItemToTopic({subject: 'some information'}, 1); - E2ETopics.addInfoItemToTopic({subject: 'some action item', itemType: "actionItem"}, 1); + await E2ETopics.addTopicToMinutes('some topic'); + await E2ETopics.addInfoItemToTopic({subject: 'some information'}, 1); + await E2ETopics.addInfoItemToTopic({subject: 'some action item', itemType: "actionItem"}, 1); - E2ETopics.addTopicToMinutes('some other topic'); - E2ETopics.addInfoItemToTopic({subject: 'some information of another topic'}, 1); - E2ETopics.addInfoItemToTopic({subject: 'some action item of another topic', itemType: "actionItem"}, 1); + await E2ETopics.addTopicToMinutes('some other topic'); + await E2ETopics.addInfoItemToTopic({subject: 'some information of another topic'}, 1); + await E2ETopics.addInfoItemToTopic({subject: 'some action item of another topic', itemType: "actionItem"}, 1); - E2EMinutes.finalizeCurrentMinutes(); + await E2EMinutes.finalizeCurrentMinutes(); - E2EMinutes.gotoParentMeetingSeries(); + await E2EMinutes.gotoParentMeetingSeries(); - E2EMeetingSeries.gotoTabItems(); + await E2EMeetingSeries.gotoTabItems(); - expect(E2ETopics.getAllItemsFromItemList().length, "List should have 4 items").to.equal(4); + await expect((await E2ETopics.getAllItemsFromItemList()).length, "List should have 4 items").to.equal(4); - expect(E2ETopics.getNthItemFromItemList(0).value, "First item should have correct subject").to.have.string("some action item of another topic"); - expect(E2ETopics.getNthItemFromItemList(1).value, "First item should have correct subject").to.have.string("some information of another topic"); - expect(E2ETopics.getNthItemFromItemList(2).value, "First item should have correct subject").to.have.string("some action item"); - expect(E2ETopics.getNthItemFromItemList(3).value, "First item should have correct subject").to.have.string("some information"); + await expect((await E2ETopics.getNthItemFromItemList(0)).value, "First item should have correct subject").to.have.string("some action item of another topic"); + await expect((await E2ETopics.getNthItemFromItemList(1)).value, "First item should have correct subject").to.have.string("some information of another topic"); + await expect((await E2ETopics.getNthItemFromItemList(2)).value, "First item should have correct subject").to.have.string("some action item"); + await expect((await E2ETopics.getNthItemFromItemList(3)).value, "First item should have correct subject").to.have.string("some information"); }); it('can expand an info item to display its details on the item list', function () { - E2ETopics.addTopicToMinutes('some topic'); - E2ETopics.addInfoItemToTopic({subject: 'some information'}, 1); - E2ETopics.addDetailsToActionItem(1, 1, "Amazing details for this information item"); + await E2ETopics.addTopicToMinutes('some topic'); + await E2ETopics.addInfoItemToTopic({subject: 'some information'}, 1); + await E2ETopics.addDetailsToActionItem(1, 1, "Amazing details for this information item"); - E2EMinutes.finalizeCurrentMinutes(); + await E2EMinutes.finalizeCurrentMinutes(); - E2EMinutes.gotoParentMeetingSeries(); + await E2EMinutes.gotoParentMeetingSeries(); - E2EMeetingSeries.gotoTabItems(); + await E2EMeetingSeries.gotoTabItems(); - E2ETopics.expandDetailsForNthInfoItem(1); + await E2ETopics.expandDetailsForNthInfoItem(1); - expect(E2ETopics.getNthItemFromItemList(0).value) - .to.have.string(formatDateISO8601(new Date()) + ' New' + '\nAmazing details for this information item'); + await expect((await E2ETopics.getNthItemFromItemList(0)).value) + .to.have.string((await formatDateISO8601(new Date())) + ' New' + '\nAmazing details for this information item'); }); }); \ No newline at end of file diff --git a/tests/end2end/MeetingSeriesSearch-test.js b/tests/end2end/MeetingSeriesSearch-test.js index c9485a4c4..430717a6b 100644 --- a/tests/end2end/MeetingSeriesSearch-test.js +++ b/tests/end2end/MeetingSeriesSearch-test.js @@ -5,61 +5,61 @@ import {E2EGlobal} from "./helpers/E2EGlobal"; describe('MeetingSeriesSearch', function () { beforeEach("goto start page and make sure test user is logged in", function () { - E2EApp.gotoStartPage(); - expect(E2EApp.isLoggedIn()).to.be.true; + await E2EApp.gotoStartPage(); + expect(await E2EApp.isLoggedIn()).to.be.true; }); before("reload page and reset app", function () { - E2EGlobal.logTimestamp("Start test suite"); - E2EApp.resetMyApp(true); - E2EApp.launchApp(); + await E2EGlobal.logTimestamp("Start test suite"); + await E2EApp.resetMyApp(true); + await E2EApp.launchApp(); }); - const bootstrapSeries = (count = 5) => { - const initialCount = E2EMeetingSeries.countMeetingSeries(); + const bootstrapSeries = async (count = 5) => { + const initialCount = await E2EMeetingSeries.countMeetingSeries(); if (initialCount !== count) { const startIndex = initialCount + 1; for (let i = startIndex; i <= count; i++) { const aProjectName = "E2E Project" + i; const aMeetingName = "Meeting Name #" + i; - E2EMeetingSeries.createMeetingSeries(aProjectName, aMeetingName); + await E2EMeetingSeries.createMeetingSeries(aProjectName, aMeetingName); } } }; it('can create four meeting series and is not able to search', function () { - bootstrapSeries(4); - expect(E2EMeetingSeries.countMeetingSeries()).to.equal(4); - expect(E2EMeetingSeries.visibleMeetingSeriesSearch()).to.be.false; + await bootstrapSeries(4); + await expect(await E2EMeetingSeries.countMeetingSeries()).to.equal(4); + expect(await E2EMeetingSeries.visibleMeetingSeriesSearch()).to.be.false; }); it('can create the fith meeting series and now is able to search', function () { - bootstrapSeries(); - expect(E2EMeetingSeries.countMeetingSeries()).to.equal(5); - expect(E2EMeetingSeries.visibleMeetingSeriesSearch()).to.be.true; + await bootstrapSeries(); + await expect(await E2EMeetingSeries.countMeetingSeries()).to.equal(5); + expect(await E2EMeetingSeries.visibleMeetingSeriesSearch()).to.be.true; }); it('can search for name', function () { - bootstrapSeries(); - E2EMeetingSeries.searchMeetingSeries('#3'); - expect(E2EMeetingSeries.countMeetingSeries(false)).to.equal(1); + await bootstrapSeries(); + await E2EMeetingSeries.searchMeetingSeries('#3'); + await expect(await E2EMeetingSeries.countMeetingSeries(false)).to.equal(1); }); it('can search for project', function () { - bootstrapSeries(); - E2EMeetingSeries.searchMeetingSeries('Project3'); - expect(E2EMeetingSeries.countMeetingSeries(false)).to.equal(1); + await bootstrapSeries(); + await E2EMeetingSeries.searchMeetingSeries('Project3'); + await expect(await E2EMeetingSeries.countMeetingSeries(false)).to.equal(1); }); it('can search with many parameters', function () { - bootstrapSeries(); - E2EMeetingSeries.searchMeetingSeries('#1 Project3 5'); - expect(E2EMeetingSeries.countMeetingSeries(false)).to.equal(0); + await bootstrapSeries(); + await E2EMeetingSeries.searchMeetingSeries('#1 Project3 5'); + await expect(await E2EMeetingSeries.countMeetingSeries(false)).to.equal(0); }); it('can notice if nothing is found', function () { - bootstrapSeries(); - E2EMeetingSeries.searchMeetingSeries('Project99'); - expect(E2EMeetingSeries.visibleWarning(false)).to.be.true; + await bootstrapSeries(); + await E2EMeetingSeries.searchMeetingSeries('Project99'); + expect(await E2EMeetingSeries.visibleWarning(false)).to.be.true; }); }); diff --git a/tests/end2end/MeetingSeries_security.js b/tests/end2end/MeetingSeries_security.js index 2c6c61947..f3d384d39 100644 --- a/tests/end2end/MeetingSeries_security.js +++ b/tests/end2end/MeetingSeries_security.js @@ -7,135 +7,135 @@ const newName = 'Changed Hacker Project #3'; describe('MeetingSeries Methods Security', function () { beforeEach('goto start page and make sure test user is logged in', function () { - E2EApp.gotoStartPage(); - expect(E2EApp.isLoggedIn()).to.be.true; + await E2EApp.gotoStartPage(); + expect(await E2EApp.isLoggedIn()).to.be.true; }); before('reload page and reset app', function () { - E2EGlobal.logTimestamp("Start test suite"); - E2EApp.resetMyApp(true); - E2EApp.launchApp(); + await E2EGlobal.logTimestamp("Start test suite"); + await E2EApp.resetMyApp(true); + await E2EApp.launchApp(); }); it('can not insert a new MeetingSerie if not logged in', function () { const name = 'Insert a MeetingSerie'; - const meetingSeriesCount = server.call('e2e.countMeetingSeriesInMongDB'); - E2EApp.logoutUser(); - expect(E2EApp.isNotLoggedIn()).to.be.true; - E2ESecurity.tryInsertMeetingSeries(name, meetingSeriesCount, 'Meeting Series can not be added if user is not logged in'); - - E2EApp.loginUser(); - expect(E2EApp.isLoggedIn()).to.be.true; - E2ESecurity.tryInsertMeetingSeries(name, meetingSeriesCount+1, 'Meeting Series can be added if user is logged in'); + const meetingSeriesCount = await server.call('e2e.countMeetingSeriesInMongDB'); + await E2EApp.logoutUser(); + expect(await E2EApp.isNotLoggedIn()).to.be.true; + await E2ESecurity.tryInsertMeetingSeries(name, meetingSeriesCount, 'Meeting Series can not be added if user is not logged in'); + + await E2EApp.loginUser(); + expect(await E2EApp.isLoggedIn()).to.be.true; + await E2ESecurity.tryInsertMeetingSeries(name, meetingSeriesCount+1, 'Meeting Series can be added if user is logged in'); }); it('can not delete a new MeetingSerie if not logged in', function () { const name = 'DeleteMeetingSerie'; - const ms_id = E2ESecurity.createMeetingSeries(name); - const meetingSeriesCount = server.call('e2e.countMeetingSeriesInMongDB'); - E2ESecurity.inviteUserToMeetingSerie(name, 'Invited', 2); + const ms_id = await E2ESecurity.createMeetingSeries(name); + const meetingSeriesCount = await server.call('e2e.countMeetingSeriesInMongDB'); + await E2ESecurity.inviteUserToMeetingSerie(name, 'Invited', 2); - E2EApp.logoutUser(); - expect(E2EApp.isNotLoggedIn()).to.be.true; - E2ESecurity.tryDeleteMeetingSeries(ms_id, meetingSeriesCount, 'Meeting Series can not be deleted if user is not logged in'); + await E2EApp.logoutUser(); + expect(await E2EApp.isNotLoggedIn()).to.be.true; + await E2ESecurity.tryDeleteMeetingSeries(ms_id, meetingSeriesCount, 'Meeting Series can not be deleted if user is not logged in'); - E2EApp.loginUser(1); - expect(E2EApp.isLoggedIn()).to.be.true; - E2ESecurity.tryDeleteMeetingSeries(ms_id, meetingSeriesCount, 'Meeting Series can not be deleted if user is not invited to a MS'); + await E2EApp.loginUser(1); + expect(await E2EApp.isLoggedIn()).to.be.true; + await E2ESecurity.tryDeleteMeetingSeries(ms_id, meetingSeriesCount, 'Meeting Series can not be deleted if user is not invited to a MS'); - E2EApp.loginUser(2); - expect(E2EApp.isLoggedIn()).to.be.true; - E2ESecurity.tryDeleteMeetingSeries(ms_id, meetingSeriesCount, 'Meeting Series can not be deleted by invited user'); + await E2EApp.loginUser(2); + expect(await E2EApp.isLoggedIn()).to.be.true; + await E2ESecurity.tryDeleteMeetingSeries(ms_id, meetingSeriesCount, 'Meeting Series can not be deleted by invited user'); - E2EApp.loginUser(0); - expect(E2EApp.isLoggedIn()).to.be.true; - E2ESecurity.tryDeleteMeetingSeries(ms_id, meetingSeriesCount-1, 'Meeting Series can be deleted if user is moderator'); + await E2EApp.loginUser(0); + expect(await E2EApp.isLoggedIn()).to.be.true; + await E2ESecurity.tryDeleteMeetingSeries(ms_id, meetingSeriesCount-1, 'Meeting Series can be deleted if user is moderator'); }); it('can not update a MeetingSerie if not logged in', function () { const name = 'UpdateMeetingSerie'; - const ms_id = E2ESecurity.createMeetingSeries(name); - const oldName = (server.call('e2e.findMeetingSeries', ms_id)).name; - E2ESecurity.inviteUserToMeetingSerie(name, 'Invited', 2); + const ms_id = await E2ESecurity.createMeetingSeries(name); + const oldName = ((await (server.call('e2e.findMeetingSeries', ms_id)))).name; + await E2ESecurity.inviteUserToMeetingSerie(name, 'Invited', 2); - E2EApp.logoutUser(); - expect(E2EApp.isNotLoggedIn()).to.be.true; - E2ESecurity.tryUpdateMeetingSeriesName(ms_id, newName, oldName, 'Meeting Series can not be updated if user is not logged in'); + await E2EApp.logoutUser(); + expect(await E2EApp.isNotLoggedIn()).to.be.true; + await E2ESecurity.tryUpdateMeetingSeriesName(ms_id, newName, oldName, 'Meeting Series can not be updated if user is not logged in'); - E2EApp.loginUser(1); - expect(E2EApp.isLoggedIn()).to.be.true; - E2ESecurity.tryUpdateMeetingSeriesName(ms_id, newName, oldName, 'Meeting Series can not be updated if user is not a moderator'); + await E2EApp.loginUser(1); + expect(await E2EApp.isLoggedIn()).to.be.true; + await E2ESecurity.tryUpdateMeetingSeriesName(ms_id, newName, oldName, 'Meeting Series can not be updated if user is not a moderator'); - E2EApp.loginUser(2); - expect(E2EApp.isLoggedIn()).to.be.true; - E2ESecurity.tryUpdateMeetingSeriesName(ms_id, newName, oldName, 'Meeting Series can not be updated by invited user'); + await E2EApp.loginUser(2); + expect(await E2EApp.isLoggedIn()).to.be.true; + await E2ESecurity.tryUpdateMeetingSeriesName(ms_id, newName, oldName, 'Meeting Series can not be updated by invited user'); - E2EApp.loginUser(); - expect(E2EApp.isLoggedIn()).to.be.true; - E2ESecurity.tryUpdateMeetingSeriesName(ms_id, newName, newName, 'Meeting Series can be updated if user is logged in and a moderator'); + await E2EApp.loginUser(); + expect(await E2EApp.isLoggedIn()).to.be.true; + await E2ESecurity.tryUpdateMeetingSeriesName(ms_id, newName, newName, 'Meeting Series can be updated if user is logged in and a moderator'); }); }); describe('MeetingSeries Publish & Subscribe Security', function () { beforeEach('goto start page and make sure test user is logged in', function () { - E2EApp.gotoStartPage(); - expect(E2EApp.isLoggedIn()).to.be.true; + await E2EApp.gotoStartPage(); + expect(await E2EApp.isLoggedIn()).to.be.true; }); before('reload page and reset app', function () { - E2EApp.resetMyApp(true); - E2EApp.launchApp(); + await E2EApp.resetMyApp(true); + await E2EApp.launchApp(); }); it('Non-logged in users have no unexpected MS published', function () { - const msUser1 = E2ESecurity.countRecordsInMiniMongo('meetingSeries'); + const msUser1 = await E2ESecurity.countRecordsInMiniMongo('meetingSeries'); const name = 'Publish MS Project #1'; - E2ESecurity.createMeetingSeries(name); + await E2ESecurity.createMeetingSeries(name); - expect(E2ESecurity.countRecordsInMiniMongo('meetingSeries'), + await expect(await E2ESecurity.countRecordsInMiniMongo('meetingSeries'), 'Moderator should have a MS published').to.equal(msUser1+1); - E2EApp.logoutUser(); - expect(E2EApp.isNotLoggedIn()).to.be.true; - expect(E2ESecurity.countRecordsInMiniMongo('meetingSeries'), + await E2EApp.logoutUser(); + expect(await E2EApp.isNotLoggedIn()).to.be.true; + await expect(await E2ESecurity.countRecordsInMiniMongo('meetingSeries'), 'Not logged in user should not have a MS published').to.equal(0); - E2EApp.loginUser(); + await E2EApp.loginUser(); }); it('Invited users have no unexpected MS published', function () { - E2EApp.loginUser(1); - expect(E2EApp.isLoggedIn()).to.be.true; - const msUser2 = E2ESecurity.countRecordsInMiniMongo('meetingSeries'); + await E2EApp.loginUser(1); + expect(await E2EApp.isLoggedIn()).to.be.true; + const msUser2 = await E2ESecurity.countRecordsInMiniMongo('meetingSeries'); - E2EApp.loginUser(); + await E2EApp.loginUser(); const name = 'Publish MS Project #2'; const name2 = 'Publish MS Project #22'; - E2ESecurity.createMeetingSeries(name); - E2ESecurity.createMeetingSeries(name2); + await E2ESecurity.createMeetingSeries(name); + await E2ESecurity.createMeetingSeries(name2); - E2ESecurity.inviteUserToMeetingSerie(name, 'Invited', 1); + await E2ESecurity.inviteUserToMeetingSerie(name, 'Invited', 1); - E2EApp.loginUser(1); - expect(E2EApp.isLoggedIn()).to.be.true; - expect(E2ESecurity.countRecordsInMiniMongo('meetingSeries'), + await E2EApp.loginUser(1); + expect(await E2EApp.isLoggedIn()).to.be.true; + await expect(await E2ESecurity.countRecordsInMiniMongo('meetingSeries'), 'Invited user should have a MS published').to.equal(msUser2+1); - E2EApp.loginUser(); + await E2EApp.loginUser(); }); it('Informed users have no unexpected MS published', function () { - E2EApp.loginUser(2); - expect(E2EApp.isLoggedIn()).to.be.true; - const msUser3 = E2ESecurity.countRecordsInMiniMongo('meetingSeries'); + await E2EApp.loginUser(2); + expect(await E2EApp.isLoggedIn()).to.be.true; + const msUser3 = await E2ESecurity.countRecordsInMiniMongo('meetingSeries'); - E2EApp.loginUser(); + await E2EApp.loginUser(); const name = 'Publish MS Project #3'; - E2ESecurity.createMeetingSeries(name); - E2ESecurity.inviteUserToMeetingSerie(name, 'Informed', 2); + await E2ESecurity.createMeetingSeries(name); + await E2ESecurity.inviteUserToMeetingSerie(name, 'Informed', 2); - E2EApp.loginUser(2); - expect(E2EApp.isLoggedIn()).to.be.true; - expect(E2ESecurity.countRecordsInMiniMongo('meetingSeries'), + await E2EApp.loginUser(2); + expect(await E2EApp.isLoggedIn()).to.be.true; + await expect(await E2ESecurity.countRecordsInMiniMongo('meetingSeries'), 'Informed user should not have a MS published').to.equal(msUser3); - E2EApp.loginUser(); + await E2EApp.loginUser(); }); }); diff --git a/tests/end2end/Migrations-test.js b/tests/end2end/Migrations-test.js index 8ccc807c0..7891ec78d 100644 --- a/tests/end2end/Migrations-test.js +++ b/tests/end2end/Migrations-test.js @@ -16,63 +16,63 @@ describe.skip('Migrations', function () { let aMeetingName; before("reload page and reset app", function () { - E2EGlobal.logTimestamp("Start test suite"); - E2EApp.resetMyApp(true); - E2EApp.launchApp(); + await E2EGlobal.logTimestamp("Start test suite"); + await E2EApp.resetMyApp(true); + await E2EApp.launchApp(); }); beforeEach("goto start page and make sure test user is logged in", function () { - E2EApp.gotoStartPage(); - expect(E2EApp.isLoggedIn()).to.be.true; + await E2EApp.gotoStartPage(); + expect(await E2EApp.isLoggedIn()).to.be.true; aMeetingCounter++; aMeetingName = aMeetingNameBase + aMeetingCounter; - E2EMeetingSeries.createMeetingSeries(aProjectName, aMeetingName); - E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName); + await E2EMeetingSeries.createMeetingSeries(aProjectName, aMeetingName); + await E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName); }); it('should not change meeting series topics history when migration down and up', function() { - E2ETopics.addTopicToMinutes('some topic'); - E2ETopics.addInfoItemToTopic({subject: 'information'}, 1); - E2ETopics.addInfoItemToTopic({subject: 'action item', itemType: 'actionItem'}, 1); + await E2ETopics.addTopicToMinutes('some topic'); + await E2ETopics.addInfoItemToTopic({subject: 'information'}, 1); + await E2ETopics.addInfoItemToTopic({subject: 'action item', itemType: 'actionItem'}, 1); - E2EMinutes.finalizeCurrentMinutes(); + await E2EMinutes.finalizeCurrentMinutes(); - E2EMinutes.gotoParentMeetingSeries(); + await E2EMinutes.gotoParentMeetingSeries(); - E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName); + await E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName); - E2ETopics.toggleActionItem(1, 1); - E2ETopics.addInfoItemToTopic({subject: 'new information'}, 1); - E2ETopics.addInfoItemToTopic({subject: 'new action item', itemType: 'actionItem'}, 1); + await E2ETopics.toggleActionItem(1, 1); + await E2ETopics.addInfoItemToTopic({subject: 'new information'}, 1); + await E2ETopics.addInfoItemToTopic({subject: 'new action item', itemType: 'actionItem'}, 1); - E2EMinutes.finalizeCurrentMinutes(); + await E2EMinutes.finalizeCurrentMinutes(); - E2EMinutes.gotoParentMeetingSeries(); + await E2EMinutes.gotoParentMeetingSeries(); - const checkHistory = () => { - const url = browser.getUrl(); + const checkHistory = async () => { + const url = await browser.getUrl(); const msId = url.slice(url.lastIndexOf("/")+1); - const topics = server.call('e2e.getTopicsOfMeetingSeries', msId); + const topics = await server.call('e2e.getTopicsOfMeetingSeries', msId); - expect(topics.length, "Meeting Series should have one topic").to.equal(1); - expect(topics[0].infoItems.length, "Topic should have four items").to.equal(4); + await expect(topics.length, "Meeting Series should have one topic").to.equal(1); + await expect(topics[0].infoItems.length, "Topic should have four items").to.equal(4); }; - checkHistory(20); + await checkHistory(20); - E2EGlobal.waitSomeTime(500); + await E2EGlobal.waitSomeTime(500); const startAtVersion = 17; - server.call('e2e.triggerMigration', startAtVersion); + await server.call('e2e.triggerMigration', startAtVersion); for (let i=startAtVersion+1; i<=21; i++) { - server.call('e2e.triggerMigration', i); + await server.call('e2e.triggerMigration', i); console.log('migrated to version ' + i); - E2EGlobal.waitSomeTime(1000); - checkHistory(); + await E2EGlobal.waitSomeTime(1000); + await checkHistory(); } }); diff --git a/tests/end2end/Minutes-test.js b/tests/end2end/Minutes-test.js index fbaf68413..6bc2a56ab 100644 --- a/tests/end2end/Minutes-test.js +++ b/tests/end2end/Minutes-test.js @@ -7,14 +7,14 @@ import { E2ETopics } from './helpers/E2ETopics'; describe('Minutes', function () { before("reload page and reset app", function () { - E2EGlobal.logTimestamp("Start test suite"); - E2EApp.resetMyApp(true); - E2EApp.launchApp(); + await E2EGlobal.logTimestamp("Start test suite"); + await E2EApp.resetMyApp(true); + await E2EApp.launchApp(); }); beforeEach("goto start page and make sure test user is logged in", function () { - E2EApp.gotoStartPage(); - expect (E2EApp.isLoggedIn()).to.be.true; + await E2EApp.gotoStartPage(); + expect (await E2EApp.isLoggedIn()).to.be.true; }); @@ -22,12 +22,12 @@ describe('Minutes', function () { let aProjectName = "E2E Minutes"; let aMeetingName = "Meeting Name #1"; - E2EMeetingSeries.createMeetingSeries(aProjectName, aMeetingName); - expect(E2EMinutes.countMinutesForSeries(aProjectName, aMeetingName)).to.equal(0); + await E2EMeetingSeries.createMeetingSeries(aProjectName, aMeetingName); + await expect(await E2EMinutes.countMinutesForSeries(aProjectName, aMeetingName)).to.equal(0); - E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName); - E2EMinutes.finalizeCurrentMinutes(); - expect(E2EMinutes.countMinutesForSeries(aProjectName, aMeetingName)).to.equal(1); + await E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName); + await E2EMinutes.finalizeCurrentMinutes(); + await expect(await E2EMinutes.countMinutesForSeries(aProjectName, aMeetingName)).to.equal(1); }); @@ -35,14 +35,14 @@ describe('Minutes', function () { let aProjectName = "E2E Minutes"; let aMeetingName = "Meeting Name #2"; - E2EMeetingSeries.createMeetingSeries(aProjectName, aMeetingName); - let countInitialMinutes = E2EMinutes.countMinutesForSeries(aProjectName, aMeetingName); + await E2EMeetingSeries.createMeetingSeries(aProjectName, aMeetingName); + let countInitialMinutes = await E2EMinutes.countMinutesForSeries(aProjectName, aMeetingName); - E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName); - E2EMinutes.finalizeCurrentMinutes(); - E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName); - E2EMeetingSeries.gotoMeetingSeries(aProjectName, aMeetingName); - expect(E2EMinutes.countMinutesForSeries(aProjectName, aMeetingName)).to.equal(countInitialMinutes +2); + await E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName); + await E2EMinutes.finalizeCurrentMinutes(); + await E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName); + await E2EMeetingSeries.gotoMeetingSeries(aProjectName, aMeetingName); + await expect(await E2EMinutes.countMinutesForSeries(aProjectName, aMeetingName)).to.equal(countInitialMinutes +2); }); @@ -51,12 +51,12 @@ describe('Minutes', function () { let aMeetingName = "Meeting Name #3"; let myDate = "2015-03-17"; // date of first project commit ;-) - E2EMeetingSeries.createMeetingSeries(aProjectName, aMeetingName); - E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName, myDate); + await E2EMeetingSeries.createMeetingSeries(aProjectName, aMeetingName); + await E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName, myDate); - E2EMeetingSeries.gotoMeetingSeries(aProjectName, aMeetingName); - expect(E2EMinutes.countMinutesForSeries(aProjectName, aMeetingName)).to.equal(1); - expect(E2EMinutes.getMinutesId(myDate)).to.be.ok; + await E2EMeetingSeries.gotoMeetingSeries(aProjectName, aMeetingName); + await expect(await E2EMinutes.countMinutesForSeries(aProjectName, aMeetingName)).to.equal(1); + expect(await E2EMinutes.getMinutesId(myDate)).to.be.ok; }); @@ -65,20 +65,20 @@ describe('Minutes', function () { let aMeetingName = "Meeting Name #4"; let myDate = "2015-03-17"; // date of first project commit ;-) - E2EMeetingSeries.createMeetingSeries(aProjectName, aMeetingName); - E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName, myDate); + await E2EMeetingSeries.createMeetingSeries(aProjectName, aMeetingName); + await E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName, myDate); - E2EMeetingSeries.gotoMeetingSeries(aProjectName, aMeetingName); - expect(E2EMinutes.countMinutesForSeries(aProjectName, aMeetingName)).to.equal(1); - expect(E2EMinutes.getMinutesId(myDate)).to.be.ok; + await E2EMeetingSeries.gotoMeetingSeries(aProjectName, aMeetingName); + await expect(await E2EMinutes.countMinutesForSeries(aProjectName, aMeetingName)).to.equal(1); + expect(await E2EMinutes.getMinutesId(myDate)).to.be.ok; // Now delete it! - E2EMinutes.gotoMinutes(myDate); - E2EGlobal.clickWithRetry("#btn_deleteMinutes"); - E2EApp.confirmationDialogAnswer(true); - E2EMeetingSeries.gotoMeetingSeries(aProjectName, aMeetingName); - expect(E2EMinutes.countMinutesForSeries(aProjectName, aMeetingName)).to.equal(0); - expect(E2EMinutes.getMinutesId(myDate)).not.to.be.ok; + await E2EMinutes.gotoMinutes(myDate); + await E2EGlobal.clickWithRetry("#btn_deleteMinutes"); + await E2EApp.confirmationDialogAnswer(true); + await E2EMeetingSeries.gotoMeetingSeries(aProjectName, aMeetingName); + await expect(await E2EMinutes.countMinutesForSeries(aProjectName, aMeetingName)).to.equal(0); + expect(await E2EMinutes.getMinutesId(myDate)).not.to.be.ok; }); @@ -87,45 +87,45 @@ describe('Minutes', function () { let aMeetingName = "Meeting Name #5"; let myDate = "2015-03-17"; // date of first project commit ;-) - E2EMeetingSeries.createMeetingSeries(aProjectName, aMeetingName); - E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName, myDate); + await E2EMeetingSeries.createMeetingSeries(aProjectName, aMeetingName); + await E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName, myDate); - E2EMeetingSeries.gotoMeetingSeries(aProjectName, aMeetingName); - expect(E2EMinutes.countMinutesForSeries(aProjectName, aMeetingName)).to.equal(1); - expect(E2EMinutes.getMinutesId(myDate)).to.be.ok; + await E2EMeetingSeries.gotoMeetingSeries(aProjectName, aMeetingName); + await expect(await E2EMinutes.countMinutesForSeries(aProjectName, aMeetingName)).to.equal(1); + expect(await E2EMinutes.getMinutesId(myDate)).to.be.ok; // Now trigger delete! - E2EMinutes.gotoMinutes(myDate); - E2EGlobal.clickWithRetry("#btn_deleteMinutes"); - E2EApp.confirmationDialogAnswer(false); - E2EMeetingSeries.gotoMeetingSeries(aProjectName, aMeetingName); - expect(E2EMinutes.countMinutesForSeries(aProjectName, aMeetingName)).to.equal(1); - expect(E2EMinutes.getMinutesId(myDate)).to.be.ok; + await E2EMinutes.gotoMinutes(myDate); + await E2EGlobal.clickWithRetry("#btn_deleteMinutes"); + await E2EApp.confirmationDialogAnswer(false); + await E2EMeetingSeries.gotoMeetingSeries(aProjectName, aMeetingName); + await expect(await E2EMinutes.countMinutesForSeries(aProjectName, aMeetingName)).to.equal(1); + expect(await E2EMinutes.getMinutesId(myDate)).to.be.ok; }); it('displays an error message if the minute is not linked to the parent series', function() { let aProjectName = "E2E Minutes"; let aMeetingName = "Meeting Name #6"; - E2EMeetingSeries.createMeetingSeries(aProjectName, aMeetingName); - E2EMeetingSeries.gotoMeetingSeries(aProjectName, aMeetingName); - let urlArr = browser.getUrl().split('/'); + await E2EMeetingSeries.createMeetingSeries(aProjectName, aMeetingName); + await E2EMeetingSeries.gotoMeetingSeries(aProjectName, aMeetingName); + let urlArr = (await browser.getUrl()).split('/'); let msId = urlArr[(urlArr.length) - 1]; - E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName); + await E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName); - E2EGlobal.waitSomeTime(2000); // wait until parent check will be enabled + await E2EGlobal.waitSomeTime(2000); // wait until parent check will be enabled let messageSelector = '[data-notify="container"]'; - expect(browser.isVisible(messageSelector), 'flash message should not be visible before un-linking the minute').to.be.false; + expect(await browser.isVisible(messageSelector), 'flash message should not be visible before un-linking the minute').to.be.false; - server.call('e2e.updateMeetingSeries', msId, {minutes: []}); + await server.call('e2e.updateMeetingSeries', msId, {minutes: []}); - browser.waitForVisible(messageSelector); - let dialogMsgElement = browser.element(messageSelector).value.ELEMENT; - let dialogMsgText = browser.elementIdText(dialogMsgElement).value; - expect(dialogMsgText, 'error message should be displayed').to.have.string('Unfortunately the minute is not linked to its parent series correctly'); + await browser.waitForVisible(messageSelector); + let dialogMsgElement = (await browser.element(messageSelector)).value.ELEMENT; + let dialogMsgText = (await browser.elementIdText(dialogMsgElement)).value; + await expect(dialogMsgText, 'error message should be displayed').to.have.string('Unfortunately the minute is not linked to its parent series correctly'); }); it('can persist global notes', function() { @@ -133,45 +133,45 @@ describe('Minutes', function () { let aMeetingName = "Meeting Name #6"; const aGlobalNote = "Amazing global note"; - E2EMeetingSeries.createMeetingSeries(aProjectName, aMeetingName); + await E2EMeetingSeries.createMeetingSeries(aProjectName, aMeetingName); - E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName); + await E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName); - browser.setValue('textarea[id="editGlobalNotes"]', aGlobalNote); - E2EGlobal.clickWithRetry('#btnParticipantsExpand'); + await browser.setValue('textarea[id="editGlobalNotes"]', aGlobalNote); + await E2EGlobal.clickWithRetry('#btnParticipantsExpand'); - let result = browser.getValue('textarea[id="editGlobalNotes"]'); - expect(result).to.equal(aGlobalNote); + let result = await browser.getValue('textarea[id="editGlobalNotes"]'); + await expect(result).to.equal(aGlobalNote); - browser.refresh(); - E2EGlobal.waitSomeTime(2500); // phantom.js needs some time here... + await browser.refresh(); + await E2EGlobal.waitSomeTime(2500); // phantom.js needs some time here... - result = browser.getValue('textarea[id="editGlobalNotes"]'); - expect(result).to.equal(aGlobalNote); + result = await browser.getValue('textarea[id="editGlobalNotes"]'); + await expect(result).to.equal(aGlobalNote); }); it('hide closed topics', function () { let aProjectName = "E2E Minutes"; let aMeetingName = "Meeting Name #7"; - E2EMeetingSeries.createMeetingSeries(aProjectName, aMeetingName); + await E2EMeetingSeries.createMeetingSeries(aProjectName, aMeetingName); - E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName); + await E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName); - E2ETopics.addTopicToMinutes("topic #1"); - E2ETopics.addTopicToMinutes("topic #2"); - E2ETopics.addTopicToMinutes("topic #3"); - E2ETopics.addTopicToMinutes("topic #4"); + await E2ETopics.addTopicToMinutes("topic #1"); + await E2ETopics.addTopicToMinutes("topic #2"); + await E2ETopics.addTopicToMinutes("topic #3"); + await E2ETopics.addTopicToMinutes("topic #4"); - E2EGlobal.waitSomeTime(700); + await E2EGlobal.waitSomeTime(700); - E2ETopics.toggleTopic(1); - E2ETopics.toggleTopic(2); + await E2ETopics.toggleTopic(1); + await E2ETopics.toggleTopic(2); - E2EGlobal.clickWithRetry("#checkHideClosedTopicsLabel"); + await E2EGlobal.clickWithRetry("#checkHideClosedTopicsLabel"); - expect(E2ETopics.countTopicsForMinute()).to.equal(2); + await expect(await E2ETopics.countTopicsForMinute()).to.equal(2); }); @@ -180,45 +180,45 @@ describe('Minutes', function () { let aProjectName = "E2E Minutes"; let aMeetingName = "Meeting Name PrevNext"; - E2EMeetingSeries.createMeetingSeries(aProjectName, aMeetingName); - E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName); - E2EMinutes.finalizeCurrentMinutes(); - E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName); - E2EMinutes.finalizeCurrentMinutes(); - const secondDate = E2EMinutes.getCurrentMinutesDate(); - E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName); - const thirdDate = E2EMinutes.getCurrentMinutesDate(); + await E2EMeetingSeries.createMeetingSeries(aProjectName, aMeetingName); + await E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName); + await E2EMinutes.finalizeCurrentMinutes(); + await E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName); + await E2EMinutes.finalizeCurrentMinutes(); + const secondDate = await E2EMinutes.getCurrentMinutesDate(); + await E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName); + const thirdDate = await E2EMinutes.getCurrentMinutesDate(); - expect(E2EMinutes.countMinutesForSeries(aProjectName, aMeetingName)).to.equal(3); + await expect(await E2EMinutes.countMinutesForSeries(aProjectName, aMeetingName)).to.equal(3); - E2EMinutes.gotoLatestMinutes(); - E2EGlobal.clickWithRetry("#btnPreviousMinutesNavigation"); - let currentdate = E2EMinutes.getCurrentMinutesDate(); - expect(currentdate).to.equal(secondDate); + await E2EMinutes.gotoLatestMinutes(); + await E2EGlobal.clickWithRetry("#btnPreviousMinutesNavigation"); + let currentdate = await E2EMinutes.getCurrentMinutesDate(); + await expect(currentdate).to.equal(secondDate); - E2EGlobal.clickWithRetry("#btnNextMinutesNavigation"); - currentdate = E2EMinutes.getCurrentMinutesDate(); - expect(currentdate).to.equal(thirdDate); + await E2EGlobal.clickWithRetry("#btnNextMinutesNavigation"); + currentdate = await E2EMinutes.getCurrentMinutesDate(); + await expect(currentdate).to.equal(thirdDate); }); it('hide closed topics by click', function () { let aProjectName = "E2E Minutes"; let aMeetingName = "Meeting Name #8"; - E2EMeetingSeries.createMeetingSeries(aProjectName, aMeetingName); + await E2EMeetingSeries.createMeetingSeries(aProjectName, aMeetingName); - E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName); + await E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName); - E2ETopics.addTopicToMinutes("topic #1"); - E2ETopics.addTopicToMinutes("topic #2"); - E2ETopics.addTopicToMinutes("topic #3"); - E2ETopics.addTopicToMinutes("topic #4"); + await E2ETopics.addTopicToMinutes("topic #1"); + await E2ETopics.addTopicToMinutes("topic #2"); + await E2ETopics.addTopicToMinutes("topic #3"); + await E2ETopics.addTopicToMinutes("topic #4"); - E2EGlobal.clickWithRetry("#checkHideClosedTopicsLabel"); - expect(E2ETopics.countTopicsForMinute()).to.equal(4); + await E2EGlobal.clickWithRetry("#checkHideClosedTopicsLabel"); + await expect(await E2ETopics.countTopicsForMinute()).to.equal(4); - E2ETopics.toggleTopic(1); - expect(E2ETopics.countTopicsForMinute()).to.equal(3); + await E2ETopics.toggleTopic(1); + await expect(await E2ETopics.countTopicsForMinute()).to.equal(3); }); }); diff --git a/tests/end2end/MinutesFinalize-test.js b/tests/end2end/MinutesFinalize-test.js index 240e259e0..8a78e317f 100644 --- a/tests/end2end/MinutesFinalize-test.js +++ b/tests/end2end/MinutesFinalize-test.js @@ -12,14 +12,14 @@ describe('Minutes Finalize', function () { let aMeetingName; before('reload page and reset app', function () { - E2EGlobal.logTimestamp('Start test suite'); - E2EApp.resetMyApp(true); - E2EApp.launchApp(); + await E2EGlobal.logTimestamp('Start test suite'); + await E2EApp.resetMyApp(true); + await E2EApp.launchApp(); }); beforeEach('goto start page and make sure test user is logged in', function () { - E2EApp.gotoStartPage(); - expect (E2EApp.isLoggedIn()).to.be.true; + await E2EApp.gotoStartPage(); + expect (await E2EApp.isLoggedIn()).to.be.true; }); @@ -27,15 +27,15 @@ describe('Minutes Finalize', function () { aMeetingCounter++; aMeetingName = aMeetingNameBase + aMeetingCounter; - E2EMeetingSeries.createMeetingSeries(aProjectName, aMeetingName); - expect(E2EMinutes.countMinutesForSeries(aProjectName, aMeetingName)).to.equal(0); + await E2EMeetingSeries.createMeetingSeries(aProjectName, aMeetingName); + await expect(await E2EMinutes.countMinutesForSeries(aProjectName, aMeetingName)).to.equal(0); - E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName); - expect(browser.isExisting('#btn_unfinalizeMinutes')).to.be.false; - E2EMinutes.finalizeCurrentMinutes(); + await E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName); + expect(await browser.isExisting('#btn_unfinalizeMinutes')).to.be.false; + await E2EMinutes.finalizeCurrentMinutes(); - expect(browser.isExisting('#btn_unfinalizeMinutes')).to.be.true; - expect(E2EMinutes.countMinutesForSeries(aProjectName, aMeetingName)).to.equal(1); + expect(await browser.isExisting('#btn_unfinalizeMinutes')).to.be.true; + await expect(await E2EMinutes.countMinutesForSeries(aProjectName, aMeetingName)).to.equal(1); }); // this test does only make sense if mail delivery is enabled @@ -44,27 +44,27 @@ describe('Minutes Finalize', function () { aMeetingCounter++; aMeetingName = aMeetingNameBase + aMeetingCounter; - E2EMeetingSeries.createMeetingSeries(aProjectName, aMeetingName); - E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName); + await E2EMeetingSeries.createMeetingSeries(aProjectName, aMeetingName); + await E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName); - E2ETopics.addTopicToMinutes('some topic'); - E2ETopics.addInfoItemToTopic({ + await E2ETopics.addTopicToMinutes('some topic'); + await E2ETopics.addInfoItemToTopic({ subject: 'action item', itemType: 'actionItem' }, 1); - E2ETopics.addInfoItemToTopic({ + await E2ETopics.addInfoItemToTopic({ subject: 'info item', itemType: 'infoItem' }, 1); - E2EMinutes.finalizeCurrentMinutes(/*autoConfirmDialog*/false); + await E2EMinutes.finalizeCurrentMinutes(/*autoConfirmDialog*/false); - expect(browser.isExisting('#cbSendAI')).to.be.true; - expect(browser.isExisting('#cbSendII')).to.be.true; + expect(await browser.isExisting('#cbSendAI')).to.be.true; + expect(await browser.isExisting('#cbSendII')).to.be.true; // close dialog otherwise beforeEach-hook will fail! - E2EApp.confirmationDialogAnswer(false); - E2EGlobal.waitSomeTime(300); // make next test happy + await E2EApp.confirmationDialogAnswer(false); + await E2EGlobal.waitSomeTime(300); // make next test happy }); } @@ -73,27 +73,27 @@ describe('Minutes Finalize', function () { aMeetingCounter++; aMeetingName = aMeetingNameBase + aMeetingCounter; - E2EMeetingSeries.createMeetingSeries(aProjectName, aMeetingName); - let countInitialMinutes = E2EMinutes.countMinutesForSeries(aProjectName, aMeetingName); + await E2EMeetingSeries.createMeetingSeries(aProjectName, aMeetingName); + let countInitialMinutes = await E2EMinutes.countMinutesForSeries(aProjectName, aMeetingName); - E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName); + await E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName); // No finalize here! - E2EMeetingSeries.gotoMeetingSeries(aProjectName, aMeetingName); - browser.waitForVisible('#btnAddMinutes'); + await E2EMeetingSeries.gotoMeetingSeries(aProjectName, aMeetingName); + await browser.waitForVisible('#btnAddMinutes'); // check that nothing happens if the add minutes button will be pressed - const urlBefore = browser.getUrl(); - expect(browser.isExisting('#btnAddMinutes'), 'btnAddMinutes should be there').to.be.true; + const urlBefore = await browser.getUrl(); + expect(await browser.isExisting('#btnAddMinutes'), 'btnAddMinutes should be there').to.be.true; try { - E2EGlobal.clickWithRetry('#btnAddMinutes'); + await E2EGlobal.clickWithRetry('#btnAddMinutes'); } catch (e) { // Intentionally left empty // We expect the above click to fail, as button is disabled } - E2EGlobal.waitSomeTime(750); - expect(browser.getUrl(), 'Route should not have changed').to.equal(urlBefore); - expect( - E2EMinutes.countMinutesForSeries(aProjectName, aMeetingName), + await E2EGlobal.waitSomeTime(750); + await expect(await browser.getUrl(), 'Route should not have changed').to.equal(urlBefore); + await expect( + await E2EMinutes.countMinutesForSeries(aProjectName, aMeetingName), 'Only one minute should have been added' ).to.equal(countInitialMinutes + 1); }); @@ -103,22 +103,22 @@ describe('Minutes Finalize', function () { aMeetingCounter++; aMeetingName = aMeetingNameBase + aMeetingCounter; - E2EMeetingSeries.createMeetingSeries(aProjectName, aMeetingName); - let countInitialMinutes = E2EMinutes.countMinutesForSeries(aProjectName, aMeetingName); + await E2EMeetingSeries.createMeetingSeries(aProjectName, aMeetingName); + let countInitialMinutes = await E2EMinutes.countMinutesForSeries(aProjectName, aMeetingName); - E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName); + await E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName); // No finalize here! - E2EMeetingSeries.gotoMeetingSeries(aProjectName, aMeetingName); - browser.waitForVisible('#btnAddMinutes'); - E2EGlobal.clickWithRetry('a#id_linkToMinutes'); // goto first available minutes + await E2EMeetingSeries.gotoMeetingSeries(aProjectName, aMeetingName); + await browser.waitForVisible('#btnAddMinutes'); + await E2EGlobal.clickWithRetry('a#id_linkToMinutes'); // goto first available minutes // Now finalize! - E2EMinutes.finalizeCurrentMinutes(); - E2EMeetingSeries.gotoMeetingSeries(aProjectName, aMeetingName); + await E2EMinutes.finalizeCurrentMinutes(); + await E2EMeetingSeries.gotoMeetingSeries(aProjectName, aMeetingName); // check if button is clicked, it does add 2nd minutes - E2EGlobal.clickWithRetry('#btnAddMinutes'); - E2EMeetingSeries.gotoMeetingSeries(aProjectName, aMeetingName); - expect(E2EMinutes.countMinutesForSeries(aProjectName, aMeetingName)).to.equal(countInitialMinutes +2); + await E2EGlobal.clickWithRetry('#btnAddMinutes'); + await E2EMeetingSeries.gotoMeetingSeries(aProjectName, aMeetingName); + await expect(await E2EMinutes.countMinutesForSeries(aProjectName, aMeetingName)).to.equal(countInitialMinutes +2); }); @@ -127,13 +127,13 @@ describe('Minutes Finalize', function () { aMeetingName = aMeetingNameBase + aMeetingCounter; let myDate = '2015-03-17'; // date of first project commit ;-) - E2EMeetingSeries.createMeetingSeries(aProjectName, aMeetingName); - E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName, myDate); - E2EMinutes.finalizeCurrentMinutes(); - E2EMinutes.gotoMinutes(myDate); + await E2EMeetingSeries.createMeetingSeries(aProjectName, aMeetingName); + await E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName, myDate); + await E2EMinutes.finalizeCurrentMinutes(); + await E2EMinutes.gotoMinutes(myDate); - expect(browser.isExisting('#btn_finalizeMinutes')).to.be.false; - expect(browser.isExisting('#btn_deleteMinutes')).to.be.false; + expect(await browser.isExisting('#btn_finalizeMinutes')).to.be.false; + expect(await browser.isExisting('#btn_deleteMinutes')).to.be.false; }); @@ -142,54 +142,54 @@ describe('Minutes Finalize', function () { aMeetingName = aMeetingNameBase + aMeetingCounter; let myDate = '2015-03-17'; // date of first project commit ;-) - E2EMeetingSeries.createMeetingSeries(aProjectName, aMeetingName); - E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName, myDate); - E2EMinutes.finalizeCurrentMinutes(); + await E2EMeetingSeries.createMeetingSeries(aProjectName, aMeetingName); + await E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName, myDate); + await E2EMinutes.finalizeCurrentMinutes(); - E2EMinutes.unfinalizeCurrentMinutes(); - expect(browser.isExisting('#btn_finalizeMinutes')).to.be.true; - expect(browser.isExisting('#btn_deleteMinutes')).to.be.true; + await E2EMinutes.unfinalizeCurrentMinutes(); + expect(await browser.isExisting('#btn_finalizeMinutes')).to.be.true; + expect(await browser.isExisting('#btn_deleteMinutes')).to.be.true; }); it('removes all fresh info items when unfinalizing the second minutes', function() { - this.timeout(150000); + await this.timeout(150000); aMeetingCounter++; aMeetingName = aMeetingNameBase + aMeetingCounter; console.log('Meeting: ', aProjectName, aMeetingName); let myDate = '2015-05-14'; - E2EMeetingSeries.createMeetingSeries(aProjectName, aMeetingName); - E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName, myDate); + await E2EMeetingSeries.createMeetingSeries(aProjectName, aMeetingName); + await E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName, myDate); - E2ETopics.addTopicToMinutes('Topic'); - E2ETopics.addInfoItemToTopic({ + await E2ETopics.addTopicToMinutes('Topic'); + await E2ETopics.addInfoItemToTopic({ subject: 'Old Info Item', itemType: 'infoItem' }, 1); - E2EMinutes.finalizeCurrentMinutes(); + await E2EMinutes.finalizeCurrentMinutes(); - E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName, myDate); - E2ETopics.addInfoItemToTopic({ + await E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName, myDate); + await E2ETopics.addInfoItemToTopic({ subject: 'New Info Item', itemType: 'infoItem' }, 1); - E2EMinutes.finalizeCurrentMinutes(); + await E2EMinutes.finalizeCurrentMinutes(); - E2EMeetingSeries.gotoMeetingSeries(aProjectName, aMeetingName); - E2EMeetingSeries.gotoTabTopics(); + await E2EMeetingSeries.gotoMeetingSeries(aProjectName, aMeetingName); + await E2EMeetingSeries.gotoTabTopics(); - expect(E2ETopics.countItemsForTopic(1), 'Topic should have two items').to.equal(2); + await expect(await E2ETopics.countItemsForTopic(1), 'Topic should have two items').to.equal(2); - E2EMeetingSeries.gotoTabMinutes(); - E2EMinutes.gotoLatestMinutes(); + await E2EMeetingSeries.gotoTabMinutes(); + await E2EMinutes.gotoLatestMinutes(); - E2EMinutes.unfinalizeCurrentMinutes(); + await E2EMinutes.unfinalizeCurrentMinutes(); - E2EMeetingSeries.gotoMeetingSeries(aProjectName, aMeetingName); - E2EMeetingSeries.gotoTabTopics(); + await E2EMeetingSeries.gotoMeetingSeries(aProjectName, aMeetingName); + await E2EMeetingSeries.gotoTabTopics(); - expect(E2ETopics.countItemsForTopic(1), 'Topic should have one items').to.equal(1); + await expect(await E2ETopics.countItemsForTopic(1), 'Topic should have one items').to.equal(1); }); @@ -199,18 +199,18 @@ describe('Minutes Finalize', function () { let myDate = '2015-03-17'; // date of first project commit ;-) let currentUsername = E2EGlobal.SETTINGS.e2eTestUsers[0]; - E2EMeetingSeries.createMeetingSeries(aProjectName, aMeetingName); - E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName, myDate); - E2EMinutes.finalizeCurrentMinutes(); - E2EGlobal.waitSomeTime(); - let finalizedText = browser.getText('#txt_FinalizedBy'); - expect(finalizedText).to.contain(currentUsername); + await E2EMeetingSeries.createMeetingSeries(aProjectName, aMeetingName); + await E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName, myDate); + await E2EMinutes.finalizeCurrentMinutes(); + await E2EGlobal.waitSomeTime(); + let finalizedText = await browser.getText('#txt_FinalizedBy'); + await expect(finalizedText).to.contain(currentUsername); // Now leave and re-enter minutes to trigger fresh render - E2EMeetingSeries.gotoMeetingSeries(aProjectName, aMeetingName); - E2EMinutes.gotoMinutes(myDate); - finalizedText = browser.getText('#txt_FinalizedBy'); - expect(finalizedText).to.contain(currentUsername); + await E2EMeetingSeries.gotoMeetingSeries(aProjectName, aMeetingName); + await E2EMinutes.gotoMinutes(myDate); + finalizedText = await browser.getText('#txt_FinalizedBy'); + await expect(finalizedText).to.contain(currentUsername); }); @@ -219,16 +219,16 @@ describe('Minutes Finalize', function () { aMeetingName = aMeetingNameBase + aMeetingCounter; let myDate = '2015-03-17'; // date of first project commit ;-) - E2EMeetingSeries.createMeetingSeries(aProjectName, aMeetingName); - E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName, myDate); - E2EMinutes.finalizeCurrentMinutes(); + await E2EMeetingSeries.createMeetingSeries(aProjectName, aMeetingName); + await E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName, myDate); + await E2EMinutes.finalizeCurrentMinutes(); - let dateOfMinutes = browser.getValue('#id_minutesdateInput'); - expect(dateOfMinutes).to.equal(myDate); + let dateOfMinutes = await browser.getValue('#id_minutesdateInput'); + await expect(dateOfMinutes).to.equal(myDate); // try to change read-only field... we expect an exception in the next statement... ;-) - try {browser.setValue('#id_minutesdateInput', '2015-05-22');} catch (e) {} - dateOfMinutes = browser.getValue('#id_minutesdateInput'); - expect(dateOfMinutes).to.equal(myDate); // still same as above? + try {await browser.setValue('#id_minutesdateInput', '2015-05-22');} catch (e) {} + dateOfMinutes = await browser.getValue('#id_minutesdateInput'); + await expect(dateOfMinutes).to.equal(myDate); // still same as above? }); @@ -238,23 +238,23 @@ describe('Minutes Finalize', function () { let myDate1 = '2015-03-17'; // date of first project commit ;-) let myDate2 = '2015-03-18'; - E2EMeetingSeries.createMeetingSeries(aProjectName, aMeetingName); - E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName, myDate1); - E2EMinutes.finalizeCurrentMinutes(); + await E2EMeetingSeries.createMeetingSeries(aProjectName, aMeetingName); + await E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName, myDate1); + await E2EMinutes.finalizeCurrentMinutes(); - E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName, myDate2); // myDate2 is kept UNFINALIZED! + await E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName, myDate2); // myDate2 is kept UNFINALIZED! - E2EMeetingSeries.gotoMeetingSeries(aProjectName, aMeetingName); - E2EMinutes.gotoMinutes(myDate1); - expect(browser.isExisting('#btn_unfinalizeMinutes')).to.be.false; + await E2EMeetingSeries.gotoMeetingSeries(aProjectName, aMeetingName); + await E2EMinutes.gotoMinutes(myDate1); + expect(await browser.isExisting('#btn_unfinalizeMinutes')).to.be.false; - E2EMeetingSeries.gotoMeetingSeries(aProjectName, aMeetingName); // now FINALIZE myDate2 - E2EMinutes.gotoMinutes(myDate2); - E2EMinutes.finalizeCurrentMinutes(); + await E2EMeetingSeries.gotoMeetingSeries(aProjectName, aMeetingName); // now FINALIZE myDate2 + await E2EMinutes.gotoMinutes(myDate2); + await E2EMinutes.finalizeCurrentMinutes(); - E2EMeetingSeries.gotoMeetingSeries(aProjectName, aMeetingName); - E2EMinutes.gotoMinutes(myDate1); - expect(browser.isExisting('#btn_unfinalizeMinutes')).to.be.false; + await E2EMeetingSeries.gotoMeetingSeries(aProjectName, aMeetingName); + await E2EMinutes.gotoMinutes(myDate1); + expect(await browser.isExisting('#btn_unfinalizeMinutes')).to.be.false; }); @@ -264,17 +264,17 @@ describe('Minutes Finalize', function () { let myDate1 = '2015-03-17'; // date of first project commit ;-) let myDate2 = '2010-01-01'; - E2EMeetingSeries.createMeetingSeries(aProjectName, aMeetingName); - E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName, myDate1); - E2EMinutes.finalizeCurrentMinutes(); + await E2EMeetingSeries.createMeetingSeries(aProjectName, aMeetingName); + await E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName, myDate1); + await E2EMinutes.finalizeCurrentMinutes(); - E2EMeetingSeries.gotoMeetingSeries(aProjectName, aMeetingName); - E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName, myDate2); - E2EMeetingSeries.gotoMeetingSeries(aProjectName, aMeetingName); + await E2EMeetingSeries.gotoMeetingSeries(aProjectName, aMeetingName); + await E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName, myDate2); + await E2EMeetingSeries.gotoMeetingSeries(aProjectName, aMeetingName); - expect(E2EMinutes.getMinutesId(myDate2)).not.to.be.ok; - let currentDateISO = E2EGlobal.formatDateISO8601(new Date()); - expect(E2EMinutes.getMinutesId(currentDateISO)).to.be.ok; + expect(await E2EMinutes.getMinutesId(myDate2)).not.to.be.ok; + let currentDateISO = await E2EGlobal.formatDateISO8601(new Date()); + expect(await E2EMinutes.getMinutesId(currentDateISO)).to.be.ok; }); @@ -283,17 +283,17 @@ describe('Minutes Finalize', function () { aMeetingName = aMeetingNameBase + aMeetingCounter; let myDate1 = '2015-03-17'; // date of first project commit ;-) - E2EMeetingSeries.createMeetingSeries(aProjectName, aMeetingName); - E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName, myDate1); - E2EMinutes.finalizeCurrentMinutes(); + await E2EMeetingSeries.createMeetingSeries(aProjectName, aMeetingName); + await E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName, myDate1); + await E2EMinutes.finalizeCurrentMinutes(); - E2EMeetingSeries.gotoMeetingSeries(aProjectName, aMeetingName); - E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName, myDate1); - E2EMeetingSeries.gotoMeetingSeries(aProjectName, aMeetingName); + await E2EMeetingSeries.gotoMeetingSeries(aProjectName, aMeetingName); + await E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName, myDate1); + await E2EMeetingSeries.gotoMeetingSeries(aProjectName, aMeetingName); - expect(E2EMinutes.countMinutesForSeries(aProjectName, aMeetingName)).to.equal(2); - let currentDateISO = E2EGlobal.formatDateISO8601(new Date()); - expect(E2EMinutes.getMinutesId(currentDateISO)).to.be.ok; + await expect(await E2EMinutes.countMinutesForSeries(aProjectName, aMeetingName)).to.equal(2); + let currentDateISO = await E2EGlobal.formatDateISO8601(new Date()); + expect(await E2EMinutes.getMinutesId(currentDateISO)).to.be.ok; }); @@ -301,63 +301,63 @@ describe('Minutes Finalize', function () { aMeetingCounter++; aMeetingName = aMeetingNameBase + aMeetingCounter; - E2EMeetingSeries.createMeetingSeries(aProjectName, aMeetingName); - expect(E2EMinutes.countMinutesForSeries(aProjectName, aMeetingName)).to.equal(0); + await E2EMeetingSeries.createMeetingSeries(aProjectName, aMeetingName); + await expect(await E2EMinutes.countMinutesForSeries(aProjectName, aMeetingName)).to.equal(0); - E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName); - expect(browser.isExisting('#btn_unfinalizeMinutes')).to.be.false; - E2EMinutes.finalizeCurrentMinutesWithoutParticipants(true, false); + await E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName); + expect(await browser.isExisting('#btn_unfinalizeMinutes')).to.be.false; + await E2EMinutes.finalizeCurrentMinutesWithoutParticipants(true, false); - expect(browser.isExisting('#btn_unfinalizeMinutes')).to.be.false; - expect(E2EMinutes.countMinutesForSeries(aProjectName, aMeetingName)).to.equal(1); + expect(await browser.isExisting('#btn_unfinalizeMinutes')).to.be.false; + await expect(await E2EMinutes.countMinutesForSeries(aProjectName, aMeetingName)).to.equal(1); }); it('process finalize Minutes, when warning-box appears', function () { aMeetingCounter++; aMeetingName = aMeetingNameBase + aMeetingCounter; - E2EMeetingSeries.createMeetingSeries(aProjectName, aMeetingName); - expect(E2EMinutes.countMinutesForSeries(aProjectName, aMeetingName)).to.equal(0); + await E2EMeetingSeries.createMeetingSeries(aProjectName, aMeetingName); + await expect(await E2EMinutes.countMinutesForSeries(aProjectName, aMeetingName)).to.equal(0); - E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName); - expect(browser.isExisting('#btn_unfinalizeMinutes')).to.be.false; - E2EMinutes.finalizeCurrentMinutesWithoutParticipants(true, true); + await E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName); + expect(await browser.isExisting('#btn_unfinalizeMinutes')).to.be.false; + await E2EMinutes.finalizeCurrentMinutesWithoutParticipants(true, true); - expect(browser.isExisting('#btn_unfinalizeMinutes')).to.be.true; - expect(E2EMinutes.countMinutesForSeries(aProjectName, aMeetingName)).to.equal(1); + expect(await browser.isExisting('#btn_unfinalizeMinutes')).to.be.true; + await expect(await E2EMinutes.countMinutesForSeries(aProjectName, aMeetingName)).to.equal(1); }); it('update detail on pinned and not discussed item in next minute after finalizing item origin minute', function () { aMeetingCounter++; aMeetingName = aMeetingNameBase + aMeetingCounter; - E2EMeetingSeries.createMeetingSeries(aProjectName, aMeetingName); - expect(E2EMinutes.countMinutesForSeries(aProjectName, aMeetingName)).to.equal(0); + await E2EMeetingSeries.createMeetingSeries(aProjectName, aMeetingName); + await expect(await E2EMinutes.countMinutesForSeries(aProjectName, aMeetingName)).to.equal(0); - E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName); + await E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName); let aTopicName = 'Topic'; let infoItemName = 'Info Item'; - E2ETopics.addTopicToMinutes(aTopicName); - E2ETopics.addInfoItemToTopic({ + await E2ETopics.addTopicToMinutes(aTopicName); + await E2ETopics.addInfoItemToTopic({ subject: infoItemName, itemType: 'infoItem' }, 1); let details = 'Details'; - E2ETopics.addDetailsToActionItem(1, 1, details); + await E2ETopics.addDetailsToActionItem(1, 1, details); - E2ETopics.toggleInfoItemStickyState(1,1); - E2EMinutes.finalizeCurrentMinutesWithoutParticipants(true, true); + await E2ETopics.toggleInfoItemStickyState(1,1); + await E2EMinutes.finalizeCurrentMinutesWithoutParticipants(true, true); - E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName); + await E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName); let detailsNew = 'Updated Details'; - E2ETopics.editDetailsForActionItem(1, 1, 1, detailsNew); + await E2ETopics.editDetailsForActionItem(1, 1, 1, detailsNew); - let itemsOfTopic = E2ETopics.getItemsForTopic(1); + let itemsOfTopic = await E2ETopics.getItemsForTopic(1); let item = itemsOfTopic[0].ELEMENT; - expect(browser.elementIdText(item).value).to.have.string(detailsNew); + await expect((await browser.elementIdText(item)).value).to.have.string(detailsNew); }); }); diff --git a/tests/end2end/MinutesParticipants-test.js b/tests/end2end/MinutesParticipants-test.js index e6197f0f4..9e7f74d26 100644 --- a/tests/end2end/MinutesParticipants-test.js +++ b/tests/end2end/MinutesParticipants-test.js @@ -13,248 +13,248 @@ describe('Minutes Participants', function () { let aMeetingName; before("reload page and reset app", function () { - E2EGlobal.logTimestamp("Start test suite"); - E2EApp.resetMyApp(true); - E2EApp.launchApp(); + await E2EGlobal.logTimestamp("Start test suite"); + await E2EApp.resetMyApp(true); + await E2EApp.launchApp(); }); beforeEach("goto start page and make sure test user is logged in", function () { - E2EApp.gotoStartPage(); - expect (E2EApp.isLoggedIn()).to.be.true; + await E2EApp.gotoStartPage(); + expect (await E2EApp.isLoggedIn()).to.be.true; aMeetingCounter++; aMeetingName = aMeetingNameBase + aMeetingCounter; - E2EMeetingSeries.createMeetingSeries(aProjectName, aMeetingName); - E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName); + await E2EMeetingSeries.createMeetingSeries(aProjectName, aMeetingName); + await E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName); }); it('ensures per default only creator of series is participant', function () { let participantsInfo = new E2EMinutesParticipants(); - expect(participantsInfo.getParticipantsCount()).to.equal(1); - expect(participantsInfo.getParticipantInfo(E2EApp.getCurrentUser())).to.be.ok; + await expect(await participantsInfo.getParticipantsCount()).to.equal(1); + expect(await participantsInfo.getParticipantInfo(E2EApp.getCurrentUser())).to.be.ok; }); it('can add users to series which will show up on new minutes', function () { - E2EMinutes.finalizeCurrentMinutes(); // we don't need these... + await E2EMinutes.finalizeCurrentMinutes(); // we don't need these... // prepare meeting series - E2EMeetingSeriesEditor.openMeetingSeriesEditor(aProjectName, aMeetingName, "invited"); - E2EGlobal.waitSomeTime(750); + await E2EMeetingSeriesEditor.openMeetingSeriesEditor(aProjectName, aMeetingName, "invited"); + await E2EGlobal.waitSomeTime(750); let user2 = E2EGlobal.SETTINGS.e2eTestUsers[1]; let user3 = E2EGlobal.SETTINGS.e2eTestUsers[2]; - E2EMeetingSeriesEditor.addUserToMeetingSeries(user2); - E2EMeetingSeriesEditor.addUserToMeetingSeries(user3, E2EGlobal.USERROLES.Moderator); - E2EMeetingSeriesEditor.closeMeetingSeriesEditor(); // close with save + await E2EMeetingSeriesEditor.addUserToMeetingSeries(user2); + await E2EMeetingSeriesEditor.addUserToMeetingSeries(user3, E2EGlobal.USERROLES.Moderator); + await E2EMeetingSeriesEditor.closeMeetingSeriesEditor(); // close with save // now create some new minutes - E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName); + await E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName); let participantsInfo = new E2EMinutesParticipants(); - expect(participantsInfo.getParticipantsCount()).to.equal(3); - expect(participantsInfo.getParticipantInfo(E2EApp.getCurrentUser()), "currentUser").to.be.ok; - expect(participantsInfo.getParticipantInfo(user2), user2).to.be.ok; - expect(participantsInfo.getParticipantInfo(user3), user3).to.be.ok; + await expect(await participantsInfo.getParticipantsCount()).to.equal(3); + expect(await participantsInfo.getParticipantInfo(E2EApp.getCurrentUser()), "currentUser").to.be.ok; + expect(await participantsInfo.getParticipantInfo(user2), user2).to.be.ok; + expect(await participantsInfo.getParticipantInfo(user3), user3).to.be.ok; }); it('can add users to series which will show up on unfinalized minutes', function () { // prepare meeting series - E2EMeetingSeriesEditor.openMeetingSeriesEditor(aProjectName, aMeetingName, "invited"); - E2EGlobal.waitSomeTime(750); + await E2EMeetingSeriesEditor.openMeetingSeriesEditor(aProjectName, aMeetingName, "invited"); + await E2EGlobal.waitSomeTime(750); let user2 = E2EGlobal.SETTINGS.e2eTestUsers[1]; let user3 = E2EGlobal.SETTINGS.e2eTestUsers[2]; - E2EMeetingSeriesEditor.addUserToMeetingSeries(user2); - E2EMeetingSeriesEditor.addUserToMeetingSeries(user3, E2EGlobal.USERROLES.Moderator); - E2EMeetingSeriesEditor.closeMeetingSeriesEditor(); // close with save + await E2EMeetingSeriesEditor.addUserToMeetingSeries(user2); + await E2EMeetingSeriesEditor.addUserToMeetingSeries(user3, E2EGlobal.USERROLES.Moderator); + await E2EMeetingSeriesEditor.closeMeetingSeriesEditor(); // close with save - E2EMinutes.gotoLatestMinutes(); + await E2EMinutes.gotoLatestMinutes(); - browser.waitForVisible('#btnParticipantsExpand', 3000); + await browser.waitForVisible('#btnParticipantsExpand', 3000); let participantsInfo = new E2EMinutesParticipants(); - expect(participantsInfo.getParticipantsCount()).to.equal(3); - expect(participantsInfo.getParticipantInfo(E2EApp.getCurrentUser()), "currentUser").to.be.ok; - expect(participantsInfo.getParticipantInfo(user2), user2).to.be.ok; - expect(participantsInfo.getParticipantInfo(user3), user3).to.be.ok; + await expect(await participantsInfo.getParticipantsCount()).to.equal(3); + expect(await participantsInfo.getParticipantInfo(E2EApp.getCurrentUser()), "currentUser").to.be.ok; + expect(await participantsInfo.getParticipantInfo(user2), user2).to.be.ok; + expect(await participantsInfo.getParticipantInfo(user3), user3).to.be.ok; }); it('prohibits user changes in series to propagate to all finalized minutes', function () { - E2EMinutes.finalizeCurrentMinutes(); + await E2EMinutes.finalizeCurrentMinutes(); // prepare meeting series - E2EMeetingSeriesEditor.openMeetingSeriesEditor(aProjectName, aMeetingName, "invited"); - E2EGlobal.waitSomeTime(750); + await E2EMeetingSeriesEditor.openMeetingSeriesEditor(aProjectName, aMeetingName, "invited"); + await E2EGlobal.waitSomeTime(750); let user2 = E2EGlobal.SETTINGS.e2eTestUsers[1]; let user3 = E2EGlobal.SETTINGS.e2eTestUsers[2]; - E2EMeetingSeriesEditor.addUserToMeetingSeries(user2); - E2EMeetingSeriesEditor.addUserToMeetingSeries(user3, E2EGlobal.USERROLES.Moderator); - E2EMeetingSeriesEditor.closeMeetingSeriesEditor(); // close with save + await E2EMeetingSeriesEditor.addUserToMeetingSeries(user2); + await E2EMeetingSeriesEditor.addUserToMeetingSeries(user3, E2EGlobal.USERROLES.Moderator); + await E2EMeetingSeriesEditor.closeMeetingSeriesEditor(); // close with save - E2EMinutes.gotoLatestMinutes(); + await E2EMinutes.gotoLatestMinutes(); // finalized minutes have their participants collapsed, by default. - E2EMinutesParticipants.expand(); + await E2EMinutesParticipants.expand(); let participantsInfo = new E2EMinutesParticipants(); - expect(participantsInfo.getParticipantsCount()).to.equal(1); - expect(participantsInfo.getParticipantInfo(E2EApp.getCurrentUser())).to.be.ok; + await expect(await participantsInfo.getParticipantsCount()).to.equal(1); + expect(await participantsInfo.getParticipantInfo(E2EApp.getCurrentUser())).to.be.ok; }); it('can persist checked participants', function () { // prepare meeting series - let currentUser = E2EApp.getCurrentUser(); - E2EMeetingSeriesEditor.openMeetingSeriesEditor(aProjectName, aMeetingName, "invited"); - E2EGlobal.waitSomeTime(750); + let currentUser = await E2EApp.getCurrentUser(); + await E2EMeetingSeriesEditor.openMeetingSeriesEditor(aProjectName, aMeetingName, "invited"); + await E2EGlobal.waitSomeTime(750); let user2 = E2EGlobal.SETTINGS.e2eTestUsers[1]; let user3 = E2EGlobal.SETTINGS.e2eTestUsers[2]; - E2EMeetingSeriesEditor.addUserToMeetingSeries(user2); - E2EMeetingSeriesEditor.addUserToMeetingSeries(user3, E2EGlobal.USERROLES.Moderator); - E2EMeetingSeriesEditor.closeMeetingSeriesEditor(); // close with save + await E2EMeetingSeriesEditor.addUserToMeetingSeries(user2); + await E2EMeetingSeriesEditor.addUserToMeetingSeries(user3, E2EGlobal.USERROLES.Moderator); + await E2EMeetingSeriesEditor.closeMeetingSeriesEditor(); // close with save - E2EMinutes.gotoLatestMinutes(); - let minId = E2EMinutes.getCurrentMinutesId(); + await E2EMinutes.gotoLatestMinutes(); + let minId = await E2EMinutes.getCurrentMinutesId(); let participantsInfo = new E2EMinutesParticipants(); - participantsInfo.setUserPresence(currentUser, true); - participantsInfo.setUserPresence(user3, true); + await participantsInfo.setUserPresence(currentUser, true); + await participantsInfo.setUserPresence(user3, true); - E2EMeetingSeries.gotoMeetingSeries(aProjectName, aMeetingName); - let parts = E2EMinutesParticipants.getPresentParticipantsFromServer(minId); - expect(parts).to.contain(currentUser); - expect(parts).to.contain(user3); + await E2EMeetingSeries.gotoMeetingSeries(aProjectName, aMeetingName); + let parts = await E2EMinutesParticipants.getPresentParticipantsFromServer(minId); + await expect(parts).to.contain(currentUser); + await expect(parts).to.contain(user3); }); it('can persist additional participants', function () { let additionalUser = "Max Mustermann"; - browser.setValue('#edtParticipantsAdditional', additionalUser); - E2EMinutes.finalizeCurrentMinutes(); + await browser.setValue('#edtParticipantsAdditional', additionalUser); + await E2EMinutes.finalizeCurrentMinutes(); - let minId = E2EMinutes.getCurrentMinutesId(); - let parts = E2EMinutesParticipants.getPresentParticipantsFromServer(minId); - expect(parts).to.contains(additionalUser); + let minId = await E2EMinutes.getCurrentMinutesId(); + let parts = await E2EMinutesParticipants.getPresentParticipantsFromServer(minId); + await expect(parts).to.contains(additionalUser); }); it('can show collapsed view', function () { - E2EMinutesParticipants.collapse(); - expect (E2EMinutesParticipants.isCollapsed()).to.be.true; + await E2EMinutesParticipants.collapse(); + expect (await E2EMinutesParticipants.isCollapsed()).to.be.true; }); it('can re-expand a collapsed view', function () { - E2EMinutesParticipants.collapse(); - E2EMinutesParticipants.expand(); - expect (E2EMinutesParticipants.isExpanded()).to.be.true; + await E2EMinutesParticipants.collapse(); + await E2EMinutesParticipants.expand(); + expect (await E2EMinutesParticipants.isExpanded()).to.be.true; }); it('shows collapsed view for non-moderators', function () { // prepare meeting series - let currentUser = E2EApp.getCurrentUser(); - E2EMeetingSeriesEditor.openMeetingSeriesEditor(aProjectName, aMeetingName, "invited"); - E2EGlobal.waitSomeTime(750); + let currentUser = await E2EApp.getCurrentUser(); + await E2EMeetingSeriesEditor.openMeetingSeriesEditor(aProjectName, aMeetingName, "invited"); + await E2EGlobal.waitSomeTime(750); let user2 = E2EGlobal.SETTINGS.e2eTestUsers[1]; - E2EMeetingSeriesEditor.addUserToMeetingSeries(user2); - E2EMeetingSeriesEditor.closeMeetingSeriesEditor(); // close with save + await E2EMeetingSeriesEditor.addUserToMeetingSeries(user2); + await E2EMeetingSeriesEditor.closeMeetingSeriesEditor(); // close with save - E2EApp.loginUser(1); - E2EMinutes.gotoLatestMinutes(); + await E2EApp.loginUser(1); + await E2EMinutes.gotoLatestMinutes(); - expect (E2EMinutesParticipants.isCollapsed()).to.be.true; + expect (await E2EMinutesParticipants.isCollapsed()).to.be.true; - E2EApp.loginUser(); + await E2EApp.loginUser(); }); it('prohibits non-moderator users to change participants', function () { // prepare meeting series - let currentUser = E2EApp.getCurrentUser(); - E2EMeetingSeriesEditor.openMeetingSeriesEditor(aProjectName, aMeetingName, "invited"); - E2EGlobal.waitSomeTime(750); + let currentUser = await E2EApp.getCurrentUser(); + await E2EMeetingSeriesEditor.openMeetingSeriesEditor(aProjectName, aMeetingName, "invited"); + await E2EGlobal.waitSomeTime(750); let user2 = E2EGlobal.SETTINGS.e2eTestUsers[1]; - E2EMeetingSeriesEditor.addUserToMeetingSeries(user2); - E2EMeetingSeriesEditor.closeMeetingSeriesEditor(); // close with save + await E2EMeetingSeriesEditor.addUserToMeetingSeries(user2); + await E2EMeetingSeriesEditor.closeMeetingSeriesEditor(); // close with save - E2EApp.loginUser(1); - E2EMeetingSeries.gotoMeetingSeries(aProjectName, aMeetingName); - E2EMinutes.gotoLatestMinutes(); - E2EMinutesParticipants.expand(); + await E2EApp.loginUser(1); + await E2EMeetingSeries.gotoMeetingSeries(aProjectName, aMeetingName); + await E2EMinutes.gotoLatestMinutes(); + await E2EMinutesParticipants.expand(); let participantsInfoBefore = new E2EMinutesParticipants(); - participantsInfoBefore.setUserPresence(currentUser, true); - participantsInfoBefore.setUserPresence(user2, true); + await participantsInfoBefore.setUserPresence(currentUser, true); + await participantsInfoBefore.setUserPresence(user2, true); let additionalUser = "Max Mustermann"; - try{browser.setValue('#edtParticipantsAdditional', additionalUser);} catch (e) {} + try{await browser.setValue('#edtParticipantsAdditional', additionalUser);} catch (e) {} let participantsInfoAfter = new E2EMinutesParticipants(); - expect(participantsInfoAfter).to.deep.equal(participantsInfoBefore); + await expect(participantsInfoAfter).to.deep.equal(participantsInfoBefore); - E2EApp.loginUser(); + await E2EApp.loginUser(); }); it('prohibits change of participants on finalized minutes', function () { - E2EMinutes.finalizeCurrentMinutes(); - let currentUser = E2EApp.getCurrentUser(); + await E2EMinutes.finalizeCurrentMinutes(); + let currentUser = await E2EApp.getCurrentUser(); let participantsInfoBefore = new E2EMinutesParticipants(); - participantsInfoBefore.setUserPresence(currentUser, true); + await participantsInfoBefore.setUserPresence(currentUser, true); let additionalUser = "Max Mustermann"; - try{browser.setValue('#edtParticipantsAdditional', additionalUser);} catch (e) {} + try{await browser.setValue('#edtParticipantsAdditional', additionalUser);} catch (e) {} let participantsInfoAfter = new E2EMinutesParticipants(); - expect(participantsInfoAfter).to.deep.equal(participantsInfoBefore); + await expect(participantsInfoAfter).to.deep.equal(participantsInfoBefore); }); it('collapses / expands participants on finalize / un-finalize', function () { - expect (E2EMinutesParticipants.isExpanded(),"initial state").to.be.true; - E2EMinutes.finalizeCurrentMinutes(); - expect (E2EMinutesParticipants.isCollapsed(), "after finalize").to.be.true; - E2EMinutes.unfinalizeCurrentMinutes(); - expect (E2EMinutesParticipants.isExpanded(), "after unfinalize").to.be.true; + expect (await E2EMinutesParticipants.isExpanded(),"initial state").to.be.true; + await E2EMinutes.finalizeCurrentMinutes(); + expect (await E2EMinutesParticipants.isCollapsed(), "after finalize").to.be.true; + await E2EMinutes.unfinalizeCurrentMinutes(); + expect (await E2EMinutesParticipants.isExpanded(), "after unfinalize").to.be.true; }); it('shows participants on minutelist in meeting series details view', function () { // prepare meeting series - let currentUser = E2EApp.getCurrentUser(); - E2EMeetingSeriesEditor.openMeetingSeriesEditor(aProjectName, aMeetingName, "invited"); - E2EGlobal.waitSomeTime(750); + let currentUser = await E2EApp.getCurrentUser(); + await E2EMeetingSeriesEditor.openMeetingSeriesEditor(aProjectName, aMeetingName, "invited"); + await E2EGlobal.waitSomeTime(750); let user2 = E2EGlobal.SETTINGS.e2eTestUsers[1]; let user3 = E2EGlobal.SETTINGS.e2eTestUsers[2]; - E2EMeetingSeriesEditor.addUserToMeetingSeries(user2); - E2EMeetingSeriesEditor.addUserToMeetingSeries(user3, E2EGlobal.USERROLES.Moderator); - E2EMeetingSeriesEditor.closeMeetingSeriesEditor(); // close with save + await E2EMeetingSeriesEditor.addUserToMeetingSeries(user2); + await E2EMeetingSeriesEditor.addUserToMeetingSeries(user3, E2EGlobal.USERROLES.Moderator); + await E2EMeetingSeriesEditor.closeMeetingSeriesEditor(); // close with save - E2EMinutes.gotoLatestMinutes(); + await E2EMinutes.gotoLatestMinutes(); let participantsInfo = new E2EMinutesParticipants(); - participantsInfo.setUserPresence(currentUser, true); - participantsInfo.setUserPresence(user3, true); + await participantsInfo.setUserPresence(currentUser, true); + await participantsInfo.setUserPresence(user3, true); let additionalUser = "Max Mustermann"; - browser.setValue('#edtParticipantsAdditional', additionalUser); - E2EMinutes.finalizeCurrentMinutes(); + await browser.setValue('#edtParticipantsAdditional', additionalUser); + await E2EMinutes.finalizeCurrentMinutes(); - E2EMeetingSeries.gotoMeetingSeries(aProjectName, aMeetingName); - expect(browser.getText("tr#id_MinuteRow")).to.contain("user1; user3; Max Mustermann"); + await E2EMeetingSeries.gotoMeetingSeries(aProjectName, aMeetingName); + await expect(await browser.getText("tr#id_MinuteRow")).to.contain("user1; user3; Max Mustermann"); }); it('can edit participants from within a minute as a moderator', function () { let participantsInfo = new E2EMinutesParticipants(); - expect(participantsInfo.getParticipantsCount()).to.equal(1); + await expect(await participantsInfo.getParticipantsCount()).to.equal(1); - E2EGlobal.clickWithRetry("#btnEditParticipants"); - E2EGlobal.waitSomeTime(750); + await E2EGlobal.clickWithRetry("#btnEditParticipants"); + await E2EGlobal.waitSomeTime(750); let user2 = E2EGlobal.SETTINGS.e2eTestUsers[1]; - E2EMeetingSeriesEditor.addUserToMeetingSeries(user2); - E2EMeetingSeriesEditor.closeMeetingSeriesEditor(); // close with save + await E2EMeetingSeriesEditor.addUserToMeetingSeries(user2); + await E2EMeetingSeriesEditor.closeMeetingSeriesEditor(); // close with save participantsInfo = new E2EMinutesParticipants(); - expect(participantsInfo.getParticipantsCount()).to.equal(2); + await expect(await participantsInfo.getParticipantsCount()).to.equal(2); }); }); diff --git a/tests/end2end/Minutes_security.js b/tests/end2end/Minutes_security.js index e9ef369c5..3a9badaf6 100644 --- a/tests/end2end/Minutes_security.js +++ b/tests/end2end/Minutes_security.js @@ -8,291 +8,291 @@ const newMinuteDate = '01.01.2000'; describe('Minutes Method Security', function () { beforeEach('goto start page and make sure test user is logged in', function () { - E2EApp.gotoStartPage(); - expect(E2EApp.isLoggedIn()).to.be.true; + await E2EApp.gotoStartPage(); + expect(await E2EApp.isLoggedIn()).to.be.true; }); before('reload page and reset app', function () { - E2EGlobal.logTimestamp("Start test suite"); - E2EApp.resetMyApp(true); - E2EApp.launchApp(); + await E2EGlobal.logTimestamp("Start test suite"); + await E2EApp.resetMyApp(true); + await E2EApp.launchApp(); }); //minute.update it('can update a Minute if moderator', function () { const name = 'MinuteUpdate as moderator'; - const min = E2ESecurity.createMeetingSeriesAndMinute(name); - E2ESecurity.tryUpdateCurrentMinuteDate(min.min_id, newMinuteDate, newMinuteDate); + const min = await E2ESecurity.createMeetingSeriesAndMinute(name); + await E2ESecurity.tryUpdateCurrentMinuteDate(min.min_id, newMinuteDate, newMinuteDate); }); it('can not update a Minute if not logged in', function () { const name = 'MinuteUpdate as not logged in'; - const min = E2ESecurity.createMeetingSeriesAndMinute(name); - E2EApp.logoutUser(); + const min = await E2ESecurity.createMeetingSeriesAndMinute(name); + await E2EApp.logoutUser(); - expect(E2EApp.isNotLoggedIn()).to.be.true; - E2ESecurity.tryUpdateCurrentMinuteDate(min.min_id, newMinuteDate, min.date); - E2EApp.loginUser(); + expect(await E2EApp.isNotLoggedIn()).to.be.true; + await E2ESecurity.tryUpdateCurrentMinuteDate(min.min_id, newMinuteDate, min.date); + await E2EApp.loginUser(); }); it('can not update a Minute if not invited to a Meeting Serie', function () { const name = 'MinuteUpdate as not invited to MS'; - const min = E2ESecurity.createMeetingSeriesAndMinute(name); - E2EApp.loginUser(1); - expect(E2EApp.isLoggedIn()).to.be.true; + const min = await E2ESecurity.createMeetingSeriesAndMinute(name); + await E2EApp.loginUser(1); + expect(await E2EApp.isLoggedIn()).to.be.true; - E2ESecurity.tryUpdateCurrentMinuteDate(min.min_id, newMinuteDate, min.date); - E2EApp.loginUser(); + await E2ESecurity.tryUpdateCurrentMinuteDate(min.min_id, newMinuteDate, min.date); + await E2EApp.loginUser(); }); it('can not update a Minute as an invited user', function () { const name = 'MinuteUpdate as Invited'; - const min = E2ESecurity.createMeetingSeriesAndMinute(name); - E2ESecurity.inviteUserToMeetingSerie(name, 'Invited', 1); + const min = await E2ESecurity.createMeetingSeriesAndMinute(name); + await E2ESecurity.inviteUserToMeetingSerie(name, 'Invited', 1); - E2EApp.loginUser(1); - expect(E2EApp.isLoggedIn()).to.be.true; + await E2EApp.loginUser(1); + expect(await E2EApp.isLoggedIn()).to.be.true; - E2ESecurity.tryUpdateCurrentMinuteDate(min.min_id, newMinuteDate, min.date); - E2EApp.loginUser(); + await E2ESecurity.tryUpdateCurrentMinuteDate(min.min_id, newMinuteDate, min.date); + await E2EApp.loginUser(); }); //addMinute it('can not add a new Minute if not logged in', function () { const name = 'MinuteAdd as not logged in'; - const ms_id = E2ESecurity.createMeetingSeries(name); + const ms_id = await E2ESecurity.createMeetingSeries(name); - const numberOfMinutes = server.call('e2e.countMinutesInMongoDB'); + const numberOfMinutes = await server.call('e2e.countMinutesInMongoDB'); - E2EApp.logoutUser(); - expect(E2EApp.isNotLoggedIn()).to.be.true; - E2ESecurity.tryAddNewMinute(ms_id, '29.07.2017', numberOfMinutes, 0); - E2EApp.loginUser(); + await E2EApp.logoutUser(); + expect(await E2EApp.isNotLoggedIn()).to.be.true; + await E2ESecurity.tryAddNewMinute(ms_id, '29.07.2017', numberOfMinutes, 0); + await E2EApp.loginUser(); }); it('can add a new Minute if a moderator', function () { const name = 'MinuteAdd as moderator'; - const ms_id = E2ESecurity.createMeetingSeries(name); - const numberOfMinutes = server.call('e2e.countMinutesInMongoDB'); + const ms_id = await E2ESecurity.createMeetingSeries(name); + const numberOfMinutes = await server.call('e2e.countMinutesInMongoDB'); - E2ESecurity.tryAddNewMinute(ms_id, '29.07.2017', numberOfMinutes+1, 0); + await E2ESecurity.tryAddNewMinute(ms_id, '29.07.2017', numberOfMinutes+1, 0); }); it('can not add a new Minute as an invited user', function () { const name = 'MinuteAdd as invited user'; - const ms_id = E2ESecurity.createMeetingSeries(name); - const numberOfMinutes = server.call('e2e.countMinutesInMongoDB'); - E2ESecurity.inviteUserToMeetingSerie(name, 'Invited', 1); - - E2EApp.loginUser(1); - expect(E2EApp.isLoggedIn()).to.be.true; - E2ESecurity.tryAddNewMinute(ms_id, '29.07.2017', numberOfMinutes, 1); - E2EApp.loginUser(); + const ms_id = await E2ESecurity.createMeetingSeries(name); + const numberOfMinutes = await server.call('e2e.countMinutesInMongoDB'); + await E2ESecurity.inviteUserToMeetingSerie(name, 'Invited', 1); + + await E2EApp.loginUser(1); + expect(await E2EApp.isLoggedIn()).to.be.true; + await E2ESecurity.tryAddNewMinute(ms_id, '29.07.2017', numberOfMinutes, 1); + await E2EApp.loginUser(); }); it('can not add a new Minute if not invited to a Meeting Serie', function () { const name = 'MinuteAdd as not invited to MS'; - const ms_id = E2ESecurity.createMeetingSeries(name); - const numberOfMinutes = server.call('e2e.countMinutesInMongoDB'); + const ms_id = await E2ESecurity.createMeetingSeries(name); + const numberOfMinutes = await server.call('e2e.countMinutesInMongoDB'); - E2EApp.loginUser(1); - expect(E2EApp.isLoggedIn()).to.be.true; - E2ESecurity.tryAddNewMinute(ms_id, '29.07.2017', numberOfMinutes, 1); - E2EApp.loginUser(); + await E2EApp.loginUser(1); + expect(await E2EApp.isLoggedIn()).to.be.true; + await E2ESecurity.tryAddNewMinute(ms_id, '29.07.2017', numberOfMinutes, 1); + await E2EApp.loginUser(); }); //workflow.removeMinute it('can delete a Minute if a moderator', function () { const name = 'MinuteDelete as moderator'; - const min = E2ESecurity.createMeetingSeriesAndMinute(name); - const numberOfMinutes = server.call('e2e.countMinutesInMongoDB'); + const min = await E2ESecurity.createMeetingSeriesAndMinute(name); + const numberOfMinutes = await server.call('e2e.countMinutesInMongoDB'); - E2ESecurity.tryRemoveMinute(min.min_id, numberOfMinutes-1); + await E2ESecurity.tryRemoveMinute(min.min_id, numberOfMinutes-1); }); it('can not delete a Minute if not logged in', function () { const name = 'MinuteDelete as not logged in'; - const min = E2ESecurity.createMeetingSeriesAndMinute(name); - const numberOfMinutes = server.call('e2e.countMinutesInMongoDB'); + const min = await E2ESecurity.createMeetingSeriesAndMinute(name); + const numberOfMinutes = await server.call('e2e.countMinutesInMongoDB'); - E2EApp.logoutUser(); - E2ESecurity.tryRemoveMinute(min.min_id, numberOfMinutes); - E2EApp.loginUser(); + await E2EApp.logoutUser(); + await E2ESecurity.tryRemoveMinute(min.min_id, numberOfMinutes); + await E2EApp.loginUser(); }); it('can not delete a Minute if not invited to a Meeting Serie', function () { const name = 'MinuteDelete as not invited to MS'; - const min = E2ESecurity.createMeetingSeriesAndMinute(name); - const numberOfMinutes = server.call('e2e.countMinutesInMongoDB'); + const min = await E2ESecurity.createMeetingSeriesAndMinute(name); + const numberOfMinutes = await server.call('e2e.countMinutesInMongoDB'); - E2EApp.loginUser(1); - expect(E2EApp.isLoggedIn()).to.be.true; - E2ESecurity.tryRemoveMinute(min.min_id, numberOfMinutes) - E2EApp.loginUser(); + await E2EApp.loginUser(1); + expect(await E2EApp.isLoggedIn()).to.be.true; + await E2ESecurity.tryRemoveMinute(min.min_id, numberOfMinutes) + await E2EApp.loginUser(); }); it('can not delete a Minute as an invited user', function () { const name = 'MinuteDelete as an invited user'; - const min = E2ESecurity.createMeetingSeriesAndMinute(name); - const numberOfMinutes = server.call('e2e.countMinutesInMongoDB'); - E2ESecurity.inviteUserToMeetingSerie(name, 'Invited', 1); - - E2EApp.loginUser(1); - expect(E2EApp.isLoggedIn()).to.be.true; - E2ESecurity.tryRemoveMinute(min.min_id, numberOfMinutes); - E2EApp.loginUser(); + const min = await E2ESecurity.createMeetingSeriesAndMinute(name); + const numberOfMinutes = await server.call('e2e.countMinutesInMongoDB'); + await E2ESecurity.inviteUserToMeetingSerie(name, 'Invited', 1); + + await E2EApp.loginUser(1); + expect(await E2EApp.isLoggedIn()).to.be.true; + await E2ESecurity.tryRemoveMinute(min.min_id, numberOfMinutes); + await E2EApp.loginUser(); }); //workflow.finalizeMinute it('can finalize a Minute if Moderator', function () { const name = 'MinuteFinalize as moderator'; - const min = E2ESecurity.createMeetingSeriesAndMinute(name); + const min = await E2ESecurity.createMeetingSeriesAndMinute(name); - E2ESecurity.tryFinalizeMinute(min.min_id, true); + await E2ESecurity.tryFinalizeMinute(min.min_id, true); }); it('can not finalize a Minute if not logged in', function () { const name = 'MinuteFinalize as not logged in'; - const min = E2ESecurity.createMeetingSeriesAndMinute(name); + const min = await E2ESecurity.createMeetingSeriesAndMinute(name); - E2EApp.logoutUser(); - expect(E2EApp.isNotLoggedIn()).to.be.true; - E2ESecurity.tryFinalizeMinute(min.min_id, false); - E2EApp.loginUser(); + await E2EApp.logoutUser(); + expect(await E2EApp.isNotLoggedIn()).to.be.true; + await E2ESecurity.tryFinalizeMinute(min.min_id, false); + await E2EApp.loginUser(); }); it('can not finalize a Minute if not invited to a Meeting Serie', function () { const name = 'MinuteFinalize as not invited to MS'; - const min = E2ESecurity.createMeetingSeriesAndMinute(name); + const min = await E2ESecurity.createMeetingSeriesAndMinute(name); - E2EApp.loginUser(1); - expect(E2EApp.isLoggedIn()).to.be.true; - E2ESecurity.tryFinalizeMinute(min.min_id, false); - E2EApp.loginUser(); + await E2EApp.loginUser(1); + expect(await E2EApp.isLoggedIn()).to.be.true; + await E2ESecurity.tryFinalizeMinute(min.min_id, false); + await E2EApp.loginUser(); }); it('can not finalize a Minute as an invited user', function () { const name = 'MinuteFinalize as an invited user'; - const min = E2ESecurity.createMeetingSeriesAndMinute(name); - E2ESecurity.inviteUserToMeetingSerie(name, 'Invited', 1); + const min = await E2ESecurity.createMeetingSeriesAndMinute(name); + await E2ESecurity.inviteUserToMeetingSerie(name, 'Invited', 1); - E2EApp.loginUser(1); - expect(E2EApp.isLoggedIn()).to.be.true; - E2ESecurity.tryFinalizeMinute(min.min_id, false); - E2EApp.loginUser(); + await E2EApp.loginUser(1); + expect(await E2EApp.isLoggedIn()).to.be.true; + await E2ESecurity.tryFinalizeMinute(min.min_id, false); + await E2EApp.loginUser(); }); //workflow.unfinalizeMinute it('can unfinalize a Minute if Moderator', function () { const name = 'MinuteUnfinalize as moderator'; - const min = E2ESecurity.createMeetingSeriesAndMinute(name); + const min = await E2ESecurity.createMeetingSeriesAndMinute(name); - E2ESecurity.executeMethod(E2ESecurity.finalizeMinute, min.min_id); - E2ESecurity.tryUnfinalizeMinute(min.min_id, false); + await E2ESecurity.executeMethod(E2ESecurity.finalizeMinute, min.min_id); + await E2ESecurity.tryUnfinalizeMinute(min.min_id, false); }); it('can not unfinalize a Minute if not logged in', function () { const name = 'MinuteUnfinalize as not logged in'; - const min = E2ESecurity.createMeetingSeriesAndMinute(name); + const min = await E2ESecurity.createMeetingSeriesAndMinute(name); - E2ESecurity.executeMethod(E2ESecurity.finalizeMinute, min.min_id); - E2EApp.logoutUser(); - expect(E2EApp.isNotLoggedIn()).to.be.true; - E2ESecurity.tryUnfinalizeMinute(min.min_id, true); - E2EApp.loginUser(); + await E2ESecurity.executeMethod(E2ESecurity.finalizeMinute, min.min_id); + await E2EApp.logoutUser(); + expect(await E2EApp.isNotLoggedIn()).to.be.true; + await E2ESecurity.tryUnfinalizeMinute(min.min_id, true); + await E2EApp.loginUser(); }); it('can not unfinalize a Minute if not invited to a Meeting Serie', function () { const name = 'MinuteUnfinalize as not invited to MS'; - const min = E2ESecurity.createMeetingSeriesAndMinute(name); + const min = await E2ESecurity.createMeetingSeriesAndMinute(name); - E2ESecurity.executeMethod(E2ESecurity.finalizeMinute, min.min_id); - E2EApp.loginUser(1); - expect(E2EApp.isLoggedIn()).to.be.true; - E2ESecurity.tryUnfinalizeMinute(min.min_id, true); - E2EApp.loginUser(); + await E2ESecurity.executeMethod(E2ESecurity.finalizeMinute, min.min_id); + await E2EApp.loginUser(1); + expect(await E2EApp.isLoggedIn()).to.be.true; + await E2ESecurity.tryUnfinalizeMinute(min.min_id, true); + await E2EApp.loginUser(); }); it('can not unfinalize a Minute as an invited user', function () { const name = 'MinuteUnfinalize as an invited user'; - const min = E2ESecurity.createMeetingSeriesAndMinute(name); + const min = await E2ESecurity.createMeetingSeriesAndMinute(name); - E2ESecurity.inviteUserToMeetingSerie(name, 'Invited', 1); - E2ESecurity.executeMethod(E2ESecurity.finalizeMinute, min.min_id); + await E2ESecurity.inviteUserToMeetingSerie(name, 'Invited', 1); + await E2ESecurity.executeMethod(E2ESecurity.finalizeMinute, min.min_id); - E2EApp.loginUser(1); - expect(E2EApp.isLoggedIn()).to.be.true; - E2ESecurity.tryUnfinalizeMinute(min.min_id, true); - E2EApp.loginUser(); + await E2EApp.loginUser(1); + expect(await E2EApp.isLoggedIn()).to.be.true; + await E2ESecurity.tryUnfinalizeMinute(min.min_id, true); + await E2EApp.loginUser(); }); it('can not unfinalize a Minute as a Moderator if it is not the last one', function () { const name = 'MinuteUnfinalize for not last Minute'; - const minute_1 = E2ESecurity.createMeetingSeriesAndMinute(name); + const minute_1 = await E2ESecurity.createMeetingSeriesAndMinute(name); - E2ESecurity.executeMethod(E2ESecurity.finalizeMinute, minute_1.min_id); - E2EMinutes.addMinutesToMeetingSeries(name, name); - E2EMinutes.gotoLatestMinutes(); - const minuteID_2 = E2EMinutes.getCurrentMinutesId(); - E2ESecurity.executeMethod(E2ESecurity.finalizeMinute, minuteID_2); + await E2ESecurity.executeMethod(E2ESecurity.finalizeMinute, minute_1.min_id); + await E2EMinutes.addMinutesToMeetingSeries(name, name); + await E2EMinutes.gotoLatestMinutes(); + const minuteID_2 = await E2EMinutes.getCurrentMinutesId(); + await E2ESecurity.executeMethod(E2ESecurity.finalizeMinute, minuteID_2); - E2ESecurity.tryUnfinalizeMinute(minute_1.min_id, true); + await E2ESecurity.tryUnfinalizeMinute(minute_1.min_id, true); }); }); describe('Minute Publish & Subscribe Security', function () { beforeEach('goto start page and make sure test user is logged in', function () { - E2EApp.gotoStartPage(); - expect(E2EApp.isLoggedIn()).to.be.true; + await E2EApp.gotoStartPage(); + expect(await E2EApp.isLoggedIn()).to.be.true; }); before('reload page and reset app', function () { - E2EApp.resetMyApp(true); - E2EApp.launchApp(); + await E2EApp.resetMyApp(true); + await E2EApp.launchApp(); }); it('Non-logged in users have no unexpected Minutes published', function () { const name = 'Publish Minutes Project #1'; - const min = E2ESecurity.createMeetingSeriesAndMinute(name); - E2ESecurity.tryFinalizeMinute(min.min_id, true); + const min = await E2ESecurity.createMeetingSeriesAndMinute(name); + await E2ESecurity.tryFinalizeMinute(min.min_id, true); - E2EMinutes.addMinutesToMeetingSeries(name, name); + await E2EMinutes.addMinutesToMeetingSeries(name, name); - expect(E2ESecurity.countRecordsInMiniMongo('minutes'), + await expect(await E2ESecurity.countRecordsInMiniMongo('minutes'), 'Moderator should have 2 Minutes published').to.equal(2); - E2EApp.logoutUser(); - expect (E2EApp.isNotLoggedIn()).to.be.true; - expect(E2ESecurity.countRecordsInMiniMongo('minutes'), + await E2EApp.logoutUser(); + expect (await E2EApp.isNotLoggedIn()).to.be.true; + await expect(await E2ESecurity.countRecordsInMiniMongo('minutes'), 'Not logged in user should not have Minutes published').to.equal(0); - E2EApp.loginUser(); + await E2EApp.loginUser(); }); it('Invited users should have Minutes published', function () { - expect(E2EApp.isLoggedIn()).to.be.true; + expect(await E2EApp.isLoggedIn()).to.be.true; const name = 'Publish Minutes Project #2'; - const min = E2ESecurity.createMeetingSeriesAndMinute(name); - E2ESecurity.inviteUserToMeetingSerie(name, 'Invited', 1); - E2ESecurity.tryFinalizeMinute(min.min_id, true); + const min = await E2ESecurity.createMeetingSeriesAndMinute(name); + await E2ESecurity.inviteUserToMeetingSerie(name, 'Invited', 1); + await E2ESecurity.tryFinalizeMinute(min.min_id, true); - E2EMinutes.addMinutesToMeetingSeries(name, name); - expect(E2ESecurity.countRecordsInMiniMongo('minutes'), 'Moderator should have 2 Minutes published').to.equal(2); + await E2EMinutes.addMinutesToMeetingSeries(name, name); + await expect(await E2ESecurity.countRecordsInMiniMongo('minutes'), 'Moderator should have 2 Minutes published').to.equal(2); - E2EApp.loginUser(1); - expect (E2EApp.isLoggedIn()).to.be.true; - expect(E2ESecurity.countRecordsInMiniMongo('minutes'), + await E2EApp.loginUser(1); + expect (await E2EApp.isLoggedIn()).to.be.true; + await expect(await E2ESecurity.countRecordsInMiniMongo('minutes'), 'Invited user should have no Minutes published when not within a Meeting Series').to.equal(0); - E2EMeetingSeries.gotoMeetingSeries(name, name); - E2EGlobal.waitSomeTime(); - expect(E2ESecurity.countRecordsInMiniMongo('minutes'), + await E2EMeetingSeries.gotoMeetingSeries(name, name); + await E2EGlobal.waitSomeTime(); + await expect(await E2ESecurity.countRecordsInMiniMongo('minutes'), 'Invited user should have 2 Minutes published').to.equal(2); - E2EApp.loginUser(); + await E2EApp.loginUser(); }); }); diff --git a/tests/end2end/MyActionItemsTab-test.js b/tests/end2end/MyActionItemsTab-test.js index 1772c6770..40999c904 100644 --- a/tests/end2end/MyActionItemsTab-test.js +++ b/tests/end2end/MyActionItemsTab-test.js @@ -10,14 +10,14 @@ describe('MyActionItems Tab', function () { let aMeetingNameBase = 'Meeting Name #'; before('reload page and reset app', function () { - E2EGlobal.logTimestamp('Start test suite'); - E2EApp.resetMyApp(true); - E2EApp.launchApp(); + await E2EGlobal.logTimestamp('Start test suite'); + await E2EApp.resetMyApp(true); + await E2EApp.launchApp(); }); beforeEach('goto start page and make sure test user is logged in', function () { - E2EApp.gotoStartPage(); - expect(E2EApp.isLoggedIn()).to.be.true; + await E2EApp.gotoStartPage(); + expect(await E2EApp.isLoggedIn()).to.be.true; }); // ************** @@ -25,39 +25,39 @@ describe('MyActionItems Tab', function () { // This test case has expected side effect to next test case! // ************** it('can filter my action items from all meeting series', function () { - this.timeout(150000); + await this.timeout(150000); let meetingName = aMeetingNameBase + '1'; - E2EMeetingSeries.createMeetingSeries(aProjectName, meetingName); + await E2EMeetingSeries.createMeetingSeries(aProjectName, meetingName); - E2EMinutes.addMinutesToMeetingSeries(aProjectName, meetingName); - E2ETopics.addTopicToMinutes('topic #1'); - E2ETopics.addInfoItemToTopic({subject: 'action item #1', itemType: 'actionItem', responsible: E2EApp.getCurrentUser()}, 1); - E2EMinutes.finalizeCurrentMinutes(); + await E2EMinutes.addMinutesToMeetingSeries(aProjectName, meetingName); + await E2ETopics.addTopicToMinutes('topic #1'); + await E2ETopics.addInfoItemToTopic({subject: 'action item #1', itemType: 'actionItem', responsible: await E2EApp.getCurrentUser()}, 1); + await E2EMinutes.finalizeCurrentMinutes(); - E2EMinutes.addMinutesToMeetingSeries(aProjectName, meetingName); - E2ETopics.addTopicToMinutes('topic #2'); - E2ETopics.addInfoItemToTopic({subject: 'action item #2', itemType: 'actionItem', responsible: E2EApp.getCurrentUser()}, 1); - E2ETopics.toggleActionItem(1, 1); - E2EMinutes.finalizeCurrentMinutes(); + await E2EMinutes.addMinutesToMeetingSeries(aProjectName, meetingName); + await E2ETopics.addTopicToMinutes('topic #2'); + await E2ETopics.addInfoItemToTopic({subject: 'action item #2', itemType: 'actionItem', responsible: await E2EApp.getCurrentUser()}, 1); + await E2ETopics.toggleActionItem(1, 1); + await E2EMinutes.finalizeCurrentMinutes(); meetingName = aMeetingNameBase + '2'; - E2EMeetingSeries.createMeetingSeries(aProjectName, meetingName); + await E2EMeetingSeries.createMeetingSeries(aProjectName, meetingName); - E2EMinutes.addMinutesToMeetingSeries(aProjectName, meetingName); - E2ETopics.addTopicToMinutes('topic #3'); - E2ETopics.addInfoItemToTopic({subject: 'action item #3', itemType: 'actionItem', responsible: E2EApp.getCurrentUser()}, 1); - E2EMinutes.finalizeCurrentMinutes(); + await E2EMinutes.addMinutesToMeetingSeries(aProjectName, meetingName); + await E2ETopics.addTopicToMinutes('topic #3'); + await E2ETopics.addInfoItemToTopic({subject: 'action item #3', itemType: 'actionItem', responsible: await E2EApp.getCurrentUser()}, 1); + await E2EMinutes.finalizeCurrentMinutes(); - E2EMinutes.addMinutesToMeetingSeries(aProjectName, meetingName); - E2ETopics.addTopicToMinutes('topic #4'); - E2ETopics.addInfoItemToTopic({subject: 'action item #4', itemType: 'actionItem', responsible: E2EApp.getCurrentUser()}, 1); - E2EMinutes.finalizeCurrentMinutes(); + await E2EMinutes.addMinutesToMeetingSeries(aProjectName, meetingName); + await E2ETopics.addTopicToMinutes('topic #4'); + await E2ETopics.addInfoItemToTopic({subject: 'action item #4', itemType: 'actionItem', responsible: await E2EApp.getCurrentUser()}, 1); + await E2EMinutes.finalizeCurrentMinutes(); - E2EApp.gotoStartPage(); - E2EApp.gotoActionItemsTab(); + await E2EApp.gotoStartPage(); + await E2EApp.gotoActionItemsTab(); - expect(E2ETopics.countItemsForTopic('#itemPanel'), 'Items list should have three items').to.equal(3); + await expect(await E2ETopics.countItemsForTopic('#itemPanel'), 'Items list should have three items').to.equal(3); }); // ************** @@ -66,30 +66,30 @@ describe('MyActionItems Tab', function () { // ************** it('can filter my action items from all action items', function () { let meetingName = aMeetingNameBase + '3'; - E2EMeetingSeries.createMeetingSeries(aProjectName, meetingName); + await E2EMeetingSeries.createMeetingSeries(aProjectName, meetingName); - E2EMinutes.addMinutesToMeetingSeries(aProjectName, meetingName); - E2ETopics.addTopicToMinutes('topic #5'); - E2ETopics.addInfoItemToTopic({subject: 'action item #5', itemType: 'actionItem', responsible: (E2EApp.getCurrentUser() + ',' + E2EGlobal.SETTINGS.e2eTestUsers[1])}, 1); - E2ETopics.addInfoItemToTopic({subject: 'action item #6', itemType: 'actionItem', responsible: E2EGlobal.SETTINGS.e2eTestUsers[1]}, 1); - E2EMinutes.finalizeCurrentMinutes(); + await E2EMinutes.addMinutesToMeetingSeries(aProjectName, meetingName); + await E2ETopics.addTopicToMinutes('topic #5'); + await E2ETopics.addInfoItemToTopic({subject: 'action item #5', itemType: 'actionItem', responsible: ((await E2EApp.getCurrentUser()) + ',' + E2EGlobal.SETTINGS.e2eTestUsers[1])}, 1); + await E2ETopics.addInfoItemToTopic({subject: 'action item #6', itemType: 'actionItem', responsible: E2EGlobal.SETTINGS.e2eTestUsers[1]}, 1); + await E2EMinutes.finalizeCurrentMinutes(); - E2EApp.gotoStartPage(); - E2EApp.gotoActionItemsTab(); + await E2EApp.gotoStartPage(); + await E2EApp.gotoActionItemsTab(); - expect(E2ETopics.countItemsForTopic('#itemPanel'), 'Items list should have four items').to.equal(4); + await expect(await E2ETopics.countItemsForTopic('#itemPanel'), 'Items list should have four items').to.equal(4); }); it('can navigate from AI on "My Action Item" to parent topic', function () { - E2EApp.gotoStartPage(); - E2EApp.gotoActionItemsTab(); + await E2EApp.gotoStartPage(); + await E2EApp.gotoActionItemsTab(); - const firstActionItemOnMyActionItemsView = E2ETopics.getNthItemFromItemList(0); + const firstActionItemOnMyActionItemsView = await E2ETopics.getNthItemFromItemList(0); const firstAItextOnMyActionItemsView = firstActionItemOnMyActionItemsView.value.replace(/\n.*/,''); - E2EGlobal.clickWithRetry('a.linkItemContext'); // navigate to parent topic view + await E2EGlobal.clickWithRetry('a.linkItemContext'); // navigate to parent topic view - const firstItemOnTopicView = E2ETopics.getNthItemFromItemList(0); + const firstItemOnTopicView = await E2ETopics.getNthItemFromItemList(0); - expect(firstAItextOnMyActionItemsView, 'AI before & AI after shall be same').to.equal(firstItemOnTopicView.value); + await expect(firstAItextOnMyActionItemsView, 'AI before & AI after shall be same').to.equal(firstItemOnTopicView.value); }); }); \ No newline at end of file diff --git a/tests/end2end/Protocols-test.js b/tests/end2end/Protocols-test.js index d10827619..b516077b6 100644 --- a/tests/end2end/Protocols-test.js +++ b/tests/end2end/Protocols-test.js @@ -10,25 +10,25 @@ describe('Protocols', function () { let _meetingCounter = 0; let _lastMinutesID; let _lastMeetingName; - let getNewMeetingName = () => { + let getNewMeetingName = async () => { _meetingCounter++; return _meetingNameBase + _meetingCounter; }; before('reload page and reset app', function () { - E2EGlobal.logTimestamp("Start test suite"); - E2EApp.resetMyApp(true); - E2EApp.launchApp(); + await E2EGlobal.logTimestamp("Start test suite"); + await E2EApp.resetMyApp(true); + await E2EApp.launchApp(); }); beforeEach('goto start page and make sure test user is logged in', function () { - E2EApp.gotoStartPage(); - expect (E2EApp.isLoggedIn()).to.be.true; + await E2EApp.gotoStartPage(); + expect (await E2EApp.isLoggedIn()).to.be.true; - _lastMeetingName = getNewMeetingName(); - E2EMeetingSeries.createMeetingSeries(_projectName, _lastMeetingName); - _lastMinutesID = E2EMinutes.addMinutesToMeetingSeries(_projectName, _lastMeetingName); + _lastMeetingName = await getNewMeetingName(); + await E2EMeetingSeries.createMeetingSeries(_projectName, _lastMeetingName); + _lastMinutesID = await E2EMinutes.addMinutesToMeetingSeries(_projectName, _lastMeetingName); }); // ****************** @@ -36,44 +36,44 @@ describe('Protocols', function () { // ****************** it('No Protocol is created on finalizing Minutes if feature is disabled', function () { - E2EProtocols.setSettingsForProtocolGeneration(); //Disable document generation + await E2EProtocols.setSettingsForProtocolGeneration(); //Disable document generation - let numberOfProtocolsBefore = E2EProtocols.countProtocolsInMongoDB(); - E2EMinutes.finalizeCurrentMinutes(); + let numberOfProtocolsBefore = await E2EProtocols.countProtocolsInMongoDB(); + await E2EMinutes.finalizeCurrentMinutes(); - expect(browser.isExisting('#btn_unfinalizeMinutes'),'Minute has been finalized').to.be.true; + expect(await browser.isExisting('#btn_unfinalizeMinutes'),'Minute has been finalized').to.be.true; - expect(E2EProtocols.countProtocolsInMongoDB(), 'No Protocol has been created').to.equal(numberOfProtocolsBefore); + await expect(await E2EProtocols.countProtocolsInMongoDB(), 'No Protocol has been created').to.equal(numberOfProtocolsBefore); }); it('HTML Protocol is created on finalizing Minutes', function () { - E2EProtocols.setSettingsForProtocolGeneration('html'); + await E2EProtocols.setSettingsForProtocolGeneration('html'); - let numberOfProtocolsBefore = E2EProtocols.countProtocolsInMongoDB(); - E2EMinutes.finalizeCurrentMinutes(); + let numberOfProtocolsBefore = await E2EProtocols.countProtocolsInMongoDB(); + await E2EMinutes.finalizeCurrentMinutes(); - expect(browser.isExisting('#btn_unfinalizeMinutes'),'Minute has been finalized').to.be.true; - expect(E2EProtocols.countProtocolsInMongoDB(), 'Protocol has been saved in database').to.equal(numberOfProtocolsBefore + 1); - expect(E2EProtocols.checkProtocolFileForMinuteExits(_lastMinutesID), 'Protocol has been saved on file system').to.be.true; + expect(await browser.isExisting('#btn_unfinalizeMinutes'),'Minute has been finalized').to.be.true; + await expect(await E2EProtocols.countProtocolsInMongoDB(), 'Protocol has been saved in database').to.equal(numberOfProtocolsBefore + 1); + expect(await E2EProtocols.checkProtocolFileForMinuteExits(_lastMinutesID), 'Protocol has been saved on file system').to.be.true; }); it('HTML Protocol is deleted on unfinalizing Minutes', function () { - E2EProtocols.setSettingsForProtocolGeneration('html'); + await E2EProtocols.setSettingsForProtocolGeneration('html'); - E2EMinutes.finalizeCurrentMinutes(); - expect(browser.isExisting('#btn_unfinalizeMinutes'),'Minute has been finalized').to.be.true; + await E2EMinutes.finalizeCurrentMinutes(); + expect(await browser.isExisting('#btn_unfinalizeMinutes'),'Minute has been finalized').to.be.true; - let numberOfProtocolsBefore = E2EProtocols.countProtocolsInMongoDB(); + let numberOfProtocolsBefore = await E2EProtocols.countProtocolsInMongoDB(); expect(numberOfProtocolsBefore > 0, 'A Protocol has been saved in database').to.be.true; - expect(E2EProtocols.checkProtocolFileForMinuteExits(_lastMinutesID), 'A Protocol has been saved on file system').to.be.true; + expect(await E2EProtocols.checkProtocolFileForMinuteExits(_lastMinutesID), 'A Protocol has been saved on file system').to.be.true; - E2EMinutes.unfinalizeCurrentMinutes(); + await E2EMinutes.unfinalizeCurrentMinutes(); - E2EGlobal.waitSomeTime(5000); + await E2EGlobal.waitSomeTime(5000); - expect(browser.isExisting('#btn_unfinalizeMinutes'),'Minute has been unfinalized').to.be.false; - expect(E2EProtocols.countProtocolsInMongoDB(), 'The Protocol has been deleted in database').to.equal(numberOfProtocolsBefore - 1); - expect(E2EProtocols.checkProtocolFileForMinuteExits(_lastMinutesID), 'The Protocol has been deleted on file system').to.be.false; + expect(await browser.isExisting('#btn_unfinalizeMinutes'),'Minute has been unfinalized').to.be.false; + await expect(await E2EProtocols.countProtocolsInMongoDB(), 'The Protocol has been deleted in database').to.equal(numberOfProtocolsBefore - 1); + expect(await E2EProtocols.checkProtocolFileForMinuteExits(_lastMinutesID), 'The Protocol has been deleted on file system').to.be.false; }); // ****************** @@ -81,99 +81,99 @@ describe('Protocols', function () { // ****************** it('Download Button is visible on finalized Minutes', function () { - E2EProtocols.setSettingsForProtocolGeneration('html'); + await E2EProtocols.setSettingsForProtocolGeneration('html'); - expect(E2EProtocols.downloadButtonExists(), 'Download button is not visible in unfinalized Mintues').to.be.false; - E2EMinutes.finalizeCurrentMinutes(); - expect(E2EProtocols.downloadButtonExists(), 'Download button is visible in finalized Mintues').to.be.true; + expect(await E2EProtocols.downloadButtonExists(), 'Download button is not visible in unfinalized Mintues').to.be.false; + await E2EMinutes.finalizeCurrentMinutes(); + expect(await E2EProtocols.downloadButtonExists(), 'Download button is visible in finalized Mintues').to.be.true; }); xit('Trying to download a non-existent protocol shows a confirmation dialog to download on-the-fly version', function () { - E2EProtocols.setSettingsForProtocolGeneration(); //Deactivate protocol generation + await E2EProtocols.setSettingsForProtocolGeneration(); //Deactivate protocol generation - let numberOfProtocolsBefore = E2EProtocols.countProtocolsInMongoDB(); - E2EMinutes.finalizeCurrentMinutes(); - expect(E2EProtocols.countProtocolsInMongoDB(), 'No protocol has been created').to.equal(numberOfProtocolsBefore); + let numberOfProtocolsBefore = await E2EProtocols.countProtocolsInMongoDB(); + await E2EMinutes.finalizeCurrentMinutes(); + await expect(await E2EProtocols.countProtocolsInMongoDB(), 'No protocol has been created').to.equal(numberOfProtocolsBefore); - E2EProtocols.setSettingsForProtocolGeneration('html'); //Reactivate protocol generation, otherwise there won't be a download-button - E2EApp.logoutUser(); //Re-Login to allow app to get changes of settings - E2EApp.loginUser(); - E2EMeetingSeries.gotoMeetingSeries(_projectName, _lastMeetingName); - E2EMinutes.gotoLatestMinutes(); + await E2EProtocols.setSettingsForProtocolGeneration('html'); //Reactivate protocol generation, otherwise there won't be a download-button + await E2EApp.logoutUser(); //Re-Login to allow app to get changes of settings + await E2EApp.loginUser(); + await E2EMeetingSeries.gotoMeetingSeries(_projectName, _lastMeetingName); + await E2EMinutes.gotoLatestMinutes(); - expect(E2EProtocols.checkDownloadOpensConfirmationDialog(), 'Confirmation Dialog is opened').to.be.true; + expect(await E2EProtocols.checkDownloadOpensConfirmationDialog(), 'Confirmation Dialog is opened').to.be.true; }); it('Trying to download an existant protocol shows no confirmation dialog', function () { console.log("checkpoint-1"); - E2EProtocols.setSettingsForProtocolGeneration('html'); + await E2EProtocols.setSettingsForProtocolGeneration('html'); console.log("checkpoint-2"); - let numberOfProtocolsBefore = E2EProtocols.countProtocolsInMongoDB(); + let numberOfProtocolsBefore = await E2EProtocols.countProtocolsInMongoDB(); console.log("checkpoint-3"); - E2EMinutes.finalizeCurrentMinutes(); + await E2EMinutes.finalizeCurrentMinutes(); console.log("checkpoint-4"); - browser.scroll('.navbar-header'); //without this the "Minutes finalized" toast would be right above the download button + await browser.scroll('.navbar-header'); //without this the "Minutes finalized" toast would be right above the download button console.log("checkpoint-5"); - E2EGlobal.waitSomeTime(750); + await E2EGlobal.waitSomeTime(750); console.log("checkpoint-6"); - expect(E2EProtocols.countProtocolsInMongoDB(), 'Protocol has been saved in database').to.equal(numberOfProtocolsBefore + 1); + await expect(await E2EProtocols.countProtocolsInMongoDB(), 'Protocol has been saved in database').to.equal(numberOfProtocolsBefore + 1); console.log("checkpoint-7"); - expect(E2EProtocols.checkDownloadOpensConfirmationDialog(), 'No Confirmation Dialog is opened').to.be.false; + expect(await E2EProtocols.checkDownloadOpensConfirmationDialog(), 'No Confirmation Dialog is opened').to.be.false; console.log("checkpoint-8"); }); it('Trying to download an protocol with an direct link should work with proper permissions', function () { - E2EProtocols.setSettingsForProtocolGeneration('html'); - let numberOfProtocolsBefore = E2EProtocols.countProtocolsInMongoDB(); + await E2EProtocols.setSettingsForProtocolGeneration('html'); + let numberOfProtocolsBefore = await E2EProtocols.countProtocolsInMongoDB(); - E2EMinutes.finalizeCurrentMinutes(); - E2EGlobal.waitSomeTime(750); - expect(E2EProtocols.countProtocolsInMongoDB(), 'Protocol has been saved in database').to.equal(numberOfProtocolsBefore + 1); + await E2EMinutes.finalizeCurrentMinutes(); + await E2EGlobal.waitSomeTime(750); + await expect(await E2EProtocols.countProtocolsInMongoDB(), 'Protocol has been saved in database').to.equal(numberOfProtocolsBefore + 1); - browser.execute((link) => { + await browser.execute((link) => { window.location = link; }, E2EProtocols.getDownloadLinkForProtocolOfMinute(_lastMinutesID) + '?download=true'); - E2EGlobal.waitSomeTime(750); + await E2EGlobal.waitSomeTime(750); - expect(browser.getText('body')).to.not.have.string('File Not Found'); + await expect(await browser.getText('body')).to.not.have.string('File Not Found'); }); it('Trying to download an protocol with an direct link should not work when logged out', function () { - E2EProtocols.setSettingsForProtocolGeneration('html'); - let numberOfProtocolsBefore = E2EProtocols.countProtocolsInMongoDB(); + await E2EProtocols.setSettingsForProtocolGeneration('html'); + let numberOfProtocolsBefore = await E2EProtocols.countProtocolsInMongoDB(); - E2EMinutes.finalizeCurrentMinutes(); - E2EGlobal.waitSomeTime(750); - expect(E2EProtocols.countProtocolsInMongoDB(), 'Protocol has been saved in database').to.equal(numberOfProtocolsBefore + 1); + await E2EMinutes.finalizeCurrentMinutes(); + await E2EGlobal.waitSomeTime(750); + await expect(await E2EProtocols.countProtocolsInMongoDB(), 'Protocol has been saved in database').to.equal(numberOfProtocolsBefore + 1); - E2EApp.logoutUser(); - browser.execute((link) => { + await E2EApp.logoutUser(); + await browser.execute((link) => { window.location = link; }, E2EProtocols.getDownloadLinkForProtocolOfMinute(_lastMinutesID) + '?download=true'); - E2EGlobal.waitSomeTime(750); + await E2EGlobal.waitSomeTime(750); - expect(browser.getText('body')).to.have.string('File Not Found'); + await expect(await browser.getText('body')).to.have.string('File Not Found'); }); it('Trying to download an protocol with an direct link should not work when loggin in but no permissions', function () { - E2EProtocols.setSettingsForProtocolGeneration('html'); - let numberOfProtocolsBefore = E2EProtocols.countProtocolsInMongoDB(); + await E2EProtocols.setSettingsForProtocolGeneration('html'); + let numberOfProtocolsBefore = await E2EProtocols.countProtocolsInMongoDB(); - E2EMinutes.finalizeCurrentMinutes(); - E2EGlobal.waitSomeTime(750); - expect(E2EProtocols.countProtocolsInMongoDB(), 'Protocol has been saved in database').to.equal(numberOfProtocolsBefore + 1); + await E2EMinutes.finalizeCurrentMinutes(); + await E2EGlobal.waitSomeTime(750); + await expect(await E2EProtocols.countProtocolsInMongoDB(), 'Protocol has been saved in database').to.equal(numberOfProtocolsBefore + 1); - E2EApp.logoutUser(); - E2EApp.loginUser(1); - browser.execute((link) => { + await E2EApp.logoutUser(); + await E2EApp.loginUser(1); + await browser.execute((link) => { window.location = link; }, E2EProtocols.getDownloadLinkForProtocolOfMinute(_lastMinutesID) + '?download=true'); - E2EGlobal.waitSomeTime(750); + await E2EGlobal.waitSomeTime(750); - expect(browser.getText('body')).to.have.string('File Not Found'); + await expect(await browser.getText('body')).to.have.string('File Not Found'); }); }); diff --git a/tests/end2end/Routing-test.js b/tests/end2end/Routing-test.js index 8a09798cb..6a6e9833d 100644 --- a/tests/end2end/Routing-test.js +++ b/tests/end2end/Routing-test.js @@ -11,87 +11,87 @@ describe('Routing', function () { let aMeetingName; before("reload page and reset app", function () { - E2EGlobal.logTimestamp("Start test suite"); - E2EApp.resetMyApp(true); - E2EApp.launchApp(); + await E2EGlobal.logTimestamp("Start test suite"); + await E2EApp.resetMyApp(true); + await E2EApp.launchApp(); }); beforeEach("goto start page and make sure test user is logged in", function () { - E2EApp.gotoStartPage(); - expect (E2EApp.isLoggedIn()).to.be.true; + await E2EApp.gotoStartPage(); + expect (await E2EApp.isLoggedIn()).to.be.true; aMeetingCounter++; aMeetingName = aMeetingNameBase + aMeetingCounter; - E2EMeetingSeries.createMeetingSeries(aProjectName, aMeetingName); + await E2EMeetingSeries.createMeetingSeries(aProjectName, aMeetingName); }); after("clear database and login user", function () { - E2EApp.launchApp(); - E2EApp.loginUser(); - expect(E2EApp.isLoggedIn()).to.be.true; + await E2EApp.launchApp(); + await E2EApp.loginUser(); + expect(await E2EApp.isLoggedIn()).to.be.true; }); it('ensures that following a URL to a meeting series will relocate to the requested series after sign-in', function () { - E2EMeetingSeries.gotoMeetingSeries(aProjectName, aMeetingName); - const url = browser.getUrl(); + await E2EMeetingSeries.gotoMeetingSeries(aProjectName, aMeetingName); + const url = await browser.getUrl(); - E2EApp.logoutUser(); + await E2EApp.logoutUser(); - browser.url(url); + await browser.url(url); - E2EApp.loginUser(0, false); + await E2EApp.loginUser(0, false); let selector = 'h2.header'; - let header = browser.element(selector).value.ELEMENT; - let headerText = browser.elementIdText(header).value; - expect(headerText).to.have.string("Meeting Series: " + aProjectName); + let header = (await browser.element(selector)).value.ELEMENT; + let headerText = (await browser.elementIdText(header)).value; + await expect(headerText).to.have.string("Meeting Series: " + aProjectName); }); it('ensures that following a URL to a concrete minute will relocate to the requested minute after sign-in', function () { - E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName); + await E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName); - const url = browser.getUrl(); + const url = await browser.getUrl(); - E2EApp.logoutUser(); + await E2EApp.logoutUser(); - browser.url(url); + await browser.url(url); - E2EApp.loginUser(0, false); + await E2EApp.loginUser(0, false); let selector = 'h2.header'; - let header = browser.element(selector).value.ELEMENT; - let headerText = browser.elementIdText(header).value; - expect(headerText).to.have.string("Minutes for " + aProjectName); + let header = (await browser.element(selector)).value.ELEMENT; + let headerText = (await browser.elementIdText(header)).value; + await expect(headerText).to.have.string("Minutes for " + aProjectName); }); it('ensures that "legal notice" route shows expected text', function () { - expect(browser.isVisible("div#divLegalNotice"), "legal notice should be invisible").to.be.false; - browser.keys(['Escape']); // close eventually open modal dialog - E2EGlobal.waitSomeTime(); + expect(await browser.isVisible("div#divLegalNotice"), "legal notice should be invisible").to.be.false; + await browser.keys(['Escape']); // close eventually open modal dialog + await E2EGlobal.waitSomeTime(); // Force to switch route - browser.url(E2EGlobal.SETTINGS.e2eUrl+"/legalnotice"); - expect(browser.getUrl(), "on 'legal notice' route").to.contain("/legalnotice"); - expect(browser.isVisible("div#divLegalNotice"), "legal notice should be visible").to.be.true; - expect(browser.getText("div#divLegalNotice"), "check text in legal notice route") + await browser.url(E2EGlobal.SETTINGS.e2eUrl+"/legalnotice"); + await expect(await browser.getUrl(), "on 'legal notice' route").to.contain("/legalnotice"); + expect(await browser.isVisible("div#divLegalNotice"), "legal notice should be visible").to.be.true; + await expect(await browser.getText("div#divLegalNotice"), "check text in legal notice route") .to.contain("THE DEMO SERVICE AVAILABLE VIA"); }); it('ensures that "legal notice" route is reachable on login screen via About dialog', function () { - E2EGlobal.waitSomeTime(1500); - browser.keys(['Escape']); // close open edit meeting series dialog - E2EGlobal.waitSomeTime(); - E2EApp.logoutUser(); + await E2EGlobal.waitSomeTime(1500); + await browser.keys(['Escape']); // close open edit meeting series dialog + await E2EGlobal.waitSomeTime(); + await E2EApp.logoutUser(); // open about dialog and trigger legal notice link - expect(browser.getUrl(), "on normal route").not.to.contain("/legalnotice"); - E2EGlobal.clickWithRetry("#btnAbout"); - E2EGlobal.waitSomeTime(); - E2EGlobal.clickWithRetry("#btnLegalNotice"); - expect(browser.getUrl(), "on 'legal notice' route").to.contain("/legalnotice"); + await expect(await browser.getUrl(), "on normal route").not.to.contain("/legalnotice"); + await E2EGlobal.clickWithRetry("#btnAbout"); + await E2EGlobal.waitSomeTime(); + await E2EGlobal.clickWithRetry("#btnLegalNotice"); + await expect(await browser.getUrl(), "on 'legal notice' route").to.contain("/legalnotice"); }); }); diff --git a/tests/end2end/SendAgenda.js b/tests/end2end/SendAgenda.js index 1fd87a866..4cc0c14e5 100644 --- a/tests/end2end/SendAgenda.js +++ b/tests/end2end/SendAgenda.js @@ -14,147 +14,147 @@ describe('Send agenda', function () { let aMeetingName; before("reload page and reset app", function () { - E2EGlobal.logTimestamp("Start test suite"); - E2EApp.launchApp(); - E2EApp.resetMyApp(true); + await E2EGlobal.logTimestamp("Start test suite"); + await E2EApp.launchApp(); + await E2EApp.resetMyApp(true); }); beforeEach("goto start page and make sure test user is logged in", function () { - E2EMails.resetSentMailsDb(); + await E2EMails.resetSentMailsDb(); - E2EApp.gotoStartPage(); - expect (E2EApp.isLoggedIn()).to.be.true; + await E2EApp.gotoStartPage(); + expect (await E2EApp.isLoggedIn()).to.be.true; aMeetingCounter++; aMeetingName = aMeetingNameBase + aMeetingCounter; - E2EMeetingSeries.createMeetingSeries(aProjectName, aMeetingName); - E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName); + await E2EMeetingSeries.createMeetingSeries(aProjectName, aMeetingName); + await E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName); }); after("clear database", function () { - if (E2EGlobal.browserIsPhantomJS()) { - E2EApp.resetMyApp(true); + if (await E2EGlobal.browserIsPhantomJS()) { + await E2EApp.resetMyApp(true); } }); it('displays a button send agenda on a new created minute', function() { - expect(browser.isVisible('#btn_sendAgenda')).to.be.true; + expect(await browser.isVisible('#btn_sendAgenda')).to.be.true; }); it('ensures that the send-agenda-button is invisible for non-moderators', function() { - E2EMeetingSeries.gotoMeetingSeries(aProjectName, aMeetingName); - E2EMeetingSeriesEditor.openMeetingSeriesEditor(aProjectName, aMeetingName, "invited"); + await E2EMeetingSeries.gotoMeetingSeries(aProjectName, aMeetingName); + await E2EMeetingSeriesEditor.openMeetingSeriesEditor(aProjectName, aMeetingName, "invited"); - let currentUser = E2EApp.getCurrentUser(); + let currentUser = await E2EApp.getCurrentUser(); let user2 = E2EGlobal.SETTINGS.e2eTestUsers[1]; - browser.setValue('#edt_AddUser', user2); - browser.keys(['Enter']); + await browser.setValue('#edt_AddUser', user2); + await browser.keys(['Enter']); let selector = "select.user-role-select"; - let usrRoleOption = browser.selectByValue(selector, "Invited"); - E2EMeetingSeriesEditor.closeMeetingSeriesEditor(); // close with save + let usrRoleOption = await browser.selectByValue(selector, "Invited"); + await E2EMeetingSeriesEditor.closeMeetingSeriesEditor(); // close with save - E2EApp.loginUser(1); - E2EMeetingSeries.gotoMeetingSeries(aProjectName, aMeetingName); - E2EGlobal.waitSomeTime(); + await E2EApp.loginUser(1); + await E2EMeetingSeries.gotoMeetingSeries(aProjectName, aMeetingName); + await E2EGlobal.waitSomeTime(); - E2EMinutes.gotoLatestMinutes(); - expect(browser.isVisible('#btn_sendAgenda')).to.be.false; + await E2EMinutes.gotoLatestMinutes(); + expect(await browser.isVisible('#btn_sendAgenda')).to.be.false; - E2EApp.loginUser(); + await E2EApp.loginUser(); }); it('ensures that the send-agenda-button is invisible for finalizes minutes', function() { - E2EMinutes.finalizeCurrentMinutes(); - expect(browser.isVisible('#btn_sendAgenda')).to.be.false; + await E2EMinutes.finalizeCurrentMinutes(); + expect(await browser.isVisible('#btn_sendAgenda')).to.be.false; }); it('ensures that a confirmation dialog is shown before sending the agenda a second time', function() { - browser.waitForVisible('#btn_sendAgenda'); - E2EGlobal.clickWithRetry('#btn_sendAgenda'); + await browser.waitForVisible('#btn_sendAgenda'); + await E2EGlobal.clickWithRetry('#btn_sendAgenda'); - E2EMinutes.confirmQualityAssuranceDialog(); + await E2EMinutes.confirmQualityAssuranceDialog(); - E2EGlobal.clickWithRetry('#btn_sendAgenda'); + await E2EGlobal.clickWithRetry('#btn_sendAgenda'); - E2EMinutes.confirmQualityAssuranceDialog(); + await E2EMinutes.confirmQualityAssuranceDialog(); let selectorDialog = "#confirmDialog"; - E2EGlobal.waitSomeTime(750); // give dialog animation time - expect(browser.isVisible(selectorDialog), "Dialog should be visible").to.be.true; + await E2EGlobal.waitSomeTime(750); // give dialog animation time + expect(await browser.isVisible(selectorDialog), "Dialog should be visible").to.be.true; // close dialog otherwise beforeEach-hook will fail! - E2EApp.confirmationDialogAnswer(false); + await E2EApp.confirmationDialogAnswer(false); }); it('sends one email to the participant containing the topic but not the info items', function() { const topicSubject = 'some topic'; const infoItemSubject = 'amazing information'; - E2ETopics.addTopicToMinutes(topicSubject); - E2ETopics.addInfoItemToTopic({ + await E2ETopics.addTopicToMinutes(topicSubject); + await E2ETopics.addInfoItemToTopic({ subject: infoItemSubject, itemType: "infoItem" }, 1); - browser.waitForVisible('#btn_sendAgenda'); - E2EGlobal.clickWithRetry('#btn_sendAgenda'); - E2EMinutes.confirmQualityAssuranceDialog(); + await browser.waitForVisible('#btn_sendAgenda'); + await E2EGlobal.clickWithRetry('#btn_sendAgenda'); + await E2EMinutes.confirmQualityAssuranceDialog(); - E2EGlobal.waitSomeTime(); + await E2EGlobal.waitSomeTime(); - let sentMails = E2EMails.getAllSentMails(); + let sentMails = await E2EMails.getAllSentMails(); expect(sentMails, 'one mail should be sent').to.have.length(1); let sentMail = sentMails[0]; - expect(sentMail.subject, 'the subject should contain the string Agenda').to.have.string('Agenda'); - expect(sentMail.html, 'the email should contain the subject of the topic').to.have.string(topicSubject); - expect(sentMail.html, 'the email should not contain the info item').to.not.have.string(infoItemSubject); + await expect(sentMail.subject, 'the subject should contain the string Agenda').to.have.string('Agenda'); + await expect(sentMail.html, 'the email should contain the subject of the topic').to.have.string(topicSubject); + await expect(sentMail.html, 'the email should not contain the info item').to.not.have.string(infoItemSubject); }); it('ensures that the agenda will be sent to all invited', function() { - E2EMeetingSeries.gotoMeetingSeries(aProjectName, aMeetingName); - E2EMeetingSeriesEditor.openMeetingSeriesEditor(aProjectName, aMeetingName, "invited"); - E2EMeetingSeriesEditor.disableEmailForRoleChange(); + await E2EMeetingSeries.gotoMeetingSeries(aProjectName, aMeetingName); + await E2EMeetingSeriesEditor.openMeetingSeriesEditor(aProjectName, aMeetingName, "invited"); + await E2EMeetingSeriesEditor.disableEmailForRoleChange(); - let currentUser = E2EApp.getCurrentUser(); + let currentUser = await E2EApp.getCurrentUser(); let user2 = E2EGlobal.SETTINGS.e2eTestUsers[1]; - browser.setValue('#edt_AddUser', user2); - browser.keys(['Enter']); + await browser.setValue('#edt_AddUser', user2); + await browser.keys(['Enter']); let selector = "select.user-role-select"; - let usrRoleOption = browser.selectByValue(selector, "Invited"); - E2EMeetingSeriesEditor.closeMeetingSeriesEditor(); // close with save + let usrRoleOption = await browser.selectByValue(selector, "Invited"); + await E2EMeetingSeriesEditor.closeMeetingSeriesEditor(); // close with save - E2EMeetingSeries.gotoMeetingSeries(aProjectName, aMeetingName); - E2EGlobal.waitSomeTime(); + await E2EMeetingSeries.gotoMeetingSeries(aProjectName, aMeetingName); + await E2EGlobal.waitSomeTime(); - E2EMinutes.gotoLatestMinutes(); + await E2EMinutes.gotoLatestMinutes(); - browser.waitForVisible('#btn_sendAgenda'); - E2EGlobal.clickWithRetry('#btn_sendAgenda'); - E2EMinutes.confirmQualityAssuranceDialog(); + await browser.waitForVisible('#btn_sendAgenda'); + await E2EGlobal.clickWithRetry('#btn_sendAgenda'); + await E2EMinutes.confirmQualityAssuranceDialog(); - E2EGlobal.waitSomeTime(); + await E2EGlobal.waitSomeTime(); - let recipients = E2EMails.getAllRecipients(); + let recipients = await E2EMails.getAllRecipients(); expect(recipients).to.have.length(2); - expect(recipients).to.include.members([E2EGlobal.SETTINGS.e2eTestEmails[0], E2EGlobal.SETTINGS.e2eTestEmails[1]]); + await expect(recipients).to.include.members([E2EGlobal.SETTINGS.e2eTestEmails[0], E2EGlobal.SETTINGS.e2eTestEmails[1]]); }); it('ensures that the agenda will be sent to the *normal* participants even if there are additional participants ' + 'with no valid email addresses', function() { let additionalUser = "Max Mustermann"; - browser.setValue('#edtParticipantsAdditional', additionalUser); + await browser.setValue('#edtParticipantsAdditional', additionalUser); - browser.waitForVisible('#btn_sendAgenda'); - E2EGlobal.clickWithRetry('#btn_sendAgenda'); - E2EMinutes.confirmQualityAssuranceDialog(); + await browser.waitForVisible('#btn_sendAgenda'); + await E2EGlobal.clickWithRetry('#btn_sendAgenda'); + await E2EMinutes.confirmQualityAssuranceDialog(); - E2EGlobal.waitSomeTime(3000); + await E2EGlobal.waitSomeTime(3000); - let sentMails = E2EMails.getAllSentMails(); + let sentMails = await E2EMails.getAllSentMails(); expect(sentMails, 'one mail should be sent').to.have.length(1); }); diff --git a/tests/end2end/StickyInfoItems-test.js b/tests/end2end/StickyInfoItems-test.js index c8fcb202d..5c6bdec6d 100644 --- a/tests/end2end/StickyInfoItems-test.js +++ b/tests/end2end/StickyInfoItems-test.js @@ -19,111 +19,111 @@ describe('Sticky Info Items', function () { let aAICounter = 0; let aAINameBase = "Info Item Name #"; - let getNewMeetingName = () => { + let getNewMeetingName = async () => { aMeetingCounter++; return aMeetingNameBase + aMeetingCounter; }; - let getNewTopicName = () => { + let getNewTopicName = async () => { aTopicCounter++; return aTopicNameBase + aTopicCounter; }; - let getNewInfoItemName = () => { + let getNewInfoItemName = async () => { aAICounter++; aInfoItemName = aAINameBase + aAICounter; return aInfoItemName; }; before("reload page and reset app", function () { - E2EGlobal.logTimestamp("Start test suite"); - E2EApp.resetMyApp(true); - E2EApp.launchApp(); + await E2EGlobal.logTimestamp("Start test suite"); + await E2EApp.resetMyApp(true); + await E2EApp.launchApp(); }); beforeEach("make sure test user is logged in, create series and add minutes", function () { - E2EApp.gotoStartPage(); - expect (E2EApp.isLoggedIn()).to.be.true; + await E2EApp.gotoStartPage(); + expect (await E2EApp.isLoggedIn()).to.be.true; - aMeetingName = getNewMeetingName(); + aMeetingName = await getNewMeetingName(); - E2EMeetingSeries.createMeetingSeries(aProjectName, aMeetingName); - E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName); + await E2EMeetingSeries.createMeetingSeries(aProjectName, aMeetingName); + await E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName); - aTopicName = getNewTopicName(); - E2ETopics.addTopicToMinutes(aTopicName); + aTopicName = await getNewTopicName(); + await E2ETopics.addTopicToMinutes(aTopicName); - E2ETopics.addInfoItemToTopic({ - subject: getNewInfoItemName(), + await E2ETopics.addInfoItemToTopic({ + subject: await getNewInfoItemName(), infoItemType: "infoItem" }, 1); }); it('is possible to toggle the sticky-state of info items', function () { - E2ETopics.toggleInfoItemStickyState(1, 1); - expect(E2ETopics.isInfoItemSticky(1, 1)).to.be.true; + await E2ETopics.toggleInfoItemStickyState(1, 1); + expect(await E2ETopics.isInfoItemSticky(1, 1)).to.be.true; }); it('ensures that sticky-info-items will be presented in the next minute again', function () { - E2ETopics.toggleInfoItemStickyState(1, 1); + await E2ETopics.toggleInfoItemStickyState(1, 1); - E2EMinutes.finalizeCurrentMinutes(); - E2EMinutes.gotoParentMeetingSeries(); + await E2EMinutes.finalizeCurrentMinutes(); + await E2EMinutes.gotoParentMeetingSeries(); // add a second minute - E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName); + await E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName); - expect(E2ETopics.countItemsForTopic(1), "The topic should have one item").to.equal(1); - let itemsOfNewTopic = E2ETopics.getItemsForTopic(1); + await expect(await E2ETopics.countItemsForTopic(1), "The topic should have one item").to.equal(1); + let itemsOfNewTopic = await E2ETopics.getItemsForTopic(1); let stickyInfoItem = itemsOfNewTopic[0].ELEMENT; - expect(browser.elementIdText(stickyInfoItem).value, "the sticky info item should be displayed") + await expect((await browser.elementIdText(stickyInfoItem)).value, "the sticky info item should be displayed") .to.have.string(aInfoItemName); - expect(E2ETopics.isInfoItemSticky(1, 1)).to.be.true; + expect(await E2ETopics.isInfoItemSticky(1, 1)).to.be.true; }); it('closes a discussed topic which has a sticky-info-item but no open AIs and does not present the topic in the next minute again', function () { - E2ETopics.toggleInfoItemStickyState(1, 1); - E2ETopics.toggleTopic(1); + await E2ETopics.toggleInfoItemStickyState(1, 1); + await E2ETopics.toggleTopic(1); - E2EMinutes.finalizeCurrentMinutes(); - E2EMinutes.gotoParentMeetingSeries(); + await E2EMinutes.finalizeCurrentMinutes(); + await E2EMinutes.gotoParentMeetingSeries(); // add a second minute - E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName); + await E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName); - expect(E2ETopics.countTopicsForMinute(), "the new minute should have no topics").to.equal(0); + await expect(await E2ETopics.countTopicsForMinute(), "the new minute should have no topics").to.equal(0); }); it('ensures that the sticky-status of an info item in a finalized minute can not be modified', function () { - E2EMinutes.finalizeCurrentMinutes(); + await E2EMinutes.finalizeCurrentMinutes(); - E2ETopics.toggleInfoItemStickyState(1, 1); - expect(E2ETopics.isInfoItemSticky(1, 1), "non-sticky item should not have changed state").to.be.false; + await E2ETopics.toggleInfoItemStickyState(1, 1); + expect(await E2ETopics.isInfoItemSticky(1, 1), "non-sticky item should not have changed state").to.be.false; - E2EMinutes.unfinalizeCurrentMinutes(); - E2ETopics.toggleInfoItemStickyState(1, 1); - E2EMinutes.finalizeCurrentMinutes(); + await E2EMinutes.unfinalizeCurrentMinutes(); + await E2ETopics.toggleInfoItemStickyState(1, 1); + await E2EMinutes.finalizeCurrentMinutes(); - expect(E2ETopics.isInfoItemSticky(1, 1), "sticky item should have changed state").to.be.true; + expect(await E2ETopics.isInfoItemSticky(1, 1), "sticky item should have changed state").to.be.true; }); it('can not change the sticky status of info-items on the topics page of the meeting series', function () { - E2ETopics.addInfoItemToTopic({ - subject: getNewInfoItemName(), + await E2ETopics.addInfoItemToTopic({ + subject: await getNewInfoItemName(), infoItemType: "infoItem" }, 1); - E2ETopics.toggleInfoItemStickyState(1, 1); + await E2ETopics.toggleInfoItemStickyState(1, 1); - E2EMinutes.finalizeCurrentMinutes(); + await E2EMinutes.finalizeCurrentMinutes(); - E2EMinutes.gotoParentMeetingSeries(); - E2EMeetingSeries.gotoTabTopics(); + await E2EMinutes.gotoParentMeetingSeries(); + await E2EMeetingSeries.gotoTabTopics(); - E2ETopics.toggleInfoItemStickyState(1, 1); - expect(E2ETopics.isInfoItemSticky(1, 1), "sticky item should not have changed state").to.be.true; + await E2ETopics.toggleInfoItemStickyState(1, 1); + expect(await E2ETopics.isInfoItemSticky(1, 1), "sticky item should not have changed state").to.be.true; - E2ETopics.toggleInfoItemStickyState(1, 2); - expect(E2ETopics.isInfoItemSticky(1, 2), "non-sticky item should not have changed state").to.be.false; + await E2ETopics.toggleInfoItemStickyState(1, 2); + expect(await E2ETopics.isInfoItemSticky(1, 2), "non-sticky item should not have changed state").to.be.false; }); it('ensures that changing the subject of a sticky-info-item also updates the related item located ' + @@ -131,24 +131,24 @@ describe('Sticky Info Items', function () { const newInfoItemName = "updated info item subject"; - E2ETopics.toggleInfoItemStickyState(1, 1); - E2EMinutes.finalizeCurrentMinutes(); - E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName); + await E2ETopics.toggleInfoItemStickyState(1, 1); + await E2EMinutes.finalizeCurrentMinutes(); + await E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName); - E2ETopics.editInfoItemForTopic(1, 1, {subject: newInfoItemName}); - E2EMinutes.finalizeCurrentMinutes(); + await E2ETopics.editInfoItemForTopic(1, 1, {subject: newInfoItemName}); + await E2EMinutes.finalizeCurrentMinutes(); - E2EMinutes.gotoParentMeetingSeries(); - E2EMeetingSeries.gotoTabTopics(); + await E2EMinutes.gotoParentMeetingSeries(); + await E2EMeetingSeries.gotoTabTopics(); - expect(E2ETopics.countItemsForTopic(1), "topic should have one item").to.equal(1); + await expect(await E2ETopics.countItemsForTopic(1), "topic should have one item").to.equal(1); - let itemsOfNewTopic = E2ETopics.getItemsForTopic(1); + let itemsOfNewTopic = await E2ETopics.getItemsForTopic(1); let stickyInfoItem = itemsOfNewTopic[0].ELEMENT; - expect(browser.elementIdText(stickyInfoItem).value, "the subject of the sticky info item should have changed") + await expect((await browser.elementIdText(stickyInfoItem)).value, "the subject of the sticky info item should have changed") .to.have.string(newInfoItemName); - expect(E2ETopics.isInfoItemSticky(1, 1), "the info item should be still sticky").to.be.true; + expect(await E2ETopics.isInfoItemSticky(1, 1), "the info item should be still sticky").to.be.true; }); }); \ No newline at end of file diff --git a/tests/end2end/TemplateRendererIntegration-test.js b/tests/end2end/TemplateRendererIntegration-test.js index e6f42026d..81bcde3d3 100644 --- a/tests/end2end/TemplateRendererIntegration-test.js +++ b/tests/end2end/TemplateRendererIntegration-test.js @@ -4,38 +4,38 @@ import {E2EGlobal} from "./helpers/E2EGlobal"; describe('TemplateRendererIntegration', function () { before("reload page and reset app", function () { - E2EGlobal.logTimestamp("Start test suite"); - E2EApp.resetMyApp(true); - E2EApp.launchApp(); + await E2EGlobal.logTimestamp("Start test suite"); + await E2EApp.resetMyApp(true); + await E2EApp.launchApp(); }); it('renders template with data correctlys', function () { const template = 'Hello {{name}}, time: {{time}}'; const name = '4minitz'; - const response = server.call('e2e-render-template', template, {name: name}); + const response = await server.call('e2e-render-template', template, {name: name}); const expected = 'Hello ' + name + ', time: ' + response.date; - expect(response.result).to.equal(expected); + await expect(response.result).to.equal(expected); }); it('uses the style template helper to include stylesheet files', function() { const template = '{{style style.css}}'; - const response = server.call('e2e-render-template', template, {}); + const response = await server.call('e2e-render-template', template, {}); const expected = ``; - expect(response.result).to.equal(expected); + await expect(response.result).to.equal(expected); }); it('uses the markdown helper correctly', function () { const template = 'Hello {{markdown2html name}}'; let expected = 'Hello Peter
\n'; - const response = server.call('e2e-render-template', template, {name: '**Peter**'}); - expect(response.result).to.equal(expected); + const response = await server.call('e2e-render-template', template, {name: '**Peter**'}); + await expect(response.result).to.equal(expected); }); it('uses the doctype helper correctly', function () { const template = '{{doctype}}'; let expected = ''; - const response = server.call('e2e-render-template', template, {}); - expect(response.result).to.equal(expected); + const response = await server.call('e2e-render-template', template, {}); + await expect(response.result).to.equal(expected); }); }); diff --git a/tests/end2end/Topics-test.js b/tests/end2end/Topics-test.js index 4425448a9..c06ae1a34 100644 --- a/tests/end2end/Topics-test.js +++ b/tests/end2end/Topics-test.js @@ -12,384 +12,384 @@ describe('Topics', function () { let aMeetingName; before("reload page and reset app", function () { - E2EGlobal.logTimestamp("Start test suite"); - E2EApp.resetMyApp(true); - E2EApp.launchApp(); + await E2EGlobal.logTimestamp("Start test suite"); + await E2EApp.resetMyApp(true); + await E2EApp.launchApp(); }); beforeEach("goto start page and make sure test user is logged in", function () { - E2EApp.gotoStartPage(); - expect (E2EApp.isLoggedIn()).to.be.true; + await E2EApp.gotoStartPage(); + expect (await E2EApp.isLoggedIn()).to.be.true; aMeetingCounter++; aMeetingName = aMeetingNameBase + aMeetingCounter; - E2EMeetingSeries.createMeetingSeries(aProjectName, aMeetingName); - E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName); + await E2EMeetingSeries.createMeetingSeries(aProjectName, aMeetingName); + await E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName); }); it('can add a topic to minutes', function () { - E2ETopics.addTopicToMinutes('some topic'); - expect(E2ETopics.countTopicsForMinute()).to.equal(1); + await E2ETopics.addTopicToMinutes('some topic'); + await expect(await E2ETopics.countTopicsForMinute()).to.equal(1); }); it('can add a topic to minutes at the end of topics list', function() { const testTopicName = 'some topic at the end'; - E2ETopics.addTopicToMinutes('some topic'); - E2ETopics.addTopicToMinutesAtEnd(testTopicName); - expect(E2ETopics.countTopicsForMinute()).to.equal(2); - expect(E2ETopics.getLastTopicForMinute() === testTopicName); + await E2ETopics.addTopicToMinutes('some topic'); + await E2ETopics.addTopicToMinutesAtEnd(testTopicName); + await expect(await E2ETopics.countTopicsForMinute()).to.equal(2); + expect((await E2ETopics.getLastTopicForMinute()) === testTopicName); }); it('can submit a new topic by pressing enter on the topic title input', function () { - browser.waitForVisible("#id_showAddTopicDialog"); - E2EGlobal.clickWithRetry("#id_showAddTopicDialog"); + await browser.waitForVisible("#id_showAddTopicDialog"); + await E2EGlobal.clickWithRetry("#id_showAddTopicDialog"); - E2ETopics.insertTopicDataIntoDialog("some topic"); + await E2ETopics.insertTopicDataIntoDialog("some topic"); - const subjectInput = browser.$('#id_subject'); - subjectInput.keys('Enter'); + const subjectInput = await browser.$('#id_subject'); + await subjectInput.keys('Enter'); - E2EGlobal.waitSomeTime(700); + await E2EGlobal.waitSomeTime(700); - expect(E2ETopics.countTopicsForMinute()).to.equal(1); + await expect(await E2ETopics.countTopicsForMinute()).to.equal(1); }); it('can add multiple topics', function () { - E2ETopics.addTopicToMinutes('some topic'); - E2ETopics.addTopicToMinutes('some other topic'); - E2ETopics.addTopicToMinutes('yet another topic'); - expect(E2ETopics.countTopicsForMinute()).to.equal(3); + await E2ETopics.addTopicToMinutes('some topic'); + await E2ETopics.addTopicToMinutes('some other topic'); + await E2ETopics.addTopicToMinutes('yet another topic'); + await expect(await E2ETopics.countTopicsForMinute()).to.equal(3); }); it('shows security question before deleting a topic', function() { - E2ETopics.addTopicToMinutes('some topic'); - E2ETopics.deleteTopic(1); + await E2ETopics.addTopicToMinutes('some topic'); + await E2ETopics.deleteTopic(1); let selectorDialog = "#confirmDialog"; - E2EGlobal.waitSomeTime(750); // give dialog animation time - expect(browser.isVisible(selectorDialog), "Dialog should be visible").to.be.true; + await E2EGlobal.waitSomeTime(750); // give dialog animation time + expect(await browser.isVisible(selectorDialog), "Dialog should be visible").to.be.true; - let dialogContentElement = browser.element(selectorDialog + " .modal-body").value.ELEMENT; - let dialogContentText = browser.elementIdText(dialogContentElement).value; + let dialogContentElement = (await browser.element(selectorDialog + " .modal-body")).value.ELEMENT; + let dialogContentText = (await browser.elementIdText(dialogContentElement)).value; - expect(dialogContentText, 'dialog content should display the title of the to-be-deleted object').to.have.string('some topic'); + await expect(dialogContentText, 'dialog content should display the title of the to-be-deleted object').to.have.string('some topic'); // close dialog otherwise beforeEach-hook will fail! - E2EApp.confirmationDialogAnswer(false); + await E2EApp.confirmationDialogAnswer(false); }); it('can delete a topic', function () { - E2ETopics.addTopicToMinutes('some topic'); - E2ETopics.addTopicToMinutes('yet another topic'); - expect(E2ETopics.countTopicsForMinute()).to.equal(2); - E2ETopics.deleteTopic(1, true); - expect(E2ETopics.countTopicsForMinute()).to.equal(1); + await E2ETopics.addTopicToMinutes('some topic'); + await E2ETopics.addTopicToMinutes('yet another topic'); + await expect(await E2ETopics.countTopicsForMinute()).to.equal(2); + await E2ETopics.deleteTopic(1, true); + await expect(await E2ETopics.countTopicsForMinute()).to.equal(1); }); it('can cancel a "delete topic"', function () { - E2ETopics.addTopicToMinutes('some topic'); - E2ETopics.addTopicToMinutes('yet another topic'); - expect(E2ETopics.countTopicsForMinute()).to.equal(2); - E2ETopics.deleteTopic(1, false); - expect(E2ETopics.countTopicsForMinute()).to.equal(2); + await E2ETopics.addTopicToMinutes('some topic'); + await E2ETopics.addTopicToMinutes('yet another topic'); + await expect(await E2ETopics.countTopicsForMinute()).to.equal(2); + await E2ETopics.deleteTopic(1, false); + await expect(await E2ETopics.countTopicsForMinute()).to.equal(2); }); it('multiple topics are added with latest topic at the top', function () { - E2ETopics.addTopicToMinutes('some topic'); - E2ETopics.addTopicToMinutes('some other topic'); - E2ETopics.addTopicToMinutes('yet another topic'); + await E2ETopics.addTopicToMinutes('some topic'); + await E2ETopics.addTopicToMinutes('some other topic'); + await E2ETopics.addTopicToMinutes('yet another topic'); - const topics = E2ETopics.getTopicsForMinute(); + const topics = await E2ETopics.getTopicsForMinute(); let elementId = topics[0].ELEMENT; - let visibleText = browser.elementIdText(elementId).value; + let visibleText = (await browser.elementIdText(elementId)).value; - expect(visibleText).to.have.string('yet another topic'); + await expect(visibleText).to.have.string('yet another topic'); }); - it.skip('can not change the order of topics via drag and drop by clicking anywhere', function () { - E2ETopics.addTopicToMinutes('some topic'); - E2ETopics.addTopicToMinutes('some other topic'); - E2ETopics.addTopicToMinutes('yet another topic'); + await it.skip('can not change the order of topics via drag and drop by clicking anywhere', function () { + await E2ETopics.addTopicToMinutes('some topic'); + await E2ETopics.addTopicToMinutes('some other topic'); + await E2ETopics.addTopicToMinutes('yet another topic'); - browser.dragAndDrop('#topicPanel .well:nth-child(3)', '#topicPanel .well:nth-child(1)'); + await browser.dragAndDrop('#topicPanel .well:nth-child(3)', '#topicPanel .well:nth-child(1)'); - const topics = E2ETopics.getTopicsForMinute(); + const topics = await E2ETopics.getTopicsForMinute(); let elementId = topics[0].ELEMENT; - let visibleText = browser.elementIdText(elementId).value; + let visibleText = (await browser.elementIdText(elementId)).value; - expect(visibleText).to.have.string('yet another topic'); + await expect(visibleText).to.have.string('yet another topic'); }); - it.skip('can change the order of topics via drag and drop by clicking on the sort icon', function () { - E2ETopics.addTopicToMinutes('some topic'); - E2ETopics.addTopicToMinutes('some other topic'); - E2ETopics.addTopicToMinutes('yet another topic'); + await it.skip('can change the order of topics via drag and drop by clicking on the sort icon', function () { + await E2ETopics.addTopicToMinutes('some topic'); + await E2ETopics.addTopicToMinutes('some other topic'); + await E2ETopics.addTopicToMinutes('yet another topic'); - browser.waitForExist('#topicPanel .well:nth-child(3) .topicDragDropHandle'); - browser.moveToObject('#topicPanel .well:nth-child(3) .topicDragDropHandle'); - browser.buttonDown(); - browser.moveTo(1, 1); - browser.moveToObject('#topicPanel .well:nth-child(1)'); - browser.buttonUp(); + await browser.waitForExist('#topicPanel .well:nth-child(3) .topicDragDropHandle'); + await browser.moveToObject('#topicPanel .well:nth-child(3) .topicDragDropHandle'); + await browser.buttonDown(); + await browser.moveTo(1, 1); + await browser.moveToObject('#topicPanel .well:nth-child(1)'); + await browser.buttonUp(); - const topics = E2ETopics.getTopicsForMinute(); + const topics = await E2ETopics.getTopicsForMinute(); let elementId = topics[0].ELEMENT; - let visibleText = browser.elementIdText(elementId).value; + let visibleText = (await browser.elementIdText(elementId)).value; - expect(visibleText).to.have.string('some topic'); + await expect(visibleText).to.have.string('some topic'); }); - it.skip('can not change the order of topics on the topics page', function () { - E2ETopics.addTopicToMinutes('some topic'); - E2ETopics.addTopicToMinutes('some other topic'); - E2ETopics.addTopicToMinutes('yet another topic'); + await it.skip('can not change the order of topics on the topics page', function () { + await E2ETopics.addTopicToMinutes('some topic'); + await E2ETopics.addTopicToMinutes('some other topic'); + await E2ETopics.addTopicToMinutes('yet another topic'); - E2EMinutes.finalizeCurrentMinutes(); - E2EMeetingSeries.gotoMeetingSeries(aProjectName, aMeetingName); + await E2EMinutes.finalizeCurrentMinutes(); + await E2EMeetingSeries.gotoMeetingSeries(aProjectName, aMeetingName); - E2EGlobal.clickWithRetry('#tab_topics'); - E2EGlobal.waitSomeTime(); + await E2EGlobal.clickWithRetry('#tab_topics'); + await E2EGlobal.waitSomeTime(); - const topicsBeforeSortAttempt = E2ETopics.getTopicsForMinute(); + const topicsBeforeSortAttempt = await E2ETopics.getTopicsForMinute(); let firstElementBeforeSortAttempt = topicsBeforeSortAttempt[0].ELEMENT; - let visibleTextBeforeSortAttempt = browser.elementIdText(firstElementBeforeSortAttempt).value; - expect(visibleTextBeforeSortAttempt).to.have.string('yet another topic'); + let visibleTextBeforeSortAttempt = (await browser.elementIdText(firstElementBeforeSortAttempt)).value; + await expect(visibleTextBeforeSortAttempt).to.have.string('yet another topic'); - browser.dragAndDrop('#topicPanel .well:nth-child(3)', '#topicPanel .well:nth-child(1)'); + await browser.dragAndDrop('#topicPanel .well:nth-child(3)', '#topicPanel .well:nth-child(1)'); - const topicsAfterSortAttempt = E2ETopics.getTopicsForMinute(); + const topicsAfterSortAttempt = await E2ETopics.getTopicsForMinute(); let firstElementAfterSortAttempt = topicsAfterSortAttempt[0].ELEMENT; - let visibleTextAfterSortAttempt = browser.elementIdText(firstElementAfterSortAttempt).value; - expect(visibleTextAfterSortAttempt).to.have.string('yet another topic'); + let visibleTextAfterSortAttempt = (await browser.elementIdText(firstElementAfterSortAttempt)).value; + await expect(visibleTextAfterSortAttempt).to.have.string('yet another topic'); }); - it.skip('can not change the order of topics of finalized minutes', function () { - E2ETopics.addTopicToMinutes('some topic'); - E2ETopics.addTopicToMinutes('some other topic'); - E2ETopics.addTopicToMinutes('yet another topic'); + await it.skip('can not change the order of topics of finalized minutes', function () { + await E2ETopics.addTopicToMinutes('some topic'); + await E2ETopics.addTopicToMinutes('some other topic'); + await E2ETopics.addTopicToMinutes('yet another topic'); - E2EMinutes.finalizeCurrentMinutes(); + await E2EMinutes.finalizeCurrentMinutes(); - const topicsBeforeSortAttempt = E2ETopics.getTopicsForMinute(); + const topicsBeforeSortAttempt = await E2ETopics.getTopicsForMinute(); let firstElementBeforeSortAttempt = topicsBeforeSortAttempt[0].ELEMENT; - let visibleTextBeforeSortAttempt = browser.elementIdText(firstElementBeforeSortAttempt).value; - expect(visibleTextBeforeSortAttempt).to.have.string('yet another topic'); + let visibleTextBeforeSortAttempt = (await browser.elementIdText(firstElementBeforeSortAttempt)).value; + await expect(visibleTextBeforeSortAttempt).to.have.string('yet another topic'); - browser.dragAndDrop('#topicPanel .well:nth-child(3)', '#topicPanel .well:nth-child(1)'); + await browser.dragAndDrop('#topicPanel .well:nth-child(3)', '#topicPanel .well:nth-child(1)'); - const topicsAfterSortAttempt = E2ETopics.getTopicsForMinute(); + const topicsAfterSortAttempt = await E2ETopics.getTopicsForMinute(); let firstElementAfterSortAttempt = topicsAfterSortAttempt[0].ELEMENT; - let visibleTextAfterSortAttempt = browser.elementIdText(firstElementAfterSortAttempt).value; - expect(visibleTextAfterSortAttempt).to.have.string('yet another topic'); + let visibleTextAfterSortAttempt = (await browser.elementIdText(firstElementAfterSortAttempt)).value; + await expect(visibleTextAfterSortAttempt).to.have.string('yet another topic'); }); - it.skip('ensures invited user can not drag-n-drop topics', function () { - E2ETopics.addTopicToMinutes('some topic'); - E2ETopics.addTopicToMinutes('some other topic'); - E2ETopics.addTopicToMinutes('yet another topic'); + await it.skip('ensures invited user can not drag-n-drop topics', function () { + await E2ETopics.addTopicToMinutes('some topic'); + await E2ETopics.addTopicToMinutes('some other topic'); + await E2ETopics.addTopicToMinutes('yet another topic'); - E2EMeetingSeries.gotoMeetingSeries(aProjectName, aMeetingName); - E2EMeetingSeriesEditor.openMeetingSeriesEditor(aProjectName, aMeetingName, "invited"); + await E2EMeetingSeries.gotoMeetingSeries(aProjectName, aMeetingName); + await E2EMeetingSeriesEditor.openMeetingSeriesEditor(aProjectName, aMeetingName, "invited"); - let currentUser = E2EApp.getCurrentUser(); + let currentUser = await E2EApp.getCurrentUser(); let user2 = E2EGlobal.SETTINGS.e2eTestUsers[1]; - browser.setValue('#edt_AddUser', user2); - browser.keys(['Enter']); + await browser.setValue('#edt_AddUser', user2); + await browser.keys(['Enter']); let selector = "select.user-role-select"; - let usrRoleOption = browser.selectByValue(selector, "Invited"); - E2EMeetingSeriesEditor.closeMeetingSeriesEditor(); // close with save + let usrRoleOption = await browser.selectByValue(selector, "Invited"); + await E2EMeetingSeriesEditor.closeMeetingSeriesEditor(); // close with save - E2EApp.loginUser(1); - E2EMeetingSeries.gotoMeetingSeries(aProjectName, aMeetingName); - E2EGlobal.waitSomeTime(); + await E2EApp.loginUser(1); + await E2EMeetingSeries.gotoMeetingSeries(aProjectName, aMeetingName); + await E2EGlobal.waitSomeTime(); - E2EMinutes.gotoLatestMinutes(); - const topicsBeforeSortAttempt = E2ETopics.getTopicsForMinute(); + await E2EMinutes.gotoLatestMinutes(); + const topicsBeforeSortAttempt = await E2ETopics.getTopicsForMinute(); let firstElementBeforeSortAttempt = topicsBeforeSortAttempt[0].ELEMENT; - let visibleTextBeforeSortAttempt = browser.elementIdText(firstElementBeforeSortAttempt).value; - expect(visibleTextBeforeSortAttempt).to.have.string('yet another topic'); + let visibleTextBeforeSortAttempt = (await browser.elementIdText(firstElementBeforeSortAttempt)).value; + await expect(visibleTextBeforeSortAttempt).to.have.string('yet another topic'); - expect(browser.isExisting('#topicPanel .well:nth-child(3) .topicDragDropHandle')).to.be.false; + expect(await browser.isExisting('#topicPanel .well:nth-child(3) .topicDragDropHandle')).to.be.false; - E2EApp.loginUser(); + await E2EApp.loginUser(); }); - it.skip('sorting of topics is persistent', function () { - E2ETopics.addTopicToMinutes('some topic'); - E2ETopics.addTopicToMinutes('some other topic'); - E2ETopics.addTopicToMinutes('yet another topic'); + await it.skip('sorting of topics is persistent', function () { + await E2ETopics.addTopicToMinutes('some topic'); + await E2ETopics.addTopicToMinutes('some other topic'); + await E2ETopics.addTopicToMinutes('yet another topic'); - browser.waitForExist('#topicPanel .well:nth-child(3) .topicDragDropHandle'); - browser.moveToObject('#topicPanel .well:nth-child(3) .topicDragDropHandle'); - browser.buttonDown(); - browser.moveTo(1, 1); - browser.moveToObject('#topicPanel .well:nth-child(1)'); - browser.buttonUp(); + await browser.waitForExist('#topicPanel .well:nth-child(3) .topicDragDropHandle'); + await browser.moveToObject('#topicPanel .well:nth-child(3) .topicDragDropHandle'); + await browser.buttonDown(); + await browser.moveTo(1, 1); + await browser.moveToObject('#topicPanel .well:nth-child(1)'); + await browser.buttonUp(); - const topicsBeforeReload = E2ETopics.getTopicsForMinute(); + const topicsBeforeReload = await E2ETopics.getTopicsForMinute(); let firstElementBeforeReload = topicsBeforeReload[0].ELEMENT; - let visibleTextBeforeReload = browser.elementIdText(firstElementBeforeReload).value; - expect(visibleTextBeforeReload).to.have.string('some topic'); + let visibleTextBeforeReload = (await browser.elementIdText(firstElementBeforeReload)).value; + await expect(visibleTextBeforeReload).to.have.string('some topic'); - browser.refresh(); - E2EGlobal.waitSomeTime(2500); // phantom.js needs some time here... + await browser.refresh(); + await E2EGlobal.waitSomeTime(2500); // phantom.js needs some time here... - const topicsAfterReload = E2ETopics.getTopicsForMinute(); + const topicsAfterReload = await E2ETopics.getTopicsForMinute(); let firstElementAfterReload = topicsAfterReload[0].ELEMENT; - let visibleTextAfterReload = browser.elementIdText(firstElementAfterReload).value; - expect(visibleTextAfterReload).to.have.string('some topic'); + let visibleTextAfterReload = (await browser.elementIdText(firstElementAfterReload)).value; + await expect(visibleTextAfterReload).to.have.string('some topic'); }); it('can collapse a topic', function () { - E2ETopics.addTopicToMinutes('topic 1'); - E2ETopics.addInfoItemToTopic({subject: "InfoItem#1",itemType: "infoItem"}, 1); - E2ETopics.addTopicToMinutes('topic 2'); - E2ETopics.addInfoItemToTopic({subject: "InfoItem#2",itemType: "infoItem"}, 1); + await E2ETopics.addTopicToMinutes('topic 1'); + await E2ETopics.addInfoItemToTopic({subject: "InfoItem#1",itemType: "infoItem"}, 1); + await E2ETopics.addTopicToMinutes('topic 2'); + await E2ETopics.addInfoItemToTopic({subject: "InfoItem#2",itemType: "infoItem"}, 1); - let infoitems = browser.elements(".infoitem").value; - expect(infoitems.length).to.be.equal(2); + let infoitems = (await browser.elements(".infoitem")).value; + await expect(infoitems.length).to.be.equal(2); // collapse top-most topic - E2EGlobal.clickWithRetry('#topicPanel .well:nth-child(1) #btnTopicExpandCollapse'); - infoitems = browser.elements(".infoitem").value; - expect(infoitems.length).to.be.equal(1); + await E2EGlobal.clickWithRetry('#topicPanel .well:nth-child(1) #btnTopicExpandCollapse'); + infoitems = (await browser.elements(".infoitem")).value; + await expect(infoitems.length).to.be.equal(1); let firstVisibleInfoitemId = infoitems[0].ELEMENT; - let firstVisibleInfoItemText = browser.elementIdText(firstVisibleInfoitemId).value; - expect(firstVisibleInfoItemText).to.have.string("InfoItem#1"); + let firstVisibleInfoItemText = (await browser.elementIdText(firstVisibleInfoitemId)).value; + await expect(firstVisibleInfoItemText).to.have.string("InfoItem#1"); }); it('can collapse and re-expand a topic', function () { - E2ETopics.addTopicToMinutes('topic 1'); - E2ETopics.addInfoItemToTopic({subject: "InfoItem#1",itemType: "infoItem"}, 1); - E2ETopics.addTopicToMinutes('topic 2'); - E2ETopics.addInfoItemToTopic({subject: "InfoItem#2",itemType: "infoItem"}, 1); + await E2ETopics.addTopicToMinutes('topic 1'); + await E2ETopics.addInfoItemToTopic({subject: "InfoItem#1",itemType: "infoItem"}, 1); + await E2ETopics.addTopicToMinutes('topic 2'); + await E2ETopics.addInfoItemToTopic({subject: "InfoItem#2",itemType: "infoItem"}, 1); // collapse & re-expand top-most topic - E2EGlobal.clickWithRetry('#topicPanel .well:nth-child(1) #btnTopicExpandCollapse'); - E2EGlobal.clickWithRetry('#topicPanel .well:nth-child(1) #btnTopicExpandCollapse'); - let infoitems = browser.elements(".infoitem").value; - expect(infoitems.length).to.be.equal(2); + await E2EGlobal.clickWithRetry('#topicPanel .well:nth-child(1) #btnTopicExpandCollapse'); + await E2EGlobal.clickWithRetry('#topicPanel .well:nth-child(1) #btnTopicExpandCollapse'); + let infoitems = (await browser.elements(".infoitem")).value; + await expect(infoitems.length).to.be.equal(2); }); it('can collapse all topics', function () { - E2ETopics.addTopicToMinutes('topic 1'); - E2ETopics.addInfoItemToTopic({subject: "InfoItem#1",itemType: "infoItem"}, 1); - E2ETopics.addTopicToMinutes('topic 2'); - E2ETopics.addInfoItemToTopic({subject: "InfoItem#2",itemType: "infoItem"}, 1); + await E2ETopics.addTopicToMinutes('topic 1'); + await E2ETopics.addInfoItemToTopic({subject: "InfoItem#1",itemType: "infoItem"}, 1); + await E2ETopics.addTopicToMinutes('topic 2'); + await E2ETopics.addInfoItemToTopic({subject: "InfoItem#2",itemType: "infoItem"}, 1); // collapse & re-expand top-most topic - E2EGlobal.clickWithRetry('#btnCollapseAll'); - let infoitems = browser.elements(".infoitem").value; - expect(infoitems.length).to.be.equal(0); + await E2EGlobal.clickWithRetry('#btnCollapseAll'); + let infoitems = (await browser.elements(".infoitem")).value; + await expect(infoitems.length).to.be.equal(0); }); it('can collapse and re-expand all topics', function () { - E2ETopics.addTopicToMinutes('topic 1'); - E2ETopics.addInfoItemToTopic({subject: "InfoItem#1",itemType: "infoItem"}, 1); - E2ETopics.addTopicToMinutes('topic 2'); - E2ETopics.addInfoItemToTopic({subject: "InfoItem#2",itemType: "infoItem"}, 1); + await E2ETopics.addTopicToMinutes('topic 1'); + await E2ETopics.addInfoItemToTopic({subject: "InfoItem#1",itemType: "infoItem"}, 1); + await E2ETopics.addTopicToMinutes('topic 2'); + await E2ETopics.addInfoItemToTopic({subject: "InfoItem#2",itemType: "infoItem"}, 1); // collapse & re-expand top-most topic - E2EGlobal.clickWithRetry('#btnCollapseAll'); - E2EGlobal.clickWithRetry('#btnExpandAll'); - let infoitems = browser.elements(".infoitem").value; - expect(infoitems.length).to.be.equal(2); + await E2EGlobal.clickWithRetry('#btnCollapseAll'); + await E2EGlobal.clickWithRetry('#btnExpandAll'); + let infoitems = (await browser.elements(".infoitem")).value; + await expect(infoitems.length).to.be.equal(2); }); it('can close topics', function () { - E2ETopics.addTopicToMinutes('topic 1'); - E2ETopics.addInfoItemToTopic({subject: "InfoItem#1",itemType: "infoItem"}, 1); - E2ETopics.addTopicToMinutes('topic 2'); - E2ETopics.addInfoItemToTopic({subject: "InfoItem#2",itemType: "infoItem"}, 1); + await E2ETopics.addTopicToMinutes('topic 1'); + await E2ETopics.addInfoItemToTopic({subject: "InfoItem#1",itemType: "infoItem"}, 1); + await E2ETopics.addTopicToMinutes('topic 2'); + await E2ETopics.addInfoItemToTopic({subject: "InfoItem#2",itemType: "infoItem"}, 1); - E2ETopics.toggleTopic(1); - E2ETopics.toggleTopic(2); + await E2ETopics.toggleTopic(1); + await E2ETopics.toggleTopic(2); - expect(E2ETopics.isTopicClosed(1), "first topic should be closed").to.be.true; - expect(E2ETopics.isTopicClosed(2), "second topic should be closed").to.be.true; + expect(await E2ETopics.isTopicClosed(1), "first topic should be closed").to.be.true; + expect(await E2ETopics.isTopicClosed(2), "second topic should be closed").to.be.true; }); it('is possible to mark topics as recurring persistently', function () { - E2ETopics.addTopicToMinutes('topic 1'); - E2ETopics.addTopicToMinutes('topic 2'); + await E2ETopics.addTopicToMinutes('topic 1'); + await E2ETopics.addTopicToMinutes('topic 2'); - expect(E2ETopics.isTopicRecurring(1), 'topic should not be recurring initially').to.be.false; + expect(await E2ETopics.isTopicRecurring(1), 'topic should not be recurring initially').to.be.false; - E2ETopics.toggleRecurringTopic(1); + await E2ETopics.toggleRecurringTopic(1); - browser.refresh(); - E2EGlobal.waitSomeTime(1500); // phantom.js needs some time here... + await browser.refresh(); + await E2EGlobal.waitSomeTime(1500); // phantom.js needs some time here... - expect(E2ETopics.isTopicRecurring(1), 'topic should be recurring').to.be.true; - expect(E2ETopics.isTopicRecurring(2), 'unchanged topic should not be recurring').to.be.false; + expect(await E2ETopics.isTopicRecurring(1), 'topic should be recurring').to.be.true; + expect(await E2ETopics.isTopicRecurring(2), 'unchanged topic should not be recurring').to.be.false; }); it('ensures that recurring topics will be displayed as recurring even in read-only-mode', function () { - E2ETopics.addTopicToMinutes('topic 1'); - E2ETopics.addTopicToMinutes('topic 2'); + await E2ETopics.addTopicToMinutes('topic 1'); + await E2ETopics.addTopicToMinutes('topic 2'); - E2ETopics.toggleRecurringTopic(1); + await E2ETopics.toggleRecurringTopic(1); - E2EMinutes.finalizeCurrentMinutes(); + await E2EMinutes.finalizeCurrentMinutes(); - expect(E2ETopics.isTopicRecurring(1), 'recurring topic should be displayed as recurring after finalizing the minute').to.be.true; - expect(E2ETopics.isTopicRecurring(2), 'unchanged topic should not be displayed as recurring after finalizing the minute').to.be.false; + expect(await E2ETopics.isTopicRecurring(1), 'recurring topic should be displayed as recurring after finalizing the minute').to.be.true; + expect(await E2ETopics.isTopicRecurring(2), 'unchanged topic should not be displayed as recurring after finalizing the minute').to.be.false; - E2EMinutes.gotoParentMeetingSeries(); - E2EMeetingSeries.gotoTabTopics(); + await E2EMinutes.gotoParentMeetingSeries(); + await E2EMeetingSeries.gotoTabTopics(); - expect(E2ETopics.isTopicRecurring(1), 'recurring topic should be displayed as recurring on topics tab').to.be.true; - expect(E2ETopics.isTopicRecurring(2), 'unchanged topic should not be displayed as recurring on topics tab').to.be.false; + expect(await E2ETopics.isTopicRecurring(1), 'recurring topic should be displayed as recurring on topics tab').to.be.true; + expect(await E2ETopics.isTopicRecurring(2), 'unchanged topic should not be displayed as recurring on topics tab').to.be.false; }); it('ensures that it is not possible to change the recurring flag if topic is presented in read-only-mode', function () { - E2ETopics.addTopicToMinutes('topic 1'); - E2ETopics.addTopicToMinutes('topic 2'); - E2ETopics.toggleRecurringTopic(1); + await E2ETopics.addTopicToMinutes('topic 1'); + await E2ETopics.addTopicToMinutes('topic 2'); + await E2ETopics.toggleRecurringTopic(1); - E2EMinutes.finalizeCurrentMinutes(); + await E2EMinutes.finalizeCurrentMinutes(); - E2ETopics.toggleRecurringTopic(1); - E2ETopics.toggleRecurringTopic(2); + await E2ETopics.toggleRecurringTopic(1); + await E2ETopics.toggleRecurringTopic(2); - expect(E2ETopics.isTopicRecurring(1), 'topic of minute should not be able to set as not-recurring if minute is finalized').to.be.true; - expect(E2ETopics.isTopicRecurring(2), 'topic of minute should not be able to set as recurring if minute is finalized').to.be.false; + expect(await E2ETopics.isTopicRecurring(1), 'topic of minute should not be able to set as not-recurring if minute is finalized').to.be.true; + expect(await E2ETopics.isTopicRecurring(2), 'topic of minute should not be able to set as recurring if minute is finalized').to.be.false; - E2EMinutes.gotoParentMeetingSeries(); - E2EMeetingSeries.gotoTabTopics(); + await E2EMinutes.gotoParentMeetingSeries(); + await E2EMeetingSeries.gotoTabTopics(); - E2ETopics.toggleRecurringTopic(1); - E2ETopics.toggleRecurringTopic(2); + await E2ETopics.toggleRecurringTopic(1); + await E2ETopics.toggleRecurringTopic(2); - expect(E2ETopics.isTopicRecurring(1), 'topic of meeting series should not be able to modify in topics tab').to.be.true; - expect(E2ETopics.isTopicRecurring(2), 'topic of meeting series should not be able to set as recurring in topics tab').to.be.false; + expect(await E2ETopics.isTopicRecurring(1), 'topic of meeting series should not be able to modify in topics tab').to.be.true; + expect(await E2ETopics.isTopicRecurring(2), 'topic of meeting series should not be able to set as recurring in topics tab').to.be.false; }); it('ensures that a closed recurring topic should be presented in the next minute again', function () { const myTopicSubject = 'recurring topic'; - E2ETopics.addTopicToMinutes(myTopicSubject); - E2ETopics.toggleRecurringTopic(1); - E2ETopics.toggleTopic(1); + await E2ETopics.addTopicToMinutes(myTopicSubject); + await E2ETopics.toggleRecurringTopic(1); + await E2ETopics.toggleTopic(1); - E2EMinutes.finalizeCurrentMinutes(); - E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName); + await E2EMinutes.finalizeCurrentMinutes(); + await E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName); - const topicsOfNewMinute = E2ETopics.getTopicsForMinute(); + const topicsOfNewMinute = await E2ETopics.getTopicsForMinute(); let firstElement = topicsOfNewMinute[0].ELEMENT; - let visibleText = browser.elementIdText(firstElement).value; - expect(visibleText).to.have.string(myTopicSubject); + let visibleText = (await browser.elementIdText(firstElement)).value; + await expect(visibleText).to.have.string(myTopicSubject); }); it('ensures that the isRecurring-State of a topic in the meeting series topic list will be overwritten from the ' + @@ -397,26 +397,26 @@ describe('Topics', function () { const myTopicSubject = 'recurring topic'; - E2ETopics.addTopicToMinutes(myTopicSubject); - E2ETopics.toggleRecurringTopic(1); - E2ETopics.toggleTopic(1); + await E2ETopics.addTopicToMinutes(myTopicSubject); + await E2ETopics.toggleRecurringTopic(1); + await E2ETopics.toggleTopic(1); - E2EMinutes.finalizeCurrentMinutes(); - E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName); + await E2EMinutes.finalizeCurrentMinutes(); + await E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName); - E2ETopics.toggleRecurringTopic(1); - E2ETopics.toggleTopic(1); + await E2ETopics.toggleRecurringTopic(1); + await E2ETopics.toggleTopic(1); - E2EMinutes.finalizeCurrentMinutes(); - E2EMinutes.gotoParentMeetingSeries(); - E2EMeetingSeries.gotoTabTopics(); + await E2EMinutes.finalizeCurrentMinutes(); + await E2EMinutes.gotoParentMeetingSeries(); + await E2EMeetingSeries.gotoTabTopics(); - expect(E2ETopics.isTopicRecurring(1)).to.be.false; + expect(await E2ETopics.isTopicRecurring(1)).to.be.false; }); it('should not be possible to insert a new topics to a meeting minutes which has the same id as an existing one ' + '- even not by using the meteor method directly', function() { - const url = browser.getUrl(); + const url = await browser.getUrl(); let parts = url.split('/'); let minutesId = parts[parts.length - 1]; @@ -432,144 +432,144 @@ describe('Topics', function () { }; let aUser = E2EGlobal.SETTINGS.e2eTestUsers[0]; let aPassword = E2EGlobal.SETTINGS.e2eTestPasswords[0]; - server.call('login', {user: {username: aUser}, password: aPassword}); + await server.call('login', {user: {username: aUser}, password: aPassword}); - server.call('minutes.addTopic', minutesId, topic); + await server.call('minutes.addTopic', minutesId, topic); try { - server.call('minutes.addTopic', minutesId, topic); + await server.call('minutes.addTopic', minutesId, topic); } catch(e) { // this is expected } - E2EGlobal.waitSomeTime(); + await E2EGlobal.waitSomeTime(); - expect(E2ETopics.countTopicsForMinute()).to.equal(1); + await expect(await E2ETopics.countTopicsForMinute()).to.equal(1); }); it('check whether labelselectionfield exists', function() { - browser.waitForVisible("#id_showAddTopicDialog"); - E2EGlobal.clickWithRetry("#id_showAddTopicDialog"); - E2EGlobal.waitSomeTime(350); + await browser.waitForVisible("#id_showAddTopicDialog"); + await E2EGlobal.clickWithRetry("#id_showAddTopicDialog"); + await E2EGlobal.waitSomeTime(350); - expect(browser.waitForExist("#id_item_selLabels")).to.be.true; - E2EGlobal.waitSomeTime(350); - E2EGlobal.clickWithRetry("#btnTopicCancel"); + expect(await browser.waitForExist("#id_item_selLabels")).to.be.true; + await E2EGlobal.waitSomeTime(350); + await E2EGlobal.clickWithRetry("#btnTopicCancel"); }); it('add label to topic via selection field', function() { let labelName = 'testLabel'; - E2ETopics.addTopicWithLabelToMinutes('topic', labelName); - E2EGlobal.waitSomeTime(500); + await E2ETopics.addTopicWithLabelToMinutes('topic', labelName); + await E2EGlobal.waitSomeTime(500); - expect(browser.waitForExist(".topic-labels")).to.be.true; - expect(browser.getText(".topic-labels .label")).to.equal(labelName); + expect(await browser.waitForExist(".topic-labels")).to.be.true; + await expect(await browser.getText(".topic-labels .label")).to.equal(labelName); }); it('add label to topic via textbox', function() { let labelName = 'testLabel'; - E2ETopics.addTopicToMinutes('topic #' + labelName); - E2EGlobal.waitSomeTime(500); + await E2ETopics.addTopicToMinutes('topic #' + labelName); + await E2EGlobal.waitSomeTime(500); - expect(browser.waitForExist(".topic-labels")).to.be.true; - expect(browser.getText(".topic-labels .label")).to.equal(labelName); + expect(await browser.waitForExist(".topic-labels")).to.be.true; + await expect(await browser.getText(".topic-labels .label")).to.equal(labelName); }); it('add more (2) labels to topic via textbox', function() { const topicName = 'testTopic' const labelName1 = 'testLabel1'; const labelName2 = 'testLabel2'; - E2ETopics.addTopicToMinutes(topicName + ' #' + labelName1 + ' #' + labelName2); - E2EGlobal.waitSomeTime(500); + await E2ETopics.addTopicToMinutes(topicName + ' #' + labelName1 + ' #' + labelName2); + await E2EGlobal.waitSomeTime(500); - expect(browser.waitForExist(".topic-labels")).to.be.true; - expect(browser.getText(".topic-labels .label:nth-child(1)")).to.equal(labelName1); - expect(browser.getText(".topic-labels .label:nth-child(2)")).to.equal(labelName2); + expect(await browser.waitForExist(".topic-labels")).to.be.true; + await expect(await browser.getText(".topic-labels .label:nth-child(1)")).to.equal(labelName1); + await expect(await browser.getText(".topic-labels .label:nth-child(2)")).to.equal(labelName2); }); it('add label to topic and check if topic is displayed in topic tab of meeting series', function() { let labelName = 'testLabel'; - E2ETopics.addTopicToMinutes('topic #' + labelName); - E2EGlobal.waitSomeTime(500); + await E2ETopics.addTopicToMinutes('topic #' + labelName); + await E2EGlobal.waitSomeTime(500); - E2EMinutes.finalizeCurrentMinutes(); - E2EMinutes.gotoParentMeetingSeries(); - E2EMeetingSeries.gotoTabTopics(); + await E2EMinutes.finalizeCurrentMinutes(); + await E2EMinutes.gotoParentMeetingSeries(); + await E2EMeetingSeries.gotoTabTopics(); - expect(browser.waitForExist(".topic-labels")).to.be.true; - expect(browser.getText(".topic-labels .label")).to.equal(labelName); + expect(await browser.waitForExist(".topic-labels")).to.be.true; + await expect(await browser.getText(".topic-labels .label")).to.equal(labelName); }); it('can add a topic with label to minutes at the end of topics list', function() { const testTopicName = 'some topic at the end'; const labelName = 'testLabel'; - E2ETopics.addTopicToMinutes('some topic on top'); - E2ETopics.addTopicToMinutesAtEnd(testTopicName + " #" + labelName); - E2EGlobal.waitSomeTime(500); + await E2ETopics.addTopicToMinutes('some topic on top'); + await E2ETopics.addTopicToMinutesAtEnd(testTopicName + " #" + labelName); + await E2EGlobal.waitSomeTime(500); - expect(E2ETopics.countTopicsForMinute()).to.equal(2); - expect(E2ETopics.getLastTopicForMinute() === testTopicName); - expect(browser.waitForExist(".topic-labels")).to.be.true; - expect(browser.getText(".topic-labels .label")).to.equal(labelName); + await expect(await E2ETopics.countTopicsForMinute()).to.equal(2); + expect((await E2ETopics.getLastTopicForMinute()) === testTopicName); + expect(await browser.waitForExist(".topic-labels")).to.be.true; + await expect(await browser.getText(".topic-labels .label")).to.equal(labelName); }); it('can add a topic with more (2) labels to minutes at the end of topics list', function() { const testTopicName = 'some topic at the end'; const labelName1 = 'testLabel1'; const labelName2 = 'testLabel2'; - E2ETopics.addTopicToMinutes('some topic on top'); - E2ETopics.addTopicToMinutesAtEnd(testTopicName + " #" + labelName1 + " #" + labelName2); - E2EGlobal.waitSomeTime(500); + await E2ETopics.addTopicToMinutes('some topic on top'); + await E2ETopics.addTopicToMinutesAtEnd(testTopicName + " #" + labelName1 + " #" + labelName2); + await E2EGlobal.waitSomeTime(500); - expect(E2ETopics.countTopicsForMinute()).to.equal(2); - expect(E2ETopics.getLastTopicForMinute() === testTopicName); - expect(browser.waitForExist(".labels")).to.be.true; - expect(browser.getText(".topic-labels .label:nth-child(1)")).to.equal(labelName1); - expect(browser.getText(".topic-labels .label:nth-child(2)")).to.equal(labelName2); + await expect(await E2ETopics.countTopicsForMinute()).to.equal(2); + expect((await E2ETopics.getLastTopicForMinute()) === testTopicName); + expect(await browser.waitForExist(".labels")).to.be.true; + await expect(await browser.getText(".topic-labels .label:nth-child(1)")).to.equal(labelName1); + await expect(await browser.getText(".topic-labels .label:nth-child(2)")).to.equal(labelName2); }); it('can add a topic with responsible to minutes at the end of topics list', function() { const testTopicName = 'some topic at the end'; const responsibleName = 'TestResponsible'; - E2ETopics.addTopicToMinutes('some topic on top'); - E2ETopics.addTopicToMinutesAtEnd(testTopicName + " @" + responsibleName); - E2EGlobal.waitSomeTime(500); + await E2ETopics.addTopicToMinutes('some topic on top'); + await E2ETopics.addTopicToMinutesAtEnd(testTopicName + " @" + responsibleName); + await E2EGlobal.waitSomeTime(500); - let topicHeadingText = browser.element("#topicPanel .well:nth-child(2) h3").getText(); + let topicHeadingText = await (await browser.element("#topicPanel .well:nth-child(2) h3")).getText(); - expect(E2ETopics.countTopicsForMinute()).to.equal(2); - expect(E2ETopics.getLastTopicForMinute() === testTopicName); - expect (topicHeadingText).to.contain(responsibleName); + await expect(await E2ETopics.countTopicsForMinute()).to.equal(2); + expect((await E2ETopics.getLastTopicForMinute()) === testTopicName); + await expect (topicHeadingText).to.contain(responsibleName); }); it('can add a topic with more (2) responsible to minutes at the end of topics list', function() { const testTopicName = 'some topic at the end'; const responsibleName1 = 'TestResponsible1'; const responsibleName2 = 'TestResponsible2'; - E2ETopics.addTopicToMinutes('some topic on top'); - E2ETopics.addTopicToMinutesAtEnd(testTopicName + " @" + responsibleName1 + " @" + responsibleName2); - E2EGlobal.waitSomeTime(500); + await E2ETopics.addTopicToMinutes('some topic on top'); + await E2ETopics.addTopicToMinutesAtEnd(testTopicName + " @" + responsibleName1 + " @" + responsibleName2); + await E2EGlobal.waitSomeTime(500); - let topicHeadingText = browser.element("#topicPanel .well:nth-child(2) h3").getText(); + let topicHeadingText = await (await browser.element("#topicPanel .well:nth-child(2) h3")).getText(); - expect(E2ETopics.countTopicsForMinute()).to.equal(2); - expect(E2ETopics.getLastTopicForMinute() === testTopicName); - expect (topicHeadingText).to.contain(responsibleName1, responsibleName2); + await expect(await E2ETopics.countTopicsForMinute()).to.equal(2); + expect((await E2ETopics.getLastTopicForMinute()) === testTopicName); + await expect (topicHeadingText).to.contain(responsibleName1, responsibleName2); }); it('can add a topic with label and responsible to minutes at the end of topics list', function() { const testTopicName = 'some topic at the end'; const labelName = 'testLabel'; const responsibleName = 'TestResponsible'; - E2ETopics.addTopicToMinutes('some topic on top'); - E2ETopics.addTopicToMinutesAtEnd(testTopicName + " #" + labelName + " @" + responsibleName); - E2EGlobal.waitSomeTime(500); + await E2ETopics.addTopicToMinutes('some topic on top'); + await E2ETopics.addTopicToMinutesAtEnd(testTopicName + " #" + labelName + " @" + responsibleName); + await E2EGlobal.waitSomeTime(500); - let topicHeadingText = browser.element("#topicPanel .well:nth-child(2) h3").getText(); + let topicHeadingText = await (await browser.element("#topicPanel .well:nth-child(2) h3")).getText(); - expect(E2ETopics.countTopicsForMinute()).to.equal(2); - expect(E2ETopics.getLastTopicForMinute() === testTopicName); - expect(browser.waitForExist(".topic-labels")).to.be.true; - expect(browser.getText(".topic-labels .label")).to.equal(labelName); - expect (topicHeadingText).to.contain(responsibleName); + await expect(await E2ETopics.countTopicsForMinute()).to.equal(2); + expect((await E2ETopics.getLastTopicForMinute()) === testTopicName); + expect(await browser.waitForExist(".topic-labels")).to.be.true; + await expect(await browser.getText(".topic-labels .label")).to.equal(labelName); + await expect (topicHeadingText).to.contain(responsibleName); }); }); diff --git a/tests/end2end/TopicsDelete-test.js b/tests/end2end/TopicsDelete-test.js index 29f111553..f86a5ffd5 100644 --- a/tests/end2end/TopicsDelete-test.js +++ b/tests/end2end/TopicsDelete-test.js @@ -15,90 +15,90 @@ describe('Topics Delete - Forbid deleting topics which were not created within t const EXISTING_STICKY_INFO = 'existing sticky info item'; before("reload page and reset app", function () { - E2EGlobal.logTimestamp("Start test suite"); - E2EApp.resetMyApp(true); - E2EApp.launchApp(); + await E2EGlobal.logTimestamp("Start test suite"); + await E2EApp.resetMyApp(true); + await E2EApp.launchApp(); }); beforeEach("goto start page and make sure test user is logged in", function () { - E2EApp.gotoStartPage(); - expect (E2EApp.isLoggedIn()).to.be.true; + await E2EApp.gotoStartPage(); + expect (await E2EApp.isLoggedIn()).to.be.true; aMeetingCounter++; aMeetingName = aMeetingNameBase + aMeetingCounter; - E2EMeetingSeries.createMeetingSeries(aProjectName, aMeetingName); - E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName); - E2ETopics.addTopicToMinutes(EXISTING_TOPIC); - E2ETopics.addInfoItemToTopic({ + await E2EMeetingSeries.createMeetingSeries(aProjectName, aMeetingName); + await E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName); + await E2ETopics.addTopicToMinutes(EXISTING_TOPIC); + await E2ETopics.addInfoItemToTopic({ subject: EXISTING_ACTION, itemType: "actionItem" }, 1); - E2ETopics.addInfoItemToTopic({ + await E2ETopics.addInfoItemToTopic({ subject: EXISTING_STICKY_INFO, itemType: "infoItem" }, 1); - E2ETopics.toggleInfoItemStickyState(1,1); - E2EMinutes.finalizeCurrentMinutes(); + await E2ETopics.toggleInfoItemStickyState(1,1); + await E2EMinutes.finalizeCurrentMinutes(); - E2EMinutes.gotoParentMeetingSeries(); - E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName); + await E2EMinutes.gotoParentMeetingSeries(); + await E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName); }); it('is allowed to delete a topic which was created within the current minutes even if it has open action items', function() { - E2ETopics.addTopicToMinutes('fresh created topic'); - E2ETopics.addInfoItemToTopic({ + await E2ETopics.addTopicToMinutes('fresh created topic'); + await E2ETopics.addInfoItemToTopic({ subject: 'fresh action item', itemType: "actionItem" }, 1); - expect(E2ETopics.countTopicsForMinute()).to.equal(2); - E2ETopics.deleteTopic(1, true); - expect(E2ETopics.countTopicsForMinute()).to.equal(1); + await expect(await E2ETopics.countTopicsForMinute()).to.equal(2); + await E2ETopics.deleteTopic(1, true); + await expect(await E2ETopics.countTopicsForMinute()).to.equal(1); }); it('closes the topic together with its open action items instead of deleting it', function() { - E2ETopics.deleteTopic(1, true); - expect(E2ETopics.countTopicsForMinute()).to.equal(1); - expect(E2ETopics.isTopicClosed(1), "the topic should be closed now").to.be.true; - expect(E2ETopics.isActionItemClosed(1, 2), 'the action item should be closed, too').to.be.true; + await E2ETopics.deleteTopic(1, true); + await expect(await E2ETopics.countTopicsForMinute()).to.equal(1); + expect(await E2ETopics.isTopicClosed(1), "the topic should be closed now").to.be.true; + expect(await E2ETopics.isActionItemClosed(1, 2), 'the action item should be closed, too').to.be.true; }); it('shows a info dialog and does nothing if the topic and its actions are already closed', function () { - E2ETopics.toggleTopic(1); - E2ETopics.toggleActionItem(1, 2); - E2ETopics.deleteTopic(1); + await E2ETopics.toggleTopic(1); + await E2ETopics.toggleActionItem(1, 2); + await E2ETopics.deleteTopic(1); let selectorDialog = '#confirmDialog'; - E2EGlobal.waitSomeTime(750); // give dialog animation time - expect(browser.isVisible(selectorDialog), "Dialog should be visible").to.be.true; + await E2EGlobal.waitSomeTime(750); // give dialog animation time + expect(await browser.isVisible(selectorDialog), "Dialog should be visible").to.be.true; - let dialogContentElement = browser.element(selectorDialog + " .modal-header").value.ELEMENT; - let dialogContentTitle = browser.elementIdText(dialogContentElement).value; + let dialogContentElement = (await browser.element(selectorDialog + " .modal-header")).value.ELEMENT; + let dialogContentTitle = (await browser.elementIdText(dialogContentElement)).value; - expect(dialogContentTitle).to.have.string('Cannot delete topic'); + await expect(dialogContentTitle).to.have.string('Cannot delete topic'); // close dialog otherwise beforeEach-hook will fail! - E2EGlobal.clickWithRetry('#confirmationDialogOK'); - E2EGlobal.waitSomeTime(); + await E2EGlobal.clickWithRetry('#confirmationDialogOK'); + await E2EGlobal.waitSomeTime(); }); it('closes the action item instead of deleting it', function () { - E2ETopics.deleteInfoItem(1, 2, true); - expect(E2ETopics.isActionItemClosed(1, 2), "the AI should be closed").to.be.true; + await E2ETopics.deleteInfoItem(1, 2, true); + expect(await E2ETopics.isActionItemClosed(1, 2), "the AI should be closed").to.be.true; }); it('closes the action item instead of deleting it even it was recently edited', function() { const topicIndex = 1, itemIndex = 2, UPDATED_SUBJECT = `${EXISTING_ACTION} (updated)`; - E2ETopics.editInfoItemForTopic(topicIndex, itemIndex, {subject: UPDATED_SUBJECT}); - E2ETopics.deleteInfoItem(topicIndex, itemIndex, true); - expect(E2ETopics.isActionItemClosed(topicIndex, 2), "the AI should be closed").to.be.true; + await E2ETopics.editInfoItemForTopic(topicIndex, itemIndex, {subject: UPDATED_SUBJECT}); + await E2ETopics.deleteInfoItem(topicIndex, itemIndex, true); + expect(await E2ETopics.isActionItemClosed(topicIndex, 2), "the AI should be closed").to.be.true; }); it('unpins the sticky info item instead of deleting it', function () { - E2ETopics.deleteInfoItem(1, 1, true); - expect(E2ETopics.isInfoItemSticky(1, 1)).to.be.false; + await E2ETopics.deleteInfoItem(1, 1, true); + expect(await E2ETopics.isInfoItemSticky(1, 1)).to.be.false; }); }); diff --git a/tests/end2end/TopicsResponsibles-test.js b/tests/end2end/TopicsResponsibles-test.js index 278777718..83141173d 100644 --- a/tests/end2end/TopicsResponsibles-test.js +++ b/tests/end2end/TopicsResponsibles-test.js @@ -12,113 +12,113 @@ describe('Topics Responsibles', function () { let aMeetingName; before("reload page and reset app", function () { - E2EGlobal.logTimestamp("Start test suite"); - E2EApp.resetMyApp(true); - E2EApp.launchApp(); + await E2EGlobal.logTimestamp("Start test suite"); + await E2EApp.resetMyApp(true); + await E2EApp.launchApp(); }); beforeEach("goto start page and make sure test user is logged in", function () { - E2EApp.gotoStartPage(); - expect (E2EApp.isLoggedIn()).to.be.true; + await E2EApp.gotoStartPage(); + expect (await E2EApp.isLoggedIn()).to.be.true; aMeetingCounter++; aMeetingName = aMeetingNameBase + aMeetingCounter; - E2EMeetingSeries.createMeetingSeries(aProjectName, aMeetingName); - E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName); + await E2EMeetingSeries.createMeetingSeries(aProjectName, aMeetingName); + await E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName); }); it('can add a responsible to a topic', function () { let user1 = E2EGlobal.SETTINGS.e2eTestUsers[0]; - E2ETopics.addTopicToMinutes('TOP-1', user1); + await E2ETopics.addTopicToMinutes('TOP-1', user1); - let topicHeadingText = browser.element("#topicPanel .well:nth-child(1) h3").getText(); - expect (topicHeadingText).to.contain(user1); + let topicHeadingText = await (await browser.element("#topicPanel .well:nth-child(1) h3")).getText(); + await expect (topicHeadingText).to.contain(user1); }); it('can add two responsibles to a topic', function () { let user1 = E2EGlobal.SETTINGS.e2eTestUsers[0]; let user2 = E2EGlobal.SETTINGS.e2eTestUsers[1]; - E2ETopics.addTopicToMinutes('TOP-1', user1+","+user2); + await E2ETopics.addTopicToMinutes('TOP-1', user1+","+user2); - let topicHeadingText = browser.element("#topicPanel .well:nth-child(1) h3").getText(); - expect (topicHeadingText).to.contain(user1); - expect (topicHeadingText).to.contain(user2); + let topicHeadingText = await (await browser.element("#topicPanel .well:nth-child(1) h3")).getText(); + await expect (topicHeadingText).to.contain(user1); + await expect (topicHeadingText).to.contain(user2); }); it('can remove a responsible from a topic', function () { let user1 = E2EGlobal.SETTINGS.e2eTestUsers[0]; let user2 = E2EGlobal.SETTINGS.e2eTestUsers[1]; - E2ETopics.addTopicToMinutes('TOP-1', user1+","+user2); + await E2ETopics.addTopicToMinutes('TOP-1', user1+","+user2); - E2ETopics.openEditTopicForMinutes(1); - browser.element(".form-group-responsibles .select2-selection__choice__remove").click(); // remove first user - browser.element(".form-group-responsibles .select2-selection").click(); - E2EGlobal.clickWithRetry("#btnTopicSave"); - E2EGlobal.waitSomeTime(); + await E2ETopics.openEditTopicForMinutes(1); + await (await browser.element(".form-group-responsibles .select2-selection__choice__remove")).click(); // remove first user + await (await browser.element(".form-group-responsibles .select2-selection")).click(); + await E2EGlobal.clickWithRetry("#btnTopicSave"); + await E2EGlobal.waitSomeTime(); - let topicHeadingText = browser.element("#topicPanel .well:nth-child(1) h3").getText(); - expect (topicHeadingText).to.contain(user2); + let topicHeadingText = await (await browser.element("#topicPanel .well:nth-child(1) h3")).getText(); + await expect (topicHeadingText).to.contain(user2); }); it('can add arbitrary free text responsible name', function () { let username = "Max Mustermann"; - E2ETopics.addTopicToMinutes('TOP-1', username); - let topicHeadingText = browser.element("#topicPanel .well:nth-child(1) h3").getText(); - expect (topicHeadingText).to.contain(username); + await E2ETopics.addTopicToMinutes('TOP-1', username); + let topicHeadingText = await (await browser.element("#topicPanel .well:nth-child(1) h3")).getText(); + await expect (topicHeadingText).to.contain(username); }); it('can add a responsible from the participant users', function () { let user1 = E2EGlobal.SETTINGS.e2eTestUsers[0]; - E2ETopics.addTopicToMinutes('TOP-1', ""); + await E2ETopics.addTopicToMinutes('TOP-1', ""); - E2ETopics.openEditTopicForMinutes(1); - browser.element(".form-group-responsibles .select2-selection").click(); - E2EGlobal.waitSomeTime(); - E2EGlobal.sendKeysWithPause("1", 200, "\uE015\uE007"); - E2EGlobal.clickWithRetry("#btnTopicSave"); - E2EGlobal.waitSomeTime(500); + await E2ETopics.openEditTopicForMinutes(1); + await (await browser.element(".form-group-responsibles .select2-selection")).click(); + await E2EGlobal.waitSomeTime(); + await E2EGlobal.sendKeysWithPause("1", 200, "\uE015\uE007"); + await E2EGlobal.clickWithRetry("#btnTopicSave"); + await E2EGlobal.waitSomeTime(500); - let topicHeadingText = browser.element("#topicPanel .well:nth-child(1) h3").getText(); - expect (topicHeadingText).to.contain(user1); + let topicHeadingText = await (await browser.element("#topicPanel .well:nth-child(1) h3")).getText(); + await expect (topicHeadingText).to.contain(user1); }); it('can add a responsible from user collection that is not a participant', function () { let user3 = E2EGlobal.SETTINGS.e2eTestUsers[2]; - E2ETopics.addTopicToMinutes('TOP-1', ""); + await E2ETopics.addTopicToMinutes('TOP-1', ""); - E2ETopics.openEditTopicForMinutes(1); - E2EGlobal.waitSomeTime(); - browser.element(".form-group-responsibles .select2-selection").click(); - E2EGlobal.sendKeysWithPause("3", 200, "\uE015\uE007"); // "3" (end of user3 string) + CursorDown + Enter - E2EGlobal.clickWithRetry("#btnTopicSave"); - E2EGlobal.waitSomeTime(500); + await E2ETopics.openEditTopicForMinutes(1); + await E2EGlobal.waitSomeTime(); + await (await browser.element(".form-group-responsibles .select2-selection")).click(); + await E2EGlobal.sendKeysWithPause("3", 200, "\uE015\uE007"); // "3" (end of user3 string) + CursorDown + Enter + await E2EGlobal.clickWithRetry("#btnTopicSave"); + await E2EGlobal.waitSomeTime(500); - let topicHeadingText = browser.element("#topicPanel .well:nth-child(1) h3").getText(); - expect (topicHeadingText).to.contain(user3); + let topicHeadingText = await (await browser.element("#topicPanel .well:nth-child(1) h3")).getText(); + await expect (topicHeadingText).to.contain(user3); }); it('can add a responsible from drop-down that is an additional participant', function () { let additionalParticipant = "Additional Participant"; - browser.setValue('#edtParticipantsAdditional', additionalParticipant); + await browser.setValue('#edtParticipantsAdditional', additionalParticipant); - E2ETopics.addTopicToMinutes('TOP-1', ""); + await E2ETopics.addTopicToMinutes('TOP-1', ""); - E2ETopics.openEditTopicForMinutes(1); - E2EGlobal.waitSomeTime(); + await E2ETopics.openEditTopicForMinutes(1); + await E2EGlobal.waitSomeTime(); - browser.element(".form-group-responsibles .select2-selection").click(); + await (await browser.element(".form-group-responsibles .select2-selection")).click(); // We only send the beginning of the name, to ensure the drop-down is used for selection! - E2EGlobal.sendKeysWithPause("Addi", 300, "\uE015\uE007"); // + CursorDown + Enter + await E2EGlobal.sendKeysWithPause("Addi", 300, "\uE015\uE007"); // + CursorDown + Enter - E2EGlobal.clickWithRetry("#btnTopicSave"); - E2EGlobal.waitSomeTime(); + await E2EGlobal.clickWithRetry("#btnTopicSave"); + await E2EGlobal.waitSomeTime(); - let topicHeadingText = browser.element("#topicPanel .well:nth-child(1) h3").getText(); - expect (topicHeadingText).to.contain(additionalParticipant); + let topicHeadingText = await (await browser.element("#topicPanel .well:nth-child(1) h3")).getText(); + await expect (topicHeadingText).to.contain(additionalParticipant); }); }); diff --git a/tests/end2end/TopicsSkip-test.js b/tests/end2end/TopicsSkip-test.js index 7d32b544e..66427a9d8 100644 --- a/tests/end2end/TopicsSkip-test.js +++ b/tests/end2end/TopicsSkip-test.js @@ -16,166 +16,166 @@ describe('Topics Skip', function () { const skippedTopicName = 'Skipped Topic #2'; before("reload page and reset app", function () { - E2EGlobal.logTimestamp("Start test suite"); - E2EApp.resetMyApp(true); - E2EApp.launchApp(); + await E2EGlobal.logTimestamp("Start test suite"); + await E2EApp.resetMyApp(true); + await E2EApp.launchApp(); }); beforeEach("goto start page and make sure test user is logged in. Also create two topics", function () { - E2EApp.gotoStartPage(); - expect (E2EApp.isLoggedIn()).to.be.true; + await E2EApp.gotoStartPage(); + expect (await E2EApp.isLoggedIn()).to.be.true; aMeetingCounter++; aMeetingName = aMeetingNameBase + aMeetingCounter; - E2EMeetingSeries.createMeetingSeries(aProjectName, aMeetingName); - E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName); + await E2EMeetingSeries.createMeetingSeries(aProjectName, aMeetingName); + await E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName); - E2ETopics.addTopicToMinutes(skippedTopicName); - E2ETopics.addTopicToMinutes(nonSkippedTopicName); - expect(E2ETopics.countTopicsForMinute()).to.equal(2); + await E2ETopics.addTopicToMinutes(skippedTopicName); + await E2ETopics.addTopicToMinutes(nonSkippedTopicName); + await expect(await E2ETopics.countTopicsForMinute()).to.equal(2); - expect(E2ETopics.isTopicSkipped(1)).to.be.false; - expect(E2ETopics.isTopicSkipped(2)).to.be.false; + expect(await E2ETopics.isTopicSkipped(1)).to.be.false; + expect(await E2ETopics.isTopicSkipped(2)).to.be.false; }); it('Can skip and unskip topic', function () { - let skipAndUnskipTopicViaUI = (useDropdownMenu) => { - E2ETopics.toggleSkipTopic(2, true); //skip - expect(E2ETopics.isTopicSkipped(1)).to.be.false; - expect(E2ETopics.isTopicSkipped(2)).to.be.true; - E2ETopics.toggleSkipTopic(2, useDropdownMenu); //unskip - expect(E2ETopics.isTopicSkipped(1)).to.be.false; - expect(E2ETopics.isTopicSkipped(2)).to.be.false; + let skipAndUnskipTopicViaUI = async useDropdownMenu => { + await E2ETopics.toggleSkipTopic(2, true); //skip + expect(await E2ETopics.isTopicSkipped(1)).to.be.false; + expect(await E2ETopics.isTopicSkipped(2)).to.be.true; + await E2ETopics.toggleSkipTopic(2, useDropdownMenu); //unskip + expect(await E2ETopics.isTopicSkipped(1)).to.be.false; + expect(await E2ETopics.isTopicSkipped(2)).to.be.false; }; //Check skip & unskip via dropdown menu - skipAndUnskipTopicViaUI(true); + await skipAndUnskipTopicViaUI(true); //Check unskip by directly pressing the skip icon - skipAndUnskipTopicViaUI(false); + await skipAndUnskipTopicViaUI(false); }); it('Skipping closed topics will open them and they cannot be closed again', function () { - E2ETopics.toggleTopic(2); - expect(E2ETopics.isTopicClosed(2)).to.be.true; + await E2ETopics.toggleTopic(2); + expect(await E2ETopics.isTopicClosed(2)).to.be.true; - E2ETopics.toggleSkipTopic(2); - expect(E2ETopics.isTopicSkipped(2)).to.be.true; - expect(E2ETopics.isTopicClosed(2)).to.be.false; // topic has been opened again + await E2ETopics.toggleSkipTopic(2); + expect(await E2ETopics.isTopicSkipped(2)).to.be.true; + expect(await E2ETopics.isTopicClosed(2)).to.be.false; // topic has been opened again - E2ETopics.toggleTopic(2); - expect(E2ETopics.isTopicClosed(2)).to.be.false; // topic has not been opened again, since the checkbox is not editable + await E2ETopics.toggleTopic(2); + expect(await E2ETopics.isTopicClosed(2)).to.be.false; // topic has not been opened again, since the checkbox is not editable }); it('Skipped topics will not be included in agenda mails', function () { - E2EMails.resetSentMailsDb(); + await E2EMails.resetSentMailsDb(); - E2ETopics.toggleSkipTopic(2, true); - browser.waitForVisible('#btn_sendAgenda'); - E2EGlobal.clickWithRetry('#btn_sendAgenda'); + await E2ETopics.toggleSkipTopic(2, true); + await browser.waitForVisible('#btn_sendAgenda'); + await E2EGlobal.clickWithRetry('#btn_sendAgenda'); - E2EGlobal.waitSomeTime(); + await E2EGlobal.waitSomeTime(); - let sentMails = E2EMails.getAllSentMails(); + let sentMails = await E2EMails.getAllSentMails(); expect(sentMails, 'one mail should be sent').to.have.length(1); let sentMail = sentMails[0]; - expect(sentMail.html, 'the email should contain the subject of the topic').to.have.string(nonSkippedTopicName); - expect(sentMail.html, 'the email should not contain the subject of the skipped topic').to.not.have.string(skippedTopicName); + await expect(sentMail.html, 'the email should contain the subject of the topic').to.have.string(nonSkippedTopicName); + await expect(sentMail.html, 'the email should not contain the subject of the skipped topic').to.not.have.string(skippedTopicName); }); it('Skipped topics will not be included in info item mails', function () { const skippedInfoItemTitle = "This is an Infoitem within a skipped Topic"; const nonSkippedInfoItemTitle = "This is an Infoitem within a non-skipped Topic" - E2EMails.resetSentMailsDb(); - E2ETopics.toggleSkipTopic(2, true); - E2ETopics.addInfoItemToTopic({ + await E2EMails.resetSentMailsDb(); + await E2ETopics.toggleSkipTopic(2, true); + await E2ETopics.addInfoItemToTopic({ subject: nonSkippedInfoItemTitle, itemType: "infoItem" }, 1); - E2ETopics.addInfoItemToTopic({ + await E2ETopics.addInfoItemToTopic({ subject: skippedInfoItemTitle, itemType: "infoItem" }, 2); - E2EMinutes.finalizeCurrentMinutes(true); - E2EGlobal.waitSomeTime(); + await E2EMinutes.finalizeCurrentMinutes(true); + await E2EGlobal.waitSomeTime(); - let sentMails = E2EMails.getAllSentMails(); + let sentMails = await E2EMails.getAllSentMails(); expect(sentMails, 'one mail should be sent').to.have.length(1); let sentMail = sentMails[0]; - expect(sentMail.html, "the email should contain the title of the non-skipped Topic's InfoItem").to.have.string(nonSkippedInfoItemTitle); - expect(sentMail.html, "the email should not contain the title of the skipped Topic's InfoItem").to.not.have.string(skippedInfoItemTitle); + await expect(sentMail.html, "the email should contain the title of the non-skipped Topic's InfoItem").to.have.string(nonSkippedInfoItemTitle); + await expect(sentMail.html, "the email should not contain the title of the skipped Topic's InfoItem").to.not.have.string(skippedInfoItemTitle); }); it('Skipped topics will not be included in action item mails', function () { const skippedActionItemTitle = "This is an ActionItem within a skipped Topic"; const nonSkippedActionItemTitle = "This is an ActionItem within a non-skipped Topic" - E2EMails.resetSentMailsDb(); - E2ETopics.toggleSkipTopic(2, true); - E2ETopics.addInfoItemToTopic({ + await E2EMails.resetSentMailsDb(); + await E2ETopics.toggleSkipTopic(2, true); + await E2ETopics.addInfoItemToTopic({ subject: nonSkippedActionItemTitle, itemType: "actionItem", - responsible: E2EApp.getCurrentUser() + responsible: await E2EApp.getCurrentUser() }, 1); - E2ETopics.addInfoItemToTopic({ + await E2ETopics.addInfoItemToTopic({ subject: skippedActionItemTitle, itemType: "actionItem", - responsible: E2EApp.getCurrentUser() + responsible: await E2EApp.getCurrentUser() }, 2); - E2EMinutes.finalizeCurrentMinutes(true); - E2EGlobal.waitSomeTime(); + await E2EMinutes.finalizeCurrentMinutes(true); + await E2EGlobal.waitSomeTime(); - let sentMails = E2EMails.getAllSentMails(); + let sentMails = await E2EMails.getAllSentMails(); expect(sentMails, 'two mail should be sent. One for the ActionItems, the other for the InfoItems').to.have.length(2); let sentMail = sentMails[0]; //ActionItem Mail will be sent first - expect(sentMail.html, "the email should contain the title of the non-skipped Topic's ActionItem").to.have.string(nonSkippedActionItemTitle); - expect(sentMail.html, "the email should not contain the title of the skipped Topic's ActionItem").to.not.have.string(skippedActionItemTitle); + await expect(sentMail.html, "the email should contain the title of the non-skipped Topic's ActionItem").to.have.string(nonSkippedActionItemTitle); + await expect(sentMail.html, "the email should not contain the title of the skipped Topic's ActionItem").to.not.have.string(skippedActionItemTitle); }); it('Skipped topics can only be seen by the moderator', function () { - E2ETopics.toggleSkipTopic(2, true); + await E2ETopics.toggleSkipTopic(2, true); //Moderator can see Topic let selector = "#topicPanel .well:nth-child(2) #btnTopicDropdownMenu"; - expect(browser.isVisible(selector)).to.be.true; + expect(await browser.isVisible(selector)).to.be.true; //Add another participant - E2EMinutes.gotoParentMeetingSeries(); - E2EMeetingSeriesEditor.openMeetingSeriesEditor(aProjectName, aMeetingName, "invited"); - E2EGlobal.waitSomeTime(750); + await E2EMinutes.gotoParentMeetingSeries(); + await E2EMeetingSeriesEditor.openMeetingSeriesEditor(aProjectName, aMeetingName, "invited"); + await E2EGlobal.waitSomeTime(750); let user2 = E2EGlobal.SETTINGS.e2eTestUsers[1]; - E2EMeetingSeriesEditor.addUserToMeetingSeries(user2); - E2EMeetingSeriesEditor.closeMeetingSeriesEditor(); // close with save + await E2EMeetingSeriesEditor.addUserToMeetingSeries(user2); + await E2EMeetingSeriesEditor.closeMeetingSeriesEditor(); // close with save //check if new non-moderator-participant can see skipped topic - E2EApp.loginUser(1); - E2EMeetingSeries.gotoMeetingSeries(aProjectName, aMeetingName); - E2EGlobal.waitSomeTime(); - E2EMinutes.gotoLatestMinutes(); - expect(browser.isVisible(selector)).to.be.false; + await E2EApp.loginUser(1); + await E2EMeetingSeries.gotoMeetingSeries(aProjectName, aMeetingName); + await E2EGlobal.waitSomeTime(); + await E2EMinutes.gotoLatestMinutes(); + expect(await browser.isVisible(selector)).to.be.false; - E2EApp.loginUser(); + await E2EApp.loginUser(); }); it('Hide closed Topics button will also hide skipped topics', function () { - E2ETopics.toggleSkipTopic(2, true); + await E2ETopics.toggleSkipTopic(2, true); let selector = "#topicPanel .well:nth-child(2) #btnTopicDropdownMenu"; - expect(browser.isVisible(selector)).to.be.true; - E2EGlobal.clickWithRetry("#checkHideClosedTopicsLabel"); - E2EGlobal.waitSomeTime(); - expect(browser.isVisible(selector)).to.be.false; - E2EGlobal.clickWithRetry("#checkHideClosedTopicsLabel"); + expect(await browser.isVisible(selector)).to.be.true; + await E2EGlobal.clickWithRetry("#checkHideClosedTopicsLabel"); + await E2EGlobal.waitSomeTime(); + expect(await browser.isVisible(selector)).to.be.false; + await E2EGlobal.clickWithRetry("#checkHideClosedTopicsLabel"); }); it('Skipped topics will appear unskipped in the next minute', function () { - E2ETopics.toggleSkipTopic(2, true); - expect(E2ETopics.isTopicSkipped(2)).to.be.true; - E2EMinutes.finalizeCurrentMinutes(true); - E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName); - E2EMinutes.gotoLatestMinutes(); - expect(E2ETopics.isTopicSkipped(2)).to.be.false; + await E2ETopics.toggleSkipTopic(2, true); + expect(await E2ETopics.isTopicSkipped(2)).to.be.true; + await E2EMinutes.finalizeCurrentMinutes(true); + await E2EMinutes.addMinutesToMeetingSeries(aProjectName, aMeetingName); + await E2EMinutes.gotoLatestMinutes(); + expect(await E2ETopics.isTopicSkipped(2)).to.be.false; }); }); \ No newline at end of file diff --git a/tests/end2end/Topics_security.js b/tests/end2end/Topics_security.js index 39ba0685b..ac9ebaee4 100644 --- a/tests/end2end/Topics_security.js +++ b/tests/end2end/Topics_security.js @@ -10,228 +10,228 @@ const newSubject = 'Updated Subject'; describe('Topics Methods Security', function () { beforeEach('goto start page and make sure test user is logged in', function () { - E2EApp.gotoStartPage(); - expect(E2EApp.isLoggedIn()).to.be.true; + await E2EApp.gotoStartPage(); + expect(await E2EApp.isLoggedIn()).to.be.true; }); before('reload page and reset app', function () { - E2EGlobal.logTimestamp("Start test suite"); - E2EApp.resetMyApp(true); - E2EApp.launchApp(); + await E2EGlobal.logTimestamp("Start test suite"); + await E2EApp.resetMyApp(true); + await E2EApp.launchApp(); }); // minutes.addTopic it('Moderator can insert a new Topic, not logged in can not insert a topic', function () { const name = 'AddTopic as moderator'; - const min = E2ESecurity.createMeetingSeriesAndMinute(name); - const topicId = E2ESecurity.returnMeteorId(); + const min = await E2ESecurity.createMeetingSeriesAndMinute(name); + const topicId = await E2ESecurity.returnMeteorId(); - E2EApp.logoutUser(); - expect(E2EApp.isNotLoggedIn()).to.be.true; - E2ESecurity.tryAddNewTopic(topicSubject, topicId, min.min_id, 0, 'not logged in user can not insert a topic'); + await E2EApp.logoutUser(); + expect(await E2EApp.isNotLoggedIn()).to.be.true; + await E2ESecurity.tryAddNewTopic(topicSubject, topicId, min.min_id, 0, 'not logged in user can not insert a topic'); - E2EApp.loginUser(); - expect(E2EApp.isLoggedIn()).to.be.true; - E2ESecurity.tryAddNewTopic(topicSubject, topicId, min.min_id, 1, 'Moderator can insert a topic'); + await E2EApp.loginUser(); + expect(await E2EApp.isLoggedIn()).to.be.true; + await E2ESecurity.tryAddNewTopic(topicSubject, topicId, min.min_id, 1, 'Moderator can insert a topic'); }); it('Informed/Invited users can not insert a new Topic', function () { const name = 'AddTopic as informed/invited'; - const min = E2ESecurity.createMeetingSeriesAndMinute(name); - const topicId = E2ESecurity.returnMeteorId(); + const min = await E2ESecurity.createMeetingSeriesAndMinute(name); + const topicId = await E2ESecurity.returnMeteorId(); - E2ESecurity.inviteUserToMeetingSerie(name, 'Invited', 1); - E2ESecurity.inviteUserToMeetingSerie(name, 'Informed', 2); + await E2ESecurity.inviteUserToMeetingSerie(name, 'Invited', 1); + await E2ESecurity.inviteUserToMeetingSerie(name, 'Informed', 2); - E2EApp.loginUser(1); - expect(E2EApp.isLoggedIn()).to.be.true; - E2ESecurity.tryAddNewTopic(topicSubject, topicId, min.min_id, 0, 'Invited user can not insert a topic'); + await E2EApp.loginUser(1); + expect(await E2EApp.isLoggedIn()).to.be.true; + await E2ESecurity.tryAddNewTopic(topicSubject, topicId, min.min_id, 0, 'Invited user can not insert a topic'); - E2EApp.loginUser(2); - expect(E2EApp.isLoggedIn()).to.be.true; - E2ESecurity.tryAddNewTopic(topicSubject, topicId, min.min_id, 0, 'Informed user can not insert a topic'); - E2EApp.loginUser(); + await E2EApp.loginUser(2); + expect(await E2EApp.isLoggedIn()).to.be.true; + await E2ESecurity.tryAddNewTopic(topicSubject, topicId, min.min_id, 0, 'Informed user can not insert a topic'); + await E2EApp.loginUser(); }); //minutes.updateTopic it('Moderator can update a Topic, not logged in user can not update a topic', function () { const name = 'UpdateTopic as moderator'; - const min = E2ESecurity.createMeetingSeriesAndMinute(name); - const topicId = E2ESecurity.returnMeteorId(); - E2ESecurity.executeMethod(E2ESecurity.addTopic, min.min_id, {subject: topicSubject, labels: Array(0), _id: topicId}); + const min = await E2ESecurity.createMeetingSeriesAndMinute(name); + const topicId = await E2ESecurity.returnMeteorId(); + await E2ESecurity.executeMethod(E2ESecurity.addTopic, min.min_id, {subject: topicSubject, labels: Array(0), _id: topicId}); - E2EApp.logoutUser(); - expect(E2EApp.isNotLoggedIn()).to.be.true; - E2ESecurity.tryUpdateTopicSubject(newSubject, topicId, min.min_id, topicSubject, 'not logged in user can not update a topic'); + await E2EApp.logoutUser(); + expect(await E2EApp.isNotLoggedIn()).to.be.true; + await E2ESecurity.tryUpdateTopicSubject(newSubject, topicId, min.min_id, topicSubject, 'not logged in user can not update a topic'); - E2EApp.loginUser(); - expect(E2EApp.isLoggedIn()).to.be.true; - E2ESecurity.tryUpdateTopicSubject(newSubject, topicId, min.min_id, newSubject,'Moderator can update a topic'); + await E2EApp.loginUser(); + expect(await E2EApp.isLoggedIn()).to.be.true; + await E2ESecurity.tryUpdateTopicSubject(newSubject, topicId, min.min_id, newSubject,'Moderator can update a topic'); }); it('Informed/Invited user in can not update a Topic', function () { const name = 'UpdateTopic as informed/invited'; - const min = E2ESecurity.createMeetingSeriesAndMinute(name); - const topicId = E2ESecurity.returnMeteorId(); - E2ESecurity.inviteUserToMeetingSerie(name, 'Invited', 1); - E2ESecurity.inviteUserToMeetingSerie(name, 'Informed', 2); - E2ESecurity.executeMethod(E2ESecurity.addTopic, min.min_id, {subject: topicSubject, labels: Array(0), _id: topicId}); - - E2EApp.loginUser(1); - expect(E2EApp.isLoggedIn()).to.be.true; - E2ESecurity.tryUpdateTopicSubject(newSubject, topicId, min.min_id, topicSubject, 'Invited user can not update a topic'); - - E2EApp.loginUser(2); - expect(E2EApp.isLoggedIn()).to.be.true; - E2ESecurity.tryUpdateTopicSubject(newSubject, topicId, min.min_id, topicSubject, 'Informed user can not update a topic'); - E2EApp.loginUser(); + const min = await E2ESecurity.createMeetingSeriesAndMinute(name); + const topicId = await E2ESecurity.returnMeteorId(); + await E2ESecurity.inviteUserToMeetingSerie(name, 'Invited', 1); + await E2ESecurity.inviteUserToMeetingSerie(name, 'Informed', 2); + await E2ESecurity.executeMethod(E2ESecurity.addTopic, min.min_id, {subject: topicSubject, labels: Array(0), _id: topicId}); + + await E2EApp.loginUser(1); + expect(await E2EApp.isLoggedIn()).to.be.true; + await E2ESecurity.tryUpdateTopicSubject(newSubject, topicId, min.min_id, topicSubject, 'Invited user can not update a topic'); + + await E2EApp.loginUser(2); + expect(await E2EApp.isLoggedIn()).to.be.true; + await E2ESecurity.tryUpdateTopicSubject(newSubject, topicId, min.min_id, topicSubject, 'Informed user can not update a topic'); + await E2EApp.loginUser(); }); //minutes.removeTopic it('Moderator can delete a Topic, not logged in can not delete a topic', function () { const name = 'RemoveTopic as moderator'; - const min = E2ESecurity.createMeetingSeriesAndMinute(name); - const topicId = E2ESecurity.returnMeteorId(); - E2ESecurity.executeMethod(E2ESecurity.addTopic, min.min_id, {subject: topicSubject, labels: Array(0), _id: topicId}); - expect(server.call('e2e.countTopicsInMongoDB', min.min_id)).to.equal(1); - - E2EApp.logoutUser(); - expect(E2EApp.isNotLoggedIn()).to.be.true; - E2ESecurity.tryRemoveTopic(topicId, min.min_id, 1, 'not logged in user can not delete a topic'); - - E2EApp.loginUser(); - expect(E2EApp.isLoggedIn()).to.be.true; - E2ESecurity.tryRemoveTopic(topicId, min.min_id, 0, 'moderator can delete a topic'); + const min = await E2ESecurity.createMeetingSeriesAndMinute(name); + const topicId = await E2ESecurity.returnMeteorId(); + await E2ESecurity.executeMethod(E2ESecurity.addTopic, min.min_id, {subject: topicSubject, labels: Array(0), _id: topicId}); + await expect(await server.call('e2e.countTopicsInMongoDB', min.min_id)).to.equal(1); + + await E2EApp.logoutUser(); + expect(await E2EApp.isNotLoggedIn()).to.be.true; + await E2ESecurity.tryRemoveTopic(topicId, min.min_id, 1, 'not logged in user can not delete a topic'); + + await E2EApp.loginUser(); + expect(await E2EApp.isLoggedIn()).to.be.true; + await E2ESecurity.tryRemoveTopic(topicId, min.min_id, 0, 'moderator can delete a topic'); }); it('Informed/Invited users can not delete a topic', function () { const name = 'RemoveTopic as informed/invited'; - const min = E2ESecurity.createMeetingSeriesAndMinute(name); - const topicId = E2ESecurity.returnMeteorId(); - E2ESecurity.inviteUserToMeetingSerie(name, 'Invited', 1); - E2ESecurity.inviteUserToMeetingSerie(name, 'Informed', 2); - - E2ESecurity.executeMethod(E2ESecurity.addTopic, min.min_id, {subject: topicSubject, labels: Array(0), _id: topicId}); - expect(server.call('e2e.countTopicsInMongoDB', min.min_id)).to.equal(1); - - E2EApp.loginUser(1); - expect(E2EApp.isLoggedIn()).to.be.true; - E2ESecurity.tryRemoveTopic(topicId, min.min_id, 1, 'Invited user can not delete a topic'); - - E2EApp.loginUser(2); - expect(E2EApp.isLoggedIn()).to.be.true; - E2ESecurity.tryRemoveTopic(topicId, min.min_id, 1, 'Informed user can not delete a topic'); - E2EApp.loginUser(); + const min = await E2ESecurity.createMeetingSeriesAndMinute(name); + const topicId = await E2ESecurity.returnMeteorId(); + await E2ESecurity.inviteUserToMeetingSerie(name, 'Invited', 1); + await E2ESecurity.inviteUserToMeetingSerie(name, 'Informed', 2); + + await E2ESecurity.executeMethod(E2ESecurity.addTopic, min.min_id, {subject: topicSubject, labels: Array(0), _id: topicId}); + await expect(await server.call('e2e.countTopicsInMongoDB', min.min_id)).to.equal(1); + + await E2EApp.loginUser(1); + expect(await E2EApp.isLoggedIn()).to.be.true; + await E2ESecurity.tryRemoveTopic(topicId, min.min_id, 1, 'Invited user can not delete a topic'); + + await E2EApp.loginUser(2); + expect(await E2EApp.isLoggedIn()).to.be.true; + await E2ESecurity.tryRemoveTopic(topicId, min.min_id, 1, 'Informed user can not delete a topic'); + await E2EApp.loginUser(); }); //'workflow.reopenTopicFromMeetingSeries' it('Moderator can reopen a topic, not logged in can not reopen a topic', function () { const name = 'ReopenTopic as moderator'; - const min = E2ESecurity.createMeetingSeriesAndMinute(name); - const topicId = E2ESecurity.returnMeteorId(); - E2ESecurity.executeMethod(E2ESecurity.addTopic, min.min_id, {subject: topicSubject, labels: Array(0), _id: topicId}); - - E2ESecurity.executeMethod(E2ESecurity.updateTopic, topicId, {isOpen: false}); - expect((server.call('e2e.getTopics', min.min_id))[0].isOpen).to.equal(false); - - E2ESecurity.executeMethod(E2ESecurity.finalizeMinute, min.min_id); - E2EGlobal.waitSomeTime(); - expect((server.call('e2e.findMinute', min.min_id)).isFinalized).to.equal(true); - - E2EApp.logoutUser(); - expect(E2EApp.isNotLoggedIn()).to.be.true; - E2ESecurity.tryReopenTopic(topicId, min.ms_id, false, 'Not logged in can not reopen a topic'); - E2EApp.loginUser(); - expect(E2EApp.isLoggedIn()).to.be.true; + const min = await E2ESecurity.createMeetingSeriesAndMinute(name); + const topicId = await E2ESecurity.returnMeteorId(); + await E2ESecurity.executeMethod(E2ESecurity.addTopic, min.min_id, {subject: topicSubject, labels: Array(0), _id: topicId}); + + await E2ESecurity.executeMethod(E2ESecurity.updateTopic, topicId, {isOpen: false}); + await expect(((await (server.call('e2e.getTopics', min.min_id))))[0].isOpen).to.equal(false); + + await E2ESecurity.executeMethod(E2ESecurity.finalizeMinute, min.min_id); + await E2EGlobal.waitSomeTime(); + await expect(((await (server.call('e2e.findMinute', min.min_id)))).isFinalized).to.equal(true); + + await E2EApp.logoutUser(); + expect(await E2EApp.isNotLoggedIn()).to.be.true; + await E2ESecurity.tryReopenTopic(topicId, min.ms_id, false, 'Not logged in can not reopen a topic'); + await E2EApp.loginUser(); + expect(await E2EApp.isLoggedIn()).to.be.true; }); it('Invited/Informed user can not reopen a topic', function () { const name = 'ReopenTopic as invited'; - const min = E2ESecurity.createMeetingSeriesAndMinute(name); - E2ESecurity.inviteUserToMeetingSerie(name, 'Invited', 1); - E2ESecurity.inviteUserToMeetingSerie(name, 'Informed', 2); - const topicId = E2ESecurity.returnMeteorId(); - - E2ESecurity.executeMethod(E2ESecurity.addTopic, min.min_id, {subject: topicSubject, labels: Array(0), _id: topicId}); - E2ESecurity.executeMethod(E2ESecurity.updateTopic, topicId, {isOpen: false}); - expect((server.call('e2e.getTopics', min.min_id))[0].isOpen).to.equal(false); - - E2ESecurity.executeMethod(E2ESecurity.finalizeMinute, min.min_id); - expect((server.call('e2e.findMinute', min.min_id)).isFinalized).to.equal(true); - - E2EApp.loginUser(1); - expect(E2EApp.isLoggedIn()).to.be.true; - E2ESecurity.tryReopenTopic(topicId, min.ms_id, false, 'Invited user can not reopen a topic'); - - E2EApp.loginUser(2); - expect(E2EApp.isLoggedIn()).to.be.true; - E2ESecurity.tryReopenTopic(topicId, min.ms_id, false, 'Informed user can not reopen a topic'); - E2EApp.loginUser(); + const min = await E2ESecurity.createMeetingSeriesAndMinute(name); + await E2ESecurity.inviteUserToMeetingSerie(name, 'Invited', 1); + await E2ESecurity.inviteUserToMeetingSerie(name, 'Informed', 2); + const topicId = await E2ESecurity.returnMeteorId(); + + await E2ESecurity.executeMethod(E2ESecurity.addTopic, min.min_id, {subject: topicSubject, labels: Array(0), _id: topicId}); + await E2ESecurity.executeMethod(E2ESecurity.updateTopic, topicId, {isOpen: false}); + await expect(((await (server.call('e2e.getTopics', min.min_id))))[0].isOpen).to.equal(false); + + await E2ESecurity.executeMethod(E2ESecurity.finalizeMinute, min.min_id); + await expect(((await (server.call('e2e.findMinute', min.min_id)))).isFinalized).to.equal(true); + + await E2EApp.loginUser(1); + expect(await E2EApp.isLoggedIn()).to.be.true; + await E2ESecurity.tryReopenTopic(topicId, min.ms_id, false, 'Invited user can not reopen a topic'); + + await E2EApp.loginUser(2); + expect(await E2EApp.isLoggedIn()).to.be.true; + await E2ESecurity.tryReopenTopic(topicId, min.ms_id, false, 'Informed user can not reopen a topic'); + await E2EApp.loginUser(); }); }); describe('Topics Publish & Subscribe Security', function () { beforeEach('goto start page and make sure test user is logged in', function () { - E2EApp.gotoStartPage(); - expect(E2EApp.isLoggedIn()).to.be.true; + await E2EApp.gotoStartPage(); + expect(await E2EApp.isLoggedIn()).to.be.true; }); before('reload page and reset app', function () { - E2EApp.resetMyApp(true); - E2EApp.launchApp(); + await E2EApp.resetMyApp(true); + await E2EApp.launchApp(); }); it('Non-logged in users have no unexpected Topics from MeetingSeries published', function () { const name = 'Publish Topics Project #1'; - const min = E2ESecurity.createMeetingSeriesAndMinute(name); - const topicId = E2ESecurity.returnMeteorId(); - E2ESecurity.executeMethod(E2ESecurity.addTopic, min.min_id, {subject: topicSubject, labels: Array(0), _id: topicId}); - E2ESecurity.tryFinalizeMinute(min.min_id, true); + const min = await E2ESecurity.createMeetingSeriesAndMinute(name); + const topicId = await E2ESecurity.returnMeteorId(); + await E2ESecurity.executeMethod(E2ESecurity.addTopic, min.min_id, {subject: topicSubject, labels: Array(0), _id: topicId}); + await E2ESecurity.tryFinalizeMinute(min.min_id, true); - const min2 = E2ESecurity.createMeetingSeriesAndMinute(name); - const topicId2 = E2ESecurity.returnMeteorId(); - E2ESecurity.executeMethod(E2ESecurity.addTopic, min2.min_id, {subject: topicSubject, labels: Array(0), _id: topicId2}); + const min2 = await E2ESecurity.createMeetingSeriesAndMinute(name); + const topicId2 = await E2ESecurity.returnMeteorId(); + await E2ESecurity.executeMethod(E2ESecurity.addTopic, min2.min_id, {subject: topicSubject, labels: Array(0), _id: topicId2}); - expect(E2ESecurity.countRecordsInMiniMongo('topics'), + await expect(await E2ESecurity.countRecordsInMiniMongo('topics'), 'Moderator should have no Topics published when not within a Meeting Series').to.equal(0); - E2EMinutes.gotoParentMeetingSeries(); + await E2EMinutes.gotoParentMeetingSeries(); - expect(E2ESecurity.countRecordsInMiniMongo('topics'), + await expect(await E2ESecurity.countRecordsInMiniMongo('topics'), 'Moderator should have 1 Topic published').to.equal(1); - E2EApp.logoutUser(); - expect (E2EApp.isNotLoggedIn()).to.be.true; - expect(E2ESecurity.countRecordsInMiniMongo('topics'), + await E2EApp.logoutUser(); + expect (await E2EApp.isNotLoggedIn()).to.be.true; + await expect(await E2ESecurity.countRecordsInMiniMongo('topics'), 'Not logged in user should not have Topics published').to.equal(0); - E2EApp.loginUser(); + await E2EApp.loginUser(); }); it('Invited users should have Topics from MeetingSeries published', function () { - expect(E2EApp.isLoggedIn()).to.be.true; + expect(await E2EApp.isLoggedIn()).to.be.true; const name = 'Publish Topics Project #2'; - const min = E2ESecurity.createMeetingSeriesAndMinute(name); - E2ESecurity.inviteUserToMeetingSerie(name, 'Invited', 1); + const min = await E2ESecurity.createMeetingSeriesAndMinute(name); + await E2ESecurity.inviteUserToMeetingSerie(name, 'Invited', 1); - const topicId = E2ESecurity.returnMeteorId(); - E2ESecurity.executeMethod(E2ESecurity.addTopic, min.min_id, {subject: topicSubject, labels: Array(0), _id: topicId}); - E2ESecurity.tryFinalizeMinute(min.min_id, true); + const topicId = await E2ESecurity.returnMeteorId(); + await E2ESecurity.executeMethod(E2ESecurity.addTopic, min.min_id, {subject: topicSubject, labels: Array(0), _id: topicId}); + await E2ESecurity.tryFinalizeMinute(min.min_id, true); - E2EMinutes.addMinutesToMeetingSeries(name, name); - E2ESecurity.executeMethod(E2ESecurity.addTopic, min.min_id, {subject: topicSubject, labels: Array(0), _id: topicId}); + await E2EMinutes.addMinutesToMeetingSeries(name, name); + await E2ESecurity.executeMethod(E2ESecurity.addTopic, min.min_id, {subject: topicSubject, labels: Array(0), _id: topicId}); - E2EApp.loginUser(1); - expect (E2EApp.isLoggedIn()).to.be.true; - expect(E2ESecurity.countRecordsInMiniMongo('topics'), + await E2EApp.loginUser(1); + expect (await E2EApp.isLoggedIn()).to.be.true; + await expect(await E2ESecurity.countRecordsInMiniMongo('topics'), 'Invited user should have no Topics published when not within a Meeting Series').to.equal(0); - E2EMeetingSeries.gotoMeetingSeries(name, name); - expect(E2ESecurity.countRecordsInMiniMongo('topics'), + await E2EMeetingSeries.gotoMeetingSeries(name, name); + await expect(await E2ESecurity.countRecordsInMiniMongo('topics'), 'Invited user should have 1 Topic published').to.equal(1); - E2EApp.loginUser(); + await E2EApp.loginUser(); }); }); diff --git a/tests/end2end/User-test.js b/tests/end2end/User-test.js index 1b0a732ca..573974404 100644 --- a/tests/end2end/User-test.js +++ b/tests/end2end/User-test.js @@ -8,192 +8,192 @@ describe('User Profile/Password editing', function () { const waitUntilTimeout = 10000; before("reload page and reset app", function () { - E2EGlobal.logTimestamp("Start test suite"); - E2EApp.resetMyApp(true); - E2EApp.launchApp(); + await E2EGlobal.logTimestamp("Start test suite"); + await E2EApp.resetMyApp(true); + await E2EApp.launchApp(); }); beforeEach("goto start page and make sure test user is logged in", function () { - E2EApp.gotoStartPage(); - expect(E2EApp.isLoggedIn()).to.be.true; + await E2EApp.gotoStartPage(); + expect(await E2EApp.isLoggedIn()).to.be.true; }); it('Buttons Change Password and Edit Profile are not visible for an LDAP user', function () { - E2EApp.logoutUser(); - expect(E2EApp.isNotLoggedIn()).to.be.true; + await E2EApp.logoutUser(); + expect(await E2EApp.isNotLoggedIn()).to.be.true; - E2EApp.loginLdapUserWithCredentials('ldapUser1', 'ldapPwd1', false); - expect(E2EApp.isLoggedIn()).to.be.true; + await E2EApp.loginLdapUserWithCredentials('ldapUser1', 'ldapPwd1', false); + expect(await E2EApp.isLoggedIn()).to.be.true; - if (E2EApp.isLoggedIn()) { - E2EGlobal.clickWithRetry('#navbar-usermenu'); - browser.waitUntil(_ => !browser.isVisible('#navbar-dlgChangedPassword')); - expect(browser.isVisible('#navbar-dlgEditProfile')).to.be.false; + if (await E2EApp.isLoggedIn()) { + await E2EGlobal.clickWithRetry('#navbar-usermenu'); + await browser.waitUntil(async _ => !(await browser.isVisible('#navbar-dlgChangedPassword'))); + expect(await browser.isVisible('#navbar-dlgEditProfile')).to.be.false; } - E2EGlobal.clickWithRetry('#navbar-usermenu'); + await E2EGlobal.clickWithRetry('#navbar-usermenu'); - E2EApp.logoutUser(); - expect(E2EApp.isNotLoggedIn()).to.be.true; - E2EApp.loginUser(); + await E2EApp.logoutUser(); + expect(await E2EApp.isNotLoggedIn()).to.be.true; + await E2EApp.loginUser(); }); it('User can successfully change his password', function () { - expect(E2EApp.isLoggedIn()).to.be.true; + expect(await E2EApp.isLoggedIn()).to.be.true; let newPassword = 'Test12'; let oldPassword = E2EGlobal.SETTINGS.e2eTestPasswords[0]; - let changePassword = (oldPassword, newPassword) => { - E2EGlobal.clickWithRetry('#navbar-usermenu'); - E2EGlobal.waitSomeTime(); - E2EGlobal.clickWithRetry('#navbar-dlgChangePassword'); - E2EGlobal.waitSomeTime(); - E2EUser.changePassword(oldPassword, newPassword, newPassword); + let changePassword = async (oldPassword, newPassword) => { + await E2EGlobal.clickWithRetry('#navbar-usermenu'); + await E2EGlobal.waitSomeTime(); + await E2EGlobal.clickWithRetry('#navbar-dlgChangePassword'); + await E2EGlobal.waitSomeTime(); + await E2EUser.changePassword(oldPassword, newPassword, newPassword); }; //change password to new one - changePassword(oldPassword, newPassword); + await changePassword(oldPassword, newPassword); - browser.waitUntil(_ => !browser.isVisible('#frmDlgChangePassword'), waitUntilTimeout); + await browser.waitUntil(async _ => !(await browser.isVisible('#frmDlgChangePassword')), waitUntilTimeout); //try ty to log in with new password - E2EApp.logoutUser(); - expect(E2EApp.isNotLoggedIn()).to.be.true; - E2EApp.loginUserWithCredentials(E2EGlobal.SETTINGS.e2eTestUsers[0], newPassword, false); - expect(E2EApp.isLoggedIn()).to.be.true; + await E2EApp.logoutUser(); + expect(await E2EApp.isNotLoggedIn()).to.be.true; + await E2EApp.loginUserWithCredentials(E2EGlobal.SETTINGS.e2eTestUsers[0], newPassword, false); + expect(await E2EApp.isLoggedIn()).to.be.true; //reset password to the old one - changePassword(newPassword, oldPassword); + await changePassword(newPassword, oldPassword); - browser.waitUntil(_ => !browser.isVisible('#frmDlgChangePassword'), waitUntilTimeout); + await browser.waitUntil(async _ => !(await browser.isVisible('#frmDlgChangePassword')), waitUntilTimeout); }); it('User can not change his password, if new Passwords are not equal', function () { - expect(E2EApp.isLoggedIn()).to.be.true; - E2EGlobal.clickWithRetry('#navbar-usermenu'); - E2EGlobal.waitSomeTime(); - E2EGlobal.clickWithRetry('#navbar-dlgChangePassword'); - E2EGlobal.waitSomeTime(); + expect(await E2EApp.isLoggedIn()).to.be.true; + await E2EGlobal.clickWithRetry('#navbar-usermenu'); + await E2EGlobal.waitSomeTime(); + await E2EGlobal.clickWithRetry('#navbar-dlgChangePassword'); + await E2EGlobal.waitSomeTime(); let oldPassword = E2EGlobal.SETTINGS.e2eTestPasswords[0]; - E2EUser.changePassword(oldPassword, 'TTest12', 'Test12'); + await E2EUser.changePassword(oldPassword, 'TTest12', 'Test12'); - browser.waitUntil(_ => browser.isVisible('#frmDlgChangePassword'), waitUntilTimeout); - E2EGlobal.clickWithRetry('#btnChangePasswordCancel'); + await browser.waitUntil(async _ => await browser.isVisible('#frmDlgChangePassword'), waitUntilTimeout); + await E2EGlobal.clickWithRetry('#btnChangePasswordCancel'); }); it('User can not change his password, if he typed his old password incorrect', function () { - expect(E2EApp.isLoggedIn()).to.be.true; - E2EGlobal.clickWithRetry('#navbar-usermenu'); - E2EGlobal.waitSomeTime(); - E2EGlobal.clickWithRetry('#navbar-dlgChangePassword'); - E2EGlobal.waitSomeTime(); + expect(await E2EApp.isLoggedIn()).to.be.true; + await E2EGlobal.clickWithRetry('#navbar-usermenu'); + await E2EGlobal.waitSomeTime(); + await E2EGlobal.clickWithRetry('#navbar-dlgChangePassword'); + await E2EGlobal.waitSomeTime(); let oldPassword = '4Minitz!'; - E2EUser.changePassword(oldPassword, 'Test12', 'Test12'); - browser.waitUntil(_ => browser.isVisible('#frmDlgChangePassword'), waitUntilTimeout); - E2EGlobal.clickWithRetry('#btnChangePasswordCancel'); - E2EGlobal.waitSomeTime(); + await E2EUser.changePassword(oldPassword, 'Test12', 'Test12'); + await browser.waitUntil(async _ => await browser.isVisible('#frmDlgChangePassword'), waitUntilTimeout); + await E2EGlobal.clickWithRetry('#btnChangePasswordCancel'); + await E2EGlobal.waitSomeTime(); }); it('User can not change his password, if his new password is not valid due to guidelines', function () { - expect(E2EApp.isLoggedIn()).to.be.true; - E2EGlobal.clickWithRetry('#navbar-usermenu'); - E2EGlobal.waitSomeTime(); - E2EGlobal.clickWithRetry('#navbar-dlgChangePassword'); - E2EGlobal.waitSomeTime(); + expect(await E2EApp.isLoggedIn()).to.be.true; + await E2EGlobal.clickWithRetry('#navbar-usermenu'); + await E2EGlobal.waitSomeTime(); + await E2EGlobal.clickWithRetry('#navbar-dlgChangePassword'); + await E2EGlobal.waitSomeTime(); let oldPassword = E2EGlobal.SETTINGS.e2eTestPasswords[0]; - E2EUser.changePassword(oldPassword, 'test12', 'test12'); - browser.waitUntil(_ => browser.isVisible('#frmDlgChangePassword'), waitUntilTimeout); - E2EGlobal.clickWithRetry('#btnChangePasswordCancel'); - E2EGlobal.waitSomeTime(); + await E2EUser.changePassword(oldPassword, 'test12', 'test12'); + await browser.waitUntil(async _ => await browser.isVisible('#frmDlgChangePassword'), waitUntilTimeout); + await E2EGlobal.clickWithRetry('#btnChangePasswordCancel'); + await E2EGlobal.waitSomeTime(); }); it('User can successefully change his profile', function () { - expect(E2EApp.isLoggedIn()).to.be.true; + expect(await E2EApp.isLoggedIn()).to.be.true; let longName = 'longname'; let email = 'test@test.de'; - E2EGlobal.clickWithRetry('#navbar-usermenu'); - E2EGlobal.waitSomeTime(); - E2EGlobal.clickWithRetry('#navbar-dlgEditProfile'); - E2EGlobal.waitSomeTime(); - E2EUser.editProfile(longName, email); - browser.waitUntil(_ => !browser.isVisible('#frmDlgEditProfile'), waitUntilTimeout); - expect(E2EUser.checkProfileChanged(longName, email).value).to.be.true; + await E2EGlobal.clickWithRetry('#navbar-usermenu'); + await E2EGlobal.waitSomeTime(); + await E2EGlobal.clickWithRetry('#navbar-dlgEditProfile'); + await E2EGlobal.waitSomeTime(); + await E2EUser.editProfile(longName, email); + await browser.waitUntil(async _ => !(await browser.isVisible('#frmDlgEditProfile')), waitUntilTimeout); + expect((await E2EUser.checkProfileChanged(longName, email)).value).to.be.true; }); it('User can not save his profile with an invalid Email', function () { - expect(E2EApp.isLoggedIn()).to.be.true; + expect(await E2EApp.isLoggedIn()).to.be.true; let longName = 'longname'; let email = 'testtest.de'; - E2EGlobal.clickWithRetry('#navbar-usermenu'); - E2EGlobal.waitSomeTime(); - E2EGlobal.clickWithRetry('#navbar-dlgEditProfile'); - E2EGlobal.waitSomeTime(); - E2EUser.editProfile(longName, email); - browser.waitUntil(_ => browser.isVisible('#frmDlgEditProfile'), waitUntilTimeout); - expect(E2EUser.checkProfileChanged(longName, email).value).to.be.false; + await E2EGlobal.clickWithRetry('#navbar-usermenu'); + await E2EGlobal.waitSomeTime(); + await E2EGlobal.clickWithRetry('#navbar-dlgEditProfile'); + await E2EGlobal.waitSomeTime(); + await E2EUser.editProfile(longName, email); + await browser.waitUntil(async _ => await browser.isVisible('#frmDlgEditProfile'), waitUntilTimeout); + expect((await E2EUser.checkProfileChanged(longName, email)).value).to.be.false; }); it('User profile is not changed, if pressing Cancel', function () { - expect(E2EApp.isLoggedIn()).to.be.true; + expect(await E2EApp.isLoggedIn()).to.be.true; let longName = 'cancellongname'; let email = 'canceltest@test.de'; - E2EGlobal.clickWithRetry('#navbar-usermenu'); - E2EGlobal.waitSomeTime(); - E2EGlobal.clickWithRetry('#navbar-dlgEditProfile'); - E2EGlobal.waitSomeTime(); - E2EUser.editProfile(longName, email, false); - - E2EGlobal.clickWithRetry('#btnEditProfileCancel'); - browser.waitUntil(_ => !E2EUser.checkProfileChanged(longName,email).value, waitUntilTimeout); + await E2EGlobal.clickWithRetry('#navbar-usermenu'); + await E2EGlobal.waitSomeTime(); + await E2EGlobal.clickWithRetry('#navbar-dlgEditProfile'); + await E2EGlobal.waitSomeTime(); + await E2EUser.editProfile(longName, email, false); + + await E2EGlobal.clickWithRetry('#btnEditProfileCancel'); + await browser.waitUntil(async _ => !(await E2EUser.checkProfileChanged(longName,email)).value, waitUntilTimeout); }); it('User can save his profile with an empty LongName', function () { - expect(E2EApp.isLoggedIn()).to.be.true; + expect(await E2EApp.isLoggedIn()).to.be.true; let longName = ''; let email = 'test@test.de'; - E2EGlobal.clickWithRetry('#navbar-usermenu'); - E2EGlobal.waitSomeTime(); - E2EGlobal.clickWithRetry('#navbar-dlgEditProfile'); - E2EGlobal.waitSomeTime(); - E2EUser.editProfile(longName, email); - browser.waitUntil(_ => E2EUser.checkProfileChanged(longName,email).value, waitUntilTimeout); + await E2EGlobal.clickWithRetry('#navbar-usermenu'); + await E2EGlobal.waitSomeTime(); + await E2EGlobal.clickWithRetry('#navbar-dlgEditProfile'); + await E2EGlobal.waitSomeTime(); + await E2EUser.editProfile(longName, email); + await browser.waitUntil(async _ => (await E2EUser.checkProfileChanged(longName,email)).value, waitUntilTimeout); }); it('User can not save his profile with an empty Email', function () { - expect(E2EApp.isLoggedIn()).to.be.true; + expect(await E2EApp.isLoggedIn()).to.be.true; let longName = 'longname'; let email = ''; - E2EGlobal.clickWithRetry('#navbar-usermenu'); - E2EGlobal.waitSomeTime(); - E2EGlobal.clickWithRetry('#navbar-dlgEditProfile'); - E2EGlobal.waitSomeTime(); - E2EUser.editProfile(longName, email); - E2EGlobal.waitUntil(_ => !E2EUser.checkProfileChanged(longName,email).value, waitUntilTimeout); + await E2EGlobal.clickWithRetry('#navbar-usermenu'); + await E2EGlobal.waitSomeTime(); + await E2EGlobal.clickWithRetry('#navbar-dlgEditProfile'); + await E2EGlobal.waitSomeTime(); + await E2EUser.editProfile(longName, email); + await E2EGlobal.waitUntil(async _ => !(await E2EUser.checkProfileChanged(longName,email)).value, waitUntilTimeout); }); it('User can change his longname without editing his Email', function () { - expect(E2EApp.isLoggedIn()).to.be.true; + expect(await E2EApp.isLoggedIn()).to.be.true; let longName = 'longnameChanged'; - let email = E2EUser.getUserEmail(); - E2EGlobal.clickWithRetry('#navbar-usermenu'); - E2EGlobal.waitSomeTime(); - E2EGlobal.clickWithRetry('#navbar-dlgEditProfile'); - E2EGlobal.waitSomeTime(); - E2EUser.editProfile(longName, email); - E2EGlobal.waitUntil(_ => !E2EUser.checkProfileChanged(longName,email).value, waitUntilTimeout); + let email = await E2EUser.getUserEmail(); + await E2EGlobal.clickWithRetry('#navbar-usermenu'); + await E2EGlobal.waitSomeTime(); + await E2EGlobal.clickWithRetry('#navbar-dlgEditProfile'); + await E2EGlobal.waitSomeTime(); + await E2EUser.editProfile(longName, email); + await E2EGlobal.waitUntil(async _ => !(await E2EUser.checkProfileChanged(longName,email)).value, waitUntilTimeout); }); it('Clicking the back button closes the password change dialog', function () { - expect(E2EApp.isLoggedIn()).to.be.true; - E2EGlobal.clickWithRetry('#navbar-usermenu'); - browser.waitForVisible('#navbar-dlgEditProfile'); + expect(await E2EApp.isLoggedIn()).to.be.true; + await E2EGlobal.clickWithRetry('#navbar-usermenu'); + await browser.waitForVisible('#navbar-dlgEditProfile'); - E2EGlobal.clickWithRetry('#navbar-dlgEditProfile'); - browser.waitForVisible('#dlgEditProfile'); + await E2EGlobal.clickWithRetry('#navbar-dlgEditProfile'); + await browser.waitForVisible('#dlgEditProfile'); - browser.back(); + await browser.back(); const waitForInvisible = true; - browser.waitForVisible('#dlgEditProfile', 10000, waitForInvisible); + await browser.waitForVisible('#dlgEditProfile', 10000, waitForInvisible); }); }); diff --git a/tests/end2end/UserRoles_security.js b/tests/end2end/UserRoles_security.js index 885557fd4..175705754 100644 --- a/tests/end2end/UserRoles_security.js +++ b/tests/end2end/UserRoles_security.js @@ -6,101 +6,101 @@ const newRoleModerator = '01'; describe('UserRoles Method Security', function () { beforeEach('goto start page and make sure test user is logged in', function () { - E2EApp.gotoStartPage(); - expect(E2EApp.isLoggedIn()).to.be.true; + await E2EApp.gotoStartPage(); + expect(await E2EApp.isLoggedIn()).to.be.true; }); before('reload page and reset app', function () { - E2EGlobal.logTimestamp("Start test suite"); - E2EApp.resetMyApp(true); - E2EApp.launchApp(); + await E2EGlobal.logTimestamp("Start test suite"); + await E2EApp.resetMyApp(true); + await E2EApp.launchApp(); }); //userroles.saveRoleForMeetingSeries it('a user can not upgrade himself to a moderator of MS', function () { const name = 'Update my own Role Project'; - const meetingSeriesID = E2ESecurity.createMeetingSeries(name); - E2ESecurity.inviteUserToMeetingSerie(name, 'Invited', 1); - const oldRole = server.call('e2e.getUserRole', meetingSeriesID, 1); - - E2EApp.loginUser(1); - expect(E2EApp.isLoggedIn()).to.be.true; - E2ESecurity.tryUpdateRole(meetingSeriesID, 1, newRoleModerator, oldRole); - E2EApp.loginUser(); + const meetingSeriesID = await E2ESecurity.createMeetingSeries(name); + await E2ESecurity.inviteUserToMeetingSerie(name, 'Invited', 1); + const oldRole = await server.call('e2e.getUserRole', meetingSeriesID, 1); + + await E2EApp.loginUser(1); + expect(await E2EApp.isLoggedIn()).to.be.true; + await E2ESecurity.tryUpdateRole(meetingSeriesID, 1, newRoleModerator, oldRole); + await E2EApp.loginUser(); }); it('a moderator can change a role of an invited user in Meeting Series', function () { const name = 'Update my own Role Moderator Project'; - const meetingSeriesID = E2ESecurity.createMeetingSeries(name); - E2ESecurity.inviteUserToMeetingSerie(name, 'Invited', 1); + const meetingSeriesID = await E2ESecurity.createMeetingSeries(name); + await E2ESecurity.inviteUserToMeetingSerie(name, 'Invited', 1); - E2ESecurity.tryUpdateRole(meetingSeriesID, 1, newRoleModerator, newRoleModerator) + await E2ESecurity.tryUpdateRole(meetingSeriesID, 1, newRoleModerator, newRoleModerator) }); it('a user can not change a Role of another user in a Meeting Serie', function () { const name = 'Update other users Role Project'; - const meetingSeriesID = E2ESecurity.createMeetingSeries(name); + const meetingSeriesID = await E2ESecurity.createMeetingSeries(name); - E2ESecurity.inviteUserToMeetingSerie(name, 'Invited', 1); - const oldRoleUser1 = server.call('e2e.getUserRole', meetingSeriesID, 1); + await E2ESecurity.inviteUserToMeetingSerie(name, 'Invited', 1); + const oldRoleUser1 = await server.call('e2e.getUserRole', meetingSeriesID, 1); - E2EApp.loginUser(2); - expect(E2EApp.isLoggedIn()).to.be.true; - E2ESecurity.tryUpdateRole(meetingSeriesID, 1, newRoleModerator, oldRoleUser1); - E2EApp.loginUser(); + await E2EApp.loginUser(2); + expect(await E2EApp.isLoggedIn()).to.be.true; + await E2ESecurity.tryUpdateRole(meetingSeriesID, 1, newRoleModerator, oldRoleUser1); + await E2EApp.loginUser(); }); it('a user can not add himself to a Meeting Serie', function () { const name = 'RoleUpdate add to MS Project'; - const meetingSeriesID = E2ESecurity.createMeetingSeries(name); + const meetingSeriesID = await E2ESecurity.createMeetingSeries(name); - E2EApp.loginUser(1); - expect(E2EApp.isLoggedIn()).to.be.true; - E2ESecurity.tryUpdateRole(meetingSeriesID, 1, newRoleModerator, null); - E2EApp.loginUser(); + await E2EApp.loginUser(1); + expect(await E2EApp.isLoggedIn()).to.be.true; + await E2ESecurity.tryUpdateRole(meetingSeriesID, 1, newRoleModerator, null); + await E2EApp.loginUser(); }); //userroles.removeAllRolesForMeetingSeries it('a Moderator can delete another user from a Meeting Serie', function () { const name = 'RoleDelete Moderator Project'; - const meetingSeriesID = E2ESecurity.createMeetingSeries(name); - E2ESecurity.inviteUserToMeetingSerie(name, 'Invited', 1); + const meetingSeriesID = await E2ESecurity.createMeetingSeries(name); + await E2ESecurity.inviteUserToMeetingSerie(name, 'Invited', 1); - E2ESecurity.tryRemoveRole(meetingSeriesID, 1, null); + await E2ESecurity.tryRemoveRole(meetingSeriesID, 1, null); }); it('a user can not delete another user from a Meeting Serie', function () { const name = 'RoleDelete invited user Project'; - const meetingSeriesID = E2ESecurity.createMeetingSeries(name); - E2ESecurity.inviteUserToMeetingSerie(name, 'Invited', 1); - E2ESecurity.inviteUserToMeetingSerie(name, 'Invited', 2); - const roleUser1 = server.call('e2e.getUserRole', meetingSeriesID, 1); - - E2EApp.loginUser(2); - expect(E2EApp.isLoggedIn()).to.be.true; - E2ESecurity.tryRemoveRole(meetingSeriesID, 1, roleUser1); - E2EApp.loginUser(); + const meetingSeriesID = await E2ESecurity.createMeetingSeries(name); + await E2ESecurity.inviteUserToMeetingSerie(name, 'Invited', 1); + await E2ESecurity.inviteUserToMeetingSerie(name, 'Invited', 2); + const roleUser1 = await server.call('e2e.getUserRole', meetingSeriesID, 1); + + await E2EApp.loginUser(2); + expect(await E2EApp.isLoggedIn()).to.be.true; + await E2ESecurity.tryRemoveRole(meetingSeriesID, 1, roleUser1); + await E2EApp.loginUser(); }); }); describe('Users Publish & Subscribe Security', function () { beforeEach('goto start page and make sure test user is logged in', function () { - E2EApp.gotoStartPage(); - expect(E2EApp.isLoggedIn()).to.be.true; + await E2EApp.gotoStartPage(); + expect(await E2EApp.isLoggedIn()).to.be.true; }); before('reload page and reset app', function () { - E2EApp.resetMyApp(true); - E2EApp.launchApp(); + await E2EApp.resetMyApp(true); + await E2EApp.launchApp(); }); it('Non-logged in users have no users collection published', function () { - expect(E2ESecurity.countRecordsInMiniMongo('users') > 0).to.be.true; + expect((await E2ESecurity.countRecordsInMiniMongo('users')) > 0).to.be.true; - E2EApp.logoutUser(); - expect(E2EApp.isNotLoggedIn()).to.be.true; - expect(E2ESecurity.countRecordsInMiniMongo('users'), + await E2EApp.logoutUser(); + expect(await E2EApp.isNotLoggedIn()).to.be.true; + await expect(await E2ESecurity.countRecordsInMiniMongo('users'), 'Not logged in user should not have users collection published').to.equal(0); - E2EApp.loginUser(); + await E2EApp.loginUser(); }); }); diff --git a/tests/end2end/helpers/E2EAdmin.js b/tests/end2end/helpers/E2EAdmin.js index e1b2cb878..ddbf4e08c 100644 --- a/tests/end2end/helpers/E2EAdmin.js +++ b/tests/end2end/helpers/E2EAdmin.js @@ -3,7 +3,7 @@ import { E2EApp } from './E2EApp'; export class E2EAdmin { - static getAdminRoute() { + static async getAdminRoute() { return 'admin'; } static selectorMap = { @@ -29,75 +29,75 @@ export class E2EAdmin { }; - static clickAdminMenu () { - if (E2EApp.isLoggedIn()) { - E2EGlobal.clickWithRetry('#navbar-usermenu'); - if (browser.isExisting('#navbar-admin')) { - E2EGlobal.clickWithRetry('#navbar-admin'); - E2EGlobal.waitSomeTime(); + static async clickAdminMenu() { + if (await E2EApp.isLoggedIn()) { + await E2EGlobal.clickWithRetry('#navbar-usermenu'); + if (await browser.isExisting('#navbar-admin')) { + await E2EGlobal.clickWithRetry('#navbar-admin'); + await E2EGlobal.waitSomeTime(); return true; } - E2EGlobal.clickWithRetry('#navbar-usermenu'); // close open menu + await E2EGlobal.clickWithRetry('#navbar-usermenu'); // close open menu } return false; } - static isOnAdminView() { - return !!(browser.getUrl().includes(E2EAdmin.getAdminRoute()) - && browser.isVisible(E2EAdmin.selectorMap.btnRegisterNewUser)); + static async isOnAdminView() { + return !!((await browser.getUrl()).includes(await E2EAdmin.getAdminRoute()) + && (await browser.isVisible(E2EAdmin.selectorMap.btnRegisterNewUser))); } - static switchToTab(tabName) { + static async switchToTab(tabName) { if (tabName === "Users") { - E2EGlobal.clickWithRetry(E2EAdmin.selectorMap.tabUsers) + await E2EGlobal.clickWithRetry(E2EAdmin.selectorMap.tabUsers) } else if (tabName === "Messages") { - E2EGlobal.clickWithRetry(E2EAdmin.selectorMap.tabMessages) + await E2EGlobal.clickWithRetry(E2EAdmin.selectorMap.tabMessages) } else { throw new Exception("Unknown admin tab: "+tabName); } - E2EGlobal.waitSomeTime(600); + await E2EGlobal.waitSomeTime(600); } - static setShowInactive(showInactive) { - if (showInactive !== E2EGlobal.isCheckboxSelected(E2EAdmin.selectorMap.chkShowInactiveUsers)) { + static async setShowInactive(showInactive) { + if (showInactive !== (await E2EGlobal.isCheckboxSelected(E2EAdmin.selectorMap.chkShowInactiveUsers))) { // With material design we can only toggle a checkbox via click on it's label - E2EGlobal.clickWithRetry(E2EAdmin.selectorMap.labShowInactiveUsers); - E2EGlobal.waitSomeTime(); + await E2EGlobal.clickWithRetry(E2EAdmin.selectorMap.labShowInactiveUsers); + await E2EGlobal.waitSomeTime(); } } - static filterForUser(username) { - browser.setValue(E2EAdmin.selectorMap.inpFilterUsers, username); + static async filterForUser(username) { + await browser.setValue(E2EAdmin.selectorMap.inpFilterUsers, username); } - static toggleUserActiveState(index) { + static async toggleUserActiveState(index) { if (index === undefined) { index = 1; } let selector = E2EAdmin.selectorMap.btnToggleUserInactive+':nth-child('+index+')'; - E2EGlobal.clickWithRetry(selector); - E2EGlobal.waitSomeTime(); + await E2EGlobal.clickWithRetry(selector); + await E2EGlobal.waitSomeTime(); } - static sendNewBroadcastMessage(message) { - E2EAdmin.switchToTab("Messages"); - browser.setValue(E2EAdmin.selectorMap.inpNewMessage, message); - browser.keys(['Enter']); - E2EGlobal.waitSomeTime(500); + static async sendNewBroadcastMessage(message) { + await E2EAdmin.switchToTab("Messages"); + await browser.setValue(E2EAdmin.selectorMap.inpNewMessage, message); + await browser.keys(['Enter']); + await E2EGlobal.waitSomeTime(500); } - static registerNewUser(username, longname, email, password) { - E2EGlobal.clickWithRetry(E2EAdmin.selectorMap.btnRegisterNewUser); - E2EGlobal.waitSomeTime(500); + static async registerNewUser(username, longname, email, password) { + await E2EGlobal.clickWithRetry(E2EAdmin.selectorMap.btnRegisterNewUser); + await E2EGlobal.waitSomeTime(500); - browser.setValue(E2EAdmin.selectorMap.inpNewUser_username, username); - browser.setValue(E2EAdmin.selectorMap.inpNewUser_longname, longname); - browser.setValue(E2EAdmin.selectorMap.inpNewUser_email, email); - browser.setValue(E2EAdmin.selectorMap.inpNewUser_password1, password); - browser.setValue(E2EAdmin.selectorMap.inpNewUser_password2, password); + await browser.setValue(E2EAdmin.selectorMap.inpNewUser_username, username); + await browser.setValue(E2EAdmin.selectorMap.inpNewUser_longname, longname); + await browser.setValue(E2EAdmin.selectorMap.inpNewUser_email, email); + await browser.setValue(E2EAdmin.selectorMap.inpNewUser_password1, password); + await browser.setValue(E2EAdmin.selectorMap.inpNewUser_password2, password); - E2EGlobal.clickWithRetry(E2EAdmin.selectorMap.btnNewUser_Save); - E2EGlobal.waitSomeTime(500); + await E2EGlobal.clickWithRetry(E2EAdmin.selectorMap.btnNewUser_Save); + await E2EGlobal.waitSomeTime(500); } } diff --git a/tests/end2end/helpers/E2EApp.js b/tests/end2end/helpers/E2EApp.js index 0f5cc811f..bde1211ae 100644 --- a/tests/end2end/helpers/E2EApp.js +++ b/tests/end2end/helpers/E2EApp.js @@ -6,60 +6,60 @@ export class E2EApp { static titlePrefix = '4Minitz!'; // Calls the server method to clean database and create fresh test users - static resetMyApp (skipUsers) { + static async resetMyApp(skipUsers) { try { - server.call('e2e.resetMyApp', skipUsers); // call meteor server method + await server.call('e2e.resetMyApp', skipUsers); // call meteor server method } catch (e) { console.log('Exception: '+e); console.log('Did you forget to run the server with \'--settings settings-test-end2end.json\'?'); } } - static isLoggedIn () { + static async isLoggedIn() { try { - browser.waitForExist('#navbar-usermenu', 5000); // browser = WebdriverIO instance + await browser.waitForExist('#navbar-usermenu', 5000); // browser = WebdriverIO instance } catch (e) { // give browser some time, on fresh login - E2EGlobal.saveScreenshot('isLoggedIn_failed'); + await E2EGlobal.saveScreenshot('isLoggedIn_failed'); } return browser.isExisting('#navbar-usermenu'); } // We need a separate isNotLoggedIn() as the isLoggedIn() returns too quick on "!isLoggedIn()" - static isNotLoggedIn () { + static async isNotLoggedIn() { try { - browser.waitForExist('#tab_standard', 5000); // browser = WebdriverIO instance + await browser.waitForExist('#tab_standard', 5000); // browser = WebdriverIO instance } catch (e) { // give browser some time, on fresh login - E2EGlobal.saveScreenshot('isNotLoggedIn_failed'); + await E2EGlobal.saveScreenshot('isNotLoggedIn_failed'); } return browser.isExisting('#tab_standard'); } - static logoutUser () { - if (E2EApp.isLoggedIn()) { - E2EGlobal.clickWithRetry('#navbar-usermenu'); - E2EGlobal.clickWithRetry('#navbar-signout'); - E2EGlobal.waitSomeTime(); + static async logoutUser() { + if (await E2EApp.isLoggedIn()) { + await E2EGlobal.clickWithRetry('#navbar-usermenu'); + await E2EGlobal.clickWithRetry('#navbar-signout'); + await E2EGlobal.waitSomeTime(); } E2EApp._currentlyLoggedInUser = ''; - E2EGlobal.waitSomeTime(600); // give title change time to settle - expect(browser.getTitle()).to.equal(E2EApp.titlePrefix); + await E2EGlobal.waitSomeTime(600); // give title change time to settle + await expect(await browser.getTitle()).to.equal(E2EApp.titlePrefix); } - static loginLdapUserWithCredentials(username, password, autoLogout) { - this.loginUserWithCredentials(username, password, autoLogout, '#tab_ldap'); + static async loginLdapUserWithCredentials(username, password, autoLogout) { + await this.loginUserWithCredentials(username, password, autoLogout, '#tab_ldap'); } - static loginFailed() { - const standardLoginErrorAlertExists = browser.isExisting('.at-error.alert.alert-danger'), - generalAlertExists = browser.isExisting('.alert.alert-danger'); + static async loginFailed() { + const standardLoginErrorAlertExists = await browser.isExisting('.at-error.alert.alert-danger'), + generalAlertExists = await browser.isExisting('.alert.alert-danger'); let generalAlertShowsLoginFailure = false; try { if (generalAlertExists) { - generalAlertShowsLoginFailure = browser.getHTML('.alert.alert-danger').includes('403'); + generalAlertShowsLoginFailure = (await browser.getHTML('.alert.alert-danger')).includes('403'); } } catch (e) { const expectedError = 'An element could not be located on the page using the given search parameters (".alert.alert-danger")'; @@ -72,62 +72,62 @@ export class E2EApp { (generalAlertExists && generalAlertShowsLoginFailure); } - static loginUserWithCredentials(username, password, autoLogout = true, tab = '#tab_standard') { + static async loginUserWithCredentials(username, password, autoLogout = true, tab = '#tab_standard') { if (autoLogout) { - E2EApp.logoutUser(); + await E2EApp.logoutUser(); } try { - browser.waitForVisible(tab, 5000); - E2EGlobal.clickWithRetry(tab); + await browser.waitForVisible(tab, 5000); + await E2EGlobal.clickWithRetry(tab); - browser.waitUntil(_ => { - let tabIsStandard = browser.isExisting('#at-field-username_and_email'); + await browser.waitUntil(async _ => { + let tabIsStandard = await browser.isExisting('#at-field-username_and_email'); let userWantsStandard = tab === '#tab_standard'; - let tabIsLdap = browser.isExisting('#id_ldapUsername'); + let tabIsLdap = await browser.isExisting('#id_ldapUsername'); let userWantsLdap = tab === '#tab_ldap'; return (tabIsStandard && userWantsStandard) || (tabIsLdap && userWantsLdap); }, 7500, 'The login screen could not been loaded in time'); - let tabIsStandard = browser.isExisting('#at-field-username_and_email'); - let tabIsLdap = browser.isExisting('#id_ldapUsername'); + let tabIsStandard = await browser.isExisting('#at-field-username_and_email'); + let tabIsLdap = await browser.isExisting('#id_ldapUsername'); if (tabIsStandard) { - E2EGlobal.setValueSafe('input[id="at-field-username_and_email"]', username); - E2EGlobal.setValueSafe('input[id="at-field-password"]', password); + await E2EGlobal.setValueSafe('input[id="at-field-username_and_email"]', username); + await E2EGlobal.setValueSafe('input[id="at-field-password"]', password); } if (tabIsLdap) { - E2EGlobal.setValueSafe('input[id="id_ldapUsername"]', username); - E2EGlobal.setValueSafe('input[id="id_ldapPassword"]', password); + await E2EGlobal.setValueSafe('input[id="id_ldapUsername"]', username); + await E2EGlobal.setValueSafe('input[id="id_ldapPassword"]', password); } - browser.keys(['Enter']); + await browser.keys(['Enter']); - browser.waitUntil(_ => { - const userMenuExists = browser.isExisting('#navbar-usermenu'); - return userMenuExists || E2EApp.loginFailed(); + await browser.waitUntil(async _ => { + const userMenuExists = await browser.isExisting('#navbar-usermenu'); + return userMenuExists || (await E2EApp.loginFailed()); }, 20000, 'The login could not been processed in time'); - if (E2EApp.loginFailed()) { + if (await E2EApp.loginFailed()) { throw new Error ('Unknown user or wrong password.'); } - if (! E2EApp.isLoggedIn()) { + if (! (await E2EApp.isLoggedIn())) { console.log('loginUserWithCredentials: no success via UI... trying Meteor.loginWithPassword()'); - browser.execute( function() { + await browser.execute( function() { Meteor.loginWithPassword(username, password); }); - browser.waitUntil(_ => { - const userMenuExists = browser.isExisting('#navbar-usermenu'); - return userMenuExists || E2EApp.loginFailed(); + await browser.waitUntil(async _ => { + const userMenuExists = await browser.isExisting('#navbar-usermenu'); + return userMenuExists || (await E2EApp.loginFailed()); }, 5000); } E2EApp._currentlyLoggedInUser = username; } catch (e) { - E2EGlobal.saveScreenshot('loginUserWithCredentials_failed'); + await E2EGlobal.saveScreenshot('loginUserWithCredentials_failed'); throw new Error (`Login failed for user ${username} with ${password}\nwith ${e}`); } } @@ -137,7 +137,7 @@ export class E2EApp { * @param indexOrUsername of test user from setting. optional. * @param autoLogout perform logout before login the test user. optional. */ - static loginUser (indexOrUsername, autoLogout) { + static async loginUser(indexOrUsername, autoLogout) { if (!indexOrUsername) { indexOrUsername = 0; } @@ -153,27 +153,27 @@ export class E2EApp { let aUser = E2EGlobal.SETTINGS.e2eTestUsers[indexOrUsername]; let aPassword = E2EGlobal.SETTINGS.e2eTestPasswords[indexOrUsername]; - this.loginUserWithCredentials(aUser, aPassword, autoLogout); + await this.loginUserWithCredentials(aUser, aPassword, autoLogout); } - static getCurrentUser () { + static async getCurrentUser() { return E2EApp._currentlyLoggedInUser; } - static launchApp () { - browser.url(E2EGlobal.SETTINGS.e2eUrl); + static async launchApp() { + await browser.url(E2EGlobal.SETTINGS.e2eUrl); - E2EGlobal.waitSomeTime(600); // give title change time to settle - const title = browser.getTitle(); + await E2EGlobal.waitSomeTime(600); // give title change time to settle + const title = await browser.getTitle(); if (title !== E2EApp.titlePrefix) { throw new Error(`App not loaded. Unexpected title ${title}. Please run app with 'meteor npm run test:end2end:server'`); } } - static isOnStartPage () { + static async isOnStartPage() { // post-condition try { - browser.waitForExist('#btnNewMeetingSeries', 2000); + await browser.waitForExist('#btnNewMeetingSeries', 2000); } catch (e) { return false; } @@ -182,74 +182,74 @@ export class E2EApp { // We can't use "launchApp" here, as this resets the browser // so we click on the "Logo" icon - static gotoStartPage () { - browser.keys(['Escape']); // close eventually open modal dialog - E2EGlobal.waitSomeTime(); + static async gotoStartPage() { + await browser.keys(['Escape']); // close eventually open modal dialog + await E2EGlobal.waitSomeTime(); try { - browser.waitForExist('a.navbar-brand', 2500); + await browser.waitForExist('a.navbar-brand', 2500); } catch (e) { - E2EApp.launchApp(); + await E2EApp.launchApp(); } // Just in case we have not already a user logged in, we do it here! - if (! E2EApp.isLoggedIn()) { - E2EApp.loginUser(0, false); + if (! (await E2EApp.isLoggedIn())) { + await E2EApp.loginUser(0, false); } - E2EGlobal.clickWithRetry('a.navbar-brand', 6000); - E2EGlobal.waitSomeTime(); + await E2EGlobal.clickWithRetry('a.navbar-brand', 6000); + await E2EGlobal.waitSomeTime(); // check post-condition - if (! E2EApp.isOnStartPage()) { - E2EGlobal.clickWithRetry('a.navbar-brand'); - E2EGlobal.waitSomeTime(1500); + if (! (await E2EApp.isOnStartPage())) { + await E2EGlobal.clickWithRetry('a.navbar-brand'); + await E2EGlobal.waitSomeTime(1500); } - if (! E2EApp.isOnStartPage()) { - E2EGlobal.saveScreenshot('gotoStartPage2'); + if (! (await E2EApp.isOnStartPage())) { + await E2EGlobal.saveScreenshot('gotoStartPage2'); } // give title change time to settle try { - browser.waitUntil(function () { - return (browser.getTitle() === E2EApp.titlePrefix); + await browser.waitUntil(async function() { + return ((await browser.getTitle()) === E2EApp.titlePrefix); },5000,'Timeout! Title did not change! Will try to re-launchApp().',250); } catch (e) { - E2EApp.launchApp(); - E2EGlobal.waitSomeTime(); + await E2EApp.launchApp(); + await E2EGlobal.waitSomeTime(); } - expect(browser.getTitle()).to.equal(E2EApp.titlePrefix); - expect(E2EApp.isOnStartPage(), 'gotoStartPage()').to.be.true; + await expect(await browser.getTitle()).to.equal(E2EApp.titlePrefix); + expect(await E2EApp.isOnStartPage(), 'gotoStartPage()').to.be.true; } - static confirmationDialogCheckMessage (containedText) { - E2EGlobal.waitSomeTime(); - expect(browser.getText('div#confirmDialog'), 'Check confirmation messagebox contains text') + static async confirmationDialogCheckMessage(containedText) { + await E2EGlobal.waitSomeTime(); + await expect(await browser.getText('div#confirmDialog'), 'Check confirmation messagebox contains text') .to.contain(containedText); } - static confirmationDialogAnswer (pressOK) { - E2EGlobal.waitSomeTime(1250); // give dialog animation time - browser.waitForVisible('#confirmationDialogOK', 1000); + static async confirmationDialogAnswer(pressOK) { + await E2EGlobal.waitSomeTime(1250); // give dialog animation time + await browser.waitForVisible('#confirmationDialogOK', 1000); if (pressOK) { - E2EGlobal.clickWithRetry('#confirmationDialogOK'); + await E2EGlobal.clickWithRetry('#confirmationDialogOK'); } else { - E2EGlobal.clickWithRetry('#confirmationDialogCancel'); + await E2EGlobal.clickWithRetry('#confirmationDialogCancel'); } - E2EGlobal.waitSomeTime(1250); // give dialog animation time + await E2EGlobal.waitSomeTime(1250); // give dialog animation time } - static resetPassword(emailAdress) { - E2EGlobal.clickWithRetry('#at-forgotPwd'); - browser.setValue('#at-field-email', emailAdress); - E2EGlobal.clickWithRetry('#at-btn'); + static async resetPassword(emailAdress) { + await E2EGlobal.clickWithRetry('#at-forgotPwd'); + await browser.setValue('#at-field-email', emailAdress); + await E2EGlobal.clickWithRetry('#at-btn'); } - static gotoActionItemsTab() { + static async gotoActionItemsTab() { let selector = '#tab_actionItems'; try { - browser.waitForExist(selector); + await browser.waitForExist(selector); } catch (e) { return false; } - E2EGlobal.clickWithRetry(selector); - E2EGlobal.waitSomeTime(); + await E2EGlobal.clickWithRetry(selector); + await E2EGlobal.waitSomeTime(); } } diff --git a/tests/end2end/helpers/E2EAttachments.js b/tests/end2end/helpers/E2EAttachments.js index 9c4ec6a20..6c8a3f5f8 100644 --- a/tests/end2end/helpers/E2EAttachments.js +++ b/tests/end2end/helpers/E2EAttachments.js @@ -8,38 +8,38 @@ import { E2EMinutes } from './E2EMinutes' export class E2EAttachments { - static expandAttachmentsArea() { - browser.waitForExist("#btn2AttachmentsExpand"); - E2EGlobal.clickWithRetry("#btn2AttachmentsExpand"); - E2EGlobal.waitSomeTime(); + static async expandAttachmentsArea() { + await browser.waitForExist("#btn2AttachmentsExpand"); + await E2EGlobal.clickWithRetry("#btn2AttachmentsExpand"); + await E2EGlobal.waitSomeTime(); } - static isUploadButtonVisible() { + static async isUploadButtonVisible() { return browser.isVisible("#lblUpload"); } - static uploadFile (filename) { + static async uploadFile(filename) { expect(fs.existsSync(filename), "E2EAttachments.uploadFile(): file should exist: "+filename) .to.be.ok; - if (! E2EAttachments.isUploadButtonVisible()) { - E2EAttachments.expandAttachmentsArea(); + if (! (await E2EAttachments.isUploadButtonVisible())) { + await E2EAttachments.expandAttachmentsArea(); } // Different file upload mechanisms for headless and desktop browsers - if (E2EGlobal.browserIsPhantomJS()) { - browser.execute(function () { + if (await E2EGlobal.browserIsPhantomJS()) { + await browser.execute(function () { $('#btnUploadAttachment').attr("style", "").focus(); // remove display:none style so that focus() works }); - browser.keys(filename); // send filename as keystrokes + await browser.keys(filename); // send filename as keystrokes } else { - browser.chooseFile("#btnUploadAttachment", filename); + await browser.chooseFile("#btnUploadAttachment", filename); } - E2EGlobal.waitSomeTime(1500); + await E2EGlobal.waitSomeTime(1500); } - static getChromeDownloadDirectory() { + static async getChromeDownloadDirectory() { // .meteor/chimp_config.js configures chrome download dir relative to cwd() let chimpopts = require ('../../../.meteor/chimp_config'); let downloadDir = chimpopts.webdriverio.desiredCapabilities.chromeOptions.prefs["download.default_directory"]; @@ -48,24 +48,24 @@ export class E2EAttachments { return downloadDir; } - static switchToUserWithDifferentRole(newRole, _projectName, _lastMeetingName) { + static async switchToUserWithDifferentRole(newRole, _projectName, _lastMeetingName) { let user2 = E2EGlobal.SETTINGS.e2eTestUsers[1]; - E2EMeetingSeriesEditor.openMeetingSeriesEditor(_projectName, _lastMeetingName, "invited"); - E2EMeetingSeriesEditor.addUserToMeetingSeries(user2, newRole); - E2EMeetingSeriesEditor.closeMeetingSeriesEditor(true); // save! - E2EApp.loginUser(1); - E2EMeetingSeries.gotoMeetingSeries(_projectName, _lastMeetingName); - E2EMinutes.gotoLatestMinutes(); + await E2EMeetingSeriesEditor.openMeetingSeriesEditor(_projectName, _lastMeetingName, "invited"); + await E2EMeetingSeriesEditor.addUserToMeetingSeries(user2, newRole); + await E2EMeetingSeriesEditor.closeMeetingSeriesEditor(true); // save! + await E2EApp.loginUser(1); + await E2EMeetingSeries.gotoMeetingSeries(_projectName, _lastMeetingName); + await E2EMinutes.gotoLatestMinutes(); } - static countAttachmentsGlobally() { + static async countAttachmentsGlobally() { return server.call('e2e.countAttachmentsInMongoDB'); } // execute an attachment collection count in the // client browser context with currently logged in user - static countAttachmentsOnClientForCurrentUser() { - let result = browser.execute(function () { + static async countAttachmentsOnClientForCurrentUser() { + let result = await browser.execute(function () { let mod = require("/imports/collections/attachments_private"); let coll = mod.AttachmentsCollection; return coll.find().count(); @@ -74,18 +74,18 @@ export class E2EAttachments { } - static getAttachmentDocsForMinuteID(minID) { - E2EGlobal.waitSomeTime(2000); + static async getAttachmentDocsForMinuteID(minID) { + await E2EGlobal.waitSomeTime(2000); return server.call('e2e.getAttachmentsForMinute', minID); } - static getRemoveButtons() { - return browser.elements('button#btnDelAttachment').value; + static async getRemoveButtons() { + return (await browser.elements('button#btnDelAttachment')).value; } - static getDownloadLinks() { - return browser.elements('a.linkToAttachmentDownload').value; + static async getDownloadLinks() { + return (await browser.elements('a.linkToAttachmentDownload')).value; } } \ No newline at end of file diff --git a/tests/end2end/helpers/E2EGlobal.js b/tests/end2end/helpers/E2EGlobal.js index 31adb4991..3a57dd9a2 100644 --- a/tests/end2end/helpers/E2EGlobal.js +++ b/tests/end2end/helpers/E2EGlobal.js @@ -1,6 +1,6 @@ export class E2EGlobal { - static getTestSpecFilename() { + static async getTestSpecFilename() { if (!driver || !driver.config || !driver.config.spec) { return 'Unknown Test Spec Filename'; } @@ -11,8 +11,8 @@ export class E2EGlobal { return specfile.replace(/^.*[\\\/]/, ''); } - static setValueSafe(selector, string, retries = 5) { - let currentValue = browser.getValue(selector), + static async setValueSafe(selector, string, retries = 5) { + let currentValue = await browser.getValue(selector), isInteractable = true, count = 0; @@ -20,12 +20,12 @@ export class E2EGlobal { throw new Error('Entering newlines with setValueSafe is not supported.'); } - browser.waitForVisible(selector); + await browser.waitForVisible(selector); while (count < retries && currentValue !== string) { try { isInteractable = true; - browser.setValue(selector, string); + await browser.setValue(selector, string); } catch (e) { const message = e.toString(), notInteractable = message.includes('Element is not currently interactable and may not be manipulated'), @@ -39,7 +39,7 @@ export class E2EGlobal { } if (!isInteractable) { - currentValue = browser.getValue(selector); + currentValue = await browser.getValue(selector); } count++; } @@ -47,34 +47,34 @@ export class E2EGlobal { static pollingInterval = 250; - static waitUntil(predicate, timeout = 10000) { + static async waitUntil(predicate, timeout = 10000) { const start = new Date(); let current = new Date(); let i = 0; while (current - start < timeout) { try { - predicate(); + await predicate(); return; } catch (e) {} - browser.pause(E2EGlobal.pollingInterval); + await browser.pause(E2EGlobal.pollingInterval); current = new Date(); } throw new Error('waitUntil timeout'); } - static clickWithRetry(selector, timeout = 10000) { - browser.scroll(selector); - E2EGlobal.waitSomeTime(100); + static async clickWithRetry(selector, timeout = 10000) { + await browser.scroll(selector); + await E2EGlobal.waitSomeTime(100); const start = new Date(); let current = new Date(); while (current - start < timeout) { try { - browser.click(selector); - E2EGlobal.waitSomeTime(100); + await browser.click(selector); + await E2EGlobal.waitSomeTime(100); return; } catch (e) { const message = e.toString(), @@ -86,25 +86,25 @@ export class E2EGlobal { throw e; } } - browser.scroll(selector); - browser.pause(E2EGlobal.pollingInterval); + await browser.scroll(selector); + await browser.pause(E2EGlobal.pollingInterval); current = new Date(); } throw new Error(`clickWithRetry ${selector} timeout`); } - static waitSomeTime (milliseconds) { + static async waitSomeTime(milliseconds) { if (!milliseconds) { // bootstrap fade animation time is 250ms, so give this some more... ;-) milliseconds = 300; } - browser.pause(milliseconds); + await browser.pause(milliseconds); try { let max = 100; - while (browser.isVisible('#loading-container') && max > 0) { + while ((await browser.isVisible('#loading-container')) && max > 0) { // E2EGlobal.saveScreenshot('loading'); - browser.pause(100); + await browser.pause(100); max--; } } catch (e) { @@ -116,7 +116,7 @@ export class E2EGlobal { } } - static formatDateISO8601 (aDate) { + static async formatDateISO8601(aDate) { let dd = aDate.getDate(); let mm = aDate.getMonth()+1; //January is 0! let yyyy = aDate.getFullYear(); @@ -129,7 +129,7 @@ export class E2EGlobal { return yyyy+'-'+mm+'-'+dd; } - static formatTimeISO8601 (aDate) { + static async formatTimeISO8601(aDate) { let isoString = ''; try { @@ -141,7 +141,7 @@ export class E2EGlobal { return isoString; } - static browserName() { + static async browserName() { if (browser && browser._original && browser._original.desiredCapabilities && @@ -152,11 +152,11 @@ export class E2EGlobal { return 'unknown'; } - static browserIsPhantomJS() { - return (E2EGlobal.browserName() === 'phantomjs'); + static async browserIsPhantomJS() { + return ((await E2EGlobal.browserName()) === 'phantomjs'); } - static isChrome() { + static async isChrome() { if (browser && browser.options && browser.options.desiredCapabilities) { @@ -166,7 +166,7 @@ export class E2EGlobal { return false; } - static isHeadless() { + static async isHeadless() { if (browser && browser.options && browser.options.desiredCapabilities) { @@ -176,14 +176,14 @@ export class E2EGlobal { return false; } - static browserIsHeadlessChrome() { - return E2EGlobal.isChrome() && E2EGlobal.isHeadless(); + static async browserIsHeadlessChrome() { + return (await E2EGlobal.isChrome()) && (await E2EGlobal.isHeadless()); } - static isCheckboxSelected(selector) { - let element = browser.element(selector).value; + static async isCheckboxSelected(selector) { + let element = (await browser.element(selector)).value; let checkboxId = element.ELEMENT; - return browser.elementIdSelected(checkboxId).value; + return (await browser.elementIdSelected(checkboxId)).value; } /** @@ -192,36 +192,36 @@ export class E2EGlobal { * * @param filename */ - static saveScreenshot(filename) { + static async saveScreenshot(filename) { let dateStr = (new Date()).toISOString().replace(/[^0-9]/g, '') + '_'; - filename = E2EGlobal.getTestSpecFilename()+'_'+ + filename = (await E2EGlobal.getTestSpecFilename())+'_'+ dateStr + (filename ? '_' : '') + filename; let fullpath = './tests/snapshots/' + filename + '.png'; - browser.saveScreenshot(fullpath); + await browser.saveScreenshot(fullpath); console.log('Screenshot taken: ', fullpath); return fullpath; } - static sendKeysWithPause(...keysAndPauses) { - function isOdd(num) { + static async sendKeysWithPause(...keysAndPauses) { + async function isOdd(num) { return num % 2; } - const keys = keysAndPauses.filter((_, index) => !isOdd(index)), - pauses = keysAndPauses.filter((_, index) => isOdd(index)), + const keys = keysAndPauses.filter((_, index) => !(await isOdd(index))), + pauses = keysAndPauses.filter((_, index) => await isOdd(index)), numberOfKeys = keys.length; for (let i = 0; i < numberOfKeys; ++i) { - browser.keys(keys[i]); - E2EGlobal.waitSomeTime(pauses[i] || 250); + await browser.keys(keys[i]); + await E2EGlobal.waitSomeTime(pauses[i] || 250); // E2EGlobal.saveScreenshot(`keys-with-pause-${i}`); } } - static logTimestamp(text) { - console.log('---', E2EGlobal.formatTimeISO8601(new Date()), text); + static async logTimestamp(text) { + console.log('---', await E2EGlobal.formatTimeISO8601(new Date()), text); } } diff --git a/tests/end2end/helpers/E2EMails.js b/tests/end2end/helpers/E2EMails.js index bcd995451..9eea1decb 100644 --- a/tests/end2end/helpers/E2EMails.js +++ b/tests/end2end/helpers/E2EMails.js @@ -2,24 +2,24 @@ import {E2EGlobal} from './E2EGlobal'; export class E2EMails { - static resetSentMailsDb() { - server.call('e2e.resetTestMailDB'); + static async resetSentMailsDb() { + await server.call('e2e.resetTestMailDB'); } - static getAllSentMails() { - E2EGlobal.waitSomeTime(700); + static async getAllSentMails() { + await E2EGlobal.waitSomeTime(700); return server.call('e2e.findSentMails'); } /** * Returns all recipients of all sent mails */ - static getAllRecipients() { - let mails = E2EMails.getAllSentMails(); + static async getAllRecipients() { + let mails = await E2EMails.getAllSentMails(); let recipients = []; - mails.forEach(mail => { + for (const mail of mails) { recipients = recipients.concat(mail.to); - }); + }; return recipients; } } \ No newline at end of file diff --git a/tests/end2end/helpers/E2EMeetingSeries.js b/tests/end2end/helpers/E2EMeetingSeries.js index e2c52fefe..72ce775b6 100644 --- a/tests/end2end/helpers/E2EMeetingSeries.js +++ b/tests/end2end/helpers/E2EMeetingSeries.js @@ -3,74 +3,74 @@ import { E2EApp } from './E2EApp'; export class E2EMeetingSeries { - static countMeetingSeries (gotToStartPage = true) { + static async countMeetingSeries(gotToStartPage = true) { if (gotToStartPage) { - E2EApp.gotoStartPage(); + await E2EApp.gotoStartPage(); } try { - browser.waitForExist('li.meeting-series-item'); + await browser.waitForExist('li.meeting-series-item'); } catch (e) { return 0; // we have no meeting series
  • => "zero" result } - const elements = browser.elements('li.meeting-series-item'); + const elements = await browser.elements('li.meeting-series-item'); return elements.length; } - static editMeetingSeriesForm (aProj, aName, switchInput) { - E2EApp.gotoStartPage(); + static async editMeetingSeriesForm(aProj, aName, switchInput) { + await E2EApp.gotoStartPage(); // is "create MeetingSeries dialog" closed? - if (!browser.isVisible('input[id="id_meetingproject"]')) { - E2EGlobal.clickWithRetry('#btnNewMeetingSeries'); // open - E2EGlobal.waitSomeTime(); - browser.waitForVisible('input[id="id_meetingproject"]'); + if (!(await browser.isVisible('input[id="id_meetingproject"]'))) { + await E2EGlobal.clickWithRetry('#btnNewMeetingSeries'); // open + await E2EGlobal.waitSomeTime(); + await browser.waitForVisible('input[id="id_meetingproject"]'); } if (switchInput) { - browser.setValue('input[id="id_meetingname"]', aName); - browser.setValue('input[id="id_meetingproject"]', aProj); + await browser.setValue('input[id="id_meetingname"]', aName); + await browser.setValue('input[id="id_meetingproject"]', aProj); } else { - browser.setValue('input[id="id_meetingproject"]', aProj); - browser.setValue('input[id="id_meetingname"]', aName); + await browser.setValue('input[id="id_meetingproject"]', aProj); + await browser.setValue('input[id="id_meetingname"]', aName); } } - static createMeetingSeries (aProj, aName, keepOpenMSEditor, switchInput) { - this.editMeetingSeriesForm(aProj, aName, switchInput); - E2EGlobal.waitSomeTime(); + static async createMeetingSeries(aProj, aName, keepOpenMSEditor, switchInput) { + await this.editMeetingSeriesForm(aProj, aName, switchInput); + await E2EGlobal.waitSomeTime(); - E2EGlobal.clickWithRetry('#btnAddInvite'); - E2EGlobal.logTimestamp('will open MS Editor'); + await E2EGlobal.clickWithRetry('#btnAddInvite'); + await E2EGlobal.logTimestamp('will open MS Editor'); try { - browser.waitForVisible('#btnMeetinSeriesEditCancel', 5000); // will check every 500ms - E2EGlobal.logTimestamp('is open: MS Editor'); + await browser.waitForVisible('#btnMeetinSeriesEditCancel', 5000); // will check every 500ms + await E2EGlobal.logTimestamp('is open: MS Editor'); } catch (e) { - E2EGlobal.logTimestamp('could not open: MS Editor'); + await E2EGlobal.logTimestamp('could not open: MS Editor'); if (keepOpenMSEditor) { throw e; } } - E2EGlobal.waitSomeTime(1000); // additional time for panel switch! - let meetingSeriesID = browser.getUrl(); + await E2EGlobal.waitSomeTime(1000); // additional time for panel switch! + let meetingSeriesID = await browser.getUrl(); meetingSeriesID = meetingSeriesID.replace(/^.*\//, ''); meetingSeriesID = meetingSeriesID.replace(/\?.*$/, ''); if (! keepOpenMSEditor) { - if (browser.isVisible('#btnMeetinSeriesEditCancel')) { - E2EGlobal.clickWithRetry('#btnMeetinSeriesEditCancel'); + if (await browser.isVisible('#btnMeetinSeriesEditCancel')) { + await E2EGlobal.clickWithRetry('#btnMeetinSeriesEditCancel'); // browser.waitForVisible('#btnMeetinSeriesEditCancel', 4000, true); // will check for IN-VISIBLE! } else { // if for miracoulous reasons the MS editor is already gone - we will try to continue... - E2EGlobal.logTimestamp('MS Editor is closed by miracle. Continue.'); + await E2EGlobal.logTimestamp('MS Editor is closed by miracle. Continue.'); } - E2EApp.gotoStartPage(); + await E2EApp.gotoStartPage(); } return meetingSeriesID; } - static getMeetingSeriesId (aProj, aName) { + static async getMeetingSeriesId(aProj, aName) { const link = $('='+aProj+': '+aName); if (!link.isExisting()) { console.log('Could not find MSId for', aProj, aName); @@ -80,80 +80,80 @@ export class E2EMeetingSeries { return linkTarget.slice(linkTarget.lastIndexOf('/')+1); } - static gotoMeetingSeries (aProj, aName) { - E2EApp.gotoStartPage(); - E2EGlobal.waitSomeTime(); + static async gotoMeetingSeries(aProj, aName) { + await E2EApp.gotoStartPage(); + await E2EGlobal.waitSomeTime(); let selector = 'li.meeting-series-item a'; try { - browser.waitForExist(selector); + await browser.waitForExist(selector); } catch (e) { return false; // we have no meeting series at all! } let compareText = aProj+': '+aName; const element = $('='+compareText); - if (!element.isExisting()) { + if (!(await element.isExisting())) { throw new Error('Could not find Meeting Series \''+compareText+'\''); } - element.scrollIntoView(); - E2EGlobal.waitSomeTime(100); - element.click(); - E2EGlobal.waitSomeTime(500); - let currentURL = browser.getUrl(); + await element.scrollIntoView(); + await E2EGlobal.waitSomeTime(100); + await element.click(); + await E2EGlobal.waitSomeTime(500); + let currentURL = await browser.getUrl(); if (!currentURL.includes('meetingseries')) { throw new Error('Could not switch to Meeting Series \''+compareText+'\''); } return true; } - static gotoTabMinutes() { + static async gotoTabMinutes() { let selector = '#tab_minutes'; try { - browser.waitForExist(selector); + await browser.waitForExist(selector); } catch (e) { return false; // we have no meeting series at all! } - E2EGlobal.clickWithRetry(selector); - E2EGlobal.waitSomeTime(); + await E2EGlobal.clickWithRetry(selector); + await E2EGlobal.waitSomeTime(); } - static gotoTabTopics() { + static async gotoTabTopics() { let selector = '#tab_topics'; try { - browser.waitForExist(selector); + await browser.waitForExist(selector); } catch (e) { return false; // we have no meeting series at all! } - E2EGlobal.clickWithRetry(selector); - E2EGlobal.waitSomeTime(); + await E2EGlobal.clickWithRetry(selector); + await E2EGlobal.waitSomeTime(); } - static gotoTabItems() { + static async gotoTabItems() { let selector = '#tab_items'; try { - browser.waitForExist(selector); + await browser.waitForExist(selector); } catch (e) { return false; // we have no meeting series at all! } - E2EGlobal.clickWithRetry(selector); - E2EGlobal.waitSomeTime(); + await E2EGlobal.clickWithRetry(selector); + await E2EGlobal.waitSomeTime(); } - static searchMeetingSeries (query) { - E2EApp.gotoStartPage(); + static async searchMeetingSeries(query) { + await E2EApp.gotoStartPage(); - if (browser.isVisible('input[id="id_MeetingSeriesSearch"]')) { - browser.setValue('input[id="id_MeetingSeriesSearch"]', query); + if (await browser.isVisible('input[id="id_MeetingSeriesSearch"]')) { + await browser.setValue('input[id="id_MeetingSeriesSearch"]', query); } - E2EGlobal.waitSomeTime(); + await E2EGlobal.waitSomeTime(); } - static visibleMeetingSeriesSearch() { + static async visibleMeetingSeriesSearch() { return browser.isVisible('input[id="id_MeetingSeriesSearch"]'); } - static visibleWarning() { + static async visibleWarning() { return browser.isVisible('span[id="id_noresults"]'); } } diff --git a/tests/end2end/helpers/E2EMeetingSeriesEditor.js b/tests/end2end/helpers/E2EMeetingSeriesEditor.js index a9990ef9a..98d86fa99 100644 --- a/tests/end2end/helpers/E2EMeetingSeriesEditor.js +++ b/tests/end2end/helpers/E2EMeetingSeriesEditor.js @@ -4,20 +4,20 @@ import { E2EMeetingSeries } from './E2EMeetingSeries'; export class E2EMeetingSeriesEditor { - static openMeetingSeriesEditor(aProj, aName, panelName = "base", skipGotoMeetingSeries) { + static async openMeetingSeriesEditor(aProj, aName, panelName = "base", skipGotoMeetingSeries) { // Maybe we can save "gotoStartPage => gotoMeetingSeries"? if (!skipGotoMeetingSeries) { - E2EMeetingSeries.gotoMeetingSeries(aProj, aName); + await E2EMeetingSeries.gotoMeetingSeries(aProj, aName); } // Open dialog - browser.waitForVisible('#btnEditMeetingSeries', 1000); - E2EGlobal.clickWithRetry('#btnEditMeetingSeries', 3000); + await browser.waitForVisible('#btnEditMeetingSeries', 1000); + await E2EGlobal.clickWithRetry('#btnEditMeetingSeries', 3000); // Check if dialog is there? - browser.waitForVisible('#btnMeetingSeriesSave', 3000); - E2EGlobal.clickWithRetry("#btnShowHideBaseConfig", 3000); - E2EGlobal.waitSomeTime(); // give dialog animation time + await browser.waitForVisible('#btnMeetingSeriesSave', 3000); + await E2EGlobal.clickWithRetry("#btnShowHideBaseConfig", 3000); + await E2EGlobal.waitSomeTime(); // give dialog animation time if (panelName && panelName !== "base") { let panelSelector = ""; @@ -29,32 +29,32 @@ export class E2EMeetingSeriesEditor { } else { throw "Unsupported panelName: " + panelName; } - browser.waitForExist(panelSelector); - E2EGlobal.clickWithRetry(panelSelector); - E2EGlobal.waitSomeTime(); // wait for panel animation + await browser.waitForExist(panelSelector); + await E2EGlobal.clickWithRetry(panelSelector); + await E2EGlobal.waitSomeTime(); // wait for panel animation } }; // assumes an open meeting series editor - static addUserToMeetingSeries(username, role) { - browser.setValue('#edt_AddUser', username); - browser.keys(['Enter']); + static async addUserToMeetingSeries(username, role) { + await browser.setValue('#edt_AddUser', username); + await browser.keys(['Enter']); if (role) { //Get Index of user's row in table - let index = browser.execute((username) => { + let index = (await browser.execute((username) => { return $("tr:contains('" + username + "')").index(); - }, username).value; + }, username)).value; index += 1; //increase by one since nth-child will start by 1 whereas index starts by 0 let selector = "tr:nth-child(" + index + ")" + ' select.user-role-select'; - browser.selectByValue(selector, role); + await browser.selectByValue(selector, role); } }; - static closeMeetingSeriesEditor(save = true) { + static async closeMeetingSeriesEditor(save = true) { let selector = (save) ? '#btnMeetingSeriesSave' : '#btnMeetinSeriesEditCancel'; - E2EGlobal.clickWithRetry(selector); - E2EGlobal.waitSomeTime(save ? 750 : 300); + await E2EGlobal.clickWithRetry(selector); + await E2EGlobal.waitSomeTime(save ? 750 : 300); } @@ -78,9 +78,9 @@ export class E2EMeetingSeriesEditor { * @param colNumDelete in which 0-based table column is the delete button? * @returns {{}} */ - static getUsersAndRoles(colNumUser, colNumRole, colNumDelete) { + static async getUsersAndRoles(colNumUser, colNumRole, colNumDelete) { // grab all user rows - const elementsUserRows = browser.elements('#id_userRow'); + const elementsUserRows = await browser.elements('#id_userRow'); let usersAndRoles = {}; let selector = "select.user-role-select"; // selects *all* @@ -89,7 +89,7 @@ export class E2EMeetingSeriesEditor { let usrRoleSelected = []; // ensure we get an array here - even in case only one value returned from getValue()! try { - usrRoleSelected = usrRoleSelected.concat(browser.getValue(selector)); + usrRoleSelected = usrRoleSelected.concat(await browser.getValue(selector)); } catch (e) { } @@ -98,14 +98,14 @@ export class E2EMeetingSeriesEditor { // we must skip this user in the above usrRoleSelected for (let rowIndex in elementsUserRows.value) { let elemTRId = elementsUserRows.value[rowIndex].ELEMENT; - let elementsTD = browser.elementIdElements(elemTRId, "td"); - let usrName = browser.elementIdText(elementsTD.value[colNumUser].ELEMENT).value; - let elementsDelete = browser.elementIdElements(elementsTD.value[colNumDelete].ELEMENT, "#btnDeleteUser"); + let elementsTD = await browser.elementIdElements(elemTRId, "td"); + let usrName = (await browser.elementIdText(elementsTD.value[colNumUser].ELEMENT)).value; + let elementsDelete = await browser.elementIdElements(elementsTD.value[colNumDelete].ELEMENT, "#btnDeleteUser"); let usrIsDeletable = elementsDelete.value.length === 1; let usrDeleteElemId = usrIsDeletable ? elementsDelete.value[0].ELEMENT : "0"; // for the current user usrRole already contains his read-only role string "Moderator" - let usrRole = browser.elementIdText(elementsTD.value[colNumRole].ELEMENT).value; + let usrRole = (await browser.elementIdText(elementsTD.value[colNumRole].ELEMENT)).value; let usrIsReadOnly = true; // For all other users we must get their role from the usrRoleSelected array @@ -131,43 +131,43 @@ export class E2EMeetingSeriesEditor { return usersAndRoles; } - static changeLabel(labelName, newLabelName, newLabelColor, autoSaveLabelChange = true) { - let labelId = E2EMeetingSeriesEditor.getLabelId(labelName); + static async changeLabel(labelName, newLabelName, newLabelColor, autoSaveLabelChange = true) { + let labelId = await E2EMeetingSeriesEditor.getLabelId(labelName); let selLabelRow = '#row-label-' + labelId; // open label editor for labelId - E2EGlobal.clickWithRetry(selLabelRow + ' .evt-btn-edit-label'); + await E2EGlobal.clickWithRetry(selLabelRow + ' .evt-btn-edit-label'); - browser.setValue(selLabelRow + " [name='labelName']", newLabelName); + await browser.setValue(selLabelRow + " [name='labelName']", newLabelName); if (newLabelColor) { - browser.setValue(selLabelRow + " [name='labelColor-" + labelId + "']", newLabelColor); + await browser.setValue(selLabelRow + " [name='labelColor-" + labelId + "']", newLabelColor); } if (autoSaveLabelChange) { - E2EGlobal.clickWithRetry(selLabelRow + ' .evt-btn-edit-save'); + await E2EGlobal.clickWithRetry(selLabelRow + ' .evt-btn-edit-save'); - E2EMeetingSeriesEditor.closeMeetingSeriesEditor(); + await E2EMeetingSeriesEditor.closeMeetingSeriesEditor(); } return labelId; } - static getLabelId(labelName) { + static async getLabelId(labelName) { // get all label elements - browser.waitForExist('#table-edit-labels .label'); - let elements = browser.elements('#table-edit-labels .label').value; + await browser.waitForExist('#table-edit-labels .label'); + let elements = (await browser.elements('#table-edit-labels .label')).value; for (let elementID of elements) { - let element = browser.elementIdText(elementID.ELEMENT); + let element = await browser.elementIdText(elementID.ELEMENT); if (labelName === element.value) { - return browser.elementIdAttribute(elementID.ELEMENT, 'id').value; + return (await browser.elementIdAttribute(elementID.ELEMENT, 'id')).value; } } } - static disableEmailForRoleChange() { - browser.waitForVisible('#labelRoleChange'); - E2EGlobal.clickWithRetry('#labelRoleChange'); + static async disableEmailForRoleChange() { + await browser.waitForVisible('#labelRoleChange'); + await E2EGlobal.clickWithRetry('#labelRoleChange'); } diff --git a/tests/end2end/helpers/E2EMinutes.js b/tests/end2end/helpers/E2EMinutes.js index 00ae4017c..bfb0175c8 100644 --- a/tests/end2end/helpers/E2EMinutes.js +++ b/tests/end2end/helpers/E2EMinutes.js @@ -10,19 +10,19 @@ export class E2EMinutes { * @param aName * @param aDate format: YYYY-MM-DD is optional! */ - static addMinutesToMeetingSeries (aProj, aName, aDate) { - E2EMeetingSeries.gotoMeetingSeries(aProj, aName); - browser.waitForVisible('#btnAddMinutes'); - E2EGlobal.clickWithRetry('#btnAddMinutes'); - E2EGlobal.waitSomeTime(700); // give route change time + static async addMinutesToMeetingSeries(aProj, aName, aDate) { + await E2EMeetingSeries.gotoMeetingSeries(aProj, aName); + await browser.waitForVisible('#btnAddMinutes'); + await E2EGlobal.clickWithRetry('#btnAddMinutes'); + await E2EGlobal.waitSomeTime(700); // give route change time - let minutesID = browser.getUrl(); + let minutesID = await browser.getUrl(); minutesID = minutesID.replace(/^.*\//, ''); if (aDate) { - browser.waitForVisible('#id_minutesdateInput'); - browser.setValue('#id_minutesdateInput', ''); - browser.setValue('#id_minutesdateInput', aDate); + await browser.waitForVisible('#id_minutesdateInput'); + await browser.setValue('#id_minutesdateInput', ''); + await browser.setValue('#id_minutesdateInput', aDate); } return minutesID; } @@ -33,20 +33,20 @@ export class E2EMinutes { * @param confirmDialog should the dialog be confirmed automatically * default: true */ - static finalizeCurrentMinutes (confirmDialog) { + static async finalizeCurrentMinutes(confirmDialog) { let participantsInfo = new E2EMinutesParticipants(); - participantsInfo.setUserPresence(E2EApp.getCurrentUser(),true); - browser.waitForVisible('#btn_finalizeMinutes'); - E2EGlobal.clickWithRetry('#btn_finalizeMinutes'); + await participantsInfo.setUserPresence(await E2EApp.getCurrentUser(),true); + await browser.waitForVisible('#btn_finalizeMinutes'); + await E2EGlobal.clickWithRetry('#btn_finalizeMinutes'); - E2EMinutes.confirmQualityAssuranceDialog(); + await E2EMinutes.confirmQualityAssuranceDialog(); if (E2EGlobal.SETTINGS.email && E2EGlobal.SETTINGS.email.enableMailDelivery) { if (confirmDialog === undefined || confirmDialog) { - E2EApp.confirmationDialogAnswer(true); + await E2EApp.confirmationDialogAnswer(true); } } - E2EGlobal.waitSomeTime(1000); + await E2EGlobal.waitSomeTime(1000); } /** @@ -56,132 +56,132 @@ export class E2EMinutes { * default: true * processFinalize is true, when you want to proceed finalizing Minutes without participants */ - static finalizeCurrentMinutesWithoutParticipants (confirmDialog, processFinalize) { - browser.waitForVisible('#btn_finalizeMinutes'); - E2EGlobal.clickWithRetry('#btn_finalizeMinutes'); + static async finalizeCurrentMinutesWithoutParticipants(confirmDialog, processFinalize) { + await browser.waitForVisible('#btn_finalizeMinutes'); + await E2EGlobal.clickWithRetry('#btn_finalizeMinutes'); if(processFinalize == true) { - E2EMinutes.confirmQualityAssuranceDialog(); + await E2EMinutes.confirmQualityAssuranceDialog(); if (E2EGlobal.SETTINGS.email && E2EGlobal.SETTINGS.email.enableMailDelivery) { if (confirmDialog === undefined || confirmDialog) { - E2EApp.confirmationDialogAnswer(true); + await E2EApp.confirmationDialogAnswer(true); } } - E2EGlobal.waitSomeTime(1000); + await E2EGlobal.waitSomeTime(1000); } else { - browser.waitForVisible('#confirmationDialogCancel'); - E2EGlobal.clickWithRetry('#confirmationDialogCancel'); + await browser.waitForVisible('#confirmationDialogCancel'); + await E2EGlobal.clickWithRetry('#confirmationDialogCancel'); } } - static confirmQualityAssuranceDialog(){ - E2EGlobal.waitSomeTime(600); - if(browser.isVisible('#minuteQualityAssuranceDialog')) { - E2EApp.confirmationDialogAnswer(true); + static async confirmQualityAssuranceDialog() { + await E2EGlobal.waitSomeTime(600); + if(await browser.isVisible('#minuteQualityAssuranceDialog')) { + await E2EApp.confirmationDialogAnswer(true); } } - static unfinalizeCurrentMinutes () { - E2EGlobal.waitSomeTime(600); - browser.waitForVisible('#btn_unfinalizeMinutes'); - E2EGlobal.clickWithRetry('#btn_unfinalizeMinutes'); - E2EGlobal.waitSomeTime(1000); + static async unfinalizeCurrentMinutes() { + await E2EGlobal.waitSomeTime(600); + await browser.waitForVisible('#btn_unfinalizeMinutes'); + await E2EGlobal.clickWithRetry('#btn_unfinalizeMinutes'); + await E2EGlobal.waitSomeTime(1000); } - static countMinutesForSeries (aProj, aName) { + static async countMinutesForSeries(aProj, aName) { let selector = 'a#id_linkToMinutes'; - E2EMeetingSeries.gotoMeetingSeries(aProj, aName); + await E2EMeetingSeries.gotoMeetingSeries(aProj, aName); try { - browser.waitForExist(selector); + await browser.waitForExist(selector); } catch (e) { return 0; // we have no minutes series
  • => "zero" result } - const elements = browser.elements(selector); + const elements = await browser.elements(selector); return elements.value.length; } - static getMinutesId (aDate) { + static async getMinutesId(aDate) { let selector = 'a#id_linkToMinutes'; try { - browser.waitForExist(selector); + await browser.waitForExist(selector); } catch (e) { return false; // we have no meeting series at all! } - const elements = browser.elements(selector); + const elements = await browser.elements(selector); for (let i in elements.value) { let elemId = elements.value[i].ELEMENT; - let visibleText = browser.elementIdText(elemId).value; + let visibleText = (await browser.elementIdText(elemId)).value; if (visibleText == aDate) { - let linkTarget = browser.elementIdAttribute(elemId, 'href').value; + let linkTarget = (await browser.elementIdAttribute(elemId, 'href')).value; return linkTarget.slice(linkTarget.lastIndexOf('/')+1); } } return false; } - static getCurrentMinutesDate() { - browser.waitForVisible('#id_minutesdateInput'); + static async getCurrentMinutesDate() { + await browser.waitForVisible('#id_minutesdateInput'); return browser.getValue('#id_minutesdateInput'); } - static getCurrentMinutesId() { - let url = browser.getUrl(); + static async getCurrentMinutesId() { + let url = await browser.getUrl(); return url.slice(url.lastIndexOf('/')+1); } - static gotoMinutes (aDate) { + static async gotoMinutes(aDate) { let selector = 'a#id_linkToMinutes'; try { - browser.waitForExist(selector); + await browser.waitForExist(selector); } catch (e) { return false; // we have no meeting series at all! } - const elements = browser.elements(selector); + const elements = await browser.elements(selector); for (let i in elements.value) { let elemId = elements.value[i].ELEMENT; - let visibleText = browser.elementIdText(elemId).value; + let visibleText = (await browser.elementIdText(elemId)).value; if (visibleText == aDate) { - browser.elementIdClick(elemId); - E2EGlobal.waitSomeTime(); + await browser.elementIdClick(elemId); + await E2EGlobal.waitSomeTime(); return true; } } throw new Error('Could not find Minutes \''+aDate+'\''); } - static gotoLatestMinutes () { + static async gotoLatestMinutes() { let selector = 'a#id_linkToMinutes'; try { - browser.waitForExist(selector); + await browser.waitForExist(selector); } catch (e) { return false; } - const elements = browser.elements(selector); + const elements = await browser.elements(selector); const firstElementId = elements.value[0].ELEMENT; - browser.elementIdClick(firstElementId); - E2EGlobal.waitSomeTime(500); + await browser.elementIdClick(firstElementId); + await E2EGlobal.waitSomeTime(500); } - static gotoParentMeetingSeries () { + static async gotoParentMeetingSeries() { let selector = 'a#id_linkToParentSeries'; try { - browser.waitForExist(selector); + await browser.waitForExist(selector); } catch (e) { return false; } - E2EGlobal.clickWithRetry(selector); - E2EGlobal.waitSomeTime(); + await E2EGlobal.clickWithRetry(selector); + await E2EGlobal.waitSomeTime(); } } diff --git a/tests/end2end/helpers/E2EMinutesParticipants.js b/tests/end2end/helpers/E2EMinutesParticipants.js index b8cac3542..697816db9 100644 --- a/tests/end2end/helpers/E2EMinutesParticipants.js +++ b/tests/end2end/helpers/E2EMinutesParticipants.js @@ -3,38 +3,38 @@ import {E2EGlobal} from './E2EGlobal'; export class E2EMinutesParticipants { constructor() { - this.updateUsersAndPresence(); + await this.updateUsersAndPresence(); } // ******************** STATIC Methods - static isExpanded() { - E2EGlobal.waitSomeTime(750); + static async isExpanded() { + await E2EGlobal.waitSomeTime(750); return browser.isExisting('#edtParticipantsAdditional'); } - static isCollapsed() { - return ! E2EMinutesParticipants.isExpanded(); + static async isCollapsed() { + return ! (await E2EMinutesParticipants.isExpanded()); } - static expand() { - if (E2EMinutesParticipants.isCollapsed()) { - E2EGlobal.clickWithRetry('#btnParticipantsExpand'); - browser.waitForVisible('#id_participants'); + static async expand() { + if (await E2EMinutesParticipants.isCollapsed()) { + await E2EGlobal.clickWithRetry('#btnParticipantsExpand'); + await browser.waitForVisible('#id_participants'); } } - static collapse() { - if (E2EMinutesParticipants.isExpanded()) { - E2EGlobal.clickWithRetry('#btnParticipantsExpand'); + static async collapse() { + if (await E2EMinutesParticipants.isExpanded()) { + await E2EGlobal.clickWithRetry('#btnParticipantsExpand'); const waitForInvisible = true; - browser.waitForVisible('#id_participants', 10000, waitForInvisible); + await browser.waitForVisible('#id_participants', 10000, waitForInvisible); } } - static getPresentParticipantsFromServer(minutesId) { + static async getPresentParticipantsFromServer(minutesId) { try { return server.call('e2e.getPresentParticipantNames', minutesId); } catch (e) { @@ -65,57 +65,57 @@ export class E2EMinutesParticipants { }, } */ - updateUsersAndPresence() { + async updateUsersAndPresence() { // scroll to top to make sure the page will not scroll if any element disappears (e.g. item input field) - browser.scrollXY(0, 0); - E2EMinutesParticipants.expand(); + await browser.scrollXY(0, 0); + await E2EMinutesParticipants.expand(); this._participantsAndPresence = {}; try { - this._participantsAndPresence['##additional participants##'] = $('#edtParticipantsAdditional').getValue(); + this._participantsAndPresence['##additional participants##'] = await $('#edtParticipantsAdditional').getValue(); } catch(e) { this._participantsAndPresence['##additional participants##'] = ''; } - const participants = $$('.js-participant-checkbox #id_username'); - const presence = $$('input.js-toggle-present'); + const participants = await $$('.js-participant-checkbox #id_username'); + const presence = await $$('input.js-toggle-present'); for (let participantIndex=0; participantIndex { + await browser.execute((format) => { Meteor.settings.public.docGeneration.enabled = !!format; if (format) { @@ -16,12 +16,12 @@ export class E2EProtocols { }, format); } - static countProtocolsInMongoDB() { + static async countProtocolsInMongoDB() { return server.call('e2e.countProtocolsInMongoDB'); } - static checkProtocolFileForMinuteExits(minuteId) { - let path = server.call('e2e.getProtocolStoragePathForMinute', minuteId); + static async checkProtocolFileForMinuteExits(minuteId) { + let path = await server.call('e2e.getProtocolStoragePathForMinute', minuteId); if (!path) { //no protocol record in MongoDB return false; @@ -29,17 +29,17 @@ export class E2EProtocols { return fs.existsSync(path); } - static downloadButtonExists() { + static async downloadButtonExists() { return browser.isVisible('.btn-download'); } - static checkDownloadOpensConfirmationDialog() { - browser.click('.btn-download'); - E2EGlobal.waitSomeTime(750); + static async checkDownloadOpensConfirmationDialog() { + await browser.click('.btn-download'); + await E2EGlobal.waitSomeTime(750); return browser.isVisible('#confirmationDialogOK'); } - static getDownloadLinkForProtocolOfMinute(minuteId) { + static async getDownloadLinkForProtocolOfMinute(minuteId) { return server.call('e2e.getProtocolLinkForMinute', minuteId); } } \ No newline at end of file diff --git a/tests/end2end/helpers/E2ESecurity.js b/tests/end2end/helpers/E2ESecurity.js index a377a2378..44acffa07 100644 --- a/tests/end2end/helpers/E2ESecurity.js +++ b/tests/end2end/helpers/E2ESecurity.js @@ -23,12 +23,12 @@ export class E2ESecurity { //Thus the names of the called meteor methods are hardcoded in the e2e-Tests and have to be updated if a method is renamed. //In order to check this, all security-e2e-tests should use this function to check if the methods called within them do still exist. //If that's not the case, the test will fail and by this give a hint for the dev, which test cases have yet to be updated with the new method name. - static expectMethodToExist(methodName){ - let methodExists = browser.execute( function(methodName) { + static async expectMethodToExist(methodName) { + let methodExists = (await browser.execute( function(methodName) { //The methodHandlers-Dictionary will contain all meteor methods known to the client. //By default it will contain exactly the same methods as the server return typeof Meteor.connection._methodHandlers[methodName] === 'function' - },methodName).value; + },methodName)).value; expect(methodExists, 'Method ' + methodName + ' exists').to.be.true; } @@ -37,8 +37,8 @@ export class E2ESecurity { //As a hacker it is not possible to manipulate the server's execution of the methods, but the client one can be. //This is done by overwriting the local client copy of the method with an empty method stump containing no checks anymore and therefore always being executed successfully. //By doing this only the server-side security mechanisms remain which should of course still stop unauthorized actions. - static replaceMethodOnClientSide(methodName) { - browser.execute( function(methodName) { + static async replaceMethodOnClientSide(methodName) { + await browser.execute( function(methodName) { //The methodHandlers-Dictionary contains the client's copy of the meteor methods. //By changing the function for a specific meteor method all future calls of this method for this session will execute the changed function. Meteor.connection._methodHandlers[methodName] = function () {console.log('Modified Client Method: ' + methodName);}; @@ -47,14 +47,14 @@ export class E2ESecurity { //Due to the asynchronous execution of most meteor methods and the necessarity to check their specific results within security-e2e-tests it is necessary //to wrap these method calls with the following function, allowing for an emulated synchronous usage of these methods. - static executeMethod(methodName, ...methodParameters) { - E2ESecurity.expectMethodToExist(methodName); - browser.timeouts("script", 5000); + static async executeMethod(methodName, ...methodParameters) { + await E2ESecurity.expectMethodToExist(methodName); + await browser.timeouts("script", 5000); try { - let result = browser.executeAsync((methodName, methodParameters, done) => { - Meteor.apply(methodName, methodParameters, _ => { + let result = await browser.executeAsync((methodName, methodParameters, done) => { + await Meteor.apply(methodName, methodParameters, _ => { }, (error, result) => { - done({error, result}); + await done({error, result}); }); }, methodName, methodParameters); // console.log(`Results are in: error = ${result.value.error}, result = ${result.value.result}`); @@ -63,134 +63,134 @@ export class E2ESecurity { } } - static countRecordsInMiniMongo(collectionName) { - return browser.execute((collectionName) => { + static async countRecordsInMiniMongo(collectionName) { + return (await browser.execute((collectionName) => { let collectionpointer = Meteor.Collection.get(collectionName); - return collectionpointer ? collectionpointer.find().count() : 0; - }, collectionName).value; + return collectionpointer ? await collectionpointer.find().count() : 0; + }, collectionName)).value; } - static returnMeteorId(){ - return browser.execute(function () { + static async returnMeteorId() { + return (await browser.execute(function () { return Random.id(); - }).value; + })).value; } - static createMeetingSeriesAndMinute = (name) => { - E2ESecurity.executeMethod(E2ESecurity.insertMeetingSeriesMethod, {project: name, name: name}); - let msID = E2EMeetingSeries.getMeetingSeriesId(name, name); - E2EMinutes.addMinutesToMeetingSeries(name, name); - E2EMinutes.gotoLatestMinutes(); + static createMeetingSeriesAndMinute = async name => { + await E2ESecurity.executeMethod(E2ESecurity.insertMeetingSeriesMethod, {project: name, name: name}); + let msID = await E2EMeetingSeries.getMeetingSeriesId(name, name); + await E2EMinutes.addMinutesToMeetingSeries(name, name); + await E2EMinutes.gotoLatestMinutes(); return { - min_id : E2EMinutes.getCurrentMinutesId(), + min_id : await E2EMinutes.getCurrentMinutesId(), ms_id: msID, - date : E2EMinutes.getCurrentMinutesDate(), + date : await E2EMinutes.getCurrentMinutesDate(), }; }; - static tryFinalizeMinute = (minuteID, expectToBeFinalized) => { - E2ESecurity.replaceMethodOnClientSide(E2ESecurity.finalizeMinute); - E2ESecurity.executeMethod(E2ESecurity.finalizeMinute, minuteID); - expect((server.call('e2e.findMinute', minuteID)).isFinalized).to.equal(expectToBeFinalized); + static tryFinalizeMinute = async (minuteID, expectToBeFinalized) => { + await E2ESecurity.replaceMethodOnClientSide(E2ESecurity.finalizeMinute); + await E2ESecurity.executeMethod(E2ESecurity.finalizeMinute, minuteID); + await expect(((await (server.call('e2e.findMinute', minuteID)))).isFinalized).to.equal(expectToBeFinalized); }; - static createMeetingSeries = (name) => { - E2ESecurity.executeMethod(E2ESecurity.insertMeetingSeriesMethod, {project: name, name: name}); + static createMeetingSeries = async name => { + await E2ESecurity.executeMethod(E2ESecurity.insertMeetingSeriesMethod, {project: name, name: name}); return E2EMeetingSeries.getMeetingSeriesId(name, name); }; - static tryUpdateCurrentMinuteDate = (minuteID, newDate, expectToEqualDate) => { - E2ESecurity.replaceMethodOnClientSide(E2ESecurity.updateMinutes); - E2ESecurity.executeMethod(E2ESecurity.updateMinutes, {_id: minuteID, date: newDate}); - expect((server.call('e2e.findMinute', minuteID)).date).to.equal(expectToEqualDate); + static tryUpdateCurrentMinuteDate = async (minuteID, newDate, expectToEqualDate) => { + await E2ESecurity.replaceMethodOnClientSide(E2ESecurity.updateMinutes); + await E2ESecurity.executeMethod(E2ESecurity.updateMinutes, {_id: minuteID, date: newDate}); + await expect(((await (server.call('e2e.findMinute', minuteID)))).date).to.equal(expectToEqualDate); }; - static tryAddNewMinute = (meetingSeriesID, date, expectToEqualNumberMinutes, userIdex) => { - const userid = server.call('e2e.getUserId', userIdex); - E2ESecurity.replaceMethodOnClientSide(E2ESecurity.addMinutes); - E2ESecurity.executeMethod(E2ESecurity.addMinutes, {meetingSeries_id: meetingSeriesID, date: date, visibleFor:[userid]}); - expect((server.call('e2e.countMinutesInMongoDB'))).to.equal(expectToEqualNumberMinutes); + static tryAddNewMinute = async (meetingSeriesID, date, expectToEqualNumberMinutes, userIdex) => { + const userid = await server.call('e2e.getUserId', userIdex); + await E2ESecurity.replaceMethodOnClientSide(E2ESecurity.addMinutes); + await E2ESecurity.executeMethod(E2ESecurity.addMinutes, {meetingSeries_id: meetingSeriesID, date: date, visibleFor:[userid]}); + await expect((await (server.call('e2e.countMinutesInMongoDB')))).to.equal(expectToEqualNumberMinutes); }; - static tryRemoveMinute = (minuteID, expectToEqualNumberMinutes) => { - E2ESecurity.replaceMethodOnClientSide(E2ESecurity.removeMinute); - E2ESecurity.executeMethod(E2ESecurity.removeMinute, minuteID); - expect((server.call('e2e.countMinutesInMongoDB'))).to.equal(expectToEqualNumberMinutes); + static tryRemoveMinute = async (minuteID, expectToEqualNumberMinutes) => { + await E2ESecurity.replaceMethodOnClientSide(E2ESecurity.removeMinute); + await E2ESecurity.executeMethod(E2ESecurity.removeMinute, minuteID); + await expect((await (server.call('e2e.countMinutesInMongoDB')))).to.equal(expectToEqualNumberMinutes); }; - static tryUnfinalizeMinute = (minuteID, expectToBeUnfinalized) => { - E2ESecurity.replaceMethodOnClientSide(E2ESecurity.unfinalizeMinute); - E2ESecurity.executeMethod(E2ESecurity.unfinalizeMinute, minuteID); - expect((server.call('e2e.findMinute', minuteID)).isFinalized).to.equal(expectToBeUnfinalized); + static tryUnfinalizeMinute = async (minuteID, expectToBeUnfinalized) => { + await E2ESecurity.replaceMethodOnClientSide(E2ESecurity.unfinalizeMinute); + await E2ESecurity.executeMethod(E2ESecurity.unfinalizeMinute, minuteID); + await expect(((await (server.call('e2e.findMinute', minuteID)))).isFinalized).to.equal(expectToBeUnfinalized); }; - static inviteUserToMeetingSerie = (MSname, role, userIndex) => { - E2EMeetingSeriesEditor.openMeetingSeriesEditor(MSname, MSname, 'invited'); + static inviteUserToMeetingSerie = async (MSname, role, userIndex) => { + await E2EMeetingSeriesEditor.openMeetingSeriesEditor(MSname, MSname, 'invited'); let user = E2EGlobal.SETTINGS.e2eTestUsers[userIndex]; if (role === 'Invited') - E2EMeetingSeriesEditor.addUserToMeetingSeries(user, E2EGlobal.USERROLES.Invited); + await E2EMeetingSeriesEditor.addUserToMeetingSeries(user, E2EGlobal.USERROLES.Invited); else - E2EMeetingSeriesEditor.addUserToMeetingSeries(user, E2EGlobal.USERROLES.Informed); - E2EMeetingSeriesEditor.closeMeetingSeriesEditor(); + await E2EMeetingSeriesEditor.addUserToMeetingSeries(user, E2EGlobal.USERROLES.Informed); + await E2EMeetingSeriesEditor.closeMeetingSeriesEditor(); }; - static tryInsertMeetingSeries = (name, expectToEqual, testName) => { - E2ESecurity.replaceMethodOnClientSide(E2ESecurity.insertMeetingSeriesMethod); - E2ESecurity.executeMethod(E2ESecurity.insertMeetingSeriesMethod, {project: name, name: name}); - expect(server.call('e2e.countMeetingSeriesInMongDB'), testName).to.equal(expectToEqual); + static tryInsertMeetingSeries = async (name, expectToEqual, testName) => { + await E2ESecurity.replaceMethodOnClientSide(E2ESecurity.insertMeetingSeriesMethod); + await E2ESecurity.executeMethod(E2ESecurity.insertMeetingSeriesMethod, {project: name, name: name}); + await expect(await server.call('e2e.countMeetingSeriesInMongDB'), testName).to.equal(expectToEqual); }; - static tryDeleteMeetingSeries = (meetingSeriesID, expectToEqual, testName) => { - E2ESecurity.replaceMethodOnClientSide(E2ESecurity.removeMeetingSeriesMethod); - E2ESecurity.executeMethod(E2ESecurity.removeMeetingSeriesMethod, meetingSeriesID); - expect(server.call('e2e.countMeetingSeriesInMongDB'), testName).to.equal(expectToEqual); + static tryDeleteMeetingSeries = async (meetingSeriesID, expectToEqual, testName) => { + await E2ESecurity.replaceMethodOnClientSide(E2ESecurity.removeMeetingSeriesMethod); + await E2ESecurity.executeMethod(E2ESecurity.removeMeetingSeriesMethod, meetingSeriesID); + await expect(await server.call('e2e.countMeetingSeriesInMongDB'), testName).to.equal(expectToEqual); }; - static tryUpdateMeetingSeriesName = (meetingSeriesID, newName, expectToEqual, testName) => { - E2ESecurity.replaceMethodOnClientSide(E2ESecurity.updateMeetingSeriesMethod); - E2ESecurity.executeMethod(E2ESecurity.updateMeetingSeriesMethod, {_id: meetingSeriesID, name: newName}); - expect((server.call('e2e.findMeetingSeries', meetingSeriesID)).name, testName).to.equal(expectToEqual); + static tryUpdateMeetingSeriesName = async (meetingSeriesID, newName, expectToEqual, testName) => { + await E2ESecurity.replaceMethodOnClientSide(E2ESecurity.updateMeetingSeriesMethod); + await E2ESecurity.executeMethod(E2ESecurity.updateMeetingSeriesMethod, {_id: meetingSeriesID, name: newName}); + await expect(((await (server.call('e2e.findMeetingSeries', meetingSeriesID)))).name, testName).to.equal(expectToEqual); }; - static tryAddNewTopic = (subject, topic_id, min_id, expectToEqual, testName) => { - E2ESecurity.replaceMethodOnClientSide(E2ESecurity.addTopic); - E2ESecurity.executeMethod(E2ESecurity.addTopic, min_id, {subject: subject, labels: Array(0), _id: topic_id}); - expect((server.call('e2e.countTopicsInMongoDB', min_id)), testName).to.equal(expectToEqual); + static tryAddNewTopic = async (subject, topic_id, min_id, expectToEqual, testName) => { + await E2ESecurity.replaceMethodOnClientSide(E2ESecurity.addTopic); + await E2ESecurity.executeMethod(E2ESecurity.addTopic, min_id, {subject: subject, labels: Array(0), _id: topic_id}); + await expect((await (server.call('e2e.countTopicsInMongoDB', min_id))), testName).to.equal(expectToEqual); }; - static tryUpdateTopicSubject = (newSubject, topic_id, min_id, expectToEqual, testName) => { - E2ESecurity.replaceMethodOnClientSide(E2ESecurity.updateTopic); - E2ESecurity.executeMethod(E2ESecurity.updateTopic, topic_id, {subject: newSubject}); - expect((server.call('e2e.getTopics', min_id))[0].subject, testName).to.equal(expectToEqual); + static tryUpdateTopicSubject = async (newSubject, topic_id, min_id, expectToEqual, testName) => { + await E2ESecurity.replaceMethodOnClientSide(E2ESecurity.updateTopic); + await E2ESecurity.executeMethod(E2ESecurity.updateTopic, topic_id, {subject: newSubject}); + await expect(((await (server.call('e2e.getTopics', min_id))))[0].subject, testName).to.equal(expectToEqual); }; - static tryRemoveTopic = (topic_id, min_id, expectToEqual, testName) => { - E2ESecurity.replaceMethodOnClientSide(E2ESecurity.removeTopic); - E2ESecurity.executeMethod(E2ESecurity.removeTopic, topic_id); - expect((server.call('e2e.countTopicsInMongoDB', min_id)), testName).to.equal(expectToEqual); + static tryRemoveTopic = async (topic_id, min_id, expectToEqual, testName) => { + await E2ESecurity.replaceMethodOnClientSide(E2ESecurity.removeTopic); + await E2ESecurity.executeMethod(E2ESecurity.removeTopic, topic_id); + await expect((await (server.call('e2e.countTopicsInMongoDB', min_id))), testName).to.equal(expectToEqual); }; - static tryReopenTopic = (topicID, meetingSeriesID, expectToBeOpened, testName) => { - E2ESecurity.replaceMethodOnClientSide(E2ESecurity.reopenTopic); - E2ESecurity.executeMethod(E2ESecurity.reopenTopic, meetingSeriesID, topicID); - E2EGlobal.waitSomeTime(); - const topicsOfSeries = server.call('e2e.getTopicsOfMeetingSeries', meetingSeriesID); - expect(topicsOfSeries[0].isOpen, testName).to.equal(expectToBeOpened); + static tryReopenTopic = async (topicID, meetingSeriesID, expectToBeOpened, testName) => { + await E2ESecurity.replaceMethodOnClientSide(E2ESecurity.reopenTopic); + await E2ESecurity.executeMethod(E2ESecurity.reopenTopic, meetingSeriesID, topicID); + await E2EGlobal.waitSomeTime(); + const topicsOfSeries = await server.call('e2e.getTopicsOfMeetingSeries', meetingSeriesID); + await expect(topicsOfSeries[0].isOpen, testName).to.equal(expectToBeOpened); }; - static tryUpdateRole = (meetingSeriesID, userIndex, newRole, expectToEqual) => { - const userID = server.call('e2e.getUserId', userIndex); - E2ESecurity.replaceMethodOnClientSide(E2ESecurity.saveRoleForMeetingSeries); - E2ESecurity.executeMethod(E2ESecurity.saveRoleForMeetingSeries, userID, meetingSeriesID, newRole); - expect((server.call('e2e.getUserRole', meetingSeriesID, userIndex))).to.equal(expectToEqual); + static tryUpdateRole = async (meetingSeriesID, userIndex, newRole, expectToEqual) => { + const userID = await server.call('e2e.getUserId', userIndex); + await E2ESecurity.replaceMethodOnClientSide(E2ESecurity.saveRoleForMeetingSeries); + await E2ESecurity.executeMethod(E2ESecurity.saveRoleForMeetingSeries, userID, meetingSeriesID, newRole); + await expect((await (server.call('e2e.getUserRole', meetingSeriesID, userIndex)))).to.equal(expectToEqual); }; - static tryRemoveRole = (meetingSeriesID, userIndex, expectToEqual) => { - const userID = server.call('e2e.getUserId', userIndex); - E2ESecurity.replaceMethodOnClientSide(E2ESecurity.removeAllRolesForMeetingSeries); - E2ESecurity.executeMethod(E2ESecurity.removeAllRolesForMeetingSeries, userID, meetingSeriesID); - expect((server.call('e2e.getUserRole', meetingSeriesID, userIndex))).to.equal(expectToEqual); + static tryRemoveRole = async (meetingSeriesID, userIndex, expectToEqual) => { + const userID = await server.call('e2e.getUserId', userIndex); + await E2ESecurity.replaceMethodOnClientSide(E2ESecurity.removeAllRolesForMeetingSeries); + await E2ESecurity.executeMethod(E2ESecurity.removeAllRolesForMeetingSeries, userID, meetingSeriesID); + await expect((await (server.call('e2e.getUserRole', meetingSeriesID, userIndex)))).to.equal(expectToEqual); }; } \ No newline at end of file diff --git a/tests/end2end/helpers/E2ETopics.js b/tests/end2end/helpers/E2ETopics.js index 171a57e0a..f59cae3ec 100644 --- a/tests/end2end/helpers/E2ETopics.js +++ b/tests/end2end/helpers/E2ETopics.js @@ -3,270 +3,270 @@ import { E2EApp } from './E2EApp' export class E2ETopics { - static addTopicToMinutes (aTopic, aResponsible) { - browser.waitForVisible("#id_showAddTopicDialog"); - E2EGlobal.clickWithRetry("#id_showAddTopicDialog"); + static async addTopicToMinutes(aTopic, aResponsible) { + await browser.waitForVisible("#id_showAddTopicDialog"); + await E2EGlobal.clickWithRetry("#id_showAddTopicDialog"); - E2ETopics.insertTopicDataIntoDialog(aTopic, aResponsible); - E2ETopics.submitTopicDialog(); + await E2ETopics.insertTopicDataIntoDialog(aTopic, aResponsible); + await E2ETopics.submitTopicDialog(); }; - static addTopicWithLabelToMinutes (aTopic,label) { - browser.waitForVisible("#id_showAddTopicDialog"); - E2EGlobal.clickWithRetry("#id_showAddTopicDialog"); + static async addTopicWithLabelToMinutes(aTopic, label) { + await browser.waitForVisible("#id_showAddTopicDialog"); + await E2EGlobal.clickWithRetry("#id_showAddTopicDialog"); - E2ETopics.insertTopicDataWithLabelIntoDialog(aTopic, label); - E2ETopics.submitTopicDialog(); + await E2ETopics.insertTopicDataWithLabelIntoDialog(aTopic, label); + await E2ETopics.submitTopicDialog(); }; - static addTopicToMinutesAtEnd (aTopic, aResonsible) { - browser.waitForVisible("#addTopicField"); - E2EGlobal.clickWithRetry("#addTopicField"); + static async addTopicToMinutesAtEnd(aTopic, aResonsible) { + await browser.waitForVisible("#addTopicField"); + await E2EGlobal.clickWithRetry("#addTopicField"); - E2ETopics.insertTopicDataAtEnd(aTopic, aResonsible); - E2ETopics.submitTopicAtEnd(); + await E2ETopics.insertTopicDataAtEnd(aTopic, aResonsible); + await E2ETopics.submitTopicAtEnd(); } - static openEditTopicForMinutes(topicIndex) { + static async openEditTopicForMinutes(topicIndex) { let selector = "#topicPanel .well:nth-child(" + topicIndex + ") #btnEditTopic"; - browser.waitForVisible(selector); - E2EGlobal.clickWithRetry(selector); - E2EGlobal.waitSomeTime(500); + await browser.waitForVisible(selector); + await E2EGlobal.clickWithRetry(selector); + await E2EGlobal.waitSomeTime(500); } - static editTopicForMinutes(topicIndex, newTopicSubject, newResponsible) { - E2ETopics.openEditTopicForMinutes(topicIndex); - E2ETopics.insertTopicDataIntoDialog(newTopicSubject, newResponsible); - E2ETopics.submitTopicDialog(); + static async editTopicForMinutes(topicIndex, newTopicSubject, newResponsible) { + await E2ETopics.openEditTopicForMinutes(topicIndex); + await E2ETopics.insertTopicDataIntoDialog(newTopicSubject, newResponsible); + await E2ETopics.submitTopicDialog(); } - static deleteTopic(topicIndex, confirmDialog) { + static async deleteTopic(topicIndex, confirmDialog) { const selectorMenu = "#topicPanel .well:nth-child(" + topicIndex + ") #btnTopicDropdownMenu"; - browser.waitForVisible(selectorMenu); - E2EGlobal.clickWithRetry(selectorMenu); + await browser.waitForVisible(selectorMenu); + await E2EGlobal.clickWithRetry(selectorMenu); const selectorDeleteBtn = "#topicPanel .well:nth-child(" + topicIndex + ") #btnDelTopic"; - browser.waitForVisible(selectorDeleteBtn); - E2EGlobal.clickWithRetry(selectorDeleteBtn); + await browser.waitForVisible(selectorDeleteBtn); + await E2EGlobal.clickWithRetry(selectorDeleteBtn); if (confirmDialog === undefined) { return; } - E2EApp.confirmationDialogAnswer(confirmDialog); + await E2EApp.confirmationDialogAnswer(confirmDialog); } - static label2TopicEnterFreetext(labelName) { - browser.element('#id_subject').click(); - browser.keys("\uE004"); // Tab to reach next input field => labels - browser.keys(labelName+"\uE007"); // plus ENTER + static async label2TopicEnterFreetext(labelName) { + await (await browser.element('#id_subject')).click(); + await browser.keys("\uE004"); // Tab to reach next input field => labels + await browser.keys(labelName+"\uE007"); // plus ENTER } - static responsible2ItemEnterFreetext(theText) { - E2EGlobal.waitSomeTime(); + static async responsible2ItemEnterFreetext(theText) { + await E2EGlobal.waitSomeTime(); // &%$#$@! - the following does not work => Uncaught Error: element not visible // browser.element(".form-group-responsibles .select2-selection").click(); // ... so we take this as workaround: click into first select2 then Tab/Tab to the next one - browser.element(".form-group-labels .select2-selection").click(); - browser.keys("\uE004\uE004"); // 2 x Tab to reach next select2 + await (await browser.element(".form-group-labels .select2-selection")).click(); + await browser.keys("\uE004\uE004"); // 2 x Tab to reach next select2 let texts = theText.split(","); for (let i in texts) { - browser.keys(texts[i]); - E2EGlobal.waitSomeTime(300); - browser.keys("\uE007"); // ENTER + await browser.keys(texts[i]); + await E2EGlobal.waitSomeTime(300); + await browser.keys("\uE007"); // ENTER } } - static responsible2TopicEnterFreetext(theText) { - browser.element('#id_subject').click(); - browser.keys("\uE004\uE004"); // Tab to reach next input field => labels - browser.keys(theText); - E2EGlobal.waitSomeTime(); - browser.keys("\uE007"); // plus ENTER + static async responsible2TopicEnterFreetext(theText) { + await (await browser.element('#id_subject')).click(); + await browser.keys("\uE004\uE004"); // Tab to reach next input field => labels + await browser.keys(theText); + await E2EGlobal.waitSomeTime(); + await browser.keys("\uE007"); // plus ENTER } - static labelEnterFreetext(theText) { - E2EGlobal.waitSomeTime(); - browser.element(".form-group-labels .select2-selection").click(); - E2EGlobal.waitSomeTime(); - browser.keys(theText+"\uE007"); // plus ENTER + static async labelEnterFreetext(theText) { + await E2EGlobal.waitSomeTime(); + await (await browser.element(".form-group-labels .select2-selection")).click(); + await E2EGlobal.waitSomeTime(); + await browser.keys(theText+"\uE007"); // plus ENTER } - static insertTopicDataIntoDialog(subject, responsible) { + static async insertTopicDataIntoDialog(subject, responsible) { try { - browser.waitForVisible('#id_subject'); + await browser.waitForVisible('#id_subject'); } catch (e) { return false; } - E2EGlobal.waitSomeTime(); + await E2EGlobal.waitSomeTime(); if (subject) { - E2EGlobal.setValueSafe('#id_subject', subject); + await E2EGlobal.setValueSafe('#id_subject', subject); } if (responsible) { - E2ETopics.responsible2TopicEnterFreetext(responsible); + await E2ETopics.responsible2TopicEnterFreetext(responsible); } } - static insertTopicDataWithLabelIntoDialog(subject, label) { + static async insertTopicDataWithLabelIntoDialog(subject, label) { try { - browser.waitForVisible('#id_subject'); - browser.waitForVisible('#id_item_selLabels'); + await browser.waitForVisible('#id_subject'); + await browser.waitForVisible('#id_item_selLabels'); } catch (e) { return false; } - E2EGlobal.waitSomeTime(); + await E2EGlobal.waitSomeTime(); if (subject) { - E2EGlobal.setValueSafe('#id_subject', subject); + await E2EGlobal.setValueSafe('#id_subject', subject); } if(label) { - E2ETopics.label2TopicEnterFreetext(label); + await E2ETopics.label2TopicEnterFreetext(label); } } - static insertTopicDataAtEnd(subject, responsible) { + static async insertTopicDataAtEnd(subject, responsible) { try { - browser.waitForVisible('#addTopicField'); + await browser.waitForVisible('#addTopicField'); } catch (e) { return false; } - E2EGlobal.waitSomeTime(); + await E2EGlobal.waitSomeTime(); if (subject) { - E2EGlobal.setValueSafe('#addTopicField', subject); + await E2EGlobal.setValueSafe('#addTopicField', subject); } if (responsible) { - E2ETopics.responsible2TopicEnterFreetext(responsible); + await E2ETopics.responsible2TopicEnterFreetext(responsible); } } - static submitTopicDialog() { - E2EGlobal.clickWithRetry("#btnTopicSave"); + static async submitTopicDialog() { + await E2EGlobal.clickWithRetry("#btnTopicSave"); const waitForInvisible = true; - browser.waitForVisible('#dlgAddTopic', 10000, waitForInvisible); - E2EGlobal.waitSomeTime(700); + await browser.waitForVisible('#dlgAddTopic', 10000, waitForInvisible); + await E2EGlobal.waitSomeTime(700); } - static submitTopicAtEnd() { - browser.keys("Enter"); - E2EGlobal.waitSomeTime(700); + static async submitTopicAtEnd() { + await browser.keys("Enter"); + await E2EGlobal.waitSomeTime(700); } - static openInfoItemDialog(topicIndex, type="infoItem") { + static async openInfoItemDialog(topicIndex, type="infoItem") { let selector = "#topicPanel .well:nth-child(" + topicIndex + ") #btnTopicDropdownMenu"; - browser.waitForVisible(selector, 2000); - E2EGlobal.clickWithRetry(selector); + await browser.waitForVisible(selector, 2000); + await E2EGlobal.clickWithRetry(selector); let typeClass = ".addTopicInfoItem"; if (type === "actionItem") { typeClass = ".addTopicActionItem"; } - E2EGlobal.clickWithRetry("#topicPanel .well:nth-child(" + topicIndex + ") "+typeClass); + await E2EGlobal.clickWithRetry("#topicPanel .well:nth-child(" + topicIndex + ") "+typeClass); - browser.waitForVisible('#id_item_subject', 5000); + await browser.waitForVisible('#id_item_subject', 5000); } - static addInfoItemToTopic (infoItemDoc, topicIndex, autoCloseDetailInput = true) { - let type = (infoItemDoc.hasOwnProperty('itemType')) ? infoItemDoc.itemType : 'infoItem'; - this.openInfoItemDialog(topicIndex, type); - this.insertInfoItemDataIntoDialog(infoItemDoc); - this.submitInfoItemDialog(); + static async addInfoItemToTopic(infoItemDoc, topicIndex, autoCloseDetailInput = true) { + let type = ((await (infoItemDoc.hasOwnProperty('itemType')))) ? infoItemDoc.itemType : 'infoItem'; + await this.openInfoItemDialog(topicIndex, type); + await this.insertInfoItemDataIntoDialog(infoItemDoc); + await this.submitInfoItemDialog(); - E2EGlobal.waitSomeTime(); + await E2EGlobal.waitSomeTime(); if (autoCloseDetailInput) { - E2EGlobal.waitSomeTime(600); - browser.keys(['Escape']); - E2EGlobal.waitSomeTime(); + await E2EGlobal.waitSomeTime(600); + await browser.keys(['Escape']); + await E2EGlobal.waitSomeTime(); } } - static openInfoItemEditor(topicIndex, infoItemIndex) { - let selector = E2ETopics.getInfoItemSelector(topicIndex, infoItemIndex) + ".btnEditInfoItem"; + static async openInfoItemEditor(topicIndex, infoItemIndex) { + let selector = (await E2ETopics.getInfoItemSelector(topicIndex, infoItemIndex)) + ".btnEditInfoItem"; - browser.waitForVisible(selector); - E2EGlobal.clickWithRetry(selector); + await browser.waitForVisible(selector); + await E2EGlobal.clickWithRetry(selector); - E2EGlobal.waitSomeTime(); + await E2EGlobal.waitSomeTime(); } - static editInfoItemForTopic(topicIndex, infoItemIndex, infoItemDoc) { - E2ETopics.openInfoItemEditor(topicIndex, infoItemIndex, infoItemDoc); + static async editInfoItemForTopic(topicIndex, infoItemIndex, infoItemDoc) { + await E2ETopics.openInfoItemEditor(topicIndex, infoItemIndex, infoItemDoc); - this.insertInfoItemDataIntoDialog(infoItemDoc, true); - this.submitInfoItemDialog(); + await this.insertInfoItemDataIntoDialog(infoItemDoc, true); + await this.submitInfoItemDialog(); } - static addLabelToItem(topicIndex, infoItemIndex, labelName) { - E2ETopics.openInfoItemEditor(topicIndex, infoItemIndex); - E2ETopics.labelEnterFreetext(labelName); - E2EGlobal.clickWithRetry("#btnInfoItemSave"); - E2EGlobal.waitSomeTime(700); + static async addLabelToItem(topicIndex, infoItemIndex, labelName) { + await E2ETopics.openInfoItemEditor(topicIndex, infoItemIndex); + await E2ETopics.labelEnterFreetext(labelName); + await E2EGlobal.clickWithRetry("#btnInfoItemSave"); + await E2EGlobal.waitSomeTime(700); } - static deleteInfoItem(topicIndex, infoItemIndex, confirmDialog) { - let selOpenMenu = E2ETopics.getInfoItemSelector(topicIndex, infoItemIndex) + "#btnItemDropdownMenu"; - browser.waitForVisible(selOpenMenu); - E2EGlobal.clickWithRetry(selOpenMenu); - let selDelete = E2ETopics.getInfoItemSelector(topicIndex, infoItemIndex) + "#btnDelInfoItem"; - browser.waitForVisible(selDelete); - E2EGlobal.clickWithRetry(selDelete); + static async deleteInfoItem(topicIndex, infoItemIndex, confirmDialog) { + let selOpenMenu = (await E2ETopics.getInfoItemSelector(topicIndex, infoItemIndex)) + "#btnItemDropdownMenu"; + await browser.waitForVisible(selOpenMenu); + await E2EGlobal.clickWithRetry(selOpenMenu); + let selDelete = (await E2ETopics.getInfoItemSelector(topicIndex, infoItemIndex)) + "#btnDelInfoItem"; + await browser.waitForVisible(selDelete); + await E2EGlobal.clickWithRetry(selDelete); if (confirmDialog === undefined) { return; } - E2EApp.confirmationDialogAnswer(confirmDialog); + await E2EApp.confirmationDialogAnswer(confirmDialog); } - static insertInfoItemDataIntoDialog(infoItemDoc) { - if (!browser.isVisible('#id_item_subject')) { + static async insertInfoItemDataIntoDialog(infoItemDoc) { + if (!(await browser.isVisible('#id_item_subject'))) { throw new Error('Info item dialog is not visible'); } if (infoItemDoc.subject) { - E2EGlobal.setValueSafe('#id_item_subject', infoItemDoc.subject); + await E2EGlobal.setValueSafe('#id_item_subject', infoItemDoc.subject); } if (infoItemDoc.label) { - E2ETopics.labelEnterFreetext(infoItemDoc.label); + await E2ETopics.labelEnterFreetext(infoItemDoc.label); } if (infoItemDoc.responsible) { - E2ETopics.responsible2ItemEnterFreetext(infoItemDoc.responsible); + await E2ETopics.responsible2ItemEnterFreetext(infoItemDoc.responsible); } if (infoItemDoc.priority) { const nthChild = infoItemDoc.priority; - E2EGlobal.clickWithRetry(`#id_item_priority option:nth-child(${nthChild})`); + await E2EGlobal.clickWithRetry(`#id_item_priority option:nth-child(${nthChild})`); } //todo: set other fields (duedate) } - static submitInfoItemDialog() { - E2EGlobal.clickWithRetry("#btnInfoItemSave"); - E2EGlobal.waitSomeTime(700); + static async submitInfoItemDialog() { + await E2EGlobal.clickWithRetry("#btnInfoItemSave"); + await E2EGlobal.waitSomeTime(700); } - static toggleTopic(topicIndex) { + static async toggleTopic(topicIndex) { let selector = "#topicPanel .well:nth-child(" + topicIndex + ") .labelTopicCb"; - browser.waitForVisible(selector); - E2EGlobal.clickWithRetry(selector); + await browser.waitForVisible(selector); + await E2EGlobal.clickWithRetry(selector); } - static toggleRecurringTopic(topicIndex) { + static async toggleRecurringTopic(topicIndex) { let selector = "#topicPanel .well:nth-child(" + topicIndex + ") #btnTopicDropdownMenu"; try { // we use the "_org" / non screen shot version here intentionally, // as we often expect the 'recurring icon' to be hidden! - browser.waitForVisible_org(selector); + await browser.waitForVisible_org(selector); } catch(e) { return false; } - E2EGlobal.clickWithRetry(selector); - E2EGlobal.clickWithRetry("#topicPanel .well:nth-child(" + topicIndex + ") .js-toggle-recurring"); + await E2EGlobal.clickWithRetry(selector); + await E2EGlobal.clickWithRetry("#topicPanel .well:nth-child(" + topicIndex + ") .js-toggle-recurring"); } - static toggleSkipTopic(topicIndex, useDropDownMenu = true) { + static async toggleSkipTopic(topicIndex, useDropDownMenu = true) { // The 2nd parameter determines if the skip should be done via the dropdown-menu or by directly clicking the IsSkipped-Icon shown on the topic. // The latter one will of course only work if the topic is currently skipped if (useDropDownMenu) { @@ -274,45 +274,45 @@ export class E2ETopics { try { // we use the "_org" / non screen shot version here intentionally, // as we often expect the 'recurring icon' to be hidden! - browser.waitForVisible_org(selector); + await browser.waitForVisible_org(selector); } catch(e) { return false; } - E2EGlobal.clickWithRetry(selector); - E2EGlobal.clickWithRetry("#topicPanel .well:nth-child(" + topicIndex + ") .js-toggle-skipped"); + await E2EGlobal.clickWithRetry(selector); + await E2EGlobal.clickWithRetry("#topicPanel .well:nth-child(" + topicIndex + ") .js-toggle-skipped"); } else { - E2EGlobal.waitSomeTime(); - E2EGlobal.clickWithRetry("#topicPanel .well:nth-child(" + topicIndex + ") #topicIsSkippedIcon"); + await E2EGlobal.waitSomeTime(); + await E2EGlobal.clickWithRetry("#topicPanel .well:nth-child(" + topicIndex + ") #topicIsSkippedIcon"); } } - static isTopicClosed(topicIndex) { + static async isTopicClosed(topicIndex) { let selector = "#topicPanel .well:nth-child(" + topicIndex + ") .btnToggleState"; return E2EGlobal.isCheckboxSelected(selector) } - static isTopicRecurring(topicIndex) { + static async isTopicRecurring(topicIndex) { return this._isSelectorVisible("#topicPanel .well:nth-child(" + topicIndex + ") .js-toggle-recurring span"); } - static isTopicSkipped(topicIndex) { + static async isTopicSkipped(topicIndex) { return this._isSelectorVisible("#topicPanel .well:nth-child(" + topicIndex + ") .js-toggle-skipped span"); } - static _isSelectorVisible(selector) { + static async _isSelectorVisible(selector) { try { // we use the "_org" / non screen shot version here intentionally, // as we often expect the 'recurring icon' to be hidden! - browser.waitForVisible_org(selector); + await browser.waitForVisible_org(selector); return true; } catch(e) { return false; } } - static hasDropDownMenuButton(topicIndex, buttonSelector) { + static async hasDropDownMenuButton(topicIndex, buttonSelector) { if (!buttonSelector) return false; @@ -320,102 +320,102 @@ export class E2ETopics { try { // we use the "_org" / non screen shot version here intentionally, // as we often expect the 'dropdown icon' to be hidden! - browser.waitForVisible_org(selector); + await browser.waitForVisible_org(selector); } catch(e) { return false; } - E2EGlobal.clickWithRetry(selector); + await E2EGlobal.clickWithRetry(selector); return browser.isVisible("#topicPanel .well:nth-child(" + topicIndex + ") " + buttonSelector); } - static reOpenTopic(topicIndex) { + static async reOpenTopic(topicIndex) { let selector = "#topicPanel .well:nth-child(" + topicIndex + ") #btnTopicDropdownMenu"; try { // we use the "_org" / non screen shot version here intentionally, // as we often expect the 'recurring icon' to be hidden! - browser.waitForVisible_org(selector); + await browser.waitForVisible_org(selector); } catch(e) { return false; } - E2EGlobal.clickWithRetry(selector); - E2EGlobal.clickWithRetry("#topicPanel .well:nth-child(" + topicIndex + ") #btnReopenTopic"); - E2EApp.confirmationDialogAnswer(true); + await E2EGlobal.clickWithRetry(selector); + await E2EGlobal.clickWithRetry("#topicPanel .well:nth-child(" + topicIndex + ") #btnReopenTopic"); + await E2EApp.confirmationDialogAnswer(true); } - static toggleActionItem(topicIndex, infoItemIndex) { - let selectInfoItem = E2ETopics.getInfoItemSelector(topicIndex, infoItemIndex); + static async toggleActionItem(topicIndex, infoItemIndex) { + let selectInfoItem = await E2ETopics.getInfoItemSelector(topicIndex, infoItemIndex); let selector = selectInfoItem + ".checkboxLabel"; - browser.waitForVisible(selector); - E2EGlobal.clickWithRetry(selector); + await browser.waitForVisible(selector); + await E2EGlobal.clickWithRetry(selector); } - static isActionItemClosed(topicIndex, infoItemIndex) { - let selector = E2ETopics.getInfoItemSelector(topicIndex, infoItemIndex) + ".btnToggleAIState"; + static async isActionItemClosed(topicIndex, infoItemIndex) { + let selector = (await E2ETopics.getInfoItemSelector(topicIndex, infoItemIndex)) + ".btnToggleAIState"; return E2EGlobal.isCheckboxSelected(selector) } - static toggleInfoItemStickyState(topicIndex, infoItemIndex) { - let selectInfoItem = E2ETopics.getInfoItemSelector(topicIndex, infoItemIndex); + static async toggleInfoItemStickyState(topicIndex, infoItemIndex) { + let selectInfoItem = await E2ETopics.getInfoItemSelector(topicIndex, infoItemIndex); let selectorOpenMenu = selectInfoItem + "#btnItemDropdownMenu"; try { - browser.waitForVisible_org(selectorOpenMenu); + await browser.waitForVisible_org(selectorOpenMenu); } catch (e) { return false; } - E2EGlobal.clickWithRetry(selectorOpenMenu); + await E2EGlobal.clickWithRetry(selectorOpenMenu); let selector = selectInfoItem + ".btnPinInfoItem"; - E2EGlobal.clickWithRetry(selector); + await E2EGlobal.clickWithRetry(selector); } - static isInfoItemSticky(topicIndex, infoItemIndex) { - let selectInfoItem = E2ETopics.getInfoItemSelector(topicIndex, infoItemIndex); + static async isInfoItemSticky(topicIndex, infoItemIndex) { + let selectInfoItem = await E2ETopics.getInfoItemSelector(topicIndex, infoItemIndex); let selector = selectInfoItem + ".btnPinInfoItem span"; try { - browser.waitForVisible(selector); + await browser.waitForVisible(selector); return true; } catch(e) { return false; } } - static getInfoItemSelector(topicIndex, infoItemIndex) { + static async getInfoItemSelector(topicIndex, infoItemIndex) { return "#topicPanel .well:nth-child(" + topicIndex + ") .topicInfoItem:nth-child(" + infoItemIndex + ") "; } - static expandDetails(selectorForInfoItem) { + static async expandDetails(selectorForInfoItem) { let selOpenDetails = selectorForInfoItem + ".expandDetails"; - browser.waitForVisible(selOpenDetails); + await browser.waitForVisible(selOpenDetails); try { - browser.waitForVisible(selectorForInfoItem + ".detailRow"); + await browser.waitForVisible(selectorForInfoItem + ".detailRow"); } catch (e) { - E2EGlobal.clickWithRetry(selOpenDetails); + await E2EGlobal.clickWithRetry(selOpenDetails); } } - static expandDetailsForActionItem(topicIndex, infoItemIndex) { - let selectInfoItem = E2ETopics.getInfoItemSelector(topicIndex, infoItemIndex); + static async expandDetailsForActionItem(topicIndex, infoItemIndex) { + let selectInfoItem = await E2ETopics.getInfoItemSelector(topicIndex, infoItemIndex); - E2ETopics.expandDetails(selectInfoItem); + await E2ETopics.expandDetails(selectInfoItem); } - static expandDetailsForNthInfoItem(n) { + static async expandDetailsForNthInfoItem(n) { let selectInfoItem = "#itemPanel .topicInfoItem:nth-child(" + n + ") "; - E2ETopics.expandDetails(selectInfoItem); - E2EGlobal.waitSomeTime(); + await E2ETopics.expandDetails(selectInfoItem); + await E2EGlobal.waitSomeTime(); } - static addFirstDetailsToNewInfoItem(infoItemDoc, topicIndex, detailsText, autoCloseDetailInput = true) { - let type = (infoItemDoc.hasOwnProperty('itemType')) ? infoItemDoc.itemType : 'infoItem'; - this.openInfoItemDialog(topicIndex, type); - this.insertInfoItemDataIntoDialog(infoItemDoc); + static async addFirstDetailsToNewInfoItem(infoItemDoc, topicIndex, detailsText, autoCloseDetailInput = true) { + let type = ((await (infoItemDoc.hasOwnProperty('itemType')))) ? infoItemDoc.itemType : 'infoItem'; + await this.openInfoItemDialog(topicIndex, type); + await this.insertInfoItemDataIntoDialog(infoItemDoc); - browser.setValue('#id_item_detailInput', detailsText); - this.submitInfoItemDialog(); + await browser.setValue('#id_item_detailInput', detailsText); + await this.submitInfoItemDialog(); } /** @@ -427,135 +427,135 @@ export class E2ETopics { * @param doBeforeSubmit callback, which will be called before submitting the changes * @returns {boolean} */ - static addDetailsToActionItem(topicIndex, infoItemIndex, detailsText, doBeforeSubmit) { - let selectInfoItem = E2ETopics.getInfoItemSelector(topicIndex, infoItemIndex); + static async addDetailsToActionItem(topicIndex, infoItemIndex, detailsText, doBeforeSubmit) { + let selectInfoItem = await E2ETopics.getInfoItemSelector(topicIndex, infoItemIndex); let selOpenMenu = selectInfoItem + "#btnItemDropdownMenu"; try { - browser.waitForVisible(selOpenMenu); + await browser.waitForVisible(selOpenMenu); } catch (e) { return false; } - E2EGlobal.clickWithRetry(selOpenMenu); + await E2EGlobal.clickWithRetry(selOpenMenu); let selAddDetails = selectInfoItem + ".addDetail"; - E2EGlobal.clickWithRetry(selAddDetails); + await E2EGlobal.clickWithRetry(selAddDetails); - let newId = E2ETopics.countDetailsForItem(topicIndex, infoItemIndex); + let newId = await E2ETopics.countDetailsForItem(topicIndex, infoItemIndex); let selDetails = selectInfoItem + ".detailRow:nth-child(" + newId + ") "; let selFocusedInput = selDetails + ".detailInput"; try { - browser.waitForVisible(selFocusedInput); + await browser.waitForVisible(selFocusedInput); } catch (e) { console.error('Could not add details. Input field not visible'); return false; } - E2EGlobal.setValueSafe(selFocusedInput, detailsText); + await E2EGlobal.setValueSafe(selFocusedInput, detailsText); if (doBeforeSubmit) { - doBeforeSubmit(selFocusedInput); + await doBeforeSubmit(selFocusedInput); } - browser.keys(['Tab']); - E2EGlobal.waitSomeTime(400); + await browser.keys(['Tab']); + await E2EGlobal.waitSomeTime(400); } - static editDetailsForActionItem(topicIndex, infoItemIndex, detailIndex, detailsText) { - let selectInfoItem = E2ETopics.getInfoItemSelector(topicIndex, infoItemIndex); - E2ETopics.expandDetailsForActionItem(topicIndex, infoItemIndex); + static async editDetailsForActionItem(topicIndex, infoItemIndex, detailIndex, detailsText) { + let selectInfoItem = await E2ETopics.getInfoItemSelector(topicIndex, infoItemIndex); + await E2ETopics.expandDetailsForActionItem(topicIndex, infoItemIndex); let selDetails = selectInfoItem + ".detailRow:nth-child(" + detailIndex + ") "; let selEditDetails = selDetails + ".detailText"; try { - browser.waitForVisible(selEditDetails); + await browser.waitForVisible(selEditDetails); } catch (e) { console.log("detailText not visible"); return false; } - E2EGlobal.clickWithRetry(selEditDetails); + await E2EGlobal.clickWithRetry(selEditDetails); let selFocusedInput = selDetails + ".detailInput"; try { - browser.waitForVisible(selFocusedInput); + await browser.waitForVisible(selFocusedInput); } catch (e) { return false; } - E2EGlobal.setValueSafe(selFocusedInput, detailsText); - browser.keys(['Tab']); + await E2EGlobal.setValueSafe(selFocusedInput, detailsText); + await browser.keys(['Tab']); } - static getTopicsForMinute () { + static async getTopicsForMinute() { let selector = '#topicPanel > div.well'; try { - browser.waitForExist(selector); + await browser.waitForExist(selector); } catch (e) { return 0; } - const elements = browser.elements(selector); + const elements = await browser.elements(selector); return elements.value; } - static countTopicsForMinute () { - let topics = E2ETopics.getTopicsForMinute(); + static async countTopicsForMinute() { + let topics = await E2ETopics.getTopicsForMinute(); return (topics.length) ? topics.length : 0; } - static getLastTopicForMinute() { - let topics = E2ETopics.getTopicsForMinute(); + static async getLastTopicForMinute() { + let topics = await E2ETopics.getTopicsForMinute(); return topics[topics.length-1]; } - static getItemsForTopic (topicIndexOrSelectorForParentElement) { + static async getItemsForTopic(topicIndexOrSelectorForParentElement) { let parentSel = topicIndexOrSelectorForParentElement; if (!isNaN(parentSel)) { parentSel = "#topicPanel .well:nth-child(" + topicIndexOrSelectorForParentElement + ")"; } let selector = parentSel + " .topicInfoItem"; try { - browser.waitForExist(selector); + await browser.waitForExist(selector); } catch (e) { return []; } - const elements = browser.elements(selector); + const elements = await browser.elements(selector); return elements.value; } - static getAllItemsFromItemList() { + static async getAllItemsFromItemList() { let selector = ".topicInfoItem"; try { - browser.waitForExist(selector); + await browser.waitForExist(selector); } catch (e) { return []; } - return browser.elements(selector).value; + return (await browser.elements(selector)).value; } - static getNthItemFromItemList(n) { - const elements = E2ETopics.getAllItemsFromItemList(); + static async getNthItemFromItemList(n) { + const elements = await E2ETopics.getAllItemsFromItemList(); return browser.elementIdText(elements[n].ELEMENT); } - static countItemsForTopic (topicIndex) { - let items = E2ETopics.getItemsForTopic(topicIndex); + static async countItemsForTopic(topicIndex) { + let items = await E2ETopics.getItemsForTopic(topicIndex); return items.length; } - static getDetailsForItem(topicIndex, infoItemIndex) { - let selectInfoItem = E2ETopics.getInfoItemSelector(topicIndex, infoItemIndex); + static async getDetailsForItem(topicIndex, infoItemIndex) { + let selectInfoItem = await E2ETopics.getInfoItemSelector(topicIndex, infoItemIndex); - E2ETopics.expandDetailsForActionItem(topicIndex, infoItemIndex); + await E2ETopics.expandDetailsForActionItem(topicIndex, infoItemIndex); let selector = selectInfoItem + " .detailRow"; try { - browser.waitForExist(selector); + await browser.waitForExist(selector); } catch (e) { return 0; } - const elements = browser.elements(selector); + const elements = await browser.elements(selector); return elements.value; } - static countDetailsForItem(topicIndex, infoItemIndex) { - let details = E2ETopics.getDetailsForItem(topicIndex, infoItemIndex); + static async countDetailsForItem(topicIndex, infoItemIndex) { + let details = await E2ETopics.getDetailsForItem(topicIndex, infoItemIndex); return details.length; } } diff --git a/tests/end2end/helpers/E2EUser.js b/tests/end2end/helpers/E2EUser.js index e690bfa9f..f1698f496 100644 --- a/tests/end2end/helpers/E2EUser.js +++ b/tests/end2end/helpers/E2EUser.js @@ -2,24 +2,24 @@ import {E2EGlobal} from './E2EGlobal' export class E2EUser { - static changePassword(oldPassword, newPassword1, newPassword2) { - E2EGlobal.setValueSafe('input#id_oldPassword', oldPassword); - E2EGlobal.setValueSafe('input#id_newPassword1', newPassword1); - E2EGlobal.setValueSafe('input#id_newPassword2', newPassword2); + static async changePassword(oldPassword, newPassword1, newPassword2) { + await E2EGlobal.setValueSafe('input#id_oldPassword', oldPassword); + await E2EGlobal.setValueSafe('input#id_newPassword1', newPassword1); + await E2EGlobal.setValueSafe('input#id_newPassword2', newPassword2); - browser.keys(['Enter']); + await browser.keys(['Enter']); } - static editProfile(longName, eMail, saveParameter = true) { - E2EGlobal.setValueSafe('input#id_longName', longName); - E2EGlobal.setValueSafe('input#id_emailAddress', eMail); + static async editProfile(longName, eMail, saveParameter = true) { + await E2EGlobal.setValueSafe('input#id_longName', longName); + await E2EGlobal.setValueSafe('input#id_emailAddress', eMail); if (saveParameter) { - browser.keys(['Enter']); + await browser.keys(['Enter']); } - E2EGlobal.waitSomeTime(); + await E2EGlobal.waitSomeTime(); } - static checkProfileChanged(longName, email) { + static async checkProfileChanged(longName, email) { return browser.execute(function (longName, email) { let profileChanged = false; @@ -32,10 +32,10 @@ export class E2EUser { }, longName, email); } - static getUserEmail(){ - return browser.execute(function () { - return Meteor.user().emails[0].address; - }).value; + static async getUserEmail() { + return (await browser.execute(function () { + return (await Meteor.user()).emails[0].address; + })).value; } } diff --git a/tests/end2end/helpers/Server.js b/tests/end2end/helpers/Server.js index 9c0f54f15..90514eb2d 100644 --- a/tests/end2end/helpers/Server.js +++ b/tests/end2end/helpers/Server.js @@ -12,34 +12,34 @@ const ddpclient = new DDPClient({ useSockJs: true }); -function connect() { +async function connect() { const future = new Future(); - ddpclient.connect(function (error) { + await ddpclient.connect(function (error) { if (error) { - future.throw(error); + await future.throw(error); } - future.return(); + await future.return(); }); return future; } -function close() { - ddpclient.close(); +async function close() { + await ddpclient.close(); } -function call() { +async function call() { const future = new Future(); - ddpclient.call( + await ddpclient.call( arguments[0], [].slice.call(arguments, 1), function (err, result) { if (err) { - future.throw(err); + await future.throw(err); } - future.return(result); + await future.return(result); } ); @@ -48,15 +48,15 @@ function call() { const server = { connect: function () { - return connect().wait(); + return (await connect()).wait(); }, close: function () { - close(); + await close(); }, call: function () { - return call.apply(this, arguments).wait(); + return (await call.apply(this, arguments)).wait(); } }; diff --git a/tests/end2end/helpers/wdio_v4_to_v5.js b/tests/end2end/helpers/wdio_v4_to_v5.js index 5dde43568..5df8df32b 100644 --- a/tests/end2end/helpers/wdio_v4_to_v5.js +++ b/tests/end2end/helpers/wdio_v4_to_v5.js @@ -15,7 +15,7 @@ browser.click = function (selector) { } catch (e) { let id = Math.random().toString(36).substr(2, 5); console.log(`browser.click() target "${selector}" not found - see screenshot with ID: ${id}`); - E2EGlobal.saveScreenshot(`click-error_${id}`); + await E2EGlobal.saveScreenshot(`click-error_${id}`); throw e; } }; @@ -38,7 +38,7 @@ browser.waitForVisible = function (selector, timeout, reverse, timeoutMsg, inter catch (e) { let id = Math.random().toString(36).substr(2, 5); console.log(`browser.waitForVisible() target "${selector}" not found - see screenshot with ID: ${id}`); - E2EGlobal.saveScreenshot(`waitForVisible-error_${id}`); + await E2EGlobal.saveScreenshot(`waitForVisible-error_${id}`); throw e; } }; @@ -47,5 +47,5 @@ browser.scroll = function (selector) { }; browser.scrollXY = function (x, y) { - browser.execute('window.scrollTo('+x+','+y+');'); + await browser.execute('window.scrollTo('+x+','+y+');'); }; diff --git a/tests/end2end/setup.js b/tests/end2end/setup.js index 18719331a..b287023a6 100644 --- a/tests/end2end/setup.js +++ b/tests/end2end/setup.js @@ -12,11 +12,11 @@ before(function() { browser.click_org = browser.click; browser.click = function (...args) { try { - browser.click_org(...args); + await browser.click_org(...args); } catch (e) { let id = Math.random().toString(36).substr(2, 5); console.log(`browser.click() target "${args[0]}" not found - see screenshot with ID: ${id}`); - E2EGlobal.saveScreenshot(`click-error_${id}`); + await E2EGlobal.saveScreenshot(`click-error_${id}`); throw e; } }; @@ -26,11 +26,11 @@ before(function() { browser.waitForVisible_org = browser.waitForVisible; browser.waitForVisible = function (selector, timeout = 10000, ...args) { try { - browser.waitForVisible_org(selector, timeout, ...args); + await browser.waitForVisible_org(selector, timeout, ...args); } catch (e) { let id = Math.random().toString(36).substr(2, 5); console.log(`browser.waitForVisible() target "${selector}" not found - see screenshot with ID: ${id}`); - E2EGlobal.saveScreenshot(`waitForVisible-error_${id}`); + await E2EGlobal.saveScreenshot(`waitForVisible-error_${id}`); throw e; } }; @@ -40,27 +40,27 @@ before(function() { browser.elementIdClick_org = browser.elementIdClick; browser.elementIdClick = function (...args) { try { - browser.elementIdClick_org(...args); + await browser.elementIdClick_org(...args); } catch (e) { let id = Math.random().toString(36).substr(2, 5); console.log(`browser.elementIdClick() target "${args[0]}" not found - see screenshot with ID: ${id}`); - E2EGlobal.saveScreenshot(`clickId-error_${id}`); + await E2EGlobal.saveScreenshot(`clickId-error_${id}`); throw e; } }; // Some E2E tests run more robust on "large" width screen - if (E2EGlobal.browserIsPhantomJS()) { - browser.setViewportSize({ + if (await E2EGlobal.browserIsPhantomJS()) { + await browser.setViewportSize({ width: 1024, - height: browser.getViewportSize('height') + height: await browser.getViewportSize('height') }); } - E2EApp.resetMyApp(); - E2EApp.launchApp(); - E2EApp.loginUser(); - expect(E2EApp.isLoggedIn(), 'User is logged in').to.be.true; + await E2EApp.resetMyApp(); + await E2EApp.launchApp(); + await E2EApp.loginUser(); + expect(await E2EApp.isLoggedIn(), 'User is logged in').to.be.true; }); beforeEach(function() { @@ -69,11 +69,11 @@ beforeEach(function() { } const testName = this.currentTest.title; - browser.execute((testName) => { + await browser.execute((testName) => { console.log('--- TEST CASE STARTED --- >' + testName + '<'); }, testName); - server.call('e2e.debugLog', `--- TEST CASE STARTED --- >${testName}<`); + await server.call('e2e.debugLog', `--- TEST CASE STARTED --- >${testName}<`); }); afterEach(function() { @@ -84,18 +84,18 @@ afterEach(function() { const testName = this.currentTest.title, testState = this.currentTest.state; - browser.execute((testName, state) => { + await browser.execute((testName, state) => { console.log('--- TEST CASE FINISHED --- >' + testName + '<'); console.log('--- TEST CASE STATUS: ' + state); }, testName, testState); - server.call('e2e.debugLog', `--- TEST CASE FINISHED --- >${testName}<`); - server.call('e2e.debugLog', `--- TEST CASE STATUS: ${testState}`); + await server.call('e2e.debugLog', `--- TEST CASE FINISHED --- >${testName}<`); + await server.call('e2e.debugLog', `--- TEST CASE STATUS: ${testState}`); if (this.currentTest.state !== 'passed') { - E2EGlobal.logTimestamp('TEST FAILED'); + await E2EGlobal.logTimestamp('TEST FAILED'); console.log('!!! FAILED: ', this.currentTest.title, this.currentTest.state); console.log('!!! Saving POST-MORTEM SCREENSHOT:'); - console.log('!!! ', E2EGlobal.saveScreenshot('FAILED_POST-MORTEM')); + console.log('!!! ', await E2EGlobal.saveScreenshot('FAILED_POST-MORTEM')); } });