import { BrowsingPage , SearchResultsPage , Utils } from '@alfresco/aca-testing-shared' ; import * as testData from './test-data-permissions' ; import * as testUtil from '../test-util' ; const page = new BrowsingPage ( ) ; const { dataTable } = page ; const searchResultsPage = new SearchResultsPage ( ) ; const { searchInput } = searchResultsPage . header ; export function collaboratorTests ( siteName ? ) { describe ( 'available actions : ' , ( ) => { beforeEach ( async ( ) => { await Utils . pressEscape ( ) ; } ) ; afterEach ( async ( ) => { await page . closeOpenDialogs ( ) ; } ) ; it ( 'on File Libraries - [C297647]' , async ( ) => { await page . goToMyLibrariesAndWait ( ) ; await dataTable . doubleClickOnRowByName ( siteName ) ; await dataTable . waitForHeader ( ) ; const expectedToolbarPrimary = [ 'Shared Link Settings' , 'Download' , 'View' , 'View Details' , 'More Actions' ] ; const expectedToolbarMore = [ 'Edit Offline' , 'Upload New Version' , 'Remove Favorite' , 'Copy' , 'Manage Versions' , 'Edit Aspects' , 'Permissions' ] ; await testUtil . checkToolbarActions ( testData . fileSharedFav . name , expectedToolbarPrimary , expectedToolbarMore ) ; } ) ; it ( 'on Shared Files - [C297651]' , async ( ) => { await page . clickSharedFilesAndWait ( ) ; const expectedToolbarPrimary = [ 'Shared Link Settings' , 'Download' , 'View' , 'View Details' , 'More Actions' ] ; const expectedToolbarMore = [ 'Edit Offline' , 'Upload New Version' , 'Remove Favorite' , 'Copy' , 'Manage Versions' , 'Edit Aspects' , 'Permissions' ] ; await testUtil . checkToolbarActions ( testData . fileSharedFav . name , expectedToolbarPrimary , expectedToolbarMore ) ; } ) ; it ( 'on Favorites - [C297652]' , async ( ) => { await page . clickFavoritesAndWait ( ) ; const expectedToolbarPrimary = [ 'Shared Link Settings' , 'Download' , 'View' , 'View Details' , 'More Actions' ] ; const expectedToolbarMore = [ 'Upload New Version' , 'Remove Favorite' , 'Move' , 'Copy' , 'Delete' , 'Manage Versions' ] ; await testUtil . checkToolbarActions ( testData . fileSharedFav . name , expectedToolbarPrimary , expectedToolbarMore ) ; } ) ; it ( 'on Search Results - [C297653]' , async ( ) => { await searchInput . clickSearchButton ( ) ; await searchInput . searchFor ( testData . fileSharedFav . name ) ; const expectedToolbarPrimary = [ 'Shared Link Settings' , 'Download' , 'View' , 'View Details' , 'More Actions' ] ; const expectedToolbarMore = [ 'Edit Offline' , 'Upload New Version' , 'Remove Favorite' , 'Copy' , 'Manage Versions' , 'Edit Aspects' , 'Permissions' ] ; await testUtil . checkToolbarActions ( testData . fileSharedFav . name , expectedToolbarPrimary , expectedToolbarMore ) ; } ) ; describe ( 'available actions in the viewer : ' , ( ) => { it ( 'file opened from File Libraries - [C297654]' , async ( ) => { await page . goToMyLibrariesAndWait ( ) ; await dataTable . doubleClickOnRowByName ( siteName ) ; await dataTable . waitForHeader ( ) ; const expectedToolbarPrimary = [ 'Activate full-screen mode' , 'Shared Link Settings' , 'Download' , 'Print' , 'View Details' , 'More Actions' ] ; const expectedToolbarMore = [ 'Edit in Microsoft Office™' , 'Edit Offline' , 'Upload New Version' , 'Remove Favorite' , 'Copy' , 'Manage Versions' , 'Edit Aspects' , 'Permissions' ] ; await testUtil . checkViewerActions ( testData . fileDocxSharedFav . name , expectedToolbarPrimary , expectedToolbarMore ) ; } ) ; it ( 'file opened from Shared Files - [C297655]' , async ( ) => { await page . clickSharedFilesAndWait ( ) ; const expectedToolbarPrimary = [ 'Activate full-screen mode' , 'Shared Link Settings' , 'Download' , 'Print' , 'View Details' , 'More Actions' ] ; const expectedToolbarMore = [ 'Edit in Microsoft Office™' , 'Edit Offline' , 'Upload New Version' , 'Remove Favorite' , 'Copy' , 'Manage Versions' , 'Edit Aspects' , 'Permissions' ] ; await testUtil . checkViewerActions ( testData . fileDocxSharedFav . name , expectedToolbarPrimary , expectedToolbarMore ) ; } ) ; it ( 'file opened from Favorites - [C297656]' , async ( ) => { await page . clickFavoritesAndWait ( ) ; const expectedToolbarPrimary = [ 'Activate full-screen mode' , 'Shared Link Settings' , 'Download' , 'Print' , 'View Details' , 'More Actions' ] ; const expectedToolbarMore = [ 'Edit in Microsoft Office™' , 'Edit Offline' , 'Upload New Version' , 'Remove Favorite' , 'Copy' , 'Manage Versions' , 'Edit Aspects' , 'Permissions' ] ; await testUtil . checkViewerActions ( testData . fileDocxSharedFav . name , expectedToolbarPrimary , expectedToolbarMore ) ; } ) ; it ( 'file opened from Search Results - [C306992]' , async ( ) => { await searchInput . clickSearchButton ( ) ; await searchInput . searchFor ( testData . fileDocxSharedFav . name ) ; await searchResultsPage . waitForResults ( ) ; const expectedToolbarPrimary = [ 'Activate full-screen mode' , 'Shared Link Settings' , 'Download' , 'Print' , 'View Details' , 'More Actions' ] ; const expectedToolbarMore = [ 'Edit in Microsoft Office™' , 'Edit Offline' , 'Upload New Version' , 'Remove Favorite' , 'Copy' , 'Manage Versions' , 'Edit Aspects' , 'Permissions' ] ; await testUtil . checkViewerActions ( testData . fileDocxSharedFav . name , expectedToolbarPrimary , expectedToolbarMore ) ; } ) ; } ) ; } ) ; } export function filesLockedByCurrentUser ( siteName ? ) { describe ( 'available actions : ' , ( ) => { beforeEach ( async ( ) => { await Utils . pressEscape ( ) ; } ) ; afterEach ( async ( ) => { await page . closeOpenDialogs ( ) ; } ) ; it ( 'on File Libraries - [C297657]' , async ( ) => { await page . goToMyLibrariesAndWait ( ) ; await dataTable . doubleClickOnRowByName ( siteName ) ; await dataTable . waitForHeader ( ) ; const expectedToolbarPrimary = [ 'Shared Link Settings' , 'Download' , 'View' , 'View Details' , 'More Actions' ] ; const expectedToolbarMore = [ 'Cancel Editing' , 'Upload New Version' , 'Remove Favorite' , 'Copy' , 'Manage Versions' ] ; await testUtil . checkToolbarActions ( testData . fileLockedByUser , expectedToolbarPrimary , expectedToolbarMore ) ; } ) ; it ( 'on Shared Files - [C297658]' , async ( ) => { await page . clickSharedFilesAndWait ( ) ; const expectedToolbarPrimary = [ 'Shared Link Settings' , 'Download' , 'View' , 'View Details' , 'More Actions' ] ; const expectedToolbarMore = [ 'Cancel Editing' , 'Upload New Version' , 'Remove Favorite' , 'Copy' , 'Manage Versions' ] ; await testUtil . checkToolbarActions ( testData . fileLockedByUser , expectedToolbarPrimary , expectedToolbarMore ) ; } ) ; it ( 'on Favorites - [C297659]' , async ( ) => { await page . clickFavoritesAndWait ( ) ; const expectedToolbarPrimary = [ 'Shared Link Settings' , 'Download' , 'View' , 'View Details' , 'More Actions' ] ; const expectedToolbarMore = [ 'Cancel Editing' , 'Upload New Version' , 'Remove Favorite' , 'Move' , 'Copy' , 'Delete' , 'Manage Versions' ] ; await testUtil . checkToolbarActions ( testData . fileLockedByUser , expectedToolbarPrimary , expectedToolbarMore ) ; } ) ; it ( 'on Search Results - [C297660]' , async ( ) => { await searchInput . clickSearchButton ( ) ; await searchInput . searchFor ( testData . fileLockedByUser ) ; await searchResultsPage . waitForResults ( ) ; const expectedToolbarPrimary = [ 'Shared Link Settings' , 'Download' , 'View' , 'View Details' , 'More Actions' ] ; const expectedToolbarMore = [ 'Cancel Editing' , 'Upload New Version' , 'Remove Favorite' , 'Copy' , 'Manage Versions' ] ; await testUtil . checkToolbarActions ( testData . fileLockedByUser , expectedToolbarPrimary , expectedToolbarMore ) ; } ) ; describe ( 'available actions in the viewer : ' , ( ) => { it ( 'file opened from File Libraries - [C297661]' , async ( ) => { await page . goToMyLibrariesAndWait ( ) ; await dataTable . doubleClickOnRowByName ( siteName ) ; await dataTable . waitForHeader ( ) ; const expectedToolbarPrimary = [ 'Activate full-screen mode' , 'Shared Link Settings' , 'Download' , 'Print' , 'View Details' , 'More Actions' ] ; const expectedToolbarMore = [ 'Cancel Editing' , 'Upload New Version' , 'Remove Favorite' , 'Copy' , 'Manage Versions' ] ; await testUtil . checkViewerActions ( testData . fileLockedByUser , expectedToolbarPrimary , expectedToolbarMore ) ; } ) ; it ( 'file opened from Shared Files - [C297662]' , async ( ) => { await page . clickSharedFilesAndWait ( ) ; const expectedToolbarPrimary = [ 'Activate full-screen mode' , 'Shared Link Settings' , 'Download' , 'Print' , 'View Details' , 'More Actions' ] ; const expectedToolbarMore = [ 'Cancel Editing' , 'Upload New Version' , 'Remove Favorite' , 'Copy' , 'Manage Versions' ] ; await testUtil . checkViewerActions ( testData . fileLockedByUser , expectedToolbarPrimary , expectedToolbarMore ) ; } ) ; it ( 'file opened from Favorites - [C297663]' , async ( ) => { await page . clickFavoritesAndWait ( ) ; const expectedToolbarPrimary = [ 'Activate full-screen mode' , 'Shared Link Settings' , 'Download' , 'Print' , 'View Details' , 'More Actions' ] ; const expectedToolbarMore = [ 'Cancel Editing' , 'Upload New Version' , 'Remove Favorite' , 'Copy' , 'Manage Versions' ] ; await testUtil . checkViewerActions ( testData . fileLockedByUser , expectedToolbarPrimary , expectedToolbarMore ) ; } ) ; it ( 'file opened from Search Results - [C306993]' , async ( ) => { await searchInput . clickSearchButton ( ) ; await searchInput . searchFor ( testData . fileLockedByUser ) ; await searchResultsPage . waitForResults ( ) ; const expectedToolbarPrimary = [ 'Activate full-screen mode' , 'Shared Link Settings' , 'Download' , 'Print' , 'View Details' , 'More Actions' ] ; const expectedToolbarMore = [ 'Cancel Editing' , 'Upload New Version' , 'Remove Favorite' , 'Copy' , 'Manage Versions' ] ; await testUtil . checkViewerActions ( testData . fileLockedByUser , expectedToolbarPrimary , expectedToolbarMore ) ; } ) ; } ) ; } ) ; } export function filesLockedByOtherUser ( siteName ? ) { describe ( 'available actions : ' , ( ) => { beforeEach ( async ( ) => { await Utils . pressEscape ( ) ; } ) ; afterEach ( async ( ) => { await page . closeOpenDialogs ( ) ; } ) ; it ( 'on File Libraries - [C297664]' , async ( ) => { await page . clickFileLibrariesAndWait ( ) ; await dataTable . doubleClickOnRowByName ( siteName ) ; await dataTable . waitForHeader ( ) ; const expectedToolbarPrimary = [ 'Shared Link Settings' , 'Download' , 'View' , 'View Details' , 'More Actions' ] ; const expectedToolbarMore = [ 'Cancel Editing' , 'Remove Favorite' , 'Move' , 'Copy' , 'Delete' , 'Manage Versions' , 'Permissions' ] ; await testUtil . checkToolbarActions ( testData . fileLockedByUser , expectedToolbarPrimary , expectedToolbarMore ) ; } ) ; it ( 'on Shared Files - [C297665]' , async ( ) => { await page . clickSharedFilesAndWait ( ) ; const expectedToolbarPrimary = [ 'Shared Link Settings' , 'Download' , 'View' , 'View Details' , 'More Actions' ] ; const expectedToolbarMore = [ 'Cancel Editing' , 'Upload New Version' , 'Remove Favorite' , 'Move' , 'Copy' , 'Delete' , 'Manage Versions' , 'Permissions' ] ; await testUtil . checkToolbarActions ( testData . fileLockedByUser , expectedToolbarPrimary , expectedToolbarMore ) ; } ) ; it ( 'on Favorites - [C297666]' , async ( ) => { await page . clickFavoritesAndWait ( ) ; const expectedToolbarPrimary = [ 'Shared Link Settings' , 'Download' , 'View' , 'View Details' , 'More Actions' ] ; const expectedToolbarMore = [ 'Upload New Version' , 'Remove Favorite' , 'Move' , 'Copy' , 'Delete' , 'Manage Versions' ] ; await testUtil . checkToolbarActions ( testData . fileLockedByUser , expectedToolbarPrimary , expectedToolbarMore ) ; } ) ; it ( 'on Search Results - [C297667]' , async ( ) => { await searchInput . clickSearchButton ( ) ; await searchInput . searchFor ( testData . fileLockedByUser ) ; await searchResultsPage . waitForResults ( ) ; const expectedToolbarPrimary = [ 'Shared Link Settings' , 'Download' , 'View' , 'View Details' , 'More Actions' ] ; const expectedToolbarMore = [ 'Cancel Editing' , 'Remove Favorite' , 'Copy' , 'Manage Versions' , 'Permissions' ] ; await testUtil . checkToolbarActions ( testData . fileLockedByUser , expectedToolbarPrimary , expectedToolbarMore ) ; } ) ; describe ( 'available actions in the viewer : ' , ( ) => { it ( 'file opened from File Libraries - [C297671]' , async ( ) => { await page . clickFileLibrariesAndWait ( ) ; await dataTable . doubleClickOnRowByName ( siteName ) ; await dataTable . waitForHeader ( ) ; const expectedToolbarPrimary = [ 'Activate full-screen mode' , 'Shared Link Settings' , 'Download' , 'Print' , 'View Details' , 'More Actions' ] ; const expectedToolbarMore = [ 'Cancel Editing' , 'Remove Favorite' , 'Move' , 'Copy' , 'Delete' , 'Manage Versions' , 'Permissions' ] ; await testUtil . checkViewerActions ( testData . fileLockedByUser , expectedToolbarPrimary , expectedToolbarMore ) ; } ) ; it ( 'file opened from Shared Files - [C297672]' , async ( ) => { await page . clickSharedFilesAndWait ( ) ; const expectedToolbarPrimary = [ 'Activate full-screen mode' , 'Shared Link Settings' , 'Download' , 'Print' , 'View Details' , 'More Actions' ] ; const expectedToolbarMore = [ 'Cancel Editing' , 'Remove Favorite' , 'Move' , 'Copy' , 'Delete' , 'Manage Versions' , 'Permissions' ] ; await testUtil . checkViewerActions ( testData . fileLockedByUser , expectedToolbarPrimary , expectedToolbarMore ) ; } ) ; it ( 'file opened from Favorites - [C297673]' , async ( ) => { await page . clickFavoritesAndWait ( ) ; const expectedToolbarPrimary = [ 'Activate full-screen mode' , 'Shared Link Settings' , 'Download' , 'Print' , 'View Details' , 'More Actions' ] ; const expectedToolbarMore = [ 'Cancel Editing' , 'Remove Favorite' , 'Move' , 'Copy' , 'Delete' , 'Manage Versions' , 'Permissions' ] ; await testUtil . checkViewerActions ( testData . fileLockedByUser , expectedToolbarPrimary , expectedToolbarMore ) ; } ) ; it ( 'file opened from Search Results - [C306994]' , async ( ) => { await searchInput . clickSearchButton ( ) ; await searchInput . searchFor ( testData . fileLockedByUser ) ; await searchResultsPage . waitForResults ( ) ; const expectedToolbarPrimary = [ 'Activate full-screen mode' , 'Shared Link Settings' , 'Download' , 'Print' , 'View Details' , 'More Actions' ] ; const expectedToolbarMore = [ 'Cancel Editing' , 'Remove Favorite' , 'Copy' , 'Manage Versions' , 'Permissions' ] ; await testUtil . checkViewerActions ( testData . fileLockedByUser , expectedToolbarPrimary , expectedToolbarMore ) ; } ) ; } ) ; } ) ; }