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

[ACS-5639] fix viewer exclude test from protractor and playwright #3443

Merged
merged 6 commits into from
Sep 25, 2023
Merged
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
10 changes: 1 addition & 9 deletions e2e/playwright/viewer/exclude.tests.json
Original file line number Diff line number Diff line change
@@ -1,9 +1 @@
{
"C284636" : "this have Protractor test Enabled https://alfresco.atlassian.net/browse/ACS-5639",
"C284635" : "this have Protractor test Enabled https://alfresco.atlassian.net/browse/ACS-5639",
"C279175" : "this have Protractor test Enabled https://alfresco.atlassian.net/browse/ACS-5639",
"C284634" : "this have Protractor test Enabled https://alfresco.atlassian.net/browse/ACS-5639",
"C297585" : "this have Protractor test Enabled https://alfresco.atlassian.net/browse/ACS-5639",
"C286379" : "this have Protractor test Enabled https://alfresco.atlassian.net/browse/ACS-5639",
"C286395" : "this have Protractor test Enabled https://alfresco.atlassian.net/browse/ACS-5639"
}
{}
25 changes: 17 additions & 8 deletions e2e/playwright/viewer/src/tests/viewer-action.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,19 +37,26 @@ test.describe('viewer action file', () => {
const fileForCancelEditing = `playwright-file2-${Utils.random()}.docx`;
let folderId: string;
let fileDocxShareId: string;
let randomDocxNameFavoriteId: string;
let fileForCancelEditingId: string;

test.beforeAll(async ({ fileAction, shareAction }) => {
test.beforeAll(async ({ fileAction, favoritesPageAction, shareAction }) => {
await apiClientFactory.setUpAcaBackend('hruser');
const node = await apiClientFactory.nodes.createNode('-my-', { name: randomFolderName, nodeType: 'cm:folder', relativePath: '/' });
folderId = node.entry.id;
await fileAction.uploadFile(TEST_FILES.DOCX.path, fileForCancelEditing, folderId);

fileDocxShareId = (await fileAction.uploadFile(TEST_FILES.DOCX.path, randomDocxNameShare, folderId)).entry.id;
await shareAction.shareFileById(fileDocxShareId);
fileForCancelEditingId = (await fileAction.uploadFile(TEST_FILES.DOCX.path, fileForCancelEditing, folderId)).entry.id;
await fileAction.lockNodes([fileForCancelEditingId]);
await fileAction.uploadFile(TEST_FILES.DOCX.path, randomDocxName, folderId);
await fileAction.uploadFile(TEST_FILES.DOCX.path, randomDocxDelete, folderId);
const fileDocShare = await fileAction.uploadFile(TEST_FILES.DOCX.path, randomDocxNameShare, folderId);
fileDocxShareId = fileDocShare.entry.id;
await fileAction.uploadFile(TEST_FILES.DOCX.path, randomDocxNameFavorite, folderId);
await shareAction.shareFileById(fileDocxShareId);
const fileFavoritesNode = await fileAction.uploadFile(TEST_FILES.DOCX.path, randomDocxNameFavorite, folderId);
randomDocxNameFavoriteId = fileFavoritesNode.entry.id;
await fileAction.uploadFile(TEST_FILES.DOCX.path, fileForEditOffline, folderId);
await favoritesPageAction.addFavoriteById('file', randomDocxNameFavoriteId);
await favoritesPageAction.isFavoriteWithRetry('hruser', randomDocxNameFavoriteId, { expect: true });
await fileAction.isFileLockedWriteWithRetry(fileForCancelEditingId, true);
});

test.beforeEach(async ({ personalFiles }) => {
Expand Down Expand Up @@ -140,6 +147,7 @@ test.describe('viewer action file', () => {
await favoritePage.viewerDialog.favoriteMenuButton.waitFor({ state: 'detached', timeout: timeouts.normal });

await sharedPage.acaHeader.clickViewerMoreActions();
await favoritePage.viewerDialog.removeFavoriteMenuButton.waitFor({ state: 'attached', timeout: timeouts.normal });
expect(await sharedPage.viewerDialog.removeFavoriteMenuButton.isVisible(), 'Item should be remove favorite').toBe(true);
await sharedPage.page.keyboard.press('Escape');
await favoritePage.navigate({ waitUntil: 'domcontentloaded' });
Expand All @@ -150,8 +158,9 @@ test.describe('viewer action file', () => {
await favoritePage.navigate({ waitUntil: 'domcontentloaded' });
await favoritePage.dataTable.performClickFolderOrFileToOpen(randomDocxNameFavorite);
expect(await favoritePage.viewer.isViewerOpened(), 'Viewer should be opened').toBe(true);

await favoritePage.acaHeader.shareButton.click();
await favoritePage.viewer.shareButton.waitFor({ state: 'attached', timeout: timeouts.normal });
await favoritePage.viewer.shareButton.click();
await favoritePage.viewerDialog.shareDialogTitle.waitFor({ state: 'attached', timeout: timeouts.normal });
expect(await favoritePage.viewerDialog.shareDialogTitle.isVisible(), 'Share dialog should be open').toBe(true);
await favoritePage.viewerDialog.shareDialogClose.click();
await favoritePage.viewerDialog.shareDialogClose.waitFor({ state: 'detached', timeout: timeouts.large });
Expand Down
32 changes: 8 additions & 24 deletions e2e/playwright/viewer/src/tests/viewer.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,18 @@ test.describe('viewer file', () => {
const randomFolderName = `playwright-folder-${Utils.random()}`;
const randomDocxName = `${TEST_FILES.DOCX.name}-${Utils.random()}`;
let folderId: string;
let fileDocxId: string;

test.beforeAll(async ({ fileAction }) => {
test.beforeAll(async ({ fileAction, shareAction, favoritesPageAction }) => {
await apiClientFactory.setUpAcaBackend('hruser');
const node = await apiClientFactory.nodes.createNode('-my-', { name: randomFolderName, nodeType: 'cm:folder', relativePath: '/' });
folderId = node.entry.id;
await fileAction.uploadFile(TEST_FILES.DOCX.path, randomDocxName, folderId);
const fileDoc = await fileAction.uploadFile(TEST_FILES.DOCX.path, randomDocxName, folderId);
fileDocxId = fileDoc.entry.id;
await shareAction.shareFileById(fileDocxId);
await favoritesPageAction.addFavoriteById('file', fileDocxId);
await favoritesPageAction.isFavoriteWithRetry('hruser', fileDocxId, { expect: true });
await fileAction.waitForNodes(randomDocxName, { expect: 1 });
});

test.beforeEach(async ({ personalFiles }) => {
Expand Down Expand Up @@ -98,28 +104,6 @@ test.describe('viewer file', () => {
expect(await searchPage.viewer.isCloseButtonDisplayed(), 'Close button is not displayed').toBe(true);
expect(await searchPage.viewer.isFileTitleDisplayed(), 'File title is not displayed').toBe(true);
});
});

test.describe('viewer file', () => {
const apiClientFactory = new ApiClientFactory();
const randomFolderName = `playwright-folder-${Utils.random()}`;
const randomDocxName = `$(TEST_FILES.DOCX.name)-${Utils.random()}`;
let folderId: string;
let fileDocxId: string;

test.beforeAll(async ({ fileAction, shareAction, favoritesPageAction: favoritesPageAction }) => {
await apiClientFactory.setUpAcaBackend('hruser');
const node = await apiClientFactory.nodes.createNode('-my-', { name: randomFolderName, nodeType: 'cm:folder', relativePath: '/' });
folderId = node.entry.id;
const fileDoc = await fileAction.uploadFile(TEST_FILES.DOCX.path, randomDocxName, folderId);
fileDocxId = fileDoc.entry.id;
await shareAction.shareFileById(fileDocxId);
await favoritesPageAction.addFavoriteById('file', fileDocxId);
});

test.afterAll(async () => {
await apiClientFactory.nodes.deleteNode(folderId, { permanent: true });
});

test('[C279285] Viewer opens when accessing the preview URL for a file', async ({ personalFiles }) => {
const previewURL = `#/personal-files/${folderId}/(viewer:view/${fileDocxId})`;
Expand Down
13 changes: 1 addition & 12 deletions e2e/protractor/protractor.excludes.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,5 @@
"C279220": "will be fixed after protractor to playwright migration, see https://alfresco.atlassian.net/browse/ACS-5007",
"C279221": "will be fixed after protractor to playwright migration, see https://alfresco.atlassian.net/browse/ACS-5007",
"C325006": "will be fixed after protractor to playwright migration, see https://alfresco.atlassiana.net/browse/ACS-5007",
"C213097": "https://alfresco.atlassian.net/browse/ACS-5479",

"C268958" : "test migrated to playwright https://alfresco.atlassian.net/browse/ACS-5604",
"C268959" : "test migrated to playwright https://alfresco.atlassian.net/browse/ACS-5604",
"C268960" : "test migrated to playwright https://alfresco.atlassian.net/browse/ACS-5604",
"C268961" : "test migrated to playwright https://alfresco.atlassian.net/browse/ACS-5604",

"C286314" : "test migrated to playwright https://alfresco.atlassian.net/browse/ACS-5650",
"C279282" : "test migrated to playwright https://alfresco.atlassian.net/browse/ACS-5650",
"C297584" : "test migrated to playwright https://alfresco.atlassian.net/browse/ACS-5650",
"C268133" : "test migrated to playwright https://alfresco.atlassian.net/browse/ACS-5650",
"C268129" : "test migrated to playwright https://alfresco.atlassian.net/browse/ACS-5650"
"C213097": "https://alfresco.atlassian.net/browse/ACS-5479"
}
135 changes: 0 additions & 135 deletions e2e/protractor/suites/viewer/viewer-actions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ describe('Viewer actions', () => {
const userActions = new UserActions();

const uploadFilesDialog = new UploadFilesDialog();
const downloadButton = element(By.css(`button[id='app.viewer.download']`));
const shareButton = element(By.css(`adf-viewer [data-automation-id="share-action-button"]`));

beforeAll(async () => {
Expand All @@ -85,8 +84,6 @@ describe('Viewer actions', () => {
const filePersonalFiles = docxFile2;
let filePersonalFilesId: string;

const fileForEditOffline = `file1-${Utils.random()}.docx`;
let fileForEditOfflineId: string;
const fileForCancelEditing = `file2-${Utils.random()}.docx`;
let fileForCancelEditingId: string;
const fileForUploadNewVersion = `file3-${Utils.random()}.docx`;
Expand All @@ -105,7 +102,6 @@ describe('Viewer actions', () => {
await apis.user.upload.uploadFileWithRename(xlsxFileForMove, parentId, xlsxPersonalFiles);
await apis.user.upload.uploadFileWithRename(pdfFileForDelete, parentId, pdfPersonalFiles);

fileForEditOfflineId = (await apis.user.upload.uploadFileWithRename(docxFile, parentId, fileForEditOffline)).entry.id;
fileForCancelEditingId = (await apis.user.upload.uploadFileWithRename(docxFile, parentId, fileForCancelEditing)).entry.id;
fileForUploadNewVersionId = (await apis.user.upload.uploadFileWithRename(docxFile, parentId, fileForUploadNewVersion)).entry.id;
fileForUploadNewVersionId2 = (await apis.user.upload.uploadFileWithRename(docxFile, parentId, fileForUploadNewVersion2)).entry.id;
Expand Down Expand Up @@ -142,37 +138,6 @@ describe('Viewer actions', () => {
}
});

it('[C268129] Download action', async () => {
await dataTable.doubleClickOnRowByName(docxPersonalFiles);
await viewer.waitForViewerToOpen();

await downloadButton.click();

expect(await Utils.fileExistsOnOS(docxPersonalFiles)).toBe(true, 'File not found in download location');
});

it('[C268133] Delete action', async () => {
await dataTable.doubleClickOnRowByName(pdfPersonalFiles);
await viewer.waitForViewerToOpen();

await toolbar.clickMoreActionsDelete();
expect(await page.getSnackBarMessage()).toContain(`${pdfPersonalFiles} deleted`);
expect(await viewer.isViewerOpened()).toBe(false, 'Viewer is opened');
await Utils.pressEscape();
await page.clickTrashAndWait();
expect(await dataTable.isItemPresent(pdfPersonalFiles)).toBe(true, 'Item is not present in Trash');
});

it('[C297584] Edit Offline action', async () => {
await dataTable.doubleClickOnRowByName(fileForEditOffline);
await viewer.waitForViewerToOpen();
await toolbar.clickMoreActionsEditOffline();

expect(await Utils.fileExistsOnOS(fileForEditOffline)).toBe(true, 'File not found in download location');
expect(await apis.user.nodes.isFileLockedWrite(fileForEditOfflineId)).toBe(true, `${fileForEditOffline} is not locked`);
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not open');
});

it('[C297585] Cancel Editing action', async () => {
await dataTable.doubleClickOnRowByName(fileForCancelEditing);
await viewer.waitForViewerToOpen();
Expand Down Expand Up @@ -216,106 +181,6 @@ describe('Viewer actions', () => {
expect(await toolbar.menu.cancelEditingAction.isPresent()).toBe(false, `'Cancel Editing' button shouldn't be shown`);
expect(await toolbar.menu.editOfflineAction.isPresent()).toBe(true, `'Edit Offline' should be shown`);
});

it('[C279282] Full screen action', async () => {
await dataTable.doubleClickOnRowByName(docxPersonalFiles);
await viewer.waitForViewerToOpen();

await toolbar.fullScreenButton.click();
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is closed after pressing Full screen');
});

it('[C286314] Pressing ESC in the viewer closes only the action dialog', async () => {
await dataTable.doubleClickOnRowByName(docxPersonalFiles);
await viewer.waitForViewerToOpen();

await toolbar.clickMoreActionsCopy();
expect(await copyMoveDialog.isDialogOpen()).toBe(true, 'Dialog is not open');
await Utils.pressEscape();
expect(await shareDialog.isDialogOpen()).toBe(false, 'Dialog is still open');
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
});
});

describe('from File Libraries', () => {
const siteName = `site-${Utils.random()}`;
const destination = `destFL-${Utils.random()}`;
let destinationId: string;

const xlsxLibraries = `xlsxFL-${Utils.random()}.xlsx`;
const pdfLibraries = `pdfFL-${Utils.random()}.pdf`;

const fileForEditOffline = `file1-${Utils.random()}.docx`;
const fileForCancelEditing = `file2-${Utils.random()}.docx`;
let fileForCancelEditingId: string;
const fileForUploadNewVersion = `file3-${Utils.random()}.docx`;
let fileForUploadNewVersionId: string;

beforeAll(async () => {
try {
await apis.user.sites.createSite(siteName);
const docLibId = await apis.user.sites.getDocLibId(siteName);
destinationId = await apis.user.createFolder(destination);

await apis.user.upload.uploadFile(docxFile2, docLibId);

await apis.user.upload.uploadFileWithRename(xlsxFileForMove, docLibId, xlsxLibraries);
await apis.user.upload.uploadFileWithRename(pdfFileForDelete, docLibId, pdfLibraries);

await apis.user.upload.uploadFileWithRename(docxFile, docLibId, fileForEditOffline);
fileForCancelEditingId = (await apis.user.upload.uploadFileWithRename(docxFile, docLibId, fileForCancelEditing)).entry.id;
fileForUploadNewVersionId = (await apis.user.upload.uploadFileWithRename(docxFile, docLibId, fileForUploadNewVersion)).entry.id;

await userActions.lockNodes([fileForCancelEditingId, fileForUploadNewVersionId]);

await loginPage.loginWith(username);
} catch (error) {
Logger.error(`----- beforeAll failed : ${error}`);
}
});

beforeEach(async () => {
try {
await page.goToMyLibrariesAndWait();
await dataTable.doubleClickOnRowByName(siteName);
await dataTable.waitForHeader();
} catch (error) {
Logger.error(`----- beforeEach failed : ${error}`);
}
});

afterEach(async () => {
await Utils.pressEscape();
await uploadFilesDialog.closeUploadDialog();
});

afterAll(async () => {
try {
await userActions.login(username, username);
await userActions.deleteSites([siteName]);
await userActions.deleteNodes([destinationId]);
await userActions.emptyTrashcan();
} catch (error) {
Logger.error(`----- afterAll failed : ${error}`);
}
});

it('[C286371] Move action', async () => {
await dataTable.doubleClickOnRowByName(xlsxLibraries);
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');

await toolbar.clickMoreActionsMove();
expect(await copyMoveDialog.isDialogOpen()).toBe(true, 'Dialog is not open');
await copyMoveDialog.selectLocation('Personal Files');
await copyMoveDialog.selectDestination(destination);
await copyMoveDialog.moveButton.click();
expect(await page.getSnackBarMessage()).toContain('Moved 1 item');
await viewer.closeButton.click();
expect(await dataTable.isItemPresent(xlsxLibraries)).toBe(false, 'Item was not moved');
await page.clickPersonalFilesAndWait();
await dataTable.doubleClickOnRowByName(destination);
expect(await dataTable.isItemPresent(xlsxLibraries)).toBe(true, 'Item is not present in destination');
});
});

describe('from Recent Files', () => {
Expand Down
35 changes: 1 addition & 34 deletions e2e/protractor/suites/viewer/viewer-general.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,8 @@ describe('Viewer general', () => {

const loginPage = new LoginPage();
const page = new BrowsingPage();
const { dataTable, toolbar } = page;
const { dataTable } = page;
const viewer = new Viewer();
const { searchInput } = page.pageLayoutHeader;

const adminApiActions = new AdminActions();
const userActions = new UserActions();
Expand Down Expand Up @@ -114,24 +113,6 @@ describe('Viewer general', () => {
expect(await viewer.isFileTitleDisplayed()).toBe(true, 'File title is not displayed');
});

it('[C284636] Viewer opens for a file from Recent Files', async () => {
await page.clickRecentFilesAndWait();
await dataTable.doubleClickOnRowByName(xlsxFile);
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
expect(await viewer.isViewerToolbarDisplayed()).toBe(true, 'Toolbar not displayed');
expect(await viewer.isCloseButtonDisplayed()).toBe(true, 'Close button is not displayed');
expect(await viewer.isFileTitleDisplayed()).toBe(true, 'File title is not displayed');
});

it('[C284635] Viewer opens for a file from Shared Files', async () => {
await page.clickSharedFilesAndWait();
await dataTable.doubleClickOnRowByName(xlsxFile);
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
expect(await viewer.isViewerToolbarDisplayed()).toBe(true, 'Toolbar not displayed');
expect(await viewer.isCloseButtonDisplayed()).toBe(true, 'Close button is not displayed');
expect(await viewer.isFileTitleDisplayed()).toBe(true, 'File title is not displayed');
});

it('[C284634] Viewer opens for a file from Favorites', async () => {
await page.clickFavoritesAndWait();
await dataTable.doubleClickOnRowByName(xlsxFile);
Expand All @@ -140,18 +121,4 @@ describe('Viewer general', () => {
expect(await viewer.isCloseButtonDisplayed()).toBe(true, 'Close button is not displayed');
expect(await viewer.isFileTitleDisplayed()).toBe(true, 'File title is not displayed');
});

it('[C279175] Viewer opens for a file from Search Results', async () => {
await toolbar.clickSearchIconButton();
await searchInput.clickSearchButton();
await searchInput.checkFilesAndFolders();
await searchInput.searchFor(xlsxFile);
await dataTable.waitForBody();

await dataTable.doubleClickOnRowByName(xlsxFile);
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not opened');
expect(await viewer.isViewerToolbarDisplayed()).toBe(true, 'Toolbar not displayed');
expect(await viewer.isCloseButtonDisplayed()).toBe(true, 'Close button is not displayed');
expect(await viewer.isFileTitleDisplayed()).toBe(true, 'File title is not displayed');
});
});
Loading