Skip to content

Commit

Permalink
update failed ui-tests
Browse files Browse the repository at this point in the history
(cherry picked from commit 8c6d50a)
  • Loading branch information
sgauruseu authored and alansemenov committed Mar 7, 2023
1 parent 9c12aab commit 7a13ee2
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 42 deletions.
13 changes: 7 additions & 6 deletions testing/specs/archive.browse.panel.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ const DeleteContentDialog = require('../page_objects/delete.content.dialog');
const ArchiveBrowsePanel = require('../page_objects/archive/archive.browse.panel');
const ArchiveItemStatisticsPanel = require('../page_objects/archive/archive.item.statistics.panel');
const ConfirmValueDialog = require('../page_objects/confirm.content.delete.dialog');
const ArchiveRestoreDialog = require('../page_objects/archive/archive.restore.dialog');
const ArchiveDeleteDialog = require('../page_objects/archive/archive.delete.dialog');
const ArchiveContentWidgetItemView = require('../page_objects/archive/archive.widget.item.view');

Expand Down Expand Up @@ -45,7 +44,7 @@ describe('archive.browse.panel.spec: tests for archive browse panel and selectio
await contentBrowsePanel.rightClickOnItemByDisplayName(FOLDER2.displayName);
await contentBrowsePanel.clickOnMenuItem(appConst.GRID_CONTEXT_MENU.ARCHIVE);
await deleteContentDialog.waitForDialogOpened();
await studioUtils.saveScreenshot("folder_to_archive2");
await studioUtils.saveScreenshot('folder_to_archive2');
await deleteContentDialog.clickOnArchiveButton();
await confirmValueDialog.waitForDialogOpened();
await confirmValueDialog.typeNumberOrName(2);
Expand All @@ -55,7 +54,7 @@ describe('archive.browse.panel.spec: tests for archive browse panel and selectio
await studioUtils.openArchivePanel();
// 3. Click on the checkbox:
await archiveBrowsePanel.clickCheckboxAndSelectRowByDisplayName(FOLDER1.displayName);
await studioUtils.saveScreenshot("archive_selection_controller1");
await studioUtils.saveScreenshot('archive_selection_controller1');
await archiveBrowsePanel.clickOnSelectionToggler();
// 4. Verify that just one item are displayed in the filtered grid:
let displayNames = await archiveBrowsePanel.getDisplayNamesInGrid();
Expand Down Expand Up @@ -97,8 +96,8 @@ describe('archive.browse.panel.spec: tests for archive browse panel and selectio
let path = await archiveItemStatisticsPanel.getPath();
assert.equal(path, `/${FOLDER1.displayName}`, "Expected path should be displayed in Item Statistics panel");
let status = await archiveItemStatisticsPanel.getStatus();
assert.isTrue(status.includes("Archived"), "Archived status should be displayed in Item Statistics panel");
assert.isTrue(status.includes("by Super User"), "'by Super User' should be displayed in Item Statistics panel");
assert.isTrue(status.includes('Archived'), "Archived status should be displayed in Item Statistics panel");
assert.isTrue(status.includes('by Super User'), "'by Super User' should be displayed in Item Statistics panel");
// 3. Verify that workflow icon is not displayed:
await contentWidgetItemView.waitForWorkflowStateNotDisplayed();
// 4. Verify the name in the content widget:
Expand Down Expand Up @@ -152,7 +151,9 @@ describe('archive.browse.panel.spec: tests for archive browse panel and selectio
await archiveBrowsePanel.waitForSelectionTogglerNotVisible();
});

beforeEach(() => studioUtils.navigateToContentStudioApp());
beforeEach(async () => {
return await studioUtils.navigateToContentStudioCloseProjectSelectionDialog();
});
afterEach(() => studioUtils.doCloseAllWindowTabsAndSwitchToHome());
before(() => {
return console.log('specification is starting: ' + this.title);
Expand Down
30 changes: 16 additions & 14 deletions testing/specs/archive.content.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ describe('archive.content.spec: tests for archiving content', function () {

let FOLDER1;
let FOLDER2;
const ARCHIVE_DELETE_TITLE = "Delete from Archive";
const ARCHIVE_RESTORE_TITLE = "Restore from Archive";
const ARCHIVE_DELETE_TITLE = 'Delete from Archive';
const ARCHIVE_RESTORE_TITLE = 'Restore from Archive';

it(`Precondition: new folder should be added`,
async () => {
Expand Down Expand Up @@ -65,20 +65,20 @@ describe('archive.content.spec: tests for archiving content', function () {
await studioUtils.findContentAndClickCheckBox(FOLDER2.displayName);
// 2. Click on 'Archive...' menu item in the Context menu
await contentBrowsePanel.rightClickOnItemByDisplayName(FOLDER2.displayName);
await studioUtils.saveScreenshot("context-menu-archive");
await studioUtils.saveScreenshot('context-menu-archive');
await contentBrowsePanel.clickOnMenuItem(appConst.GRID_CONTEXT_MENU.ARCHIVE);
await deleteContentDialog.waitForDialogOpened();
await studioUtils.saveScreenshot("folder_to_archive2");
await studioUtils.saveScreenshot('folder_to_archive2');
// 3. Click on 'Archive' button in the modal dialog:
await deleteContentDialog.clickOnArchiveButton();
// 4. Verify that the content is not displayed in Content Browse Panel:
await contentBrowsePanel.waitForContentNotDisplayed(FOLDER2.displayName);
let message = await contentBrowsePanel.waitForNotificationMessage();
let expectedMessage = appConst.itemIsArchived(FOLDER2.displayName);
assert.equal(message, expectedMessage, "Expected notification message should appear");
assert.equal(message, expectedMessage, 'Expected notification message should appear');
// 5. Navigate to 'Archive Browse Panel' and check the archived content:
await studioUtils.openArchivePanel();
await studioUtils.saveScreenshot("folder_in_archive2");
await studioUtils.saveScreenshot('folder_in_archive2');
await archiveBrowsePanel.waitForContentDisplayed(FOLDER2.displayName);
});

Expand All @@ -91,23 +91,23 @@ describe('archive.content.spec: tests for archiving content', function () {
await studioUtils.openArchivePanel();
// 2. Do 'rightClick' on the folder and Click on 'Restore...' menu item in the Context menu
await archiveBrowsePanel.rightClickOnItemByDisplayName(FOLDER2.displayName);
await studioUtils.saveScreenshot("context-menu-restore");
await studioUtils.saveScreenshot('context-menu-restore');
await archiveBrowsePanel.clickOnMenuItem(appConst.GRID_CONTEXT_MENU.RESTORE);
await archiveRestoreDialog.waitForOpened();
let actualTitle = await archiveRestoreDialog.getTitleInHeader();
assert.equal(actualTitle, ARCHIVE_RESTORE_TITLE, "Expected title should be displayed in the dialog");
await studioUtils.saveScreenshot("folder_to_restore1");
await studioUtils.saveScreenshot('folder_to_restore1');
// 3. Click on 'Restore' button in the modal dialog:
await archiveRestoreDialog.clickOnRestoreButton();
// 4. Verify that the content is not displayed in Archive Browse Panel:
let message = await contentBrowsePanel.waitForNotificationMessage();
await studioUtils.saveScreenshot("folder_to_restore_notification");
await studioUtils.saveScreenshot('folder_to_restore_notification');
let expectedMessage = appConst.itemIsRestored(FOLDER2.displayName);
assert.equal(message, expectedMessage, "Expected notification message should appear");
await archiveBrowsePanel.waitForContentNotDisplayed(FOLDER2.displayName);
// 5. Verify the content is present in Content Browse Panel
await studioUtils.switchToContentMode();
await studioUtils.saveScreenshot("folder_is_restored");
await studioUtils.saveScreenshot('folder_is_restored');
await studioUtils.findContentAndClickCheckBox(FOLDER2.displayName);
});

Expand All @@ -120,14 +120,14 @@ describe('archive.content.spec: tests for archiving content', function () {
await archiveBrowsePanel.clickCheckboxAndSelectRowByDisplayName(FOLDER1.displayName);
// 2. Do 'rightClick' on the folder and Click on 'Restore...' menu item in the Context menu
await archiveBrowsePanel.rightClickOnItemByDisplayName(FOLDER1.displayName);
await studioUtils.saveScreenshot("context-menu-delete");
await studioUtils.saveScreenshot('context-menu-delete');
await archiveBrowsePanel.clickOnMenuItem(appConst.GRID_CONTEXT_MENU.DELETE);
await archiveDeleteDialog.waitForOpened();
await studioUtils.saveScreenshot("delete_archive_dialog");
await studioUtils.saveScreenshot('delete_archive_dialog');
// 3. 'Delete' button and expected title should be displayed in the dialog:
await archiveDeleteDialog.waitForDeleteButtonDisplayed();
let title = await archiveDeleteDialog.getTitleInHeader();
assert.equal(title, ARCHIVE_DELETE_TITLE, "Expected title should be present in the dialog");
assert.equal(title, ARCHIVE_DELETE_TITLE, 'Expected title should be present in the dialog');
let actualItems = await archiveDeleteDialog.getItemsToDeleteDisplayName();
assert.equal(actualItems[0], FOLDER1.displayName, "Expected item to delete should be displayed");
});
Expand Down Expand Up @@ -157,7 +157,9 @@ describe('archive.content.spec: tests for archiving content', function () {
assert.equal(message, expectedMessage, 'Expected notification message should appear');
});

beforeEach(() => studioUtils.navigateToContentStudioApp());
beforeEach(async () => {
return await studioUtils.navigateToContentStudioCloseProjectSelectionDialog();
});
afterEach(() => studioUtils.doCloseAllWindowTabsAndSwitchToHome());
before(() => {
return console.log('specification is starting: ' + this.title);
Expand Down
39 changes: 19 additions & 20 deletions testing/specs/archive.muiltiselect.restore.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,54 +61,52 @@ describe('archive.muiltiselect.restore.spec: tests for restore several items', f
await archiveBrowsePanel.waitForContentDisplayed(FOLDER2.displayName);
});

//Verifies issue https://github.com/enonic/app-contentstudio-plus/issues/311
//Confirm restore dialog - the modal dialog should be closed after click on Cancel button or Esc #311
// Verifies issue https://github.com/enonic/app-contentstudio-plus/issues/311
// Confirm restore dialog - the modal dialog should be closed after click on Cancel button or Esc #311
it(`GIVEN 2 folders are selected in Archive AND Confirm Value dialog has been opened WHEN 'Cancel' button has been pressed THEN modal dialog should be closed`,
async () => {
let contentBrowsePanel = new ContentBrowsePanel();
let archiveRestoreDialog = new ArchiveRestoreDialog();
let archiveBrowsePanel = new ArchiveBrowsePanel();
let confirmValueDialog = new ConfirmValueDialog();
//1. Navigate to 'Archive Browse Panel':
// 1. Navigate to 'Archive Browse Panel':
await studioUtils.openArchivePanel();
//2. Select two folders
// 2. Select two folders
await archiveBrowsePanel.clickOnCheckboxAndSelectRowByName(FOLDER1.displayName);
await archiveBrowsePanel.clickOnCheckboxAndSelectRowByName(FOLDER2.displayName);
//3. Click on Restore... button in the browse toolbar
// 3. Click on Restore... button in the browse toolbar
await archiveBrowsePanel.clickOnRestoreButton();
await archiveRestoreDialog.waitForOpened();
//4. Click on Restore in the modal dialog:
// 4. Click on Restore in the modal dialog:
await archiveRestoreDialog.clickOnRestoreButton();
await confirmValueDialog.waitForDialogOpened();
//5. Click on Cancel button in the modal dialog:
// 5. Click on Cancel button in the modal dialog:
await confirmValueDialog.clickOnCancelButton();
//6. Verify that both dialogs are closed:
// 6. Verify that both dialogs are closed:
await confirmValueDialog.waitForDialogClosed();
await archiveRestoreDialog.waitForClosed();
});

//Verifies issue https://github.com/enonic/app-contentstudio-plus/issues/311
//Confirm restore dialog - the modal dialog should be closed after click on Cancel button or Esc #311
// Verifies issue https://github.com/enonic/app-contentstudio-plus/issues/311
// Confirm restore dialog - the modal dialog should be closed after click on Cancel button or Esc #311
it(`GIVEN 2 folders are selected in Archive AND Confirm Value dialog has been opened WHEN 'Esc' key has been pressed THEN modal dialog should be closed`,
async () => {
let contentBrowsePanel = new ContentBrowsePanel();
let archiveRestoreDialog = new ArchiveRestoreDialog();
let archiveBrowsePanel = new ArchiveBrowsePanel();
let confirmValueDialog = new ConfirmValueDialog();
//1. Navigate to 'Archive Browse Panel':
// 1. Navigate to 'Archive Browse Panel':
await studioUtils.openArchivePanel();
//2. Select two folders
// 2. Select two folders
await archiveBrowsePanel.clickOnCheckboxAndSelectRowByName(FOLDER1.displayName);
await archiveBrowsePanel.clickOnCheckboxAndSelectRowByName(FOLDER2.displayName);
//3. Click on Restore... button in the browse toolbar
// 3. Click on Restore... button in the browse toolbar
await archiveBrowsePanel.clickOnRestoreButton();
await archiveRestoreDialog.waitForOpened();
//4. Click on Restore in the modal dialog:
// 4. Click on Restore in the modal dialog:
await archiveRestoreDialog.clickOnRestoreButton();
await confirmValueDialog.waitForDialogOpened();
//5. Press the ESC key
// 5. Press the ESC key
await confirmValueDialog.pressEscKey();
//6. Verify that both dialogs are closed:
// 6. Verify that both dialogs are closed:
await confirmValueDialog.waitForDialogClosed();
await archiveRestoreDialog.waitForClosed();
});
Expand Down Expand Up @@ -175,8 +173,9 @@ describe('archive.muiltiselect.restore.spec: tests for restore several items', f
//await archiveBrowsePanel.waitForSelectionTogglerNotVisible();
});


beforeEach(() => studioUtils.navigateToContentStudioApp());
beforeEach(async () => {
return await studioUtils.navigateToContentStudioCloseProjectSelectionDialog();
});
afterEach(() => studioUtils.doCloseAllWindowTabsAndSwitchToHome());
before(() => {
return console.log('specification is starting: ' + this.title);
Expand Down
6 changes: 4 additions & 2 deletions testing/specs/archive.restore.content.dependant.items.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const ConfirmValueDialog = require('../page_objects/confirm.content.delete.dialo
const ArchiveRestoreDialog = require('../page_objects/archive/archive.restore.dialog');
const ArchiveDeleteDialog = require('../page_objects/archive/archive.delete.dialog');

describe('archive.restore.content.dependant.spec: tests for archive/restore folder with children', function () {
describe('archive.restore.content.dependant.items.spec: tests for archive/restore folder with children', function () {
this.timeout(appConst.SUITE_TIMEOUT);
webDriverHelper.setupBrowser();

Expand Down Expand Up @@ -84,7 +84,9 @@ describe('archive.restore.content.dependant.spec: tests for archive/restore fold
await studioUtils.findContentAndClickCheckBox(FOLDER_DISPLAY_NAME);
});

beforeEach(() => studioUtils.navigateToContentStudioApp());
beforeEach(async () => {
return await studioUtils.navigateToContentStudioCloseProjectSelectionDialog();
});
afterEach(() => studioUtils.doCloseAllWindowTabsAndSwitchToHome());
before(() => {
return console.log('specification is starting: ' + this.title);
Expand Down

0 comments on commit 7a13ee2

Please sign in to comment.