Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Functional tests #320

Merged
merged 1 commit into from
Jan 3, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 17 additions & 7 deletions functional-tests/helpers/actions.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
/* eslint-disable prefer-arrow-callback, no-var, func-names */
const {
SELECTOR_ANNOTATION_POPOVER,
SELECTOR_ANNOTATION_BUTTON_POST,
SELECTOR_ANNOTATION_BUTTON_CANCEL,
SELECTOR_ANNOTATION_COMMENT,
SELECTOR_DELETE_COMMENT_BTN,
SELECTOR_DRAFTEDITOR_CONTENT,
SELECTOR_ACTION_CONTROLS,
SELECTOR_INPUT_SUBMIT_BTN,
SELECTOR_INPUT_CANCEL_BTN,
SELECTOR_ANNOTATION_POINT_MARKER,
SELECTOR_ANNOTATION_TEXTAREA,
SELECTOR_ANNNOTATION_MODE_BACKGROUND,
SELECTOR_ANNOTATION_BUTTON_POINT,
SELECTOR_ANNOTATION_BUTTON_POINT_EXIT,
@@ -85,6 +82,21 @@ function enterPointMode(I) {
I.waitForVisible(SELECTOR_ANNOTATION_BUTTON_POINT_EXIT);
}

/**
* Exit point annotation mode
*
* @param {Object} I - the codeceptjs I
*
* @return {void}
*/
function exitPointMode(I) {
I.say('Exit point annotation mode');
I.click(SELECTOR_ANNOTATION_BUTTON_POINT_EXIT);
I.waitForVisible(SELECTOR_ANNOTATION_BUTTON_POINT);
I.dontSeeElement(SELECTOR_ANNNOTATION_MODE_BACKGROUND);
I.dontSeeElement(SELECTOR_POINT_MODE_HEADER);
I.dontSeeElement(SELECTOR_ANNOTATION_BUTTON_POINT_EXIT);
}
/**
* Cancel a point annotation
*
@@ -131,14 +143,12 @@ function createReplyDeletePoint(I) {
deleteAnnotation(I, 1);
I.waitForDetached(SELECTOR_ANNOTATION_POINT_MARKER, 1);

I.say('Exit point annotation mode');
I.click(SELECTOR_ANNOTATION_BUTTON_POINT_EXIT);
I.dontSeeElement(SELECTOR_ANNNOTATION_MODE_BACKGROUND);
I.waitForVisible(SELECTOR_ANNOTATION_BUTTON_POINT);
exitPointMode(I);
}

exports.replyToThread = replyToThread;
exports.deleteAnnotation = deleteAnnotation;
exports.enterPointMode = enterPointMode;
exports.exitPointMode = exitPointMode;
exports.cancelPointAnnotation = cancelPointAnnotation;
exports.createReplyDeletePoint = createReplyDeletePoint;
2 changes: 1 addition & 1 deletion functional-tests/helpers/validation.js
Original file line number Diff line number Diff line change
@@ -25,7 +25,7 @@ const {
*/
async function validateIconColor(I, selector, color) {
I.waitForElement(selector);
const clr = await I.grabCssPropertyFrom(`${selector} svg`, 'fill');
const clr = await I.grabCssPropertyFrom(selector, 'fill');
expect(clr).to.equal(color);
}

3 changes: 0 additions & 3 deletions functional-tests/tests/draw.js
Original file line number Diff line number Diff line change
@@ -11,7 +11,6 @@ const {
SELECTOR_ANNOTATION_BUTTON_DRAW_CANCEL,
SELECTOR_ANNOTATION_LAYER_DRAW_IN_PROGRESS,
SELECTOR_DRAW_CONTROLS,
SELECTOR_ADD_DRAWING_BTN,
SELECTOR_ANNOTATION_DRAWING_LABEL,
SELECTOR_DRAWING_DELETE_BTN,
SELECTOR_HIGHLIGHT_CONTROLS
@@ -94,7 +93,6 @@ Scenario('Create/Delete drawing @desktop @doc', function(I) {

I.say('Save drawing');
I.click(SELECTOR_DRAWING_SAVE_BTN);
I.waitForInvisible(SELECTOR_DRAW_CONTROLS);

// Unselect newly created drawing
I.click(SELECTOR_TEXT_LAYER);
@@ -121,7 +119,6 @@ Scenario('Create/Delete drawing @desktop @doc', function(I) {

I.say('Save drawing');
I.click(SELECTOR_DRAWING_SAVE_BTN);
I.waitForInvisible(SELECTOR_DRAW_CONTROLS);

// Unselect newly created drawing
I.click(SELECTOR_TEXT_LAYER);
32 changes: 29 additions & 3 deletions functional-tests/tests/plain_highlight.js
Original file line number Diff line number Diff line change
@@ -5,10 +5,14 @@ const {
SELECTOR_HIGHLIGHT_CONTROLS,
SELECTOR_ANNOTATION_POPOVER,
SELECTOR_HIGHLIGHT_BTN,
SELECTOR_ANNOTATOR_LABEL
SELECTOR_SAVED_HIGHLIGHT,
SELECTOR_ANNOTATOR_LABEL,
SELECTOR_ANNOTATION_BUTTON_DRAW,
SELECTOR_ANNOTATION_BUTTON_DRAW_CANCEL
} = require('../helpers/constants');

const { selectText } = require('../helpers/mouseEvents');
const { selectText, clickAtLocation } = require('../helpers/mouseEvents');
const { enterPointMode, exitPointMode } = require('../helpers/actions');
const { validateIconColor } = require('../helpers/validation');
const { cleanupAnnotations } = require('../helpers/cleanup');

@@ -25,6 +29,28 @@ After(function() {
Scenario('Create/Delete a new plain highlight annotation @desktop @doc', function(I) {
I.waitForVisible(SELECTOR_ANNOTATIONS_LOADED);

/** Highlighting should still work after drawing on the file */
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it make sense to break this out into a separate scenario, "highlight after drawing on the file", and leave the simple scenario of creating a plain highlight?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Breaking it out into a separate Scenario causes the page to refresh. Apparently you can't open the page in the BeforeSuite helper which would have allowed me to break each segment into it's own scenario :-/

I.say('Enter draw annotation mode');
I.click(SELECTOR_ANNOTATION_BUTTON_DRAW);
I.waitForVisible(SELECTOR_ANNOTATION_BUTTON_DRAW_CANCEL);

I.say('Exit draw annotations mode');
I.click(SELECTOR_ANNOTATION_BUTTON_DRAW_CANCEL);
I.waitForVisible(SELECTOR_ANNOTATION_BUTTON_DRAW);

selectText(I, SELECTOR_TEXT_LAYER);
I.waitForVisible(SELECTOR_HIGHLIGHT_CONTROLS);

/** Highlighting should still work after entering/exiting point mode */
I.say('Enter point mode');
enterPointMode(I);

I.say('Starting creating point annotation');
clickAtLocation(I, SELECTOR_TEXT_LAYER);

I.say('Exit point mode');
exitPointMode(I);

/*
* Create plain highlight annotation
*/
@@ -40,7 +66,7 @@ Scenario('Create/Delete a new plain highlight annotation @desktop @doc', functio
I.waitForText('Kanye West highlighted', 9, SELECTOR_ANNOTATOR_LABEL);
I.waitForEnabled(SELECTOR_HIGHLIGHT_BTN);

validateIconColor(I, `${SELECTOR_HIGHLIGHT_BTN}`, 'rgb(255, 201, 0)');
validateIconColor(I, SELECTOR_SAVED_HIGHLIGHT, 'rgb(254, 217, 78)');

/*
* Delete plain highlight annotation