Skip to content

Commit

Permalink
update failed ui-tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sgauruseu authored and alansemenov committed Oct 30, 2024
1 parent c303d6b commit 1f56fd8
Show file tree
Hide file tree
Showing 10 changed files with 32 additions and 27 deletions.
22 changes: 5 additions & 17 deletions testing/libs/studio.utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -330,10 +330,10 @@ module.exports = {
},
async doAddSite(site, noControllers) {
let contentWizardPanel = new ContentWizardPanel();
//1. Open new site-wizard:
// 1. Open new site-wizard:
await this.openContentWizard(appConst.contentTypes.SITE);
await contentWizardPanel.typeData(site);
//2. Type the data and save:
// 2. Type the data and save:
if (site.data.controller) {
await contentWizardPanel.selectPageDescriptor(site.data.controller);
}
Expand Down Expand Up @@ -698,17 +698,6 @@ module.exports = {
throw new Error('Error when switching to Content Studio App ' + err);
}
},
async switchToTab(title) {
let handles = await this.getBrowser().getWindowHandles();
for (const handle of handles) {
await this.getBrowser().switchToWindow(handle);
let currentTitle = await this.getBrowser().getTitle();
if (currentTitle === title) {
return handle;
}
}
throw new Error('Browser tab with title ' + title + ' was not found');
},
async switchToTabContains(text) {
let handles = await this.getBrowser().getWindowHandles();
for (const handle of handles) {
Expand All @@ -718,8 +707,9 @@ module.exports = {
return handle;
}
}
throw new Error('Browser tab with title ' + title + ' was not found');
throw new Error('Browser tab with title ' + text + ' was not found');
},

async doSwitchToContentBrowsePanelAndSelectDefaultContext() {
try {
let projectSelectionDialog = new ProjectSelectionDialog();
Expand Down Expand Up @@ -759,13 +749,11 @@ module.exports = {

async switchToContentTabWindow(contentDisplayName) {
try {
//await this.getBrowser().switchWindow(contentDisplayName);
await this.switchToTabContains(contentDisplayName);
let contentWizardPanel = new ContentWizardPanel();
return await contentWizardPanel.waitForSpinnerNotVisible();
} catch (err) {
let screenshot = appConst.generateRandomName('err_switch_window');
await this.saveScreenshot(screenshot);
let screenshot = await this.saveScreenshotUniqueName('err_switch_window');
await this.getBrowser().pause(1500);
await this.getBrowser().switchWindow(contentDisplayName);
}
Expand Down
4 changes: 2 additions & 2 deletions testing/page_objects/base.browse.panel.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ class BaseBrowsePanel extends Page {
return await this.pause(300);
} catch (err) {
let screenshot = await this.saveScreenshotUniqueName('err_edit_button');
throw Error(`Edit button is not enabled, screenshot:${screenshot} ` + err);
throw Error(`Edit button is not enabled, screenshot: ${screenshot} ` + err);
}
}

Expand All @@ -184,7 +184,7 @@ class BaseBrowsePanel extends Page {
try {
await this.waitForElementEnabled(this.editButton, appConst.mediumTimeout);
await this.clickOnElement(this.editButton);
return await this.pause(500);
return await this.pause(1500);
} catch (err) {
let screenshot = await this.saveScreenshotUniqueName('err_browse_panel_edit_button');
throw new Error(`Browse Panel: Edit button is not enabled! screenshot:${screenshot} ` + err);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
*/
const BaseDependenciesWidget = require('../../details_panel/base.dependencies.widget');
const appConst = require('../../../libs/app_const');
const lib = require('../../../libs/elements');

const xpath = {
widget: "//div[contains(@id,'ContentBrowsePanel')]//div[contains(@id,'DependenciesWidgetItemView')]",
Expand All @@ -17,7 +18,7 @@ class BrowseDependenciesWidget extends BaseDependenciesWidget {
}

get showOutboundButton() {
return xpath.widget + xpath.showOutboundButton;
return xpath.widget + lib.actionButton('Show Outbound');
}

get showInboundButton() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class BaseDependenciesWidget extends Page {
await this.waitForElementDisplayed(this.showOutboundButton, appConst.shortTimeout);
await this.waitForElementEnabled(this.showOutboundButton, appConst.shortTimeout);
await this.clickOnElement(this.showOutboundButton);
return await this.pause(2000);
return await this.pause(3000);
} catch (err) {
await this.saveScreenshot('err_outbound_button');
throw new Error('Show Outbound button is not visible in ' + err);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ class InsertImageDialog extends Page {
let imageSelectorDropdown = new ImageSelectorDropdown();
// parent locator = ImageModalDialog
await imageSelectorDropdown.selectFilteredImageInFlatMode(imageDisplayName, XPATH.container);
await this.pause(400);
await this.pause(1000);
}

async filterAndSelectImageByPath(path) {
Expand Down
5 changes: 3 additions & 2 deletions testing/page_objects/wizardpanel/site.form.panel.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ class SiteForm extends Page {
}
if (siteData.applications) {
await this.addApplications(siteData.applications);
await this.waitForNotificationMessage();
// Applications may not have controllers, so autosaving does not occur in this case
// await this.waitForNotificationMessage();
}
} catch (err) {
throw new Error("Error during creating site(Site form panel) " + err);
Expand Down Expand Up @@ -112,7 +113,7 @@ class SiteForm extends Page {
try {
let siteConfiguratorComboBox = new SiteConfiguratorComboBox();
await siteConfiguratorComboBox.selectFilteredApplicationAndClickOnApply(displayName, XPATH.wizardSteps);
await this.pause(700);
await this.pause(900);
} catch (err) {
let screenshot = await this.saveScreenshotUniqueName('err_app_option');
throw new Error(`Error occurred in Site wizard, application selector, screenshot : ${screenshot} ` + err);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ describe('insert.image.custom.style.filters.spec: select an image with filters i
await htmlAreaForm.doubleClickOnHtmlArea();
await insertImageDialog.waitForDialogVisible();
// 3. Verify the selected style option in styles selector:
let actualStyle = await insertImageDialog.getSelectedStyleName();
let actualStyle = await insertImageDialog.getSelectedStyleValue();
// 4. Verify that 'Avatar' option should be selected in the styles dropdown selector
await studioUtils.saveScreenshot('image_dialog_custom_style_avatar');
assert.equal(actualStyle, 'Avatar', "'Avatar' style should be selected in the dropdown");
Expand Down
3 changes: 2 additions & 1 deletion testing/specs/page-editor/my.first.site.country.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,10 @@ describe('my.first.site.country.spec - Create a site with country content', func
await cityForm.typePopulation(NEW_SF_POPULATION);
await contentWizard.waitAndClickOnSave();
await contentWizard.waitForNotificationMessage();
await studioUtils.saveScreenshot('new_population_saving');
// 2. Verify that population is not updated in master, because the content is not published now(Modified):
await studioUtils.openResourceInMaster(SITE.displayName + '/' + USA_CONTENT_NAME);
await studioUtils.saveScreenshot('new_population_saved');
await studioUtils.saveScreenshot('new_population_in_master');
let pageSource = await studioUtils.getPageSource();
assert.ok(pageSource.includes(SF_POPULATION), "population should not be updated");
});
Expand Down
15 changes: 15 additions & 0 deletions testing/specs/site.configurator.required.input.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,21 @@ describe('site.configurator.required.input.spec: verifies wizard validation when

let SITE;

it(`GIVEN wizard for new site has been opened WHEN an application that does not have controllers has been selected THEN Save button remains enabled`,
async () => {
let contentWizard = new ContentWizard();
let siteFormPanel = new SiteFormPanel();
// 1. Open site-wizard
await studioUtils.openContentWizard(appConst.contentTypes.SITE);
await contentWizard.typeDisplayName(appConst.generateRandomName('site'));
// 2. Select an application that does not have controllers:
await siteFormPanel.filterOptionsAndSelectApplication(appConst.APP_WITH_CONFIGURATOR);
await contentWizard.pause(1000);
await studioUtils.saveScreenshot('site_app_has_no_controllers');
// 3. Verify that Save button remains enabled after selecting this application:
await contentWizard.waitForSaveButtonEnabled();
});

it(`GIVEN existing site is opened WHEN 'edit' button in the 'selected-option-view' has been clicked THEN 'site configurator dialog should appear'`,
async () => {
let siteFormPanel = new SiteFormPanel();
Expand Down
1 change: 0 additions & 1 deletion testing/wdio/wdio.modal.dialog.chrome.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ exports.config = {
path.join(__dirname, '../specs/modal-dialog/*.spec.js')
],
exclude: [
path.join(__dirname, '../specs/modal-dialog/insert.image.custom.style.filters.spec.js'),
path.join(__dirname, '../specs/modal-dialog/mobile.mode.preview.panel.spec.js'),
path.join(__dirname, '../specs/modal-dialog/mobile.browse.panel.toolbar.spec.js'),
],
Expand Down

0 comments on commit 1f56fd8

Please sign in to comment.