mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-05-26 17:24:45 +00:00
[ACA-990] framework improvements (#96)
* refactoring * e2e API improvements * forgot one file
This commit is contained in:
parent
1dade550a1
commit
79f8ec33a9
@ -34,6 +34,7 @@ export class DataTable extends Component {
|
|||||||
row: 'tr',
|
row: 'tr',
|
||||||
selectedRow: 'tr.is-selected',
|
selectedRow: 'tr.is-selected',
|
||||||
cell: 'td',
|
cell: 'td',
|
||||||
|
nameCell: 'td.app-name-column',
|
||||||
|
|
||||||
emptyListContainer: 'td.adf-no-content-container',
|
emptyListContainer: 'td.adf-no-content-container',
|
||||||
emptyFolderDragAndDrop: '.adf-empty-list_template .adf-empty-folder',
|
emptyFolderDragAndDrop: '.adf-empty-list_template .adf-empty-folder',
|
||||||
@ -44,7 +45,6 @@ export class DataTable extends Component {
|
|||||||
|
|
||||||
head: ElementFinder = this.component.element(by.css(DataTable.selectors.head));
|
head: ElementFinder = this.component.element(by.css(DataTable.selectors.head));
|
||||||
body: ElementFinder = this.component.element(by.css(DataTable.selectors.body));
|
body: ElementFinder = this.component.element(by.css(DataTable.selectors.body));
|
||||||
cell = by.css(DataTable.selectors.cell);
|
|
||||||
emptyList: ElementFinder = this.component.element(by.css(DataTable.selectors.emptyListContainer));
|
emptyList: ElementFinder = this.component.element(by.css(DataTable.selectors.emptyListContainer));
|
||||||
emptyFolderDragAndDrop: ElementFinder = this.component.element(by.css(DataTable.selectors.emptyFolderDragAndDrop));
|
emptyFolderDragAndDrop: ElementFinder = this.component.element(by.css(DataTable.selectors.emptyFolderDragAndDrop));
|
||||||
emptyListTitle: ElementFinder = this.component.element(by.css(DataTable.selectors.emptyListTitle));
|
emptyListTitle: ElementFinder = this.component.element(by.css(DataTable.selectors.emptyListTitle));
|
||||||
@ -113,18 +113,16 @@ export class DataTable extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Navigation/selection methods
|
// Navigation/selection methods
|
||||||
doubleClickOnRowByContainingText(text: string): promise.Promise<void> {
|
doubleClickOnItemName(name: string): promise.Promise<void> {
|
||||||
const row = this.getRowByContainingText(text);
|
const locator = by.cssContainingText(DataTable.selectors.nameCell, name);
|
||||||
const dblClick = browser.actions().mouseMove(row).click().click();
|
const dblClick = browser.actions().mouseMove(this.body.element(locator)).click().click();
|
||||||
|
|
||||||
return dblClick.perform();
|
return dblClick.perform();
|
||||||
}
|
}
|
||||||
|
|
||||||
clickOnRowByContainingText(text: string): promise.Promise<void> {
|
clickOnItemName(name: string): promise.Promise<void> {
|
||||||
const row = this.getRowByContainingText(text);
|
const locator = by.cssContainingText(DataTable.selectors.nameCell, name);
|
||||||
const click = browser.actions().mouseMove(row).click();
|
return this.body.element(locator).click();
|
||||||
|
|
||||||
return click.perform();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
selectMultipleItems(names: string[]): promise.Promise<void> {
|
selectMultipleItems(names: string[]): promise.Promise<void> {
|
||||||
|
@ -47,7 +47,11 @@ export class Menu extends Component {
|
|||||||
return this.getItemByLabel(label).getAttribute('title');
|
return this.getItemByLabel(label).getAttribute('title');
|
||||||
}
|
}
|
||||||
|
|
||||||
clicktNthItem(nth: number): promise.Promise<void> {
|
getItemsCount(): promise.Promise<number> {
|
||||||
|
return this.items.count();
|
||||||
|
}
|
||||||
|
|
||||||
|
clickNthItem(nth: number): promise.Promise<void> {
|
||||||
return this.getNthItem(nth).click();
|
return this.getNthItem(nth).click();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ import { browser, element, by, ElementFinder, promise, ExpectedConditions as EC
|
|||||||
import { BROWSER_WAIT_TIMEOUT } from './../configs';
|
import { BROWSER_WAIT_TIMEOUT } from './../configs';
|
||||||
|
|
||||||
export abstract class Page {
|
export abstract class Page {
|
||||||
private static USE_HASH_STRATEGY = false;
|
private static USE_HASH_STRATEGY = true;
|
||||||
|
|
||||||
private locators = {
|
private locators = {
|
||||||
app: by.css('app-root'),
|
app: by.css('app-root'),
|
||||||
|
@ -87,7 +87,7 @@ describe('Create folder', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('option is enabled when having enough permissions', () => {
|
it('option is enabled when having enough permissions', () => {
|
||||||
personalFilesPage.dataTable.doubleClickOnRowByContainingText(parent)
|
personalFilesPage.dataTable.doubleClickOnItemName(parent)
|
||||||
.then(() => personalFilesPage.sidenav.openNewMenu()
|
.then(() => personalFilesPage.sidenav.openNewMenu()
|
||||||
.then((menu) => {
|
.then((menu) => {
|
||||||
const isEnabled = menu.getItemByLabel('Create folder').getWebElement().isEnabled();
|
const isEnabled = menu.getItemByLabel('Create folder').getWebElement().isEnabled();
|
||||||
@ -98,7 +98,7 @@ describe('Create folder', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('creates new folder with name', () => {
|
it('creates new folder with name', () => {
|
||||||
personalFilesPage.dataTable.doubleClickOnRowByContainingText(parent)
|
personalFilesPage.dataTable.doubleClickOnItemName(parent)
|
||||||
.then(() => openCreateDialog()
|
.then(() => openCreateDialog()
|
||||||
.then(() => createDialog.enterName(folderName1).clickCreate())
|
.then(() => createDialog.enterName(folderName1).clickCreate())
|
||||||
.then(() => createDialog.waitForDialogToClose())
|
.then(() => createDialog.waitForDialogToClose())
|
||||||
@ -111,7 +111,7 @@ describe('Create folder', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('creates new folder with name and description', () => {
|
it('creates new folder with name and description', () => {
|
||||||
personalFilesPage.dataTable.doubleClickOnRowByContainingText(parent)
|
personalFilesPage.dataTable.doubleClickOnItemName(parent)
|
||||||
.then(() => openCreateDialog()
|
.then(() => openCreateDialog()
|
||||||
.then(() => {
|
.then(() => {
|
||||||
createDialog
|
createDialog
|
||||||
@ -133,7 +133,7 @@ describe('Create folder', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('enabled option tooltip', () => {
|
it('enabled option tooltip', () => {
|
||||||
personalFilesPage.dataTable.doubleClickOnRowByContainingText(parent)
|
personalFilesPage.dataTable.doubleClickOnItemName(parent)
|
||||||
.then(() => personalFilesPage.sidenav.openNewMenu()
|
.then(() => personalFilesPage.sidenav.openNewMenu()
|
||||||
.then(menu => {
|
.then(menu => {
|
||||||
const action = browser.actions().mouseMove(menu.getItemByLabel('Create folder'));
|
const action = browser.actions().mouseMove(menu.getItemByLabel('Create folder'));
|
||||||
@ -152,8 +152,8 @@ describe('Create folder', () => {
|
|||||||
const fileLibrariesPage = new BrowsingPage(APP_ROUTES.FILE_LIBRARIES);
|
const fileLibrariesPage = new BrowsingPage(APP_ROUTES.FILE_LIBRARIES);
|
||||||
|
|
||||||
fileLibrariesPage.sidenav.navigateToLinkByLabel('File Libraries')
|
fileLibrariesPage.sidenav.navigateToLinkByLabel('File Libraries')
|
||||||
.then(() => fileLibrariesPage.dataTable.doubleClickOnRowByContainingText(siteName))
|
.then(() => fileLibrariesPage.dataTable.doubleClickOnItemName(siteName))
|
||||||
.then(() => fileLibrariesPage.dataTable.doubleClickOnRowByContainingText(folderName1))
|
.then(() => fileLibrariesPage.dataTable.doubleClickOnItemName(folderName1))
|
||||||
.then(() => fileLibrariesPage.sidenav.openNewMenu())
|
.then(() => fileLibrariesPage.sidenav.openNewMenu())
|
||||||
.then(menu => {
|
.then(menu => {
|
||||||
const isEnabled = menu.getItemByLabel('Create folder').getWebElement().isEnabled();
|
const isEnabled = menu.getItemByLabel('Create folder').getWebElement().isEnabled();
|
||||||
@ -165,8 +165,8 @@ describe('Create folder', () => {
|
|||||||
const fileLibrariesPage = new BrowsingPage(APP_ROUTES.FILE_LIBRARIES);
|
const fileLibrariesPage = new BrowsingPage(APP_ROUTES.FILE_LIBRARIES);
|
||||||
|
|
||||||
fileLibrariesPage.sidenav.navigateToLinkByLabel('File Libraries')
|
fileLibrariesPage.sidenav.navigateToLinkByLabel('File Libraries')
|
||||||
.then(() => fileLibrariesPage.dataTable.doubleClickOnRowByContainingText(siteName))
|
.then(() => fileLibrariesPage.dataTable.doubleClickOnItemName(siteName))
|
||||||
.then(() => fileLibrariesPage.dataTable.doubleClickOnRowByContainingText(folderName1))
|
.then(() => fileLibrariesPage.dataTable.doubleClickOnItemName(folderName1))
|
||||||
.then(() => fileLibrariesPage.sidenav.openNewMenu())
|
.then(() => fileLibrariesPage.sidenav.openNewMenu())
|
||||||
.then(menu => {
|
.then(menu => {
|
||||||
const action = browser.actions().mouseMove(menu.getItemByLabel('Create folder'));
|
const action = browser.actions().mouseMove(menu.getItemByLabel('Create folder'));
|
||||||
@ -179,7 +179,7 @@ describe('Create folder', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('dialog UI elements', () => {
|
it('dialog UI elements', () => {
|
||||||
personalFilesPage.dataTable.doubleClickOnRowByContainingText(parent)
|
personalFilesPage.dataTable.doubleClickOnItemName(parent)
|
||||||
.then(() => openCreateDialog().then(() => {
|
.then(() => openCreateDialog().then(() => {
|
||||||
const dialogTitle = createDialog.getTitle();
|
const dialogTitle = createDialog.getTitle();
|
||||||
const isFolderNameDisplayed = createDialog.nameInput.getWebElement().isDisplayed();
|
const isFolderNameDisplayed = createDialog.nameInput.getWebElement().isDisplayed();
|
||||||
@ -197,7 +197,7 @@ describe('Create folder', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('with empty folder name', () => {
|
it('with empty folder name', () => {
|
||||||
personalFilesPage.dataTable.doubleClickOnRowByContainingText(parent)
|
personalFilesPage.dataTable.doubleClickOnItemName(parent)
|
||||||
.then(() => openCreateDialog()
|
.then(() => openCreateDialog()
|
||||||
.then(() => {
|
.then(() => {
|
||||||
createDialog.deleteNameWithBackspace();
|
createDialog.deleteNameWithBackspace();
|
||||||
@ -213,7 +213,7 @@ describe('Create folder', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('with folder name ending with a dot "."', () => {
|
it('with folder name ending with a dot "."', () => {
|
||||||
personalFilesPage.dataTable.doubleClickOnRowByContainingText(parent)
|
personalFilesPage.dataTable.doubleClickOnItemName(parent)
|
||||||
.then(() => openCreateDialog()
|
.then(() => openCreateDialog()
|
||||||
.then(() => createDialog.enterName('folder-name.'))
|
.then(() => createDialog.enterName('folder-name.'))
|
||||||
.then((dialog) => {
|
.then((dialog) => {
|
||||||
@ -229,7 +229,7 @@ describe('Create folder', () => {
|
|||||||
it('with folder name containing special characters', () => {
|
it('with folder name containing special characters', () => {
|
||||||
const namesWithSpecialChars = [ 'a*a', 'a"a', 'a<a', 'a>a', `a\\a`, 'a/a', 'a?a', 'a:a', 'a|a' ];
|
const namesWithSpecialChars = [ 'a*a', 'a"a', 'a<a', 'a>a', `a\\a`, 'a/a', 'a?a', 'a:a', 'a|a' ];
|
||||||
|
|
||||||
personalFilesPage.dataTable.doubleClickOnRowByContainingText(parent)
|
personalFilesPage.dataTable.doubleClickOnItemName(parent)
|
||||||
.then(() => openCreateDialog()
|
.then(() => openCreateDialog()
|
||||||
.then(() => {
|
.then(() => {
|
||||||
namesWithSpecialChars.forEach(name => {
|
namesWithSpecialChars.forEach(name => {
|
||||||
@ -246,7 +246,7 @@ describe('Create folder', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('with folder name containing only spaces', () => {
|
it('with folder name containing only spaces', () => {
|
||||||
personalFilesPage.dataTable.doubleClickOnRowByContainingText(parent)
|
personalFilesPage.dataTable.doubleClickOnItemName(parent)
|
||||||
.then(() => openCreateDialog()
|
.then(() => openCreateDialog()
|
||||||
.then(() => createDialog.enterName(' '))
|
.then(() => createDialog.enterName(' '))
|
||||||
.then((dialog) => {
|
.then((dialog) => {
|
||||||
@ -260,7 +260,7 @@ describe('Create folder', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('cancel folder creation', () => {
|
it('cancel folder creation', () => {
|
||||||
personalFilesPage.dataTable.doubleClickOnRowByContainingText(parent)
|
personalFilesPage.dataTable.doubleClickOnItemName(parent)
|
||||||
.then(() => openCreateDialog()
|
.then(() => openCreateDialog()
|
||||||
.then(() => {
|
.then(() => {
|
||||||
createDialog
|
createDialog
|
||||||
@ -273,7 +273,7 @@ describe('Create folder', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('duplicate folder name', () => {
|
it('duplicate folder name', () => {
|
||||||
personalFilesPage.dataTable.doubleClickOnRowByContainingText(parent)
|
personalFilesPage.dataTable.doubleClickOnItemName(parent)
|
||||||
.then(() => openCreateDialog()
|
.then(() => openCreateDialog()
|
||||||
.then(() => createDialog.enterName(duplicateFolderName).clickCreate())
|
.then(() => createDialog.enterName(duplicateFolderName).clickCreate())
|
||||||
.then(() => {
|
.then(() => {
|
||||||
@ -287,7 +287,7 @@ describe('Create folder', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('trim ending spaces from folder name', () => {
|
it('trim ending spaces from folder name', () => {
|
||||||
personalFilesPage.dataTable.doubleClickOnRowByContainingText(parent)
|
personalFilesPage.dataTable.doubleClickOnItemName(parent)
|
||||||
.then(() => openCreateDialog()
|
.then(() => openCreateDialog()
|
||||||
.then(() => createDialog.enterName(nameWithSpaces).clickCreate())
|
.then(() => createDialog.enterName(nameWithSpaces).clickCreate())
|
||||||
.then(() => createDialog.waitForDialogToClose())
|
.then(() => createDialog.waitForDialogToClose())
|
||||||
|
@ -87,8 +87,8 @@ describe('Edit folder', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('dialog UI defaults', () => {
|
it('dialog UI defaults', () => {
|
||||||
personalFilesPage.dataTable.doubleClickOnRowByContainingText(parent)
|
personalFilesPage.dataTable.doubleClickOnItemName(parent)
|
||||||
.then(() => dataTable.clickOnRowByContainingText(folderName)
|
.then(() => dataTable.clickOnItemName(folderName)
|
||||||
.then(() => editButton.click())
|
.then(() => editButton.click())
|
||||||
.then(() => {
|
.then(() => {
|
||||||
expect(editDialog.getTitle()).toBe('Edit folder');
|
expect(editDialog.getTitle()).toBe('Edit folder');
|
||||||
@ -101,8 +101,8 @@ describe('Edit folder', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('properties are modified when pressing OK', () => {
|
it('properties are modified when pressing OK', () => {
|
||||||
personalFilesPage.dataTable.doubleClickOnRowByContainingText(parent)
|
personalFilesPage.dataTable.doubleClickOnItemName(parent)
|
||||||
.then(() => dataTable.clickOnRowByContainingText(folderNameToEdit)
|
.then(() => dataTable.clickOnItemName(folderNameToEdit)
|
||||||
.then(() => editButton.click())
|
.then(() => editButton.click())
|
||||||
.then(() => {
|
.then(() => {
|
||||||
editDialog
|
editDialog
|
||||||
@ -126,8 +126,8 @@ describe('Edit folder', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('with empty folder name', () => {
|
it('with empty folder name', () => {
|
||||||
personalFilesPage.dataTable.doubleClickOnRowByContainingText(parent)
|
personalFilesPage.dataTable.doubleClickOnItemName(parent)
|
||||||
.then(() => dataTable.clickOnRowByContainingText(folderName)
|
.then(() => dataTable.clickOnItemName(folderName)
|
||||||
.then(() => editButton.click())
|
.then(() => editButton.click())
|
||||||
.then(() => {
|
.then(() => {
|
||||||
editDialog.deleteNameWithBackspace();
|
editDialog.deleteNameWithBackspace();
|
||||||
@ -142,8 +142,8 @@ describe('Edit folder', () => {
|
|||||||
it('with name with special characters', () => {
|
it('with name with special characters', () => {
|
||||||
const namesWithSpecialChars = [ 'a*a', 'a"a', 'a<a', 'a>a', `a\\a`, 'a/a', 'a?a', 'a:a', 'a|a' ];
|
const namesWithSpecialChars = [ 'a*a', 'a"a', 'a<a', 'a>a', `a\\a`, 'a/a', 'a?a', 'a:a', 'a|a' ];
|
||||||
|
|
||||||
personalFilesPage.dataTable.doubleClickOnRowByContainingText(parent)
|
personalFilesPage.dataTable.doubleClickOnItemName(parent)
|
||||||
.then(() => dataTable.clickOnRowByContainingText(folderName)
|
.then(() => dataTable.clickOnItemName(folderName)
|
||||||
.then(() => editButton.click())
|
.then(() => editButton.click())
|
||||||
.then(() => {
|
.then(() => {
|
||||||
namesWithSpecialChars.forEach(name => {
|
namesWithSpecialChars.forEach(name => {
|
||||||
@ -157,8 +157,8 @@ describe('Edit folder', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('with name ending with a dot', () => {
|
it('with name ending with a dot', () => {
|
||||||
personalFilesPage.dataTable.doubleClickOnRowByContainingText(parent)
|
personalFilesPage.dataTable.doubleClickOnItemName(parent)
|
||||||
.then(() => dataTable.clickOnRowByContainingText(folderName)
|
.then(() => dataTable.clickOnItemName(folderName)
|
||||||
.then(() => editButton.click())
|
.then(() => editButton.click())
|
||||||
.then(() => editDialog.nameInput.sendKeys('.'))
|
.then(() => editDialog.nameInput.sendKeys('.'))
|
||||||
.then(() => {
|
.then(() => {
|
||||||
@ -169,8 +169,8 @@ describe('Edit folder', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('Cancel button', () => {
|
it('Cancel button', () => {
|
||||||
personalFilesPage.dataTable.doubleClickOnRowByContainingText(parent)
|
personalFilesPage.dataTable.doubleClickOnItemName(parent)
|
||||||
.then(() => dataTable.clickOnRowByContainingText(folderName)
|
.then(() => dataTable.clickOnItemName(folderName)
|
||||||
.then(() => editButton.click())
|
.then(() => editButton.click())
|
||||||
.then(() => editDialog.clickCancel())
|
.then(() => editDialog.clickCancel())
|
||||||
.then(() => {
|
.then(() => {
|
||||||
@ -180,8 +180,8 @@ describe('Edit folder', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('with duplicate folder name', () => {
|
it('with duplicate folder name', () => {
|
||||||
personalFilesPage.dataTable.doubleClickOnRowByContainingText(parent)
|
personalFilesPage.dataTable.doubleClickOnItemName(parent)
|
||||||
.then(() => dataTable.clickOnRowByContainingText(folderName)
|
.then(() => dataTable.clickOnItemName(folderName)
|
||||||
.then(() => editButton.click())
|
.then(() => editButton.click())
|
||||||
.then(() => editDialog.enterName(duplicateFolderName).clickUpdate())
|
.then(() => editDialog.enterName(duplicateFolderName).clickUpdate())
|
||||||
.then(() => {
|
.then(() => {
|
||||||
@ -195,8 +195,8 @@ describe('Edit folder', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('trim ending spaces', () => {
|
it('trim ending spaces', () => {
|
||||||
personalFilesPage.dataTable.doubleClickOnRowByContainingText(parent)
|
personalFilesPage.dataTable.doubleClickOnItemName(parent)
|
||||||
.then(() => dataTable.clickOnRowByContainingText(folderName)
|
.then(() => dataTable.clickOnItemName(folderName)
|
||||||
.then(() => editButton.click())
|
.then(() => editButton.click())
|
||||||
.then(() => editDialog.nameInput.sendKeys(' '))
|
.then(() => editDialog.nameInput.sendKeys(' '))
|
||||||
.then(() => editDialog.clickUpdate())
|
.then(() => editDialog.clickUpdate())
|
||||||
|
@ -25,14 +25,12 @@ describe('Permanently delete from Trash', () => {
|
|||||||
const username = `user-${Utils.random()}`;
|
const username = `user-${Utils.random()}`;
|
||||||
|
|
||||||
const file1 = `file-${Utils.random()}.txt`;
|
const file1 = `file-${Utils.random()}.txt`;
|
||||||
let file1Id;
|
|
||||||
const file2 = `file-${Utils.random()}.txt`;
|
const file2 = `file-${Utils.random()}.txt`;
|
||||||
let file2Id;
|
let filesIds;
|
||||||
|
|
||||||
const folder1 = `folder-${Utils.random()}`;
|
const folder1 = `folder-${Utils.random()}`;
|
||||||
let folder1Id;
|
|
||||||
const folder2 = `folder-${Utils.random()}`;
|
const folder2 = `folder-${Utils.random()}`;
|
||||||
let folder2Id;
|
let foldersIds;
|
||||||
|
|
||||||
const apis = {
|
const apis = {
|
||||||
admin: new RepoClient(),
|
admin: new RepoClient(),
|
||||||
@ -47,15 +45,13 @@ describe('Permanently delete from Trash', () => {
|
|||||||
|
|
||||||
beforeAll(done => {
|
beforeAll(done => {
|
||||||
apis.admin.people.createUser(username)
|
apis.admin.people.createUser(username)
|
||||||
.then(() => apis.user.nodes.createFiles([ file1 ]).then(resp => file1Id = resp.data.entry.id))
|
.then(() => apis.user.nodes.createFiles([ file1, file2 ]))
|
||||||
.then(() => apis.user.nodes.createFiles([ file2 ]).then(resp => file2Id = resp.data.entry.id))
|
.then(resp => filesIds = resp.data.list.entries.map(entries => entries.entry.id))
|
||||||
.then(() => apis.user.nodes.createFolders([ folder1 ]).then(resp => folder1Id = resp.data.entry.id))
|
.then(() => apis.user.nodes.createFolders([ folder1, folder2 ]))
|
||||||
.then(() => apis.user.nodes.createFolders([ folder2 ]).then(resp => folder2Id = resp.data.entry.id))
|
.then(resp => foldersIds = resp.data.list.entries.map(entries => entries.entry.id))
|
||||||
|
|
||||||
.then(() => apis.user.nodes.deleteNodeById(file1Id, false))
|
.then(() => apis.user.nodes.deleteNodesById(filesIds, false))
|
||||||
.then(() => apis.user.nodes.deleteNodeById(file2Id, false))
|
.then(() => apis.user.nodes.deleteNodesById(foldersIds, false))
|
||||||
.then(() => apis.user.nodes.deleteNodeById(folder1Id, false))
|
|
||||||
.then(() => apis.user.nodes.deleteNodeById(folder2Id, false))
|
|
||||||
|
|
||||||
.then(() => loginPage.load())
|
.then(() => loginPage.load())
|
||||||
.then(() => loginPage.loginWith(username))
|
.then(() => loginPage.loginWith(username))
|
||||||
@ -70,21 +66,15 @@ describe('Permanently delete from Trash', () => {
|
|||||||
|
|
||||||
afterAll(done => {
|
afterAll(done => {
|
||||||
Promise.all([
|
Promise.all([
|
||||||
apis.user.trashcan.permanentlyDelete(file1Id),
|
apis.user.trashcan.emptyTrash(),
|
||||||
apis.user.trashcan.permanentlyDelete(file2Id),
|
|
||||||
apis.user.trashcan.permanentlyDelete(folder1Id),
|
|
||||||
apis.user.trashcan.permanentlyDelete(folder2Id),
|
|
||||||
logoutPage.load()
|
logoutPage.load()
|
||||||
])
|
])
|
||||||
.then(done);
|
.then(done);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('delete file', () => {
|
it('delete file', () => {
|
||||||
dataTable.clickOnRowByContainingText(file1)
|
dataTable.clickOnItemName(file1)
|
||||||
.then(() => {
|
.then(() => toolbar.actions.getButtonByTitleAttribute('Permanently delete').click())
|
||||||
const button = toolbar.actions.getButtonByTitleAttribute('Permanently delete');
|
|
||||||
button.click();
|
|
||||||
})
|
|
||||||
.then(() => trashPage.getSnackBarMessage())
|
.then(() => trashPage.getSnackBarMessage())
|
||||||
.then(text => {
|
.then(text => {
|
||||||
expect(text).toBe(`${file1} deleted`);
|
expect(text).toBe(`${file1} deleted`);
|
||||||
@ -93,11 +83,8 @@ describe('Permanently delete from Trash', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('delete folder', () => {
|
it('delete folder', () => {
|
||||||
dataTable.clickOnRowByContainingText(folder1)
|
dataTable.clickOnItemName(folder1)
|
||||||
.then(() => {
|
.then(() => toolbar.actions.getButtonByTitleAttribute('Permanently delete').click())
|
||||||
const button = toolbar.actions.getButtonByTitleAttribute('Permanently delete');
|
|
||||||
button.click();
|
|
||||||
})
|
|
||||||
.then(() => trashPage.getSnackBarMessage())
|
.then(() => trashPage.getSnackBarMessage())
|
||||||
.then(text => {
|
.then(text => {
|
||||||
expect(text).toBe(`${folder1} deleted`);
|
expect(text).toBe(`${folder1} deleted`);
|
||||||
@ -107,10 +94,7 @@ describe('Permanently delete from Trash', () => {
|
|||||||
|
|
||||||
it('delete multiple items', () => {
|
it('delete multiple items', () => {
|
||||||
dataTable.selectMultipleItems([ file2, folder2 ])
|
dataTable.selectMultipleItems([ file2, folder2 ])
|
||||||
.then(() => {
|
.then(() => toolbar.actions.getButtonByTitleAttribute('Permanently delete').click())
|
||||||
const button = toolbar.actions.getButtonByTitleAttribute('Permanently delete');
|
|
||||||
button.click();
|
|
||||||
})
|
|
||||||
.then(() => trashPage.getSnackBarMessage())
|
.then(() => trashPage.getSnackBarMessage())
|
||||||
.then(text => {
|
.then(text => {
|
||||||
expect(text).toBe(`2 items deleted`);
|
expect(text).toBe(`2 items deleted`);
|
||||||
|
@ -25,16 +25,13 @@ describe('Restore from Trash', () => {
|
|||||||
const username = `user-${Utils.random()}`;
|
const username = `user-${Utils.random()}`;
|
||||||
|
|
||||||
const file1 = `file-${Utils.random()}.txt`;
|
const file1 = `file-${Utils.random()}.txt`;
|
||||||
let file1Id;
|
|
||||||
const file2 = `file-${Utils.random()}.txt`;
|
const file2 = `file-${Utils.random()}.txt`;
|
||||||
let file2Id;
|
|
||||||
const file3 = `file-${Utils.random()}.txt`;
|
const file3 = `file-${Utils.random()}.txt`;
|
||||||
let file3Id;
|
let filesIds;
|
||||||
|
|
||||||
const folder1 = `folder-${Utils.random()}`;
|
const folder1 = `folder-${Utils.random()}`;
|
||||||
let folder1Id;
|
|
||||||
const folder2 = `folder-${Utils.random()}`;
|
const folder2 = `folder-${Utils.random()}`;
|
||||||
let folder2Id;
|
let foldersIds;
|
||||||
|
|
||||||
const apis = {
|
const apis = {
|
||||||
admin: new RepoClient(),
|
admin: new RepoClient(),
|
||||||
@ -50,17 +47,13 @@ describe('Restore from Trash', () => {
|
|||||||
|
|
||||||
beforeAll(done => {
|
beforeAll(done => {
|
||||||
apis.admin.people.createUser(username)
|
apis.admin.people.createUser(username)
|
||||||
.then(() => apis.user.nodes.createFiles([ file1 ]).then(resp => file1Id = resp.data.entry.id))
|
.then(() => apis.user.nodes.createFiles([ file1, file2, file3 ]))
|
||||||
.then(() => apis.user.nodes.createFiles([ file2 ]).then(resp => file2Id = resp.data.entry.id))
|
.then(resp => filesIds = resp.data.list.entries.map(entries => entries.entry.id))
|
||||||
.then(() => apis.user.nodes.createFiles([ file3 ]).then(resp => file3Id = resp.data.entry.id))
|
.then(() => apis.user.nodes.createFolders([ folder1, folder2 ]))
|
||||||
.then(() => apis.user.nodes.createFolders([ folder1 ]).then(resp => folder1Id = resp.data.entry.id))
|
.then(resp => foldersIds = resp.data.list.entries.map(entries => entries.entry.id))
|
||||||
.then(() => apis.user.nodes.createFolders([ folder2 ]).then(resp => folder2Id = resp.data.entry.id))
|
|
||||||
|
|
||||||
.then(() => apis.user.nodes.deleteNodeById(file1Id, false))
|
.then(() => apis.user.nodes.deleteNodesById(filesIds, false))
|
||||||
.then(() => apis.user.nodes.deleteNodeById(file2Id, false))
|
.then(() => apis.user.nodes.deleteNodesById(foldersIds, false))
|
||||||
.then(() => apis.user.nodes.deleteNodeById(file3Id, false))
|
|
||||||
.then(() => apis.user.nodes.deleteNodeById(folder1Id, false))
|
|
||||||
.then(() => apis.user.nodes.deleteNodeById(folder2Id, false))
|
|
||||||
|
|
||||||
.then(() => loginPage.load())
|
.then(() => loginPage.load())
|
||||||
.then(() => loginPage.loginWith(username))
|
.then(() => loginPage.loginWith(username))
|
||||||
@ -75,18 +68,16 @@ describe('Restore from Trash', () => {
|
|||||||
|
|
||||||
afterAll(done => {
|
afterAll(done => {
|
||||||
Promise.all([
|
Promise.all([
|
||||||
apis.user.nodes.deleteNodeById(file1Id),
|
apis.user.nodes.deleteNodesById(filesIds),
|
||||||
apis.user.nodes.deleteNodeById(file2Id),
|
apis.user.nodes.deleteNodesById(foldersIds),
|
||||||
apis.user.nodes.deleteNodeById(file3Id),
|
apis.user.trashcan.emptyTrash(),
|
||||||
apis.user.nodes.deleteNodeById(folder1Id),
|
|
||||||
apis.user.nodes.deleteNodeById(folder2Id),
|
|
||||||
logoutPage.load()
|
logoutPage.load()
|
||||||
])
|
])
|
||||||
.then(done);
|
.then(done);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('restore file', () => {
|
it('restore file', () => {
|
||||||
dataTable.clickOnRowByContainingText(file1)
|
dataTable.clickOnItemName(file1)
|
||||||
.then(() => toolbar.actions.getButtonByTitleAttribute('Restore').click())
|
.then(() => toolbar.actions.getButtonByTitleAttribute('Restore').click())
|
||||||
.then(() => trashPage.getSnackBarMessage())
|
.then(() => trashPage.getSnackBarMessage())
|
||||||
.then(text => {
|
.then(text => {
|
||||||
@ -102,7 +93,7 @@ describe('Restore from Trash', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('restore folder', () => {
|
it('restore folder', () => {
|
||||||
dataTable.clickOnRowByContainingText(folder1)
|
dataTable.clickOnItemName(folder1)
|
||||||
.then(() => toolbar.actions.getButtonByTitleAttribute('Restore').click())
|
.then(() => toolbar.actions.getButtonByTitleAttribute('Restore').click())
|
||||||
.then(() => trashPage.getSnackBarMessage())
|
.then(() => trashPage.getSnackBarMessage())
|
||||||
.then(text => {
|
.then(text => {
|
||||||
@ -136,7 +127,7 @@ describe('Restore from Trash', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('View from notification', () => {
|
it('View from notification', () => {
|
||||||
dataTable.clickOnRowByContainingText(file3)
|
dataTable.clickOnItemName(file3)
|
||||||
.then(() => toolbar.actions.getButtonByTitleAttribute('Restore').click())
|
.then(() => toolbar.actions.getButtonByTitleAttribute('Restore').click())
|
||||||
.then(() => trashPage.getSnackBarAction().click())
|
.then(() => trashPage.getSnackBarAction().click())
|
||||||
.then(() => personalFilesPage.dataTable.waitForHeader())
|
.then(() => personalFilesPage.dataTable.waitForHeader())
|
||||||
|
@ -189,7 +189,7 @@ describe('Toolbar actions - multiple selection : ', () => {
|
|||||||
beforeEach(done => {
|
beforeEach(done => {
|
||||||
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FILE_LIBRARIES)
|
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FILE_LIBRARIES)
|
||||||
.then(() => dataTable.waitForHeader())
|
.then(() => dataTable.waitForHeader())
|
||||||
.then(() => dataTable.doubleClickOnRowByContainingText(siteName))
|
.then(() => dataTable.doubleClickOnItemName(siteName))
|
||||||
.then(() => dataTable.waitForHeader())
|
.then(() => dataTable.waitForHeader())
|
||||||
.then(done);
|
.then(done);
|
||||||
});
|
});
|
||||||
|
@ -49,15 +49,18 @@ describe('Toolbar actions - single selection : ', () => {
|
|||||||
const loginPage = new LoginPage();
|
const loginPage = new LoginPage();
|
||||||
const logoutPage = new LogoutPage();
|
const logoutPage = new LogoutPage();
|
||||||
const page = new BrowsingPage();
|
const page = new BrowsingPage();
|
||||||
const { dataTable } = page;
|
const { dataTable, toolbar } = page;
|
||||||
const { toolbar } = page;
|
|
||||||
|
|
||||||
beforeAll(done => {
|
beforeAll(done => {
|
||||||
apis.admin.people.createUser(username)
|
apis.admin.people.createUser(username)
|
||||||
.then(() => apis.user.nodes.createFiles([ fileUser ]).then(resp => { fileUserId = resp.data.entry.id; }))
|
.then(() => apis.user.nodes.createFiles([ fileUser ]))
|
||||||
.then(() => apis.user.nodes.createFiles([ fileForDelete ]).then(resp => { fileForDeleteId = resp.data.entry.id; }))
|
.then(resp => fileUserId = resp.data.entry.id)
|
||||||
.then(() => apis.user.nodes.createFolders([ folderForDelete ]).then((resp) => { folderForDeleteId = resp.data.entry.id; }))
|
.then(() => apis.user.nodes.createFiles([ fileForDelete ]))
|
||||||
.then(() => apis.user.nodes.createFolders([ folderUser ]).then(resp => { folderUserId = resp.data.entry.id; }))
|
.then(resp => fileForDeleteId = resp.data.entry.id)
|
||||||
|
.then(() => apis.user.nodes.createFolders([ folderForDelete ]))
|
||||||
|
.then(resp => folderForDeleteId = resp.data.entry.id)
|
||||||
|
.then(() => apis.user.nodes.createFolders([ folderUser ]))
|
||||||
|
.then(resp => folderUserId = resp.data.entry.id)
|
||||||
.then(() => apis.user.shared.shareFileById(fileUserId))
|
.then(() => apis.user.shared.shareFileById(fileUserId))
|
||||||
.then(() => apis.user.favorites.addFavoriteById('file', fileUserId))
|
.then(() => apis.user.favorites.addFavoriteById('file', fileUserId))
|
||||||
.then(() => apis.user.favorites.addFavoriteById('folder', folderUserId))
|
.then(() => apis.user.favorites.addFavoriteById('folder', folderUserId))
|
||||||
@ -97,21 +100,21 @@ describe('Toolbar actions - single selection : ', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('actions are displayed when a file is selected', () => {
|
it('actions are displayed when a file is selected', () => {
|
||||||
dataTable.clickOnRowByContainingText(fileUser)
|
dataTable.clickOnItemName(fileUser)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
expect(toolbar.actions.isEmpty()).toBe(false, `actions not displayed for ${fileUser}`);
|
expect(toolbar.actions.isEmpty()).toBe(false, `actions not displayed for ${fileUser}`);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('actions are displayed when a folder is selected', () => {
|
it('actions are displayed when a folder is selected', () => {
|
||||||
dataTable.clickOnRowByContainingText(folderUser)
|
dataTable.clickOnItemName(folderUser)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
expect(toolbar.actions.isEmpty()).toBe(false, `actions not displayed for ${folderUser}`);
|
expect(toolbar.actions.isEmpty()).toBe(false, `actions not displayed for ${folderUser}`);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('correct actions appear when a file is selected', () => {
|
it('correct actions appear when a file is selected', () => {
|
||||||
dataTable.clickOnRowByContainingText(fileUser)
|
dataTable.clickOnItemName(fileUser)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
expect(toolbar.actions.isButtonPresent('View')).toBe(true, `View is not displayed for ${fileUser}`);
|
expect(toolbar.actions.isButtonPresent('View')).toBe(true, `View is not displayed for ${fileUser}`);
|
||||||
expect(toolbar.actions.isButtonPresent('Download')).toBe(true, `Download is not displayed for ${fileUser}`);
|
expect(toolbar.actions.isButtonPresent('Download')).toBe(true, `Download is not displayed for ${fileUser}`);
|
||||||
@ -128,7 +131,7 @@ describe('Toolbar actions - single selection : ', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('correct actions appear when a folder is selected', () => {
|
it('correct actions appear when a folder is selected', () => {
|
||||||
dataTable.clickOnRowByContainingText(folderUser)
|
dataTable.clickOnItemName(folderUser)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
expect(toolbar.actions.isButtonPresent('View')).toBe(false, `View is displayed for ${folderUser}`);
|
expect(toolbar.actions.isButtonPresent('View')).toBe(false, `View is displayed for ${folderUser}`);
|
||||||
expect(toolbar.actions.isButtonPresent('Download')).toBe(true, `Download is not enabled for ${folderUser}`);
|
expect(toolbar.actions.isButtonPresent('Download')).toBe(true, `Download is not enabled for ${folderUser}`);
|
||||||
@ -159,7 +162,7 @@ describe('Toolbar actions - single selection : ', () => {
|
|||||||
beforeEach(done => {
|
beforeEach(done => {
|
||||||
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FILE_LIBRARIES)
|
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FILE_LIBRARIES)
|
||||||
.then(() => dataTable.waitForHeader())
|
.then(() => dataTable.waitForHeader())
|
||||||
.then(() => dataTable.doubleClickOnRowByContainingText(siteName))
|
.then(() => dataTable.doubleClickOnItemName(siteName))
|
||||||
.then(() => dataTable.waitForHeader())
|
.then(() => dataTable.waitForHeader())
|
||||||
.then(done);
|
.then(done);
|
||||||
});
|
});
|
||||||
@ -186,21 +189,21 @@ describe('Toolbar actions - single selection : ', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('actions are displayed when a file is selected', () => {
|
it('actions are displayed when a file is selected', () => {
|
||||||
dataTable.clickOnRowByContainingText(fileAdmin)
|
dataTable.clickOnItemName(fileAdmin)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
expect(toolbar.actions.isEmpty()).toBe(false, `actions not displayed for ${fileAdmin}`);
|
expect(toolbar.actions.isEmpty()).toBe(false, `actions not displayed for ${fileAdmin}`);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('actions are displayed when a folder is selected', () => {
|
it('actions are displayed when a folder is selected', () => {
|
||||||
dataTable.clickOnRowByContainingText(folderAdmin)
|
dataTable.clickOnItemName(folderAdmin)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
expect(toolbar.actions.isEmpty()).toBe(false, `actions not displayed for ${folderAdmin}`);
|
expect(toolbar.actions.isEmpty()).toBe(false, `actions not displayed for ${folderAdmin}`);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('correct actions appear when a file is selected', () => {
|
it('correct actions appear when a file is selected', () => {
|
||||||
dataTable.clickOnRowByContainingText(fileAdmin)
|
dataTable.clickOnItemName(fileAdmin)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
expect(toolbar.actions.isButtonPresent('View')).toBe(true, `View is not displayed for ${fileAdmin}`);
|
expect(toolbar.actions.isButtonPresent('View')).toBe(true, `View is not displayed for ${fileAdmin}`);
|
||||||
expect(toolbar.actions.isButtonPresent('Download')).toBe(true, `Download is not displayed for ${fileAdmin}`);
|
expect(toolbar.actions.isButtonPresent('Download')).toBe(true, `Download is not displayed for ${fileAdmin}`);
|
||||||
@ -217,7 +220,7 @@ describe('Toolbar actions - single selection : ', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('correct actions appear when a folder is selected', () => {
|
it('correct actions appear when a folder is selected', () => {
|
||||||
dataTable.clickOnRowByContainingText(folderAdmin)
|
dataTable.clickOnItemName(folderAdmin)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
expect(toolbar.actions.isButtonPresent('View')).toBe(false, `View is displayed for ${folderAdmin}`);
|
expect(toolbar.actions.isButtonPresent('View')).toBe(false, `View is displayed for ${folderAdmin}`);
|
||||||
expect(toolbar.actions.isButtonPresent('Download')).toBe(true, `Download is not enabled for ${folderAdmin}`);
|
expect(toolbar.actions.isButtonPresent('Download')).toBe(true, `Download is not enabled for ${folderAdmin}`);
|
||||||
@ -250,21 +253,21 @@ describe('Toolbar actions - single selection : ', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('actions are displayed when a file is selected', () => {
|
it('actions are displayed when a file is selected', () => {
|
||||||
dataTable.clickOnRowByContainingText(fileAdmin)
|
dataTable.clickOnItemName(fileAdmin)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
expect(toolbar.actions.isEmpty()).toBe(false, `actions not displayed for ${fileAdmin}`);
|
expect(toolbar.actions.isEmpty()).toBe(false, `actions not displayed for ${fileAdmin}`);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('actions are displayed when a folder is selected', () => {
|
it('actions are displayed when a folder is selected', () => {
|
||||||
dataTable.clickOnRowByContainingText(folderAdmin)
|
dataTable.clickOnItemName(folderAdmin)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
expect(toolbar.actions.isEmpty()).toBe(false, `actions not displayed for ${folderAdmin}`);
|
expect(toolbar.actions.isEmpty()).toBe(false, `actions not displayed for ${folderAdmin}`);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('correct actions appear when a file is selected', () => {
|
it('correct actions appear when a file is selected', () => {
|
||||||
dataTable.clickOnRowByContainingText(fileAdmin)
|
dataTable.clickOnItemName(fileAdmin)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
expect(toolbar.actions.isButtonPresent('View')).toBe(true, `View is not displayed for ${fileAdmin}`);
|
expect(toolbar.actions.isButtonPresent('View')).toBe(true, `View is not displayed for ${fileAdmin}`);
|
||||||
expect(toolbar.actions.isButtonPresent('Download')).toBe(true, `Download is not displayed for ${fileAdmin}`);
|
expect(toolbar.actions.isButtonPresent('Download')).toBe(true, `Download is not displayed for ${fileAdmin}`);
|
||||||
@ -281,7 +284,7 @@ describe('Toolbar actions - single selection : ', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('correct actions appear when a folder is selected', () => {
|
it('correct actions appear when a folder is selected', () => {
|
||||||
dataTable.clickOnRowByContainingText(folderAdmin)
|
dataTable.clickOnItemName(folderAdmin)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
expect(toolbar.actions.isButtonPresent('View')).toBe(false, `View is displayed for ${folderAdmin}`);
|
expect(toolbar.actions.isButtonPresent('View')).toBe(false, `View is displayed for ${folderAdmin}`);
|
||||||
expect(toolbar.actions.isButtonPresent('Download')).toBe(true, `Download is not enabled for ${folderAdmin}`);
|
expect(toolbar.actions.isButtonPresent('Download')).toBe(true, `Download is not enabled for ${folderAdmin}`);
|
||||||
@ -321,14 +324,14 @@ describe('Toolbar actions - single selection : ', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('actions are displayed when a file is selected', () => {
|
it('actions are displayed when a file is selected', () => {
|
||||||
dataTable.clickOnRowByContainingText(fileUser)
|
dataTable.clickOnItemName(fileUser)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
expect(toolbar.actions.isEmpty()).toBe(false, `actions not displayed for ${fileUser}`);
|
expect(toolbar.actions.isEmpty()).toBe(false, `actions not displayed for ${fileUser}`);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('correct actions appear when a file is selected', () => {
|
it('correct actions appear when a file is selected', () => {
|
||||||
dataTable.clickOnRowByContainingText(fileUser)
|
dataTable.clickOnItemName(fileUser)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
expect(toolbar.actions.isButtonPresent('View')).toBe(true, `View is not displayed for ${fileUser}`);
|
expect(toolbar.actions.isButtonPresent('View')).toBe(true, `View is not displayed for ${fileUser}`);
|
||||||
expect(toolbar.actions.isButtonPresent('Download')).toBe(true, `Download is not displayed for ${fileUser}`);
|
expect(toolbar.actions.isButtonPresent('Download')).toBe(true, `Download is not displayed for ${fileUser}`);
|
||||||
@ -367,14 +370,14 @@ describe('Toolbar actions - single selection : ', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('actions are displayed when a file is selected', () => {
|
it('actions are displayed when a file is selected', () => {
|
||||||
dataTable.clickOnRowByContainingText(fileUser)
|
dataTable.clickOnItemName(fileUser)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
expect(toolbar.actions.isEmpty()).toBe(false, `actions not displayed for ${fileUser}`);
|
expect(toolbar.actions.isEmpty()).toBe(false, `actions not displayed for ${fileUser}`);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('correct actions appear when a file is selected', () => {
|
it('correct actions appear when a file is selected', () => {
|
||||||
dataTable.clickOnRowByContainingText(fileUser)
|
dataTable.clickOnItemName(fileUser)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
expect(toolbar.actions.isButtonPresent('View')).toBe(true, `View is not displayed for ${fileUser}`);
|
expect(toolbar.actions.isButtonPresent('View')).toBe(true, `View is not displayed for ${fileUser}`);
|
||||||
expect(toolbar.actions.isButtonPresent('Download')).toBe(true, `Download is not displayed for ${fileUser}`);
|
expect(toolbar.actions.isButtonPresent('Download')).toBe(true, `Download is not displayed for ${fileUser}`);
|
||||||
@ -413,21 +416,21 @@ describe('Toolbar actions - single selection : ', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('actions are displayed when a file is selected', () => {
|
it('actions are displayed when a file is selected', () => {
|
||||||
dataTable.clickOnRowByContainingText(fileUser)
|
dataTable.clickOnItemName(fileUser)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
expect(toolbar.actions.isEmpty()).toBe(false, `actions not displayed for ${fileUser}`);
|
expect(toolbar.actions.isEmpty()).toBe(false, `actions not displayed for ${fileUser}`);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('actions are displayed when a folder is selected', () => {
|
it('actions are displayed when a folder is selected', () => {
|
||||||
dataTable.clickOnRowByContainingText(folderUser)
|
dataTable.clickOnItemName(folderUser)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
expect(toolbar.actions.isEmpty()).toBe(false, `actions not displayed for ${folderUser}`);
|
expect(toolbar.actions.isEmpty()).toBe(false, `actions not displayed for ${folderUser}`);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('correct actions appear when a file is selected', () => {
|
it('correct actions appear when a file is selected', () => {
|
||||||
dataTable.clickOnRowByContainingText(fileUser)
|
dataTable.clickOnItemName(fileUser)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
expect(toolbar.actions.isButtonPresent('View')).toBe(true, `View is not displayed for ${fileUser}`);
|
expect(toolbar.actions.isButtonPresent('View')).toBe(true, `View is not displayed for ${fileUser}`);
|
||||||
expect(toolbar.actions.isButtonPresent('Download')).toBe(true, `Download is not displayed for ${fileUser}`);
|
expect(toolbar.actions.isButtonPresent('Download')).toBe(true, `Download is not displayed for ${fileUser}`);
|
||||||
@ -444,7 +447,7 @@ describe('Toolbar actions - single selection : ', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('correct actions appear when a folder is selected', () => {
|
it('correct actions appear when a folder is selected', () => {
|
||||||
dataTable.clickOnRowByContainingText(folderUser)
|
dataTable.clickOnItemName(folderUser)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
expect(toolbar.actions.isButtonPresent('View')).toBe(false, `View is displayed for ${folderUser}`);
|
expect(toolbar.actions.isButtonPresent('View')).toBe(false, `View is displayed for ${folderUser}`);
|
||||||
expect(toolbar.actions.isButtonPresent('Download')).toBe(true, `Download is not enabled for ${folderUser}`);
|
expect(toolbar.actions.isButtonPresent('Download')).toBe(true, `Download is not enabled for ${folderUser}`);
|
||||||
@ -490,21 +493,21 @@ describe('Toolbar actions - single selection : ', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('actions are displayed when a file is selected', () => {
|
it('actions are displayed when a file is selected', () => {
|
||||||
dataTable.clickOnRowByContainingText(fileForDelete)
|
dataTable.clickOnItemName(fileForDelete)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
expect(toolbar.actions.isEmpty()).toBe(false, `actions not displayed for ${fileForDelete}`);
|
expect(toolbar.actions.isEmpty()).toBe(false, `actions not displayed for ${fileForDelete}`);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('actions are displayed when a folder is selected', () => {
|
it('actions are displayed when a folder is selected', () => {
|
||||||
dataTable.clickOnRowByContainingText(folderForDelete)
|
dataTable.clickOnItemName(folderForDelete)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
expect(toolbar.actions.isEmpty()).toBe(false, `actions not displayed for ${folderForDelete}`);
|
expect(toolbar.actions.isEmpty()).toBe(false, `actions not displayed for ${folderForDelete}`);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('correct actions appear when a file is selected', () => {
|
it('correct actions appear when a file is selected', () => {
|
||||||
dataTable.clickOnRowByContainingText(fileForDelete)
|
dataTable.clickOnItemName(fileForDelete)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
expect(toolbar.actions.isButtonPresent('Permanently delete'))
|
expect(toolbar.actions.isButtonPresent('Permanently delete'))
|
||||||
.toBe(true, `Permanently delete is not displayed for ${fileForDelete}`);
|
.toBe(true, `Permanently delete is not displayed for ${fileForDelete}`);
|
||||||
@ -513,7 +516,7 @@ describe('Toolbar actions - single selection : ', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('correct actions appear when a folder is selected', () => {
|
it('correct actions appear when a folder is selected', () => {
|
||||||
dataTable.clickOnRowByContainingText(folderForDelete)
|
dataTable.clickOnItemName(folderForDelete)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
expect(toolbar.actions.isButtonPresent('Permanently delete'))
|
expect(toolbar.actions.isButtonPresent('Permanently delete'))
|
||||||
.toBe(true, `Permanently delete is displayed for ${folderForDelete}`);
|
.toBe(true, `Permanently delete is displayed for ${folderForDelete}`);
|
||||||
|
@ -15,8 +15,6 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { browser, by } from 'protractor';
|
|
||||||
|
|
||||||
import { APP_ROUTES, SITE_VISIBILITY, SITE_ROLES, SIDEBAR_LABELS } from '../../configs';
|
import { APP_ROUTES, SITE_VISIBILITY, SITE_ROLES, SIDEBAR_LABELS } from '../../configs';
|
||||||
import { LoginPage, LogoutPage, BrowsingPage } from '../../pages/pages';
|
import { LoginPage, LogoutPage, BrowsingPage } from '../../pages/pages';
|
||||||
import { Utils } from '../../utilities/utils';
|
import { Utils } from '../../utilities/utils';
|
||||||
|
@ -134,7 +134,7 @@ describe('Personal Files', () => {
|
|||||||
.then(response => response.data.entry.id);
|
.then(response => response.data.entry.id);
|
||||||
|
|
||||||
const navigatePromise = dataTable
|
const navigatePromise = dataTable
|
||||||
.doubleClickOnRowByContainingText(userFolder)
|
.doubleClickOnItemName(userFolder)
|
||||||
.then(() => dataTable.waitForHeader());
|
.then(() => dataTable.waitForHeader());
|
||||||
|
|
||||||
Promise
|
Promise
|
||||||
@ -158,7 +158,7 @@ describe('Personal Files', () => {
|
|||||||
const { actions } = personalFilesPage.toolbar;
|
const { actions } = personalFilesPage.toolbar;
|
||||||
|
|
||||||
dataTable
|
dataTable
|
||||||
.clickOnRowByContainingText(userFolder)
|
.clickOnItemName(userFolder)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
expect(actions.isEmpty()).toBe(false, 'Toolbar to be present');
|
expect(actions.isEmpty()).toBe(false, 'Toolbar to be present');
|
||||||
})
|
})
|
||||||
|
@ -65,14 +65,16 @@ describe('Pagination', () => {
|
|||||||
beforeEach(done => {
|
beforeEach(done => {
|
||||||
personalFilesPage.load()
|
personalFilesPage.load()
|
||||||
.then(() => dataTable.waitForHeader())
|
.then(() => dataTable.waitForHeader())
|
||||||
.then(() => dataTable.doubleClickOnRowByContainingText(content.name))
|
.then(() => dataTable.doubleClickOnItemName(content.name))
|
||||||
.then(() => dataTable.sortByColumn('Name'))
|
.then(() => dataTable.sortByColumn('Name'))
|
||||||
.then(done);
|
.then(done);
|
||||||
});
|
});
|
||||||
|
|
||||||
afterAll(done => {
|
afterAll(done => {
|
||||||
logoutPage.load()
|
logoutPage.load()
|
||||||
.then(() => nodesApi.deleteNodes([ content.name ]))
|
.then(() => {
|
||||||
|
nodesApi.deleteNodes([ content.name ]);
|
||||||
|
})
|
||||||
.then(done);
|
.then(done);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -116,7 +118,7 @@ describe('Pagination', () => {
|
|||||||
|
|
||||||
it('changes the current page from menu', () => {
|
it('changes the current page from menu', () => {
|
||||||
pagination.openCurrentPageMenu()
|
pagination.openCurrentPageMenu()
|
||||||
.then(menu => menu.clicktNthItem(3))
|
.then(menu => menu.clickNthItem(3))
|
||||||
.then(() => dataTable.waitForHeader())
|
.then(() => dataTable.waitForHeader())
|
||||||
.then(() => {
|
.then(() => {
|
||||||
expect(pagination.range.getText()).toContain('51-75 of 101', 'Range');
|
expect(pagination.range.getText()).toContain('51-75 of 101', 'Range');
|
||||||
@ -140,7 +142,7 @@ describe('Pagination', () => {
|
|||||||
|
|
||||||
it('navigates to previous page', () => {
|
it('navigates to previous page', () => {
|
||||||
pagination.openCurrentPageMenu()
|
pagination.openCurrentPageMenu()
|
||||||
.then(menu => menu.clicktNthItem(2))
|
.then(menu => menu.clickNthItem(2))
|
||||||
.then(() => dataTable.waitForHeader())
|
.then(() => dataTable.waitForHeader())
|
||||||
.then(() => pagination.previousButton.click())
|
.then(() => pagination.previousButton.click())
|
||||||
.then(() => dataTable.waitForHeader())
|
.then(() => dataTable.waitForHeader())
|
||||||
@ -153,7 +155,7 @@ describe('Pagination', () => {
|
|||||||
|
|
||||||
it('has one item on the last page', () => {
|
it('has one item on the last page', () => {
|
||||||
pagination.openCurrentPageMenu()
|
pagination.openCurrentPageMenu()
|
||||||
.then(menu => menu.clicktNthItem(5))
|
.then(menu => menu.clickNthItem(5))
|
||||||
.then(() => dataTable.waitForHeader())
|
.then(() => dataTable.waitForHeader())
|
||||||
.then(() => {
|
.then(() => {
|
||||||
expect(dataTable.countRows()).toBe(1, 'Single item on the last page');
|
expect(dataTable.countRows()).toBe(1, 'Single item on the last page');
|
||||||
|
@ -52,6 +52,12 @@ export class FavoritesApi extends RepoApi {
|
|||||||
.catch(this.handleError);
|
.catch(this.handleError);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
addFavoritesByIds(nodeType: string, ids: string[]): Promise<any[]> {
|
||||||
|
return ids.reduce((previous, current) => (
|
||||||
|
previous.then(() => this.addFavoriteById(nodeType, current))
|
||||||
|
), Promise.resolve());
|
||||||
|
}
|
||||||
|
|
||||||
getFavorite(api: RepoClient, name: string): Promise<any> {
|
getFavorite(api: RepoClient, name: string): Promise<any> {
|
||||||
return api.nodes.getNodeByPath(name)
|
return api.nodes.getNodeByPath(name)
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
|
@ -33,6 +33,12 @@ export class NodesApi extends RepoApi {
|
|||||||
.catch(this.handleError);
|
.catch(this.handleError);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getNodeDescription(name: string): Promise<string> {
|
||||||
|
return this.getNodeByPath(name)
|
||||||
|
.then(response => response.data.entry.properties['cm:description'])
|
||||||
|
.catch(() => Promise.resolve(''));
|
||||||
|
}
|
||||||
|
|
||||||
deleteNodeById(id: string, permanent: boolean = true): Promise<any> {
|
deleteNodeById(id: string, permanent: boolean = true): Promise<any> {
|
||||||
return this
|
return this
|
||||||
.delete(`/nodes/${id}?permanent=${permanent}`)
|
.delete(`/nodes/${id}?permanent=${permanent}`)
|
||||||
@ -47,19 +53,10 @@ export class NodesApi extends RepoApi {
|
|||||||
.catch(this.handleError);
|
.catch(this.handleError);
|
||||||
}
|
}
|
||||||
|
|
||||||
getNodeDescription(name: string): Promise<string> {
|
deleteNodes(names: string[], relativePath: string = '', permanent: boolean = true): Promise<any[]> {
|
||||||
return this.getNodeByPath(name)
|
return names.reduce((previous, current) => (
|
||||||
.then(response => response.data.entry.properties['cm:description'])
|
previous.then(() => this.deleteNodeByPath(`${relativePath}/${current}`, permanent))
|
||||||
.catch(() => Promise.resolve(''));
|
), Promise.resolve());
|
||||||
}
|
|
||||||
|
|
||||||
deleteNodes(names: string[], relativePath: string = '', permanent: boolean = true): Promise<any> {
|
|
||||||
const deletions = names
|
|
||||||
.map((name: string): any => {
|
|
||||||
return this.deleteNodeByPath(`${relativePath}/${name}`, permanent);
|
|
||||||
});
|
|
||||||
|
|
||||||
return Promise.all(deletions);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
deleteNodesById(ids: string[], permanent: boolean = true): Promise<any[]> {
|
deleteNodesById(ids: string[], permanent: boolean = true): Promise<any[]> {
|
||||||
|
@ -28,6 +28,12 @@ export class SharedLinksApi extends RepoApi {
|
|||||||
.catch(this.handleError);
|
.catch(this.handleError);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
shareFilesByIds(ids: string[]): Promise<any[]> {
|
||||||
|
return ids.reduce((previous, current) => (
|
||||||
|
previous.then(() => this.shareFileById(current))
|
||||||
|
), Promise.resolve());
|
||||||
|
}
|
||||||
|
|
||||||
getSharedLinks(): Promise<any> {
|
getSharedLinks(): Promise<any> {
|
||||||
return this.get(`/shared-links`)
|
return this.get(`/shared-links`)
|
||||||
.catch(this.handleError);
|
.catch(this.handleError);
|
||||||
|
@ -35,7 +35,7 @@ export class SitesApi extends RepoApi {
|
|||||||
.catch(this.handleError);
|
.catch(this.handleError);
|
||||||
}
|
}
|
||||||
|
|
||||||
createSite(title: string, visibility: string, details?: Site): Promise<any> {
|
createOrUpdateSite(title: string, visibility: string, details?: Site): Promise<any> {
|
||||||
const site: Site = new Site(title, visibility, details);
|
const site: Site = new Site(title, visibility, details);
|
||||||
const onSuccess = (response) => response;
|
const onSuccess = (response) => response;
|
||||||
const onError = (response) => {
|
const onError = (response) => {
|
||||||
@ -50,12 +50,31 @@ export class SitesApi extends RepoApi {
|
|||||||
.catch(this.handleError);
|
.catch(this.handleError);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
createSite(title: string, visibility: string, details?: Site): Promise<any> {
|
||||||
|
const site: Site = new Site(title, visibility, details);
|
||||||
|
return this
|
||||||
|
.post(`/sites`, { data: site })
|
||||||
|
.catch(this.handleError);
|
||||||
|
}
|
||||||
|
|
||||||
|
createSites(titles: string[], visibility: string): Promise<any[]> {
|
||||||
|
return titles.reduce((previous, current) => (
|
||||||
|
previous.then(() => this.createSite(current, visibility))
|
||||||
|
), Promise.resolve());
|
||||||
|
}
|
||||||
|
|
||||||
deleteSite(id: string, permanent: boolean = true): Promise<any> {
|
deleteSite(id: string, permanent: boolean = true): Promise<any> {
|
||||||
return this
|
return this
|
||||||
.delete(`/sites/${id}?permanent=${permanent}`)
|
.delete(`/sites/${id}?permanent=${permanent}`)
|
||||||
.catch(this.handleError);
|
.catch(this.handleError);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
deleteSites(ids: string[], permanent: boolean = true): Promise<any[]> {
|
||||||
|
return ids.reduce((previous, current) => (
|
||||||
|
previous.then(() => this.deleteSite(current))
|
||||||
|
), Promise.resolve());
|
||||||
|
}
|
||||||
|
|
||||||
updateSiteMember(siteId: string, userId: string, role: string): Promise<any> {
|
updateSiteMember(siteId: string, userId: string, role: string): Promise<any> {
|
||||||
return this
|
return this
|
||||||
.put(`/sites/${siteId}/members/${userId}`, { data: { role } })
|
.put(`/sites/${siteId}/members/${userId}`, { data: { role } })
|
||||||
|
@ -23,4 +23,24 @@ export class TrashcanApi extends RepoApi {
|
|||||||
.delete(`/deleted-nodes/${id}`)
|
.delete(`/deleted-nodes/${id}`)
|
||||||
.catch(this.handleError);
|
.catch(this.handleError);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getDeletedNodes(): Promise<any> {
|
||||||
|
return this
|
||||||
|
.get(`/deleted-nodes?maxItems=1000`)
|
||||||
|
.catch(this.handleError);
|
||||||
|
}
|
||||||
|
|
||||||
|
emptyTrash(): Promise<any> {
|
||||||
|
return this.getDeletedNodes()
|
||||||
|
.then(resp => {
|
||||||
|
return resp.data.list.entries.map(entries => entries.entry.id);
|
||||||
|
})
|
||||||
|
.then(ids => {
|
||||||
|
return ids.reduce((previous, current) => (
|
||||||
|
previous.then(() => this.permanentlyDelete(current))
|
||||||
|
), Promise.resolve());
|
||||||
|
})
|
||||||
|
.catch(this.handleError);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,9 @@ const jasmineReporters = require('jasmine-reporters');
|
|||||||
|
|
||||||
const projectRoot = path.resolve(__dirname);
|
const projectRoot = path.resolve(__dirname);
|
||||||
|
|
||||||
|
const width = 1366;
|
||||||
|
const height = 768;
|
||||||
|
|
||||||
exports.config = {
|
exports.config = {
|
||||||
allScriptsTimeout: 11000,
|
allScriptsTimeout: 11000,
|
||||||
|
|
||||||
@ -55,6 +58,8 @@ exports.config = {
|
|||||||
project: 'e2e/tsconfig.e2e.json'
|
project: 'e2e/tsconfig.e2e.json'
|
||||||
});
|
});
|
||||||
|
|
||||||
|
browser.manage().window().setSize(width, height);
|
||||||
|
|
||||||
jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } }));
|
jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } }));
|
||||||
|
|
||||||
jasmine.getEnv().addReporter(new jasmineReporters.JUnitXmlReporter({
|
jasmine.getEnv().addReporter(new jasmineReporters.JUnitXmlReporter({
|
||||||
|
Loading…
x
Reference in New Issue
Block a user