[ACA-990] e2e fixes (#101)

* change selector
rename methods
separate pagination tests into multiple files to try to avoid jasmine timeout
increase a bit the timeouts

* shared-links api needs a bit more time to complete

* a bit more time
This commit is contained in:
Adina Parpalita 2017-11-30 21:44:21 +02:00 committed by Denys Vuika
parent c8e318c5ee
commit 2ce7d57737
17 changed files with 940 additions and 714 deletions

View File

@ -34,7 +34,6 @@ 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',
@ -104,9 +103,8 @@ export class DataTable extends Component {
return this.getRows().get(nth - 1); return this.getRows().get(nth - 1);
} }
getRowByContainingText(text: string): ElementFinder { getRowByName(name: string): ElementFinder {
const locator = by.cssContainingText(DataTable.selectors.row, text); return this.body.element(by.css(`adf-datatable-cell [title="${name}"]`));
return this.body.element(locator);
} }
countRows(): promise.Promise<number> { countRows(): promise.Promise<number> {
@ -115,22 +113,23 @@ export class DataTable extends Component {
// Navigation/selection methods // Navigation/selection methods
doubleClickOnItemName(name: string): promise.Promise<void> { doubleClickOnItemName(name: string): promise.Promise<void> {
const locator = by.cssContainingText(DataTable.selectors.nameCell, name); const dblClick = browser.actions()
const dblClick = browser.actions().mouseMove(this.body.element(locator)).click().click(); .mouseMove(this.getRowByName(name))
.click()
.click();
return dblClick.perform(); return dblClick.perform();
} }
clickOnItemName(name: string): promise.Promise<void> { clickOnItemName(name: string): promise.Promise<void> {
const locator = by.cssContainingText(DataTable.selectors.nameCell, name); return this.getRowByName(name).click();
return this.body.element(locator).click();
} }
selectMultipleItems(names: string[]): promise.Promise<void> { selectMultipleItems(names: string[]): promise.Promise<void> {
return browser.actions().sendKeys(protractor.Key.COMMAND).perform() return browser.actions().sendKeys(protractor.Key.COMMAND).perform()
.then(() => { .then(() => {
names.forEach(name => { names.forEach(name => {
this.getRowByContainingText(name).click(); this.clickOnItemName(name);
}); });
}) })
.then(() => browser.actions().sendKeys(protractor.Key.NULL).perform()); .then(() => browser.actions().sendKeys(protractor.Key.NULL).perform());

View File

@ -1,7 +1,7 @@
export const BROWSER_RESOLUTION_WIDTH = 1200; export const BROWSER_RESOLUTION_WIDTH = 1200;
export const BROWSER_RESOLUTION_HEIGHT = 800; export const BROWSER_RESOLUTION_HEIGHT = 800;
export const BROWSER_WAIT_TIMEOUT = 10000; export const BROWSER_WAIT_TIMEOUT = 20000;
// Application configs // Application configs
export const APP_HOST = 'http://localhost:3000'; export const APP_HOST = 'http://localhost:3000';

View File

@ -104,7 +104,7 @@ describe('Create folder', () => {
.then(() => createDialog.waitForDialogToClose()) .then(() => createDialog.waitForDialogToClose())
.then(() => dataTable.waitForHeader()) .then(() => dataTable.waitForHeader())
.then(() => { .then(() => {
const isPresent = dataTable.getRowByContainingText(folderName1).isPresent(); const isPresent = dataTable.getRowByName(folderName1).isPresent();
expect(isPresent).toBe(true, 'Folder not displayed in list view'); expect(isPresent).toBe(true, 'Folder not displayed in list view');
}) })
); );
@ -122,7 +122,7 @@ describe('Create folder', () => {
.then(() => createDialog.waitForDialogToClose()) .then(() => createDialog.waitForDialogToClose())
.then(() => dataTable.waitForHeader()) .then(() => dataTable.waitForHeader())
.then(() => { .then(() => {
const isPresent = dataTable.getRowByContainingText(folderName2).isPresent(); const isPresent = dataTable.getRowByName(folderName2).isPresent();
expect(isPresent).toBe(true, 'Folder not displayed in list view'); expect(isPresent).toBe(true, 'Folder not displayed in list view');
}) })
.then(() => { .then(() => {
@ -293,7 +293,7 @@ describe('Create folder', () => {
.then(() => createDialog.waitForDialogToClose()) .then(() => createDialog.waitForDialogToClose())
.then(() => dataTable.waitForHeader()) .then(() => dataTable.waitForHeader())
.then(() => { .then(() => {
const isPresent = dataTable.getRowByContainingText(nameWithSpaces.trim()).isPresent(); const isPresent = dataTable.getRowByName(nameWithSpaces.trim()).isPresent();
expect(isPresent).toBe(true, 'Folder not displayed in list view'); expect(isPresent).toBe(true, 'Folder not displayed in list view');
}) })
); );

View File

@ -113,7 +113,7 @@ describe('Edit folder', () => {
.then(() => editDialog.waitForDialogToClose()) .then(() => editDialog.waitForDialogToClose())
.then(() => dataTable.waitForHeader()) .then(() => dataTable.waitForHeader())
.then(() => { .then(() => {
const isPresent = dataTable.getRowByContainingText(folderNameEdited).isPresent(); const isPresent = dataTable.getRowByName(folderNameEdited).isPresent();
expect(isPresent).toBe(true, 'Folder not displayed in list view'); expect(isPresent).toBe(true, 'Folder not displayed in list view');
}) })
.then(() => { .then(() => {
@ -203,7 +203,7 @@ describe('Edit folder', () => {
.then(() => editDialog.waitForDialogToClose()) .then(() => editDialog.waitForDialogToClose())
.then(() => { .then(() => {
expect(personalFilesPage.snackBar.isPresent()).not.toBe(true, 'notification appears'); expect(personalFilesPage.snackBar.isPresent()).not.toBe(true, 'notification appears');
expect(dataTable.getRowByContainingText(folderName).isPresent()).toBe(true, 'Folder not displayed in list view'); expect(dataTable.getRowByName(folderName).isPresent()).toBe(true, 'Folder not displayed in list view');
}) })
); );
}); });

View File

@ -78,7 +78,7 @@ describe('Permanently delete from Trash', () => {
.then(() => trashPage.getSnackBarMessage()) .then(() => trashPage.getSnackBarMessage())
.then(text => { .then(text => {
expect(text).toBe(`${file1} deleted`); expect(text).toBe(`${file1} deleted`);
expect(dataTable.getRowByContainingText(file1).isPresent()).toBe(false, 'Item was not deleted'); expect(dataTable.getRowByName(file1).isPresent()).toBe(false, 'Item was not deleted');
}); });
}); });
@ -88,7 +88,7 @@ describe('Permanently delete from Trash', () => {
.then(() => trashPage.getSnackBarMessage()) .then(() => trashPage.getSnackBarMessage())
.then(text => { .then(text => {
expect(text).toBe(`${folder1} deleted`); expect(text).toBe(`${folder1} deleted`);
expect(dataTable.getRowByContainingText(folder1).isPresent()).toBe(false, 'Item was not deleted'); expect(dataTable.getRowByName(folder1).isPresent()).toBe(false, 'Item was not deleted');
}); });
}); });
@ -98,8 +98,8 @@ describe('Permanently delete from Trash', () => {
.then(() => trashPage.getSnackBarMessage()) .then(() => trashPage.getSnackBarMessage())
.then(text => { .then(text => {
expect(text).toBe(`2 items deleted`); expect(text).toBe(`2 items deleted`);
expect(dataTable.getRowByContainingText(file2).isPresent()).toBe(false, 'Item was not deleted'); expect(dataTable.getRowByName(file2).isPresent()).toBe(false, 'Item was not deleted');
expect(dataTable.getRowByContainingText(folder2).isPresent()).toBe(false, 'Item was not deleted'); expect(dataTable.getRowByName(folder2).isPresent()).toBe(false, 'Item was not deleted');
}); });
}); });
}); });

View File

@ -83,12 +83,12 @@ describe('Restore from Trash', () => {
.then(text => { .then(text => {
expect(text).toContain(`${file1} restored`); expect(text).toContain(`${file1} restored`);
expect(text).toContain(`View`); expect(text).toContain(`View`);
expect(dataTable.getRowByContainingText(file1).isPresent()).toBe(false, 'Item was not removed from list'); expect(dataTable.getRowByName(file1).isPresent()).toBe(false, 'Item was not removed from list');
}) })
.then(() => personalFilesPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES)) .then(() => personalFilesPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES))
.then(() => personalFilesPage.dataTable.waitForHeader()) .then(() => personalFilesPage.dataTable.waitForHeader())
.then(() => { .then(() => {
expect(personalFilesPage.dataTable.getRowByContainingText(file1).isPresent()).toBe(true, 'Item not displayed in list'); expect(personalFilesPage.dataTable.getRowByName(file1).isPresent()).toBe(true, 'Item not displayed in list');
}); });
}); });
@ -99,12 +99,12 @@ describe('Restore from Trash', () => {
.then(text => { .then(text => {
expect(text).toContain(`${folder1} restored`); expect(text).toContain(`${folder1} restored`);
expect(text).toContain(`View`); expect(text).toContain(`View`);
expect(dataTable.getRowByContainingText(folder1).isPresent()).toBe(false, 'Item was not removed from list'); expect(dataTable.getRowByName(folder1).isPresent()).toBe(false, 'Item was not removed from list');
}) })
.then(() => personalFilesPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES)) .then(() => personalFilesPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES))
.then(() => personalFilesPage.dataTable.waitForHeader()) .then(() => personalFilesPage.dataTable.waitForHeader())
.then(() => { .then(() => {
expect(personalFilesPage.dataTable.getRowByContainingText(folder1).isPresent()).toBe(true, 'Item not displayed in list'); expect(personalFilesPage.dataTable.getRowByName(folder1).isPresent()).toBe(true, 'Item not displayed in list');
}); });
}); });
@ -115,14 +115,14 @@ describe('Restore from Trash', () => {
.then(text => { .then(text => {
expect(text).toContain(`Restore successful`); expect(text).toContain(`Restore successful`);
expect(text).not.toContain(`View`); expect(text).not.toContain(`View`);
expect(dataTable.getRowByContainingText(file2).isPresent()).toBe(false, 'Item was not removed from list'); expect(dataTable.getRowByName(file2).isPresent()).toBe(false, 'Item was not removed from list');
expect(dataTable.getRowByContainingText(folder2).isPresent()).toBe(false, 'Item was not removed from list'); expect(dataTable.getRowByName(folder2).isPresent()).toBe(false, 'Item was not removed from list');
}) })
.then(() => personalFilesPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES)) .then(() => personalFilesPage.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES))
.then(() => personalFilesPage.dataTable.waitForHeader()) .then(() => personalFilesPage.dataTable.waitForHeader())
.then(() => { .then(() => {
expect(personalFilesPage.dataTable.getRowByContainingText(file2).isPresent()).toBe(true, 'Item not displayed in list'); expect(personalFilesPage.dataTable.getRowByName(file2).isPresent()).toBe(true, 'Item not displayed in list');
expect(personalFilesPage.dataTable.getRowByContainingText(folder2).isPresent()).toBe(true, 'Item not displayed in list'); expect(personalFilesPage.dataTable.getRowByName(folder2).isPresent()).toBe(true, 'Item not displayed in list');
}); });
}); });

View File

@ -84,9 +84,9 @@ describe('Favorites', () => {
it('displays the favorite files and folders', () => { it('displays the favorite files and folders', () => {
expect(dataTable.countRows()).toEqual(3, 'Incorrect number of items displayed'); expect(dataTable.countRows()).toEqual(3, 'Incorrect number of items displayed');
expect(dataTable.getRowByContainingText(fileName1).isPresent()).toBe(true, `${fileName1} not displayed`); expect(dataTable.getRowByName(fileName1).isPresent()).toBe(true, `${fileName1} not displayed`);
expect(dataTable.getRowByContainingText(fileName2).isPresent()).toBe(true, `${fileName2} not displayed`); expect(dataTable.getRowByName(fileName2).isPresent()).toBe(true, `${fileName2} not displayed`);
expect(dataTable.getRowByContainingText(folderName).isPresent()).toBe(true, `${folderName} not displayed`); expect(dataTable.getRowByName(folderName).isPresent()).toBe(true, `${folderName} not displayed`);
}); });
it('Location column displays the parent folder of the files', () => { it('Location column displays the parent folder of the files', () => {

View File

@ -97,7 +97,7 @@ describe('File Libraries', () => {
}; };
expect(sitesCount).toEqual(3, 'Incorrect number of sites displayed'); expect(sitesCount).toEqual(3, 'Incorrect number of sites displayed');
expect(dataTable.getRowByContainingText(adminSite).isPresent()).toBe(false, 'Incorrect site appears in list'); expect(dataTable.getRowByName(adminSite).isPresent()).toBe(false, 'Incorrect site appears in list');
dataTable.getRows() dataTable.getRows()
.map((row) => { .map((row) => {

View File

@ -82,11 +82,11 @@ describe('Personal Files', () => {
}); });
it('has "Data Dictionary" folder', () => { it('has "Data Dictionary" folder', () => {
expect(dataTable.getRowByContainingText('Data Dictionary').isPresent()).toBe(true); expect(dataTable.getRowByName('Data Dictionary').isPresent()).toBe(true);
}); });
it('has created content', () => { it('has created content', () => {
expect(dataTable.getRowByContainingText('admin-folder').isPresent()).toBe(true); expect(dataTable.getRowByName(adminFolder).isPresent()).toBe(true);
}); });
}); });
@ -124,7 +124,7 @@ describe('Personal Files', () => {
}); });
it('has user created content', () => { it('has user created content', () => {
expect(dataTable.getRowByContainingText(userFolder).isPresent()) expect(dataTable.getRowByName(userFolder).isPresent())
.toBe(true); .toBe(true);
}); });
@ -146,7 +146,7 @@ describe('Personal Files', () => {
expect(browser.getCurrentUrl()) expect(browser.getCurrentUrl())
.toContain(nodeId, 'Node ID is not in the URL'); .toContain(nodeId, 'Node ID is not in the URL');
expect(dataTable.getRowByContainingText(userFile).isPresent()) expect(dataTable.getRowByName(userFile).isPresent())
.toBe(true, 'user file is missing'); .toBe(true, 'user file is missing');
}); });
}); });

View File

@ -114,11 +114,11 @@ describe('Trash', () => {
it('displays the files and folders deleted by everyone', () => { it('displays the files and folders deleted by everyone', () => {
expect(dataTable.countRows()).toEqual(5, 'Incorrect number of deleted items displayed'); expect(dataTable.countRows()).toEqual(5, 'Incorrect number of deleted items displayed');
expect(dataTable.getRowByContainingText(fileAdmin).isPresent()).toBe(true, `${fileAdmin} not displayed`); expect(dataTable.getRowByName(fileAdmin).isPresent()).toBe(true, `${fileAdmin} not displayed`);
expect(dataTable.getRowByContainingText(folderAdmin).isPresent()).toBe(true, `${folderAdmin} not displayed`); expect(dataTable.getRowByName(folderAdmin).isPresent()).toBe(true, `${folderAdmin} not displayed`);
expect(dataTable.getRowByContainingText(fileUser).isPresent()).toBe(true, `${fileUser} not displayed`); expect(dataTable.getRowByName(fileUser).isPresent()).toBe(true, `${fileUser} not displayed`);
expect(dataTable.getRowByContainingText(folderUser).isPresent()).toBe(true, `${folderUser} not displayed`); expect(dataTable.getRowByName(folderUser).isPresent()).toBe(true, `${folderUser} not displayed`);
expect(dataTable.getRowByContainingText(fileSite).isPresent()).toBe(true, `${fileSite} not displayed`); expect(dataTable.getRowByName(fileSite).isPresent()).toBe(true, `${fileSite} not displayed`);
}); });
}); });
@ -149,9 +149,9 @@ describe('Trash', () => {
it('displays the files and folders deleted by the user', () => { it('displays the files and folders deleted by the user', () => {
expect(dataTable.countRows()).toEqual(3, 'Incorrect number of deleted items displayed'); expect(dataTable.countRows()).toEqual(3, 'Incorrect number of deleted items displayed');
expect(dataTable.getRowByContainingText(fileSite).isPresent()).toBe(true, `${fileSite} not displayed`); expect(dataTable.getRowByName(fileSite).isPresent()).toBe(true, `${fileSite} not displayed`);
expect(dataTable.getRowByContainingText(fileUser).isPresent()).toBe(true, `${fileUser} not displayed`); expect(dataTable.getRowByName(fileUser).isPresent()).toBe(true, `${fileUser} not displayed`);
expect(dataTable.getRowByContainingText(folderUser).isPresent()).toBe(true, `${folderUser} not displayed`); expect(dataTable.getRowByName(folderUser).isPresent()).toBe(true, `${folderUser} not displayed`);
}); });
}); });
}); });

View File

@ -0,0 +1,178 @@
/*!
* @license
* Copyright 2017 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { browser, protractor, promise } from 'protractor';
import { SIDEBAR_LABELS, SITE_VISIBILITY } from '../../configs';
import { LoginPage, LogoutPage, BrowsingPage } from '../../pages/pages';
import { Utils } from '../../utilities/utils';
import { RepoClient, NodeContentTree } from '../../utilities/repo-client/repo-client';
describe('Pagination on Favorites', () => {
const username = `user-${Utils.random()}`;
const apis = {
admin: new RepoClient(),
user: new RepoClient(username, username)
};
const { nodes: nodesApi, favorites: favoritesApi } = apis.user;
const loginPage = new LoginPage();
const logoutPage = new LogoutPage();
const page = new BrowsingPage();
const { dataTable, pagination } = page;
const parent = `parent-${Utils.random()}`;
const files = Array(101)
.fill('file')
.map((name, index): string => `${name}-${index + 1}.txt`);
let filesIds;
function resetToDefaultPageSize(): promise.Promise<any> {
return pagination.openMaxItemsMenu()
.then(menu => menu.clickMenuItem('25'))
.then(() => dataTable.waitForHeader());
}
function resetToDefaultPageNumber(): promise.Promise<any> {
return pagination.openCurrentPageMenu()
.then(menu => menu.clickMenuItem('1'))
.then(() => dataTable.waitForHeader());
}
beforeAll(done => {
apis.admin.people.createUser(username)
.then(() => nodesApi.createFiles(files, parent))
.then(resp => filesIds = resp.data.list.entries.map(entries => entries.entry.id))
.then(() => favoritesApi.addFavoritesByIds('file', filesIds))
.then(() => loginPage.load())
.then(() => loginPage.loginWith(username))
.then(done);
});
beforeEach(done => {
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FAVORITES)
.then(() => dataTable.waitForHeader())
.then(done);
});
afterEach(done => {
browser.actions().sendKeys(protractor.Key.ESCAPE).perform().then(done);
});
afterAll(done => {
Promise.all([
nodesApi.deleteNodes([ parent ]),
logoutPage.load()
])
.then(done);
});
it('default values', () => {
expect(pagination.range.getText()).toContain('1-25 of 101');
expect(pagination.maxItems.getText()).toContain('25');
expect(pagination.currentPage.getText()).toContain('Page 1');
expect(pagination.totalPages.getText()).toContain('of 5');
expect(pagination.previousButton.isEnabled()).toBe(false, 'Previous button is enabled');
expect(pagination.nextButton.isEnabled()).toBe(true, 'Next button is not enabled');
});
it('page sizes', () => {
pagination.openMaxItemsMenu()
.then(menu => {
const [ first, second, third ] = [1, 2, 3]
.map(nth => menu.getNthItem(nth).getText());
expect(first).toBe('25');
expect(second).toBe('50');
expect(third).toBe('100');
});
});
it('change the page size', () => {
pagination.openMaxItemsMenu()
.then(menu => menu.clickMenuItem('50'))
.then(() => dataTable.waitForHeader())
.then(() => {
expect(pagination.maxItems.getText()).toContain('50');
expect(pagination.totalPages.getText()).toContain('of 3');
})
.then(() => resetToDefaultPageSize());
});
it('current page menu items', () => {
pagination.openCurrentPageMenu()
.then(menu => {
expect(menu.getItemsCount()).toBe(5);
});
});
it('change the current page from menu', () => {
pagination.openCurrentPageMenu()
.then(menu => menu.clickNthItem(3))
.then(() => dataTable.waitForHeader())
.then(() => {
expect(pagination.range.getText()).toContain('51-75 of 101');
expect(pagination.currentPage.getText()).toContain('Page 3');
expect(pagination.previousButton.isEnabled()).toBe(true, 'Previous button is not enabled');
expect(pagination.nextButton.isEnabled()).toBe(true, 'Next button is not enabled');
expect(dataTable.getRowByName('file-40.txt').isPresent())
.toBe(true, 'File not found on page');
})
.then(() => resetToDefaultPageNumber());
});
it('navigate to next page', () => {
pagination.nextButton.click()
.then(() => dataTable.waitForHeader())
.then(() => {
expect(pagination.range.getText()).toContain('26-50 of 101');
expect(dataTable.getRowByName('file-70.txt').isPresent())
.toBe(true, 'File not found on page');
})
.then(() => resetToDefaultPageNumber());
});
it('navigate to previous page', () => {
pagination.openCurrentPageMenu()
.then(menu => menu.clickNthItem(2))
.then(() => dataTable.waitForHeader())
.then(() => pagination.previousButton.click())
.then(() => dataTable.waitForHeader())
.then(() => {
expect(pagination.range.getText()).toContain('1-25 of 101');
expect(dataTable.getRowByName('file-88.txt').isPresent())
.toBe(true, 'File not found on page');
})
.then(() => resetToDefaultPageNumber());
});
it('last page', () => {
pagination.openCurrentPageMenu()
.then(menu => menu.clickNthItem(5))
.then(() => dataTable.waitForHeader())
.then(() => {
expect(dataTable.countRows()).toBe(1, 'Incorrect number of items on the last page');
expect(pagination.currentPage.getText()).toContain('Page 5');
expect(pagination.nextButton.isEnabled()).toBe(false, 'Next button is enabled');
});
});
});

View File

@ -0,0 +1,175 @@
/*!
* @license
* Copyright 2017 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { browser, protractor, promise } from 'protractor';
import { SIDEBAR_LABELS, SITE_VISIBILITY } from '../../configs';
import { LoginPage, LogoutPage, BrowsingPage } from '../../pages/pages';
import { Utils } from '../../utilities/utils';
import { RepoClient, NodeContentTree } from '../../utilities/repo-client/repo-client';
describe('Pagination on Personal Files', () => {
const username = `user-${Utils.random()}`;
const apis = {
admin: new RepoClient(),
user: new RepoClient(username, username)
};
const { nodes: nodesApi } = apis.user;
const loginPage = new LoginPage();
const logoutPage = new LogoutPage();
const page = new BrowsingPage();
const { dataTable, pagination } = page;
const parent = `parent-${Utils.random()}`;
const files = Array(101)
.fill('file')
.map((name, index): string => `${name}-${index + 1}.txt`);
function resetToDefaultPageSize(): promise.Promise<any> {
return pagination.openMaxItemsMenu()
.then(menu => menu.clickMenuItem('25'))
.then(() => dataTable.waitForHeader());
}
function resetToDefaultPageNumber(): promise.Promise<any> {
return pagination.openCurrentPageMenu()
.then(menu => menu.clickMenuItem('1'))
.then(() => dataTable.waitForHeader());
}
beforeAll(done => {
apis.admin.people.createUser(username)
.then(() => nodesApi.createFiles(files, parent))
.then(() => loginPage.load())
.then(() => loginPage.loginWith(username))
.then(done);
});
beforeEach(done => {
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES)
.then(() => dataTable.waitForHeader())
.then(() => dataTable.doubleClickOnItemName(parent))
.then(done);
});
afterEach(done => {
browser.actions().sendKeys(protractor.Key.ESCAPE).perform().then(done);
});
afterAll(done => {
Promise.all([
nodesApi.deleteNodes([ parent ]),
logoutPage.load()
])
.then(done);
});
it('default values', () => {
expect(pagination.range.getText()).toContain('1-25 of 101');
expect(pagination.maxItems.getText()).toContain('25');
expect(pagination.currentPage.getText()).toContain('Page 1');
expect(pagination.totalPages.getText()).toContain('of 5');
expect(pagination.previousButton.isEnabled()).toBe(false, 'Previous button is enabled');
expect(pagination.nextButton.isEnabled()).toBe(true, 'Next button is not enabled');
});
it('page sizes', () => {
pagination.openMaxItemsMenu()
.then(menu => {
const [ first, second, third ] = [1, 2, 3]
.map(nth => menu.getNthItem(nth).getText());
expect(first).toBe('25');
expect(second).toBe('50');
expect(third).toBe('100');
});
});
it('change the page size', () => {
pagination.openMaxItemsMenu()
.then(menu => menu.clickMenuItem('50'))
.then(() => dataTable.waitForHeader())
.then(() => {
expect(pagination.maxItems.getText()).toContain('50');
expect(pagination.totalPages.getText()).toContain('of 3');
})
.then(() => resetToDefaultPageSize());
});
it('current page menu items', () => {
pagination.openCurrentPageMenu()
.then(menu => {
expect(menu.getItemsCount()).toBe(5);
});
});
it('change the current page from menu', () => {
pagination.openCurrentPageMenu()
.then(menu => menu.clickNthItem(3))
.then(() => dataTable.waitForHeader())
.then(() => {
expect(pagination.range.getText()).toContain('51-75 of 101');
expect(pagination.currentPage.getText()).toContain('Page 3');
expect(pagination.previousButton.isEnabled()).toBe(true, 'Previous button is not enabled');
expect(pagination.nextButton.isEnabled()).toBe(true, 'Next button is not enabled');
expect(dataTable.getRowByName('file-60.txt').isPresent())
.toBe(true, 'File not found on page');
})
.then(() => resetToDefaultPageNumber());
});
it('navigate to next page', () => {
pagination.nextButton.click()
.then(() => dataTable.waitForHeader())
.then(() => {
expect(pagination.range.getText()).toContain('26-50 of 101');
expect(dataTable.getRowByName('file-30.txt').isPresent())
.toBe(true, 'File not found on page');
})
.then(() => resetToDefaultPageNumber());
});
it('navigate to previous page', () => {
pagination.openCurrentPageMenu()
.then(menu => menu.clickNthItem(2))
.then(() => dataTable.waitForHeader())
.then(() => pagination.previousButton.click())
.then(() => dataTable.waitForHeader())
.then(() => {
expect(pagination.range.getText()).toContain('1-25 of 101');
expect(dataTable.getRowByName('file-12.txt').isPresent())
.toBe(true, 'File not found on page');
})
.then(() => resetToDefaultPageNumber());
});
it('last page', () => {
pagination.openCurrentPageMenu()
.then(menu => menu.clickNthItem(5))
.then(() => dataTable.waitForHeader())
.then(() => {
expect(dataTable.countRows()).toBe(1, 'Incorrect number of items on the last page');
expect(pagination.currentPage.getText()).toContain('Page 5');
expect(pagination.nextButton.isEnabled()).toBe(false, 'Next button is enabled');
});
});
});

View File

@ -0,0 +1,181 @@
/*!
* @license
* Copyright 2017 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { browser, protractor, promise } from 'protractor';
import { SIDEBAR_LABELS, SITE_VISIBILITY } from '../../configs';
import { LoginPage, LogoutPage, BrowsingPage } from '../../pages/pages';
import { Utils } from '../../utilities/utils';
import { RepoClient, NodeContentTree } from '../../utilities/repo-client/repo-client';
describe('Pagination on Recent Files', () => {
const username = `user-${Utils.random()}`;
const apis = {
admin: new RepoClient(),
user: new RepoClient(username, username)
};
const { nodes: nodesApi } = apis.user;
const loginPage = new LoginPage();
const logoutPage = new LogoutPage();
const page = new BrowsingPage();
const { dataTable, pagination } = page;
const parent = `parent-${Utils.random()}`;
const files = Array(101)
.fill('file')
.map((name, index): string => `${name}-${index + 1}.txt`);
function resetToDefaultPageSize(): promise.Promise<any> {
return pagination.openMaxItemsMenu()
.then(menu => menu.clickMenuItem('25'))
.then(() => dataTable.waitForHeader());
}
function resetToDefaultPageNumber(): promise.Promise<any> {
return pagination.openCurrentPageMenu()
.then(menu => menu.clickMenuItem('1'))
.then(() => dataTable.waitForHeader());
}
beforeAll(done => {
apis.admin.people.createUser(username)
.then(() => nodesApi.createFiles(files, parent))
.then(() => loginPage.load())
.then(() => loginPage.loginWith(username))
.then(done);
});
beforeEach(done => {
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.RECENT_FILES)
.then(() => dataTable.isEmptyList())
.then(empty => {
if (empty) {
browser.sleep(3000);
page.refresh();
}
})
.then(() => dataTable.waitForHeader())
.then(done);
});
afterEach(done => {
browser.actions().sendKeys(protractor.Key.ESCAPE).perform().then(done);
});
afterAll(done => {
Promise.all([
nodesApi.deleteNodes([ parent ]),
logoutPage.load()
])
.then(done);
});
it('default values', () => {
expect(pagination.range.getText()).toContain('1-25 of 101');
expect(pagination.maxItems.getText()).toContain('25');
expect(pagination.currentPage.getText()).toContain('Page 1');
expect(pagination.totalPages.getText()).toContain('of 5');
expect(pagination.previousButton.isEnabled()).toBe(false, 'Previous button is enabled');
expect(pagination.nextButton.isEnabled()).toBe(true, 'Next button is not enabled');
});
it('page sizes', () => {
pagination.openMaxItemsMenu()
.then(menu => {
const [ first, second, third ] = [1, 2, 3]
.map(nth => menu.getNthItem(nth).getText());
expect(first).toBe('25');
expect(second).toBe('50');
expect(third).toBe('100');
});
});
it('change the page size', () => {
pagination.openMaxItemsMenu()
.then(menu => menu.clickMenuItem('50'))
.then(() => dataTable.waitForHeader())
.then(() => {
expect(pagination.maxItems.getText()).toContain('50');
expect(pagination.totalPages.getText()).toContain('of 3');
})
.then(() => resetToDefaultPageSize());
});
it('current page menu items', () => {
pagination.openCurrentPageMenu()
.then(menu => {
expect(menu.getItemsCount()).toBe(5);
});
});
it('change the current page from menu', () => {
pagination.openCurrentPageMenu()
.then(menu => menu.clickNthItem(3))
.then(() => dataTable.waitForHeader())
.then(() => {
expect(pagination.range.getText()).toContain('51-75 of 101');
expect(pagination.currentPage.getText()).toContain('Page 3');
expect(pagination.previousButton.isEnabled()).toBe(true, 'Previous button is not enabled');
expect(pagination.nextButton.isEnabled()).toBe(true, 'Next button is not enabled');
expect(dataTable.getRowByName('file-40.txt').isPresent())
.toBe(true, 'File not found on page');
})
.then(() => resetToDefaultPageNumber());
});
it('navigate to next page', () => {
pagination.nextButton.click()
.then(() => dataTable.waitForHeader())
.then(() => {
expect(pagination.range.getText()).toContain('26-50 of 101');
expect(dataTable.getRowByName('file-70.txt').isPresent())
.toBe(true, 'File not found on page');
})
.then(() => resetToDefaultPageNumber());
});
it('navigate to previous page', () => {
pagination.openCurrentPageMenu()
.then(menu => menu.clickNthItem(2))
.then(() => dataTable.waitForHeader())
.then(() => pagination.previousButton.click())
.then(() => dataTable.waitForHeader())
.then(() => {
expect(pagination.range.getText()).toContain('1-25 of 101');
expect(dataTable.getRowByName('file-88.txt').isPresent())
.toBe(true, 'File not found on page');
})
.then(() => resetToDefaultPageNumber());
});
it('last page', () => {
pagination.openCurrentPageMenu()
.then(menu => menu.clickNthItem(5))
.then(() => dataTable.waitForHeader())
.then(() => {
expect(dataTable.countRows()).toBe(1, 'Incorrect number of items on the last page');
expect(pagination.currentPage.getText()).toContain('Page 5');
expect(pagination.nextButton.isEnabled()).toBe(false, 'Next button is enabled');
});
});
});

View File

@ -0,0 +1,185 @@
/*!
* @license
* Copyright 2017 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { browser, protractor, promise } from 'protractor';
import { SIDEBAR_LABELS, SITE_VISIBILITY } from '../../configs';
import { LoginPage, LogoutPage, BrowsingPage } from '../../pages/pages';
import { Utils } from '../../utilities/utils';
import { RepoClient, NodeContentTree } from '../../utilities/repo-client/repo-client';
describe('Pagination on Shared Files', () => {
const username = `user-${Utils.random()}`;
const apis = {
admin: new RepoClient(),
user: new RepoClient(username, username)
};
const { nodes: nodesApi, shared: sharedApi } = apis.user;
const loginPage = new LoginPage();
const logoutPage = new LogoutPage();
const page = new BrowsingPage();
const { dataTable, pagination } = page;
const parent = `parent-${Utils.random()}`;
const files = Array(101)
.fill('file')
.map((name, index): string => `${name}-${index + 1}.txt`);
let filesIds;
function resetToDefaultPageSize(): promise.Promise<any> {
return pagination.openMaxItemsMenu()
.then(menu => menu.clickMenuItem('25'))
.then(() => dataTable.waitForHeader());
}
function resetToDefaultPageNumber(): promise.Promise<any> {
return pagination.openCurrentPageMenu()
.then(menu => menu.clickMenuItem('1'))
.then(() => dataTable.waitForHeader());
}
beforeAll(done => {
apis.admin.people.createUser(username)
.then(() => nodesApi.createFiles(files, parent))
.then(resp => filesIds = resp.data.list.entries.map(entries => entries.entry.id))
.then(() => sharedApi.shareFilesByIds(filesIds))
.then(() => loginPage.load())
.then(() => loginPage.loginWith(username))
.then(done);
});
beforeEach(done => {
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.SHARED_FILES)
.then(() => dataTable.isEmptyList())
.then(empty => {
if (empty) {
browser.sleep(6000);
page.refresh();
}
})
.then(() => dataTable.waitForHeader())
.then(done);
});
afterEach(done => {
browser.actions().sendKeys(protractor.Key.ESCAPE).perform().then(done);
});
afterAll(done => {
Promise.all([
nodesApi.deleteNodes([ parent ]),
logoutPage.load()
])
.then(done);
});
it('default values', () => {
expect(pagination.range.getText()).toContain('1-25 of 101');
expect(pagination.maxItems.getText()).toContain('25');
expect(pagination.currentPage.getText()).toContain('Page 1');
expect(pagination.totalPages.getText()).toContain('of 5');
expect(pagination.previousButton.isEnabled()).toBe(false, 'Previous button is enabled');
expect(pagination.nextButton.isEnabled()).toBe(true, 'Next button is not enabled');
});
it('page sizes', () => {
pagination.openMaxItemsMenu()
.then(menu => {
const [ first, second, third ] = [1, 2, 3]
.map(nth => menu.getNthItem(nth).getText());
expect(first).toBe('25');
expect(second).toBe('50');
expect(third).toBe('100');
});
});
it('change the page size', () => {
pagination.openMaxItemsMenu()
.then(menu => menu.clickMenuItem('50'))
.then(() => dataTable.waitForHeader())
.then(() => {
expect(pagination.maxItems.getText()).toContain('50');
expect(pagination.totalPages.getText()).toContain('of 3');
})
.then(() => resetToDefaultPageSize());
});
it('current page menu items', () => {
pagination.openCurrentPageMenu()
.then(menu => {
expect(menu.getItemsCount()).toBe(5);
});
});
it('change the current page from menu', () => {
pagination.openCurrentPageMenu()
.then(menu => menu.clickNthItem(3))
.then(() => dataTable.waitForHeader())
.then(() => {
expect(pagination.range.getText()).toContain('51-75 of 101');
expect(pagination.currentPage.getText()).toContain('Page 3');
expect(pagination.previousButton.isEnabled()).toBe(true, 'Previous button is not enabled');
expect(pagination.nextButton.isEnabled()).toBe(true, 'Next button is not enabled');
expect(dataTable.getRowByName('file-40.txt').isPresent())
.toBe(true, 'File not found on page');
})
.then(() => resetToDefaultPageNumber());
});
it('navigate to next page', () => {
pagination.nextButton.click()
.then(() => dataTable.waitForHeader())
.then(() => {
expect(pagination.range.getText()).toContain('26-50 of 101');
expect(dataTable.getRowByName('file-70.txt').isPresent())
.toBe(true, 'File not found on page');
})
.then(() => resetToDefaultPageNumber());
});
it('navigate to previous page', () => {
pagination.openCurrentPageMenu()
.then(menu => menu.clickNthItem(2))
.then(() => dataTable.waitForHeader())
.then(() => pagination.previousButton.click())
.then(() => dataTable.waitForHeader())
.then(() => {
expect(pagination.range.getText()).toContain('1-25 of 101');
expect(dataTable.getRowByName('file-88.txt').isPresent())
.toBe(true, 'File not found on page');
})
.then(() => resetToDefaultPageNumber());
});
it('last page', () => {
pagination.openCurrentPageMenu()
.then(menu => menu.clickNthItem(5))
.then(() => dataTable.waitForHeader())
.then(() => {
expect(dataTable.countRows()).toBe(1, 'Incorrect number of items on the last page');
expect(pagination.currentPage.getText()).toContain('Page 5');
expect(pagination.nextButton.isEnabled()).toBe(false, 'Next button is enabled');
});
});
});

View File

@ -0,0 +1,176 @@
/*!
* @license
* Copyright 2017 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { browser, protractor, promise } from 'protractor';
import { SIDEBAR_LABELS, SITE_VISIBILITY } from '../../configs';
import { LoginPage, LogoutPage, BrowsingPage } from '../../pages/pages';
import { Utils } from '../../utilities/utils';
import { RepoClient, NodeContentTree } from '../../utilities/repo-client/repo-client';
describe('Pagination on Trash', () => {
const username = `user-${Utils.random()}`;
const apis = {
admin: new RepoClient(),
user: new RepoClient(username, username)
};
const { nodes: nodesApi, trashcan: trashApi } = apis.user;
const loginPage = new LoginPage();
const logoutPage = new LogoutPage();
const page = new BrowsingPage();
const { dataTable, pagination } = page;
const filesForDelete = Array(101)
.fill('file')
.map((name, index): string => `${name}-${index + 1}.txt`);
let filesDeletedIds;
function resetToDefaultPageSize(): promise.Promise<any> {
return pagination.openMaxItemsMenu()
.then(menu => menu.clickMenuItem('25'))
.then(() => dataTable.waitForHeader());
}
function resetToDefaultPageNumber(): promise.Promise<any> {
return pagination.openCurrentPageMenu()
.then(menu => menu.clickMenuItem('1'))
.then(() => dataTable.waitForHeader());
}
beforeAll(done => {
apis.admin.people.createUser(username)
.then(() => nodesApi.createFiles(filesForDelete))
.then(resp => filesDeletedIds = resp.data.list.entries.map(entries => entries.entry.id))
.then(() => nodesApi.deleteNodesById(filesDeletedIds, false))
.then(() => loginPage.load())
.then(() => loginPage.loginWith(username))
.then(done);
});
beforeEach(done => {
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH)
.then(() => dataTable.waitForHeader())
.then(done);
});
afterEach(done => {
browser.actions().sendKeys(protractor.Key.ESCAPE).perform().then(done);
});
afterAll(done => {
Promise.all([
trashApi.emptyTrash(),
logoutPage.load()
])
.then(done);
});
it('default values', () => {
expect(pagination.range.getText()).toContain('1-25 of 101');
expect(pagination.maxItems.getText()).toContain('25');
expect(pagination.currentPage.getText()).toContain('Page 1');
expect(pagination.totalPages.getText()).toContain('of 5');
expect(pagination.previousButton.isEnabled()).toBe(false, 'Previous button is enabled');
expect(pagination.nextButton.isEnabled()).toBe(true, 'Next button is not enabled');
});
it('page sizes', () => {
pagination.openMaxItemsMenu()
.then(menu => {
const [ first, second, third ] = [1, 2, 3]
.map(nth => menu.getNthItem(nth).getText());
expect(first).toBe('25');
expect(second).toBe('50');
expect(third).toBe('100');
});
});
it('change the page size', () => {
pagination.openMaxItemsMenu()
.then(menu => menu.clickMenuItem('50'))
.then(() => dataTable.waitForHeader())
.then(() => {
expect(pagination.maxItems.getText()).toContain('50');
expect(pagination.totalPages.getText()).toContain('of 3');
})
.then(() => resetToDefaultPageSize());
});
it('current page menu items', () => {
pagination.openCurrentPageMenu()
.then(menu => {
expect(menu.getItemsCount()).toBe(5);
});
});
it('change the current page from menu', () => {
pagination.openCurrentPageMenu()
.then(menu => menu.clickNthItem(3))
.then(() => dataTable.waitForHeader())
.then(() => {
expect(pagination.range.getText()).toContain('51-75 of 101');
expect(pagination.currentPage.getText()).toContain('Page 3');
expect(pagination.previousButton.isEnabled()).toBe(true, 'Previous button is not enabled');
expect(pagination.nextButton.isEnabled()).toBe(true, 'Next button is not enabled');
expect(dataTable.getRowByName('file-40.txt').isPresent())
.toBe(true, 'File not found on page');
})
.then(() => resetToDefaultPageNumber());
});
it('navigate to next page', () => {
pagination.nextButton.click()
.then(() => dataTable.waitForHeader())
.then(() => {
expect(pagination.range.getText()).toContain('26-50 of 101');
expect(dataTable.getRowByName('file-70.txt').isPresent())
.toBe(true, 'File not found on page');
})
.then(() => resetToDefaultPageNumber());
});
it('navigate to previous page', () => {
pagination.openCurrentPageMenu()
.then(menu => menu.clickNthItem(2))
.then(() => dataTable.waitForHeader())
.then(() => pagination.previousButton.click())
.then(() => dataTable.waitForHeader())
.then(() => {
expect(pagination.range.getText()).toContain('1-25 of 101');
expect(dataTable.getRowByName('file-88.txt').isPresent())
.toBe(true, 'File not found on page');
})
.then(() => resetToDefaultPageNumber());
});
it('last page', () => {
pagination.openCurrentPageMenu()
.then(menu => menu.clickNthItem(5))
.then(() => dataTable.waitForHeader())
.then(() => {
expect(dataTable.countRows()).toBe(1, 'Incorrect number of items on the last page');
expect(pagination.currentPage.getText()).toContain('Page 5');
expect(pagination.nextButton.isEnabled()).toBe(false, 'Next button is enabled');
});
});
});

View File

@ -1,668 +0,0 @@
/*!
* @license
* Copyright 2017 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { browser, protractor, promise } from 'protractor';
import { SIDEBAR_LABELS, SITE_VISIBILITY } from '../../configs';
import { LoginPage, LogoutPage, BrowsingPage } from '../../pages/pages';
import { Utils } from '../../utilities/utils';
import { RepoClient, NodeContentTree } from '../../utilities/repo-client/repo-client';
describe('Pagination', () => {
const username = `user-${Utils.random()}`;
const apis = {
admin: new RepoClient(),
user: new RepoClient(username, username)
};
const {
nodes: nodesApi,
trashcan: trashApi,
favorites: favoritesApi,
shared: sharedApi,
sites: sitesApi
} = apis.user;
const loginPage = new LoginPage();
const logoutPage = new LogoutPage();
const page = new BrowsingPage();
const { dataTable, pagination } = page;
const parent = `parent-${Utils.random()}`;
const files = Array(101)
.fill('file')
.map((name, index): string => `${name}-${index + 1}.txt`);
let filesIds;
const filesForDelete = Array(101)
.fill('file')
.map((name, index): string => `${name}-${index + 1}.txt`);
let filesDeletedIds;
function resetToDefaultPageSize(): promise.Promise<any> {
return pagination.openMaxItemsMenu()
.then(menu => menu.clickMenuItem('25'))
.then(() => dataTable.waitForHeader());
}
function resetToDefaultPageNumber(): promise.Promise<any> {
return pagination.openCurrentPageMenu()
.then(menu => menu.clickMenuItem('1'))
.then(() => dataTable.waitForHeader());
}
beforeAll(done => {
apis.admin.people.createUser(username)
.then(() => nodesApi.createFiles(files, parent))
.then(resp => filesIds = resp.data.list.entries.map(entries => entries.entry.id))
.then(() => sharedApi.shareFilesByIds(filesIds))
.then(() => favoritesApi.addFavoritesByIds('file', filesIds))
.then(() => nodesApi.createFiles(filesForDelete))
.then(resp => filesDeletedIds = resp.data.list.entries.map(entries => entries.entry.id))
.then(() => nodesApi.deleteNodesById(filesDeletedIds, false))
.then(done);
});
afterAll(done => {
Promise.all([
nodesApi.deleteNodes([ parent ]),
trashApi.emptyTrash()
])
.then(done);
});
xit('');
describe(`on Personal Files`, () => {
beforeAll(done => {
loginPage.load()
.then(() => loginPage.loginWith(username))
.then(done);
});
beforeEach(done => {
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES)
.then(() => dataTable.waitForHeader())
.then(() => dataTable.doubleClickOnItemName(parent))
.then(done);
});
afterEach(done => {
browser.actions().sendKeys(protractor.Key.ESCAPE).perform().then(done);
});
afterAll(done => {
logoutPage.load().then(done);
});
it('default values', () => {
expect(pagination.range.getText()).toContain('1-25 of 101');
expect(pagination.maxItems.getText()).toContain('25');
expect(pagination.currentPage.getText()).toContain('Page 1');
expect(pagination.totalPages.getText()).toContain('of 5');
expect(pagination.previousButton.isEnabled()).toBe(false, 'Previous button is enabled');
expect(pagination.nextButton.isEnabled()).toBe(true, 'Next button is not enabled');
});
it('page sizes', () => {
pagination.openMaxItemsMenu()
.then(menu => {
const [ first, second, third ] = [1, 2, 3]
.map(nth => menu.getNthItem(nth).getText());
expect(first).toBe('25');
expect(second).toBe('50');
expect(third).toBe('100');
});
});
it('change the page size', () => {
pagination.openMaxItemsMenu()
.then(menu => menu.clickMenuItem('50'))
.then(() => dataTable.waitForHeader())
.then(() => {
expect(pagination.maxItems.getText()).toContain('50');
expect(pagination.totalPages.getText()).toContain('of 3');
})
.then(() => resetToDefaultPageSize());
});
it('current page menu items', () => {
pagination.openCurrentPageMenu()
.then(menu => {
expect(menu.getItemsCount()).toBe(5);
});
});
it('change the current page from menu', () => {
pagination.openCurrentPageMenu()
.then(menu => menu.clickNthItem(3))
.then(() => dataTable.waitForHeader())
.then(() => {
expect(pagination.range.getText()).toContain('51-75 of 101');
expect(pagination.currentPage.getText()).toContain('Page 3');
expect(pagination.previousButton.isEnabled()).toBe(true, 'Previous button is not enabled');
expect(pagination.nextButton.isEnabled()).toBe(true, 'Next button is not enabled');
expect(dataTable.getRowByContainingText('file-60.txt').isPresent())
.toBe(true, 'File not found on page');
})
.then(() => resetToDefaultPageNumber());
});
it('navigate to next page', () => {
pagination.nextButton.click()
.then(() => dataTable.waitForHeader())
.then(() => {
expect(pagination.range.getText()).toContain('26-50 of 101');
expect(dataTable.getRowByContainingText('file-30.txt').isPresent())
.toBe(true, 'File not found on page');
})
.then(() => resetToDefaultPageNumber());
});
it('navigate to previous page', () => {
pagination.openCurrentPageMenu()
.then(menu => menu.clickNthItem(2))
.then(() => dataTable.waitForHeader())
.then(() => pagination.previousButton.click())
.then(() => dataTable.waitForHeader())
.then(() => {
expect(pagination.range.getText()).toContain('1-25 of 101');
expect(dataTable.getRowByContainingText('file-12.txt').isPresent())
.toBe(true, 'File not found on page');
})
.then(() => resetToDefaultPageNumber());
});
it('last page', () => {
pagination.openCurrentPageMenu()
.then(menu => menu.clickNthItem(5))
.then(() => dataTable.waitForHeader())
.then(() => {
expect(dataTable.countRows()).toBe(1, 'Incorrect number of items on the last page');
expect(pagination.currentPage.getText()).toContain('Page 5');
expect(pagination.nextButton.isEnabled()).toBe(false, 'Next button is enabled');
});
});
});
describe(`on Recent Files`, () => {
beforeAll(done => {
loginPage.load()
.then(() => loginPage.loginWith(username))
.then(done);
});
beforeEach(done => {
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.RECENT_FILES)
.then(() => dataTable.waitForHeader())
.then(done);
});
afterEach(done => {
browser.actions().sendKeys(protractor.Key.ESCAPE).perform().then(done);
});
afterAll(done => {
logoutPage.load().then(done);
});
it('default values', () => {
expect(pagination.range.getText()).toContain('1-25 of 101');
expect(pagination.maxItems.getText()).toContain('25');
expect(pagination.currentPage.getText()).toContain('Page 1');
expect(pagination.totalPages.getText()).toContain('of 5');
expect(pagination.previousButton.isEnabled()).toBe(false, 'Previous button is enabled');
expect(pagination.nextButton.isEnabled()).toBe(true, 'Next button is not enabled');
});
it('page sizes', () => {
pagination.openMaxItemsMenu()
.then(menu => {
const [ first, second, third ] = [1, 2, 3]
.map(nth => menu.getNthItem(nth).getText());
expect(first).toBe('25');
expect(second).toBe('50');
expect(third).toBe('100');
});
});
it('change the page size', () => {
pagination.openMaxItemsMenu()
.then(menu => menu.clickMenuItem('50'))
.then(() => dataTable.waitForHeader())
.then(() => {
expect(pagination.maxItems.getText()).toContain('50');
expect(pagination.totalPages.getText()).toContain('of 3');
})
.then(() => resetToDefaultPageSize());
});
it('current page menu items', () => {
pagination.openCurrentPageMenu()
.then(menu => {
expect(menu.getItemsCount()).toBe(5);
});
});
it('change the current page from menu', () => {
pagination.openCurrentPageMenu()
.then(menu => menu.clickNthItem(3))
.then(() => dataTable.waitForHeader())
.then(() => {
expect(pagination.range.getText()).toContain('51-75 of 101');
expect(pagination.currentPage.getText()).toContain('Page 3');
expect(pagination.previousButton.isEnabled()).toBe(true, 'Previous button is not enabled');
expect(pagination.nextButton.isEnabled()).toBe(true, 'Next button is not enabled');
expect(dataTable.getRowByContainingText('file-40.txt').isPresent())
.toBe(true, 'File not found on page');
})
.then(() => resetToDefaultPageNumber());
});
it('navigate to next page', () => {
pagination.nextButton.click()
.then(() => dataTable.waitForHeader())
.then(() => {
expect(pagination.range.getText()).toContain('26-50 of 101');
expect(dataTable.getRowByContainingText('file-70.txt').isPresent())
.toBe(true, 'File not found on page');
})
.then(() => resetToDefaultPageNumber());
});
it('navigate to previous page', () => {
pagination.openCurrentPageMenu()
.then(menu => menu.clickNthItem(2))
.then(() => dataTable.waitForHeader())
.then(() => pagination.previousButton.click())
.then(() => dataTable.waitForHeader())
.then(() => {
expect(pagination.range.getText()).toContain('1-25 of 101');
expect(dataTable.getRowByContainingText('file-88.txt').isPresent())
.toBe(true, 'File not found on page');
})
.then(() => resetToDefaultPageNumber());
});
it('last page', () => {
pagination.openCurrentPageMenu()
.then(menu => menu.clickNthItem(5))
.then(() => dataTable.waitForHeader())
.then(() => {
expect(dataTable.countRows()).toBe(1, 'Incorrect number of items on the last page');
expect(pagination.currentPage.getText()).toContain('Page 5');
expect(pagination.nextButton.isEnabled()).toBe(false, 'Next button is enabled');
});
});
});
describe(`on Favorites`, () => {
beforeAll(done => {
loginPage.load()
.then(() => loginPage.loginWith(username))
.then(done);
});
beforeEach(done => {
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FAVORITES)
.then(() => dataTable.waitForHeader())
.then(done);
});
afterEach(done => {
browser.actions().sendKeys(protractor.Key.ESCAPE).perform().then(done);
});
afterAll(done => {
logoutPage.load().then(done);
});
it('default values', () => {
expect(pagination.range.getText()).toContain('1-25 of 101');
expect(pagination.maxItems.getText()).toContain('25');
expect(pagination.currentPage.getText()).toContain('Page 1');
expect(pagination.totalPages.getText()).toContain('of 5');
expect(pagination.previousButton.isEnabled()).toBe(false, 'Previous button is enabled');
expect(pagination.nextButton.isEnabled()).toBe(true, 'Next button is not enabled');
});
it('page sizes', () => {
pagination.openMaxItemsMenu()
.then(menu => {
const [ first, second, third ] = [1, 2, 3]
.map(nth => menu.getNthItem(nth).getText());
expect(first).toBe('25');
expect(second).toBe('50');
expect(third).toBe('100');
});
});
it('change the page size', () => {
pagination.openMaxItemsMenu()
.then(menu => menu.clickMenuItem('50'))
.then(() => dataTable.waitForHeader())
.then(() => {
expect(pagination.maxItems.getText()).toContain('50');
expect(pagination.totalPages.getText()).toContain('of 3');
})
.then(() => resetToDefaultPageSize());
});
it('current page menu items', () => {
pagination.openCurrentPageMenu()
.then(menu => {
expect(menu.getItemsCount()).toBe(5);
});
});
it('change the current page from menu', () => {
pagination.openCurrentPageMenu()
.then(menu => menu.clickNthItem(3))
.then(() => dataTable.waitForHeader())
.then(() => {
expect(pagination.range.getText()).toContain('51-75 of 101');
expect(pagination.currentPage.getText()).toContain('Page 3');
expect(pagination.previousButton.isEnabled()).toBe(true, 'Previous button is not enabled');
expect(pagination.nextButton.isEnabled()).toBe(true, 'Next button is not enabled');
expect(dataTable.getRowByContainingText('file-40.txt').isPresent())
.toBe(true, 'File not found on page');
})
.then(() => resetToDefaultPageNumber());
});
it('navigate to next page', () => {
pagination.nextButton.click()
.then(() => dataTable.waitForHeader())
.then(() => {
expect(pagination.range.getText()).toContain('26-50 of 101');
expect(dataTable.getRowByContainingText('file-70.txt').isPresent())
.toBe(true, 'File not found on page');
})
.then(() => resetToDefaultPageNumber());
});
it('navigate to previous page', () => {
pagination.openCurrentPageMenu()
.then(menu => menu.clickNthItem(2))
.then(() => dataTable.waitForHeader())
.then(() => pagination.previousButton.click())
.then(() => dataTable.waitForHeader())
.then(() => {
expect(pagination.range.getText()).toContain('1-25 of 101');
expect(dataTable.getRowByContainingText('file-88.txt').isPresent())
.toBe(true, 'File not found on page');
})
.then(() => resetToDefaultPageNumber());
});
it('last page', () => {
pagination.openCurrentPageMenu()
.then(menu => menu.clickNthItem(5))
.then(() => dataTable.waitForHeader())
.then(() => {
expect(dataTable.countRows()).toBe(1, 'Incorrect number of items on the last page');
expect(pagination.currentPage.getText()).toContain('Page 5');
expect(pagination.nextButton.isEnabled()).toBe(false, 'Next button is enabled');
});
});
});
describe(`on Shared Files`, () => {
beforeAll(done => {
loginPage.load()
.then(() => loginPage.loginWith(username))
.then(done);
});
beforeEach(done => {
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.SHARED_FILES)
.then(() => dataTable.waitForHeader())
.then(done);
});
afterEach(done => {
browser.actions().sendKeys(protractor.Key.ESCAPE).perform().then(done);
});
afterAll(done => {
logoutPage.load().then(done);
});
it('default values', () => {
expect(pagination.range.getText()).toContain('1-25 of 101');
expect(pagination.maxItems.getText()).toContain('25');
expect(pagination.currentPage.getText()).toContain('Page 1');
expect(pagination.totalPages.getText()).toContain('of 5');
expect(pagination.previousButton.isEnabled()).toBe(false, 'Previous button is enabled');
expect(pagination.nextButton.isEnabled()).toBe(true, 'Next button is not enabled');
});
it('page sizes', () => {
pagination.openMaxItemsMenu()
.then(menu => {
const [ first, second, third ] = [1, 2, 3]
.map(nth => menu.getNthItem(nth).getText());
expect(first).toBe('25');
expect(second).toBe('50');
expect(third).toBe('100');
});
});
it('change the page size', () => {
pagination.openMaxItemsMenu()
.then(menu => menu.clickMenuItem('50'))
.then(() => dataTable.waitForHeader())
.then(() => {
expect(pagination.maxItems.getText()).toContain('50');
expect(pagination.totalPages.getText()).toContain('of 3');
})
.then(() => resetToDefaultPageSize());
});
it('current page menu items', () => {
pagination.openCurrentPageMenu()
.then(menu => {
expect(menu.getItemsCount()).toBe(5);
});
});
it('change the current page from menu', () => {
pagination.openCurrentPageMenu()
.then(menu => menu.clickNthItem(3))
.then(() => dataTable.waitForHeader())
.then(() => {
expect(pagination.range.getText()).toContain('51-75 of 101');
expect(pagination.currentPage.getText()).toContain('Page 3');
expect(pagination.previousButton.isEnabled()).toBe(true, 'Previous button is not enabled');
expect(pagination.nextButton.isEnabled()).toBe(true, 'Next button is not enabled');
expect(dataTable.getRowByContainingText('file-40.txt').isPresent())
.toBe(true, 'File not found on page');
})
.then(() => resetToDefaultPageNumber());
});
it('navigate to next page', () => {
pagination.nextButton.click()
.then(() => dataTable.waitForHeader())
.then(() => {
expect(pagination.range.getText()).toContain('26-50 of 101');
expect(dataTable.getRowByContainingText('file-70.txt').isPresent())
.toBe(true, 'File not found on page');
})
.then(() => resetToDefaultPageNumber());
});
it('navigate to previous page', () => {
pagination.openCurrentPageMenu()
.then(menu => menu.clickNthItem(2))
.then(() => dataTable.waitForHeader())
.then(() => pagination.previousButton.click())
.then(() => dataTable.waitForHeader())
.then(() => {
expect(pagination.range.getText()).toContain('1-25 of 101');
expect(dataTable.getRowByContainingText('file-88.txt').isPresent())
.toBe(true, 'File not found on page');
})
.then(() => resetToDefaultPageNumber());
});
it('last page', () => {
pagination.openCurrentPageMenu()
.then(menu => menu.clickNthItem(5))
.then(() => dataTable.waitForHeader())
.then(() => {
expect(dataTable.countRows()).toBe(1, 'Incorrect number of items on the last page');
expect(pagination.currentPage.getText()).toContain('Page 5');
expect(pagination.nextButton.isEnabled()).toBe(false, 'Next button is enabled');
});
});
});
describe(`on Trash`, () => {
beforeAll(done => {
loginPage.load()
.then(() => loginPage.loginWith(username))
.then(done);
});
beforeEach(done => {
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH)
.then(() => dataTable.waitForHeader())
.then(done);
});
afterEach(done => {
browser.actions().sendKeys(protractor.Key.ESCAPE).perform().then(done);
});
afterAll(done => {
logoutPage.load().then(done);
});
it('default values', () => {
expect(pagination.range.getText()).toContain('1-25 of 101');
expect(pagination.maxItems.getText()).toContain('25');
expect(pagination.currentPage.getText()).toContain('Page 1');
expect(pagination.totalPages.getText()).toContain('of 5');
expect(pagination.previousButton.isEnabled()).toBe(false, 'Previous button is enabled');
expect(pagination.nextButton.isEnabled()).toBe(true, 'Next button is not enabled');
});
it('page sizes', () => {
pagination.openMaxItemsMenu()
.then(menu => {
const [ first, second, third ] = [1, 2, 3]
.map(nth => menu.getNthItem(nth).getText());
expect(first).toBe('25');
expect(second).toBe('50');
expect(third).toBe('100');
});
});
it('change the page size', () => {
pagination.openMaxItemsMenu()
.then(menu => menu.clickMenuItem('50'))
.then(() => dataTable.waitForHeader())
.then(() => {
expect(pagination.maxItems.getText()).toContain('50');
expect(pagination.totalPages.getText()).toContain('of 3');
})
.then(() => resetToDefaultPageSize());
});
it('current page menu items', () => {
pagination.openCurrentPageMenu()
.then(menu => {
expect(menu.getItemsCount()).toBe(5);
});
});
it('change the current page from menu', () => {
pagination.openCurrentPageMenu()
.then(menu => menu.clickNthItem(3))
.then(() => dataTable.waitForHeader())
.then(() => {
expect(pagination.range.getText()).toContain('51-75 of 101');
expect(pagination.currentPage.getText()).toContain('Page 3');
expect(pagination.previousButton.isEnabled()).toBe(true, 'Previous button is not enabled');
expect(pagination.nextButton.isEnabled()).toBe(true, 'Next button is not enabled');
expect(dataTable.getRowByContainingText('file-40.txt').isPresent())
.toBe(true, 'File not found on page');
})
.then(() => resetToDefaultPageNumber());
});
it('navigate to next page', () => {
pagination.nextButton.click()
.then(() => dataTable.waitForHeader())
.then(() => {
expect(pagination.range.getText()).toContain('26-50 of 101');
expect(dataTable.getRowByContainingText('file-70.txt').isPresent())
.toBe(true, 'File not found on page');
})
.then(() => resetToDefaultPageNumber());
});
it('navigate to previous page', () => {
pagination.openCurrentPageMenu()
.then(menu => menu.clickNthItem(2))
.then(() => dataTable.waitForHeader())
.then(() => pagination.previousButton.click())
.then(() => dataTable.waitForHeader())
.then(() => {
expect(pagination.range.getText()).toContain('1-25 of 101');
expect(dataTable.getRowByContainingText('file-88.txt').isPresent())
.toBe(true, 'File not found on page');
})
.then(() => resetToDefaultPageNumber());
});
it('last page', () => {
pagination.openCurrentPageMenu()
.then(menu => menu.clickNthItem(5))
.then(() => dataTable.waitForHeader())
.then(() => {
expect(dataTable.countRows()).toBe(1, 'Incorrect number of items on the last page');
expect(pagination.currentPage.getText()).toContain('Page 5');
expect(pagination.nextButton.isEnabled()).toBe(false, 'Next button is enabled');
});
});
});
});

View File

@ -11,14 +11,14 @@ const width = 1366;
const height = 768; const height = 768;
exports.config = { exports.config = {
allScriptsTimeout: 11000, allScriptsTimeout: 30000,
specs: [ specs: [
'./e2e/suites/authentication/*.test.ts', './e2e/suites/authentication/*.test.ts',
'./e2e/suites/list-views/*.test.ts', './e2e/suites/list-views/*.test.ts',
'./e2e/suites/application/page-titles.test.ts', './e2e/suites/application/page-titles.test.ts',
'./e2e/suites/navigation/side-navigation.test.ts', './e2e/suites/navigation/side-navigation.test.ts',
'./e2e/suites/pagination/pagination.test.ts', './e2e/suites/pagination/*.test.ts',
'./e2e/suites/actions/*.test.ts' './e2e/suites/actions/*.test.ts'
], ],
@ -38,7 +38,7 @@ exports.config = {
framework: 'jasmine2', framework: 'jasmine2',
jasmineNodeOpts: { jasmineNodeOpts: {
showColors: true, showColors: true,
defaultTimeoutInterval: 30000, defaultTimeoutInterval: 50000,
print: function() {} print: function() {}
}, },