test e2e confirmation close wysiwyg
parent
17f78ce2cb
commit
c20ff9d368
|
@ -29,7 +29,9 @@ helper.description = function(){
|
|||
|
||||
let obj = {
|
||||
el: el,
|
||||
|
||||
focus: function() {
|
||||
el.$('textarea').click();
|
||||
},
|
||||
enabledEditionMode: async function(){
|
||||
await el.$(".view-description").click();
|
||||
},
|
||||
|
|
|
@ -38,6 +38,10 @@ helper.editor = function(){
|
|||
let obj = {
|
||||
el: el,
|
||||
|
||||
focus: function() {
|
||||
el.$("textarea").click();
|
||||
},
|
||||
|
||||
enabledEditionMode: async function(){
|
||||
await el.$("section[tg-editable-wiki-content] .view-wiki-content").click();
|
||||
},
|
||||
|
@ -58,7 +62,7 @@ helper.editor = function(){
|
|||
},
|
||||
|
||||
getInnerHtml: async function(text){
|
||||
let wikiText = await el.$(".content").getInnerHtml();
|
||||
let wikiText = await el.$(".view-wiki-content .wysiwyg").getInnerHtml();
|
||||
return wikiText;
|
||||
},
|
||||
|
||||
|
@ -75,7 +79,10 @@ helper.editor = function(){
|
|||
await el.$(".preview-icon a").click();
|
||||
await browser.waitForAngular();
|
||||
},
|
||||
|
||||
closePreview: async function(){
|
||||
await el.$(".actions .wysiwyg").click();
|
||||
await browser.waitForAngular();
|
||||
},
|
||||
save: async function(){
|
||||
await el.$(".save").click();
|
||||
await browser.waitForAngular();
|
||||
|
|
|
@ -3,6 +3,7 @@ var detailHelper = require('../helpers').detail;
|
|||
var commonHelper = require('../helpers').common;
|
||||
var customFieldsHelper = require('../helpers/custom-fields-helper');
|
||||
var commonUtil = require('../utils/common');
|
||||
var lightbox = require('../utils/lightbox');
|
||||
var notifications = require('../utils/notifications');
|
||||
|
||||
var chai = require('chai');
|
||||
|
@ -46,21 +47,47 @@ shared.tagsTesting = async function() {
|
|||
expect(newtagsText).to.be.not.eql(tagsText);
|
||||
}
|
||||
|
||||
shared.descriptionTesting = async function() {
|
||||
let descriptionHelper = detailHelper.description();
|
||||
let description = await descriptionHelper.getInnerHtml();
|
||||
let date = Date.now();
|
||||
descriptionHelper.enabledEditionMode();
|
||||
descriptionHelper.setText("New description " + date);
|
||||
descriptionHelper.save();
|
||||
shared.descriptionTesting = function() {
|
||||
it('confirm close with ESC', async function() {
|
||||
let descriptionHelper = detailHelper.description();
|
||||
|
||||
let newDescription = await descriptionHelper.getInnerHtml();
|
||||
let notificationOpen = await notifications.success.open();
|
||||
descriptionHelper.enabledEditionMode();
|
||||
|
||||
expect(notificationOpen).to.be.equal.true;
|
||||
expect(newDescription).to.be.not.equal(description);
|
||||
browser.actions().sendKeys(protractor.Key.ESCAPE).perform();
|
||||
|
||||
await notifications.success.close();
|
||||
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 description = await descriptionHelper.getInnerHtml();
|
||||
let date = Date.now();
|
||||
descriptionHelper.enabledEditionMode();
|
||||
descriptionHelper.setText("New description " + date);
|
||||
descriptionHelper.save();
|
||||
|
||||
let newDescription = await descriptionHelper.getInnerHtml();
|
||||
let notificationOpen = await notifications.success.open();
|
||||
|
||||
expect(notificationOpen).to.be.equal.true;
|
||||
expect(newDescription).to.be.not.equal(description);
|
||||
|
||||
await notifications.success.close();
|
||||
});
|
||||
}
|
||||
|
||||
shared.statusTesting = async function(status1 , status2) {
|
||||
|
|
|
@ -29,7 +29,7 @@ describe('Issue detail', async function(){
|
|||
|
||||
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'));
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ describe('Task detail', function(){
|
|||
|
||||
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'));
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ describe('User story detail', function(){
|
|||
|
||||
it('tags edition', sharedDetail.tagsTesting);
|
||||
|
||||
it('description edition', sharedDetail.descriptionTesting);
|
||||
describe('description', sharedDetail.descriptionTesting);
|
||||
|
||||
it('status edition', sharedDetail.statusTesting.bind(this, 'Ready', 'In progress'));
|
||||
|
||||
|
|
|
@ -60,6 +60,7 @@ describe('wiki', function() {
|
|||
//preview
|
||||
wikiHelper.editor().preview();
|
||||
await utils.common.takeScreenshot("wiki", "home-edition-preview");
|
||||
wikiHelper.editor().closePreview();
|
||||
|
||||
//save
|
||||
wikiHelper.editor().save();
|
||||
|
@ -74,6 +75,28 @@ describe('wiki', function() {
|
|||
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('delete', async function() {
|
||||
|
|
|
@ -71,3 +71,13 @@ lightbox.confirm.ok = async function() {
|
|||
|
||||
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);
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue