Skip to content

Commit e78fc48

Browse files
author
sgauruseu
committed
updated ui-tests for WizardLiveView #8810
1 parent 30312bb commit e78fc48

File tree

7 files changed

+91
-33
lines changed

7 files changed

+91
-33
lines changed

testing/page_objects/components/text.component.js

Lines changed: 56 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -79,24 +79,39 @@ class TextComponent extends Page {
7979
return component.toolbox + lib.CKE.insertSpecialCharacter;
8080
}
8181

82+
get sourceButton() {
83+
return component.toolbox + lib.CKE.sourceButton;
84+
}
85+
8286
async typeTextInCkeEditor(text) {
83-
await this.switchToLiveEditFrame();
84-
await this.waitForElementDisplayed(lib.RICH_TEXT_EDITOR, appConst.mediumTimeout);
85-
let id = await this.getEditorId();
86-
await utils.setTextInCKE(id, text);
87-
await this.getBrowser().switchToParentFrame();
88-
return await this.pause(1000);
87+
try {
88+
await this.switchToLiveEditFrame();
89+
await this.waitForElementDisplayed(lib.RICH_TEXT_EDITOR, appConst.mediumTimeout);
90+
let id = await this.getEditorId();
91+
await utils.setTextInCKE(id, text);
92+
await this.getBrowser().switchToParentFrame();
93+
return await this.pause(1000);
94+
} catch (err) {
95+
let screenshot = await this.saveScreenshotUniqueName('err_text_component_insert_text');
96+
throw new Error(`Error during typing text in CKE editor, screenshot: ${screenshot}` + err);
97+
}
8998
}
9099

91100
async insertTextInCkeEditor(text) {
92-
await this.switchToLiveEditFrame();
93-
await this.waitForElementDisplayed(lib.RICH_TEXT_EDITOR, appConst.mediumTimeout);
94-
let id = await this.getEditorId();
95-
await utils.insertTextInCKE(id, text);
96-
await this.getBrowser().switchToParentFrame();
97-
return await this.pause(1000);
101+
try {
102+
await this.switchToLiveEditFrame();
103+
await this.waitForElementDisplayed(lib.RICH_TEXT_EDITOR, appConst.mediumTimeout);
104+
let id = await this.getEditorId();
105+
await utils.insertTextInCKE(id, text);
106+
await this.getBrowser().switchToParentFrame();
107+
return await this.pause(1000);
108+
} catch (err) {
109+
let screenshot = await this.saveScreenshotUniqueName('err_text_component_insert_text');
110+
throw new Error(`Error during typing text in CKE editor, screenshot:${screenshot}` + err);
111+
}
98112
}
99113

114+
// Inserts the text in 'section' element
100115
async insertTextInCkeEditorSection(text) {
101116
await this.switchToLiveEditFrame();
102117
let locator = "//section[contains(@id,'TextComponentView') and contains(@class,'editor-focused')]"
@@ -116,16 +131,21 @@ class TextComponent extends Page {
116131
await this.getBrowser().switchToParentFrame();
117132
return result;
118133
} catch (err) {
119-
await this.saveScreenshot(appConst.generateRandomName("err_text_component_focus"));
120-
throw new Error("Editor is not focused " + err);
134+
let screenshot = await this.saveScreenshotUniqueName('err_text_component_focus');
135+
throw new Error(`Text component, Editor is not focused, screenshot: ${screenshot} ` + err);
121136
}
122137
}
123138

124139
async getTextFromEditor() {
125-
await this.waitForElementDisplayed(lib.RICH_TEXT_EDITOR, appConst.mediumTimeout);
126-
let editorId = await this.getEditorId();
127-
let result = await utils.getTextInCKE(editorId);
128-
return result.trim();
140+
try {
141+
await this.waitForElementDisplayed(lib.RICH_TEXT_EDITOR, appConst.mediumTimeout);
142+
let editorId = await this.getEditorId();
143+
let result = await utils.getTextInCKE(editorId);
144+
return result.trim();
145+
} catch (err) {
146+
let screenshot = await this.saveScreenshotUniqueName('err_text_component_get_text');
147+
throw new Error(`Error during getting text from CKE editor, screenshot: ${screenshot}` + err);
148+
}
129149
}
130150

131151
getEditorId() {
@@ -163,7 +183,8 @@ class TextComponent extends Page {
163183
await this.switchToParentFrame();
164184
} catch (err) {
165185
await this.switchToParentFrame();
166-
throw new Error(err);
186+
let screenshot = await this.saveScreenshotUniqueName('err_more_button');
187+
throw new Error(`Error after clicking on More button(Insert Table), screenshot: ${screenshot}` + err);
167188
}
168189
}
169190

@@ -181,8 +202,8 @@ class TextComponent extends Page {
181202
await this.switchToParentFrame();
182203
return await insertLinkDialog.waitForDialogLoaded();
183204
} catch (err) {
184-
await this.saveScreenshot(appConst.generateRandomName('err_insert_link'));
185-
throw new Error('Text Component - Error when clicking on Insert Link button ' + err);
205+
let screenshot = await this.saveScreenshotUniqueName('err_insert_link');
206+
throw new Error(`Text Component - Error when clicking on Insert Link button, screenshot:${screenshot} ` + err);
186207
}
187208
}
188209

@@ -192,8 +213,8 @@ class TextComponent extends Page {
192213
await this.clickOnElement(this.insertMacroButton);
193214
return await this.switchToParentFrame();
194215
} catch (err) {
195-
await this.saveScreenshot(appConst.generateRandomName('err_insert_macro'));
196-
throw new Error('Text Component - Error when clicking on Insert Macro button ' + err);
216+
let screenshot = await this.saveScreenshotUniqueName('err_insert_macro');
217+
throw new Error(`Text Component - Error when clicking on Insert Macro button, screenshot:${screenshot} ` + err);
197218
}
198219
}
199220

@@ -217,8 +238,8 @@ class TextComponent extends Page {
217238
return await insertImageDialog.waitForDialogVisible();
218239
} catch (err) {
219240
await this.switchToParentFrame();
220-
await this.saveScreenshotUniqueName('err_insert_image_button');
221-
throw new Error("Text Component Toolbar - Error after clicking on Insert Image button:" + err);
241+
let screenshot = await this.saveScreenshotUniqueName('err_insert_image_button');
242+
throw new Error(`Text Component Toolbar - Error after clicking on Insert Image button, screenshot:${screenshot} ` + err);
222243
}
223244
}
224245

@@ -250,6 +271,16 @@ class TextComponent extends Page {
250271
waitForJustifyButtonButtonDisplayed() {
251272
return this.waitForElementDisplayed(this.justifyButton, appConst.mediumTimeout);
252273
}
274+
275+
async clickOnSourceButton() {
276+
try {
277+
await this.waitForElementDisplayed(lib.RICH_TEXT_EDITOR, appConst.mediumTimeout);
278+
await this.clickOnElement(this.sourceButton);
279+
} catch (err) {
280+
let screenshot = await this.saveScreenshotUniqueName('err_source_btn');
281+
throw new Error(`Text Component - Error occurred during clicking on Source button, screenshot:${screenshot} ` + err);
282+
}
283+
}
253284
}
254285

255286
module.exports = TextComponent;

testing/page_objects/wizardpanel/base.page.components.view.js

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
const Page = require('../page');
55
const lib = require('../../libs/elements');
66
const appConst = require('../../libs/app_const');
7+
78
const xpath = {
89
parentListElement: "//ancestor::div[contains(@class,'item-view-wrapper')]",
910
pageComponentsItemViewer: "//div[contains(@id,'PageComponentsItemViewer')]",
@@ -201,7 +202,7 @@ class BasePageComponentView extends Page {
201202

202203
async swapComponents(sourceName, destinationName) {
203204
let sourceElem = this.container + xpath.componentByName(sourceName);
204-
let destinationElem = this.container + xpath.container + xpath.componentByName(destinationName);
205+
let destinationElem = this.container + xpath.componentByName(destinationName);
205206
let source = await this.findElement(sourceElem);
206207
let destination = await this.findElement(destinationElem);
207208
await source.dragAndDrop(destination);
@@ -260,6 +261,18 @@ class BasePageComponentView extends Page {
260261
}
261262
}
262263

264+
async isComponentItemInvalid(itemDisplayName) {
265+
try {
266+
let locator = this.container + xpath.componentByName(itemDisplayName) + "//div[contains(@class,'xp-admin-common-wrapper')]"; //div[contains(@class,'xp-admin-common-wrapper')]
267+
await this.waitForElementDisplayed(locator, appConst.mediumTimeout);
268+
let attr = await this.getAttribute(locator, 'class');
269+
return attr.includes('icon-state-invalid');
270+
} catch (err) {
271+
let screenshot = await this.saveScreenshotUniqueName('err_select_layout');
272+
throw new Error(`Error during checking the component in PCV, screenshot:${screenshot} ` + err);
273+
}
274+
}
275+
263276
async expandItem(item) {
264277
let locator = this.container + lib.itemStrictByDisplayName(item) + `//ancestor::div[contains(@class,'item-view-wrapper')]` +
265278
lib.TREE_GRID.EXPANDER_ICON_DIV;

testing/page_objects/wizardpanel/html-area/insert.image.dialog.cke.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ class InsertImageDialog extends Page {
292292
let imageSelectorDropdown = new ImageSelectorDropdown();
293293
// parent locator = ImageModalDialog
294294
await imageSelectorDropdown.selectFilteredImageInFlatMode(imageDisplayName, XPATH.container);
295-
await this.pause(400);
295+
await this.pause(1000);
296296
}
297297

298298
async filterAndSelectImageByPath(path) {
@@ -363,6 +363,18 @@ class InsertImageDialog extends Page {
363363
let imageStyleSelectorDropdown = new ImageStyleSelectorDropdown();
364364
await imageStyleSelectorDropdown.clickOnFilteredStyle(style);
365365
}
366+
367+
async clickOnDropdownHandle() {
368+
let imageSelectorDropdown = new ImageSelectorDropdown();
369+
await imageSelectorDropdown.clickOnDropdownHandle(XPATH.container);
370+
await this.pause(1000);
371+
}
372+
373+
async getImagesNameInFlatMode() {
374+
let imageSelectorDropdown = new ImageSelectorDropdown();
375+
let images = await imageSelectorDropdown.getOptionsDisplayNameInFlatMode(XPATH.container);
376+
return images;
377+
}
366378
}
367379

368380
module.exports = InsertImageDialog;

testing/page_objects/wizardpanel/liveform/inspection/city.list.part.inspection.panel.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ class CityListPartInspectionPanel extends BaseComponentInspectionPanel {
3838
let contentSelectorDropdown = new ContentSelectorDropdown();
3939
return await contentSelectorDropdown.selectFilteredByDisplayNameContentMulti(displayName, xpath.container);
4040
} catch (err) {
41-
let screenshot = await this.saveScreenshotUniqueName('err_part_inspection');
42-
throw new Error(`Part Inspection Panel - Error during selecting an option, screenshot: ${screenshot} ` + err);
41+
let screenshot = await this.saveScreenshotUniqueName('err_city_list_inspection');
42+
throw new Error(`City List Inspection Panel - screenshot: ${screenshot} ` + err);
4343
}
4444
}
4545

@@ -62,16 +62,17 @@ class CityListPartInspectionPanel extends BaseComponentInspectionPanel {
6262
return await this.pause(300);
6363
} catch (err) {
6464
let screenshot = await this.saveScreenshotUniqueName("err_inspect_panel_dropdown");
65-
throw new Error(`Error during clicking on dropdown handle in content selector, screenshot: ${screenshot}` + err);
65+
throw new Error(`City List Inspection, screenshot: ${screenshot}` + err);
6666
}
6767
}
6868

6969
async waitForLoaded() {
7070
try {
71-
return await this.waitForElementDisplayed(xpath.container, appConst.mediumTimeout)
71+
await this.waitForElementDisplayed(xpath.container, appConst.mediumTimeout);
72+
await this.pause(200);
7273
} catch (err) {
7374
let screenshot = await this.saveScreenshotUniqueName('err_load_inspect_panel');
74-
throw new Error(`Live Edit, Part Inspection Panel is not loaded, screenshot: ${screenshot} ` + err);
75+
throw new Error(`Live Edit, City List Part Inspection Panel is not loaded, screenshot: ${screenshot} ` + err);
7576
}
7677
}
7778

testing/specs/modal-dialog/insert.image.custom.style.filters.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ describe('insert.image.custom.style.filters.spec: select an image with filters i
6161
await htmlAreaForm.doubleClickOnHtmlArea();
6262
await insertImageDialog.waitForDialogVisible();
6363
// 3. Verify the selected style option in styles selector:
64-
let actualStyle = await insertImageDialog.getSelectedStyleName();
64+
let actualStyle = await insertImageDialog.getSelectedStyleValue();
6565
// 4. Verify that 'Avatar' option should be selected in the styles dropdown selector
6666
await studioUtils.saveScreenshot('image_dialog_custom_style_avatar');
6767
assert.equal(actualStyle, 'Avatar', "'Avatar' style should be selected in the dropdown");

testing/specs/publish/version.items.after.publishing.spec.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ describe('version.items.after.publishing.spec tests for version items', function
105105
let compareWithPublishedVersionDialog = new CompareWithPublishedVersionDialog();
106106
// 1. Open the modified folder(permissions updated):
107107
await studioUtils.selectAndOpenContentInWizard(FOLDER_NAME);
108+
await contentWizard.clickOnPageEditorToggler();
108109
// 2. Open 'Compare With Published Version' modal dialog
109110
await contentWizard.clickOnShowChangesToolbarButton();
110111
await compareWithPublishedVersionDialog.waitForDialogOpened();
7.37 KB
Binary file not shown.

0 commit comments

Comments
 (0)