test e2e confirmation close wysiwyg

stable
Juanfran 2016-05-10 14:55:35 +02:00
parent 17f78ce2cb
commit c20ff9d368
8 changed files with 87 additions and 18 deletions

View File

@ -29,7 +29,9 @@ helper.description = function(){
let obj = { let obj = {
el: el, el: el,
focus: function() {
el.$('textarea').click();
},
enabledEditionMode: async function(){ enabledEditionMode: async function(){
await el.$(".view-description").click(); await el.$(".view-description").click();
}, },

View File

@ -38,6 +38,10 @@ helper.editor = function(){
let obj = { let obj = {
el: el, el: el,
focus: function() {
el.$("textarea").click();
},
enabledEditionMode: async function(){ enabledEditionMode: async function(){
await el.$("section[tg-editable-wiki-content] .view-wiki-content").click(); await el.$("section[tg-editable-wiki-content] .view-wiki-content").click();
}, },
@ -58,7 +62,7 @@ helper.editor = function(){
}, },
getInnerHtml: async function(text){ getInnerHtml: async function(text){
let wikiText = await el.$(".content").getInnerHtml(); let wikiText = await el.$(".view-wiki-content .wysiwyg").getInnerHtml();
return wikiText; return wikiText;
}, },
@ -75,7 +79,10 @@ helper.editor = function(){
await el.$(".preview-icon a").click(); await el.$(".preview-icon a").click();
await browser.waitForAngular(); await browser.waitForAngular();
}, },
closePreview: async function(){
await el.$(".actions .wysiwyg").click();
await browser.waitForAngular();
},
save: async function(){ save: async function(){
await el.$(".save").click(); await el.$(".save").click();
await browser.waitForAngular(); await browser.waitForAngular();

View File

@ -3,6 +3,7 @@ var detailHelper = require('../helpers').detail;
var commonHelper = require('../helpers').common; var commonHelper = require('../helpers').common;
var customFieldsHelper = require('../helpers/custom-fields-helper'); var customFieldsHelper = require('../helpers/custom-fields-helper');
var commonUtil = require('../utils/common'); var commonUtil = require('../utils/common');
var lightbox = require('../utils/lightbox');
var notifications = require('../utils/notifications'); var notifications = require('../utils/notifications');
var chai = require('chai'); var chai = require('chai');
@ -46,7 +47,32 @@ shared.tagsTesting = async function() {
expect(newtagsText).to.be.not.eql(tagsText); expect(newtagsText).to.be.not.eql(tagsText);
} }
shared.descriptionTesting = async function() { shared.descriptionTesting = function() {
it('confirm close with ESC', async function() {
let descriptionHelper = detailHelper.description();
descriptionHelper.enabledEditionMode();
browser.actions().sendKeys(protractor.Key.ESCAPE).perform();
await lightbox.confirm.cancel();
let descriptionVisibility = await $('.edit-description').isDisplayed();
expect(descriptionVisibility).to.be.true;
descriptionHelper.focus();
browser.actions().sendKeys(protractor.Key.ESCAPE).perform();
await lightbox.confirm.ok();
descriptionVisibility = await $('.edit-description').isDisplayed();
expect(descriptionVisibility).to.be.false;
});
it('edit', async function() {
let descriptionHelper = detailHelper.description(); let descriptionHelper = detailHelper.description();
let description = await descriptionHelper.getInnerHtml(); let description = await descriptionHelper.getInnerHtml();
let date = Date.now(); let date = Date.now();
@ -61,6 +87,7 @@ shared.descriptionTesting = async function() {
expect(newDescription).to.be.not.equal(description); expect(newDescription).to.be.not.equal(description);
await notifications.success.close(); await notifications.success.close();
});
} }
shared.statusTesting = async function(status1 , status2) { shared.statusTesting = async function(status1 , status2) {

View File

@ -29,7 +29,7 @@ describe('Issue detail', async function(){
it('tags edition', sharedDetail.tagsTesting); it('tags edition', sharedDetail.tagsTesting);
it('description edition', sharedDetail.descriptionTesting); describe('description', sharedDetail.descriptionTesting);
it('status edition', sharedDetail.statusTesting.bind(this, 'In progress', 'Ready for test')); it('status edition', sharedDetail.statusTesting.bind(this, 'In progress', 'Ready for test'));

View File

@ -31,7 +31,7 @@ describe('Task detail', function(){
it('tags edition', sharedDetail.tagsTesting); it('tags edition', sharedDetail.tagsTesting);
it('description edition', sharedDetail.descriptionTesting); describe('description', sharedDetail.descriptionTesting);
it('status edition', sharedDetail.statusTesting.bind(this, 'In progress', 'Ready for test')); it('status edition', sharedDetail.statusTesting.bind(this, 'In progress', 'Ready for test'));

View File

@ -30,7 +30,7 @@ describe('User story detail', function(){
it('tags edition', sharedDetail.tagsTesting); it('tags edition', sharedDetail.tagsTesting);
it('description edition', sharedDetail.descriptionTesting); describe('description', sharedDetail.descriptionTesting);
it('status edition', sharedDetail.statusTesting.bind(this, 'Ready', 'In progress')); it('status edition', sharedDetail.statusTesting.bind(this, 'Ready', 'In progress'));

View File

@ -60,6 +60,7 @@ describe('wiki', function() {
//preview //preview
wikiHelper.editor().preview(); wikiHelper.editor().preview();
await utils.common.takeScreenshot("wiki", "home-edition-preview"); await utils.common.takeScreenshot("wiki", "home-edition-preview");
wikiHelper.editor().closePreview();
//save //save
wikiHelper.editor().save(); wikiHelper.editor().save();
@ -74,6 +75,28 @@ describe('wiki', function() {
await utils.common.takeScreenshot("wiki", "home-edition"); await utils.common.takeScreenshot("wiki", "home-edition");
}); });
it('confirm close with ESC in lightbox', async function() {
wikiHelper.editor().enabledEditionMode();
browser.actions().sendKeys(protractor.Key.ESCAPE).perform();
await utils.lightbox.confirm.cancel();
let descriptionVisibility = await $('.view-wiki-content').isDisplayed();
expect(descriptionVisibility).to.be.false;
wikiHelper.editor().focus();
browser.actions().sendKeys(protractor.Key.ESCAPE).perform();
await utils.lightbox.confirm.ok();
descriptionVisibility = await $('.view-wiki-content').isDisplayed();
expect(descriptionVisibility).to.be.true;
});
it('attachments', sharedDetail.attachmentTesting); it('attachments', sharedDetail.attachmentTesting);
it('delete', async function() { it('delete', async function() {

View File

@ -71,3 +71,13 @@ lightbox.confirm.ok = async function() {
await lightbox.close(lb); await lightbox.close(lb);
}; };
lightbox.confirm.cancel = async function() {
let lb = $('.lightbox-generic-ask');
await lightbox.open(lb);
lb.$('.button-red').click();
await lightbox.close(lb);
};