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

ui-tests issue #7647 #7648

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ class ProjectWizardDialog extends Page {
return await this.waitForDialogClosed();
} catch (err) {
await this.saveScreenshot(appConst.generateRandomName('err_cancel_button'));
throw new Error('Layers Content Tree dialog, error when clicking on Cancel(Top) button ' + err);
throw new Error('Project Wizard dialog, error when clicking on Cancel(Top) button ' + err);
}
}

Expand All @@ -182,15 +182,15 @@ class ProjectWizardDialog extends Page {
return await this.waitForElementNotDisplayed(XPATH.container, appConst.saveProjectTimeout);
} catch (err) {
let screenshot = await this.saveScreenshotUniqueName('err_wizard_not_closed');
throw new Error('Layers Content Tree dialog should be closed, screenshot ' + screenshot + ' ' + err);
throw new Error('Project Wizard dialog should be closed, screenshot ' + screenshot + ' ' + err);
}
}

async waitForCancelButtonTopDisplayed() {
try {
return await this.waitForElementDisplayed(this.cancelButtonTop, appConst.shortTimeout);
} catch (err) {
throw new Error('Layers Content Tree dialog dialog - Cancel button is not displayed :' + err);
throw new Error('Project Wizard dialog - Cancel Top button is not displayed :' + err);
}
}

Expand Down
2 changes: 1 addition & 1 deletion testing/page_objects/project/settings.browse.panel.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ class SettingsBrowsePanel extends BaseBrowsePanel {
async waitForProjectByDisplayNameVisible(displayName) {
try {
let nameXpath = XPATH.itemsTreeGrid + lib.itemByDisplayName(displayName);
return await this.waitForElementDisplayed(nameXpath, appConst.mediumTimeout);
return await this.waitForElementDisplayed(nameXpath, appConst.shortTimeout);
} catch (err) {
let screenshot = await this.saveScreenshotUniqueName('err_find_project');
throw Error('Project is not visible, screenshot:' + screenshot + " " + err);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,8 @@ describe('layer.contributor.multi.inheritance.spec - ui-tests for user with laye
await studioUtils.navigateToContentStudioCloseProjectSelectionDialog('su', 'password');
await studioUtils.openSettingsPanel();
// 1. Select and delete the layer:
await projectUtils.selectAndDeleteProject(LAYER_DISPLAY_NAME)
await projectUtils.selectAndDeleteProject(LAYER_DISPLAY_NAME);
await projectUtils.selectAndDeleteProject(PROJECT_DISPLAY_NAME);
});

afterEach(async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,8 @@ describe('layer.owner.multi.inheritance.spec - ui-tests for user with layer-owne
await studioUtils.navigateToContentStudioCloseProjectSelectionDialog('su', 'password');
await studioUtils.openSettingsPanel();
// 1. Select and delete the layer:
await projectUtils.selectAndDeleteProject(LAYER_DISPLAY_NAME)
await projectUtils.selectAndDeleteProject(LAYER_DISPLAY_NAME);
await projectUtils.selectAndDeleteProject(PROJECT_DISPLAY_NAME);
});

afterEach(async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ describe('parent.project.step.multi.inheritance.spec - ui-tests for parent proje
}

const PROJECT_DISPLAY_NAME = studioUtils.generateRandomName('project');
const LAYER_DISPLAY_NAME = studioUtils.generateRandomName('layer');
const MULTI_PROJECTS = [PROJECT_DISPLAY_NAME, 'Default'];


Expand Down
99 changes: 99 additions & 0 deletions testing/specs/project-multi/project.not.available.dialog.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
/**
* Created on 12.07.2023
*/
const assert = require('node:assert');
const webDriverHelper = require('../../libs/WebDriverHelper');
const studioUtils = require('../../libs/studio.utils.js');
const projectUtils = require('../../libs/project.utils.js');
const SettingsBrowsePanel = require('../../page_objects/project/settings.browse.panel');
const appConst = require('../../libs/app_const');
const ProjectWizardDialogApplicationsStep = require('../../page_objects/project/project-wizard-dialog/project.wizard.applications.step');
const ProjectWizardDialogLanguageStep = require('../../page_objects/project/project-wizard-dialog/project.wizard.language.step');
const ProjectNotAvailableDialog = require('../../page_objects/project/project.not.available.dialog');
const ContentBrowsePanel = require('../../page_objects/browsepanel/content.browse.panel');
const lib = require('../../libs/elements');

describe("project.not.available.dialog.spec - clicking on 'Start Wizard' button", function () {
this.timeout(appConst.SUITE_TIMEOUT);

if (typeof browser === 'undefined') {
webDriverHelper.setupBrowser();
}
const PROJECT_DEFAULT_NAME = 'Default';

it("GIVEN existing the only one project has been deleted THEN 'project not available' modal dialog should be loaded",
async () => {
// 1. Open Setting panel
await studioUtils.openSettingsPanel();
// 2. Select and delete the project:
await projectUtils.selectAndDeleteProject(PROJECT_DEFAULT_NAME,'default');
let projectNotAvailableDialog = new ProjectNotAvailableDialog();
await projectUtils.saveScreenshot('the_only_one_project_deleted');
// 3. Verify that Project Not Available modal Dialog is automatically loaded
await projectNotAvailableDialog.waitForDialogLoaded();
});

it("GIVEN 'Start Wizard' button in 'not available project' modal dialog has been pressed WHEN the project wizard has been closed THEN 'Start Wizard' action button gets visible",
async () => {
let languageStep = new ProjectWizardDialogLanguageStep();
let projectNotAvailableDialog = new ProjectNotAvailableDialog();
// 1. Project Not Available Dialog should be loaded
await projectNotAvailableDialog.waitForDialogLoaded();
await projectUtils.saveScreenshot('not_available_modal_dialog');
// 2. Click on 'Start Wizard' button in the modal dialog:
await projectNotAvailableDialog.clickOnStartWizardButton();
// 3. Click on Cancel button in the language step:
await languageStep.waitForLoaded();
await languageStep.clickOnCancelButtonTop();
await languageStep.waitForDialogClosed();
// 4. Action button 'Start Wizard' should be loaded:
let locator = lib.actionButton('Start Wizard');
await projectUtils.waitForElementDisplayed(locator, appConst.mediumTimeout);
});

it("GIVEN navigated to Content Studio, 'No available projects found' - dialog is shown WHEN 'Start Wizard' button has been pressed THEN project wizard should be loaded",
async () => {
let settingsBrowsePanel = new SettingsBrowsePanel();
let contentBrowsePanel = new ContentBrowsePanel();
let languageStep = new ProjectWizardDialogLanguageStep();
let applicationsStep = new ProjectWizardDialogApplicationsStep();
let projectNotAvailableDialog = new ProjectNotAvailableDialog();
// 1. Project Not Available Dialog should be loaded
await projectNotAvailableDialog.waitForDialogLoaded();
await projectUtils.saveScreenshot('not_available_modal_dialog');
// 2. Click on Start button in the modal dialog:
await projectNotAvailableDialog.clickOnStartWizardButton();
await projectNotAvailableDialog.waitForDialogClosed();
// 3. Skip the language step
await languageStep.waitForLoaded();
await languageStep.clickOnSkipButton();
// 4. Select 'Private' access mode in the fours step:
let permissionsStep = await projectUtils.fillAccessModeStep(appConst.PROJECT_ACCESS_MODE.PRIVATE);
await permissionsStep.waitForLoaded();
// 5. skip the permissions step:
await permissionsStep.clickOnSkipButton();
// 6. Skip the applications step
if (await applicationsStep.isLoaded()) {
await applicationsStep.clickOnSkipButton();
}
// 7. Fill in the name input
let summaryStep = await projectUtils.fillNameAndDescriptionStep(PROJECT_DEFAULT_NAME);
await summaryStep.waitForLoaded();
// 8. Click on 'Create Project' button and wait for the dialog is closed:
await summaryStep.clickOnCreateProjectButton();
await summaryStep.waitForDialogClosed();
await settingsBrowsePanel.waitForNotificationMessage();
// 9. project-context should be loaded after creating a project:
let actualContext = await contentBrowsePanel.getSelectedProjectDisplayName();
assert.equal(actualContext, PROJECT_DEFAULT_NAME, 'Expected name should be displayed in the project selected option(App Bar)');
});

beforeEach(() => studioUtils.navigateToContentStudioWithProjects());
afterEach(() => studioUtils.doCloseAllWindowTabsAndSwitchToHome());
before(async () => {
if (typeof browser !== 'undefined') {
await studioUtils.getBrowser().setWindowSize(appConst.BROWSER_WIDTH, appConst.BROWSER_HEIGHT);
}
return console.log('specification starting: ' + this.title);
});
});
72 changes: 72 additions & 0 deletions testing/specs/project-multi/project.recreate.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
/**
* Created on 07.06.2024
*/
const assert = require('node:assert');
const webDriverHelper = require('../../libs/WebDriverHelper');
const studioUtils = require('../../libs/studio.utils.js');
const projectUtils = require('../../libs/project.utils.js');
const SettingsBrowsePanel = require('../../page_objects/project/settings.browse.panel');
const appConst = require('../../libs/app_const');
const ProjectWizardDialogApplicationsStep = require('../../page_objects/project/project-wizard-dialog/project.wizard.applications.step');
const ProjectWizardDialogLanguageStep = require('../../page_objects/project/project-wizard-dialog/project.wizard.language.step');
const ProjectNotAvailableDialog = require('../../page_objects/project/project.not.available.dialog');

describe("project.recreate.spec - tests for recreating a single project ", function () {
this.timeout(appConst.SUITE_TIMEOUT);

if (typeof browser === 'undefined') {
webDriverHelper.setupBrowser();
}
const PROJECT_DEFAULT_NAME = 'Default';

// Settings Panel is not refreshed after creating the first project in empty grid #7646
// https://github.com/enonic/app-contentstudio/issues/7646
it("GIVEN the only one existing project has been deleted then recreated THEN the project should be displayed in Setting Panel",
async () => {
let settingsBrowsePanel = new SettingsBrowsePanel();
let languageStep = new ProjectWizardDialogLanguageStep();
let applicationsStep = new ProjectWizardDialogApplicationsStep();
// 1. Open Setting panel
await studioUtils.openSettingsPanel();
// 2. Select and delete the project:
await projectUtils.selectAndDeleteProject(PROJECT_DEFAULT_NAME, 'default');
let projectNotAvailableDialog = new ProjectNotAvailableDialog();
// 3. Verify that Project Not Available modal Dialog is automatically loaded
await projectNotAvailableDialog.waitForDialogLoaded();
// 4. Open the wizard:
await projectNotAvailableDialog.clickOnStartWizardButton();
await projectNotAvailableDialog.waitForDialogClosed();
// 5. Skip the language step
await languageStep.waitForLoaded();
await languageStep.clickOnSkipButton();
// 6. Select 'Private' access mode in the fours step:
let permissionsStep = await projectUtils.fillAccessModeStep(appConst.PROJECT_ACCESS_MODE.PRIVATE);
await permissionsStep.waitForLoaded();
// 7. skip the permissions step:
await permissionsStep.clickOnSkipButton();
// 8. Skip the applications step
if (await applicationsStep.isLoaded()) {
await applicationsStep.clickOnSkipButton();
}
// 9. Fill in the name input
let summaryStep = await projectUtils.fillNameAndDescriptionStep(PROJECT_DEFAULT_NAME);
await summaryStep.waitForLoaded();
// 10. Click on 'Create Project' button and wait for the wizard-dialog is closed:
await summaryStep.clickOnCreateProjectButton();
await summaryStep.waitForDialogClosed();
await settingsBrowsePanel.waitForNotificationMessage();
await studioUtils.saveScreenshotUniqueName('verify_issue_7646');
let items = await settingsBrowsePanel.getDisplayNames();
assert.ok(items.length === 1, 'Just created project should be displayed in Settings Panel');
await settingsBrowsePanel.waitForProjectByDisplayNameVisible('Default');
});

beforeEach(() => studioUtils.navigateToContentStudioWithProjects());
afterEach(() => studioUtils.doCloseAllWindowTabsAndSwitchToHome());
before(async () => {
if (typeof browser !== 'undefined') {
await studioUtils.getBrowser().setWindowSize(appConst.BROWSER_WIDTH, appConst.BROWSER_HEIGHT);
}
return console.log('specification starting: ' + this.title);
});
});
Loading