Skip to content

Commit

Permalink
Chore: Functional test fixes (#172)
Browse files Browse the repository at this point in the history
- Only sending alert emails to [email protected] until tests are more stable
- Only running desktop/mobile tests when needed
- Removing arrow functions from app.js
  • Loading branch information
pramodsum authored Apr 13, 2018
1 parent 629ecab commit 580e1d7
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 17 deletions.
7 changes: 4 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ cache: yarn
notifications:
email:
recipients:
- [email protected]
# Update to preview-alerts when tests are more stable
- [email protected]
aliases:
- &sauce-labs
if: type = cron
Expand All @@ -18,10 +19,10 @@ aliases:
script: yarn run functional-tests-ci
- &sauce-labs-mobile
<<: *sauce-labs
script: yarn run functional-tests-ci --grep @mobile --grep @enabled
script: yarn run functional-tests-ci --grep @mobile
- &sauce-labs-desktop
<<: *sauce-labs
script: yarn run functional-tests-ci --grep @desktop --grep @enabled
script: yarn run functional-tests-ci --grep @desktop
jobs:
include:
- script: yarn run ci
Expand Down
11 changes: 5 additions & 6 deletions functional-tests/app.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
/* eslint-disable func-names */
/* eslint-disable prefer-arrow-callback */
/* eslint-disable require-jsdoc */
/* eslint-disable no-console */
/* eslint-disable func-names, require-jsdoc, prefer-arrow-callback, no-console */
const express = require('express');
const path = require('path');
const BoxSDK = require('box-node-sdk');
Expand All @@ -13,7 +10,9 @@ const {
} = process.env;

const app = express();
const server = app.listen(8080, () => console.log('Example app listening on port 8080!'));
const server = app.listen(8080, function() {
console.log('Example app listening on port 8080!');
});

// Set up SDK & client
const sdk = new BoxSDK({
Expand Down Expand Up @@ -58,7 +57,7 @@ app.get('/', function(req, res) {
};

client.exchangeToken(['item_preview'], url, options)
.then((tokenInfo) => {
.then(function (tokenInfo) {
// tokenInfo.accessToken contains the new annotator token
res.render('index', { token: tokenInfo.accessToken, file_id: FILE_ID });
})
Expand Down
6 changes: 3 additions & 3 deletions functional-tests/helpers/eventHooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ module.exports = function() {
* @param {boolean} isPassed - true if passed
* @return {void}
*/
const updateStatus = (test, isPassed) => {
const updateStatus = function (test, isPassed) {
const sessionId = container.helpers('WebDriverIO').browser.requestHandler.sessionID;

myAccount.updateJob(sessionId, {
Expand All @@ -24,11 +24,11 @@ module.exports = function() {
});
};

event.dispatcher.on(event.test.passed, (test) => {
event.dispatcher.on(event.test.passed, function (test) {
updateStatus(test, true);
});

event.dispatcher.on(event.test.failed, (test) => {
event.dispatcher.on(event.test.failed, function (test) {
updateStatus(test, false);
});
};
6 changes: 3 additions & 3 deletions functional-tests/tests/draw.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Before((I) => {
I.amOnPage('/');
});

Scenario('Can enter/exit drawing mode properly @desktop @enabled', (I) => {
Scenario('Can enter/exit drawing mode properly @desktop', (I) => {
I.waitForVisible(SELECTOR_ANNOTATIONS_LOADED);
I.waitForVisible(SELECTOR_ANNOTATION_BUTTON_DRAW);

Expand All @@ -42,7 +42,7 @@ Scenario('Can enter/exit drawing mode properly @desktop @enabled', (I) => {
I.waitForVisible(SELECTOR_ANNOTATION_BUTTON_DRAW);
});

Scenario('Cancel a new drawing annotation @desktop @enabled', (I) => {
Scenario('Cancel a new drawing annotation @desktop', (I) => {
I.waitForVisible(SELECTOR_ANNOTATIONS_LOADED);
I.waitForVisible(SELECTOR_ANNOTATION_BUTTON_DRAW);

Expand All @@ -63,7 +63,7 @@ Scenario('Cancel a new drawing annotation @desktop @enabled', (I) => {
I.waitForInvisible(SELECTOR_ANNOTATION_DRAWING_DIALOG);
});

Scenario('Create a drawing annotation @desktop @enabled', (I) => {
Scenario('Create a drawing annotation @desktop', (I) => {
I.waitForVisible(SELECTOR_ANNOTATIONS_LOADED);
I.waitForVisible(SELECTOR_ANNOTATION_BUTTON_DRAW);

Expand Down
4 changes: 2 additions & 2 deletions functional-tests/tests/plain_highlight.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Before((I) => {
I.amOnPage('/');
});

Scenario('Create a new plain highlight annotation @desktop @enabled', (I) => {
Scenario('Create a new plain highlight annotation @desktop', (I) => {
I.waitForVisible(SELECTOR_ANNOTATIONS_LOADED);

I.say('Highlight dialog should appear after selecting text');
Expand All @@ -30,7 +30,7 @@ Scenario('Create a new plain highlight annotation @desktop @enabled', (I) => {
I.waitForEnabled(SELECTOR_ADD_HIGHLIGHT_BTN);
});

Scenario('Delete the plain highlight annotation @desktop @enabled', (I) => {
Scenario('Delete the plain highlight annotation @desktop', (I) => {
I.waitForVisible(SELECTOR_ANNOTATIONS_LOADED);

I.say('Highlight dialog should appear on click');
Expand Down

0 comments on commit 580e1d7

Please sign in to comment.