mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-06-30 18:14:45 +00:00
[ACA-1762] async await pagination (#687)
* use async / await in pagination tests * add catch in waitForApi
This commit is contained in:
parent
ac99f5397d
commit
4f4a69338f
112
e2e/suites/pagination/pag-empty-page.test.ts
Executable file
112
e2e/suites/pagination/pag-empty-page.test.ts
Executable file
@ -0,0 +1,112 @@
|
|||||||
|
/*!
|
||||||
|
* @license
|
||||||
|
* Alfresco Example Content Application
|
||||||
|
*
|
||||||
|
* Copyright (C) 2005 - 2018 Alfresco Software Limited
|
||||||
|
*
|
||||||
|
* This file is part of the Alfresco Example Content Application.
|
||||||
|
* If the software was purchased under a paid Alfresco license, the terms of
|
||||||
|
* the paid license agreement will prevail. Otherwise, the software is
|
||||||
|
* provided under the following open source license terms:
|
||||||
|
*
|
||||||
|
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { SIDEBAR_LABELS } from '../../configs';
|
||||||
|
import { LoginPage, LogoutPage, BrowsingPage } from '../../pages/pages';
|
||||||
|
import { Utils } from '../../utilities/utils';
|
||||||
|
import { RepoClient } from '../../utilities/repo-client/repo-client';
|
||||||
|
|
||||||
|
describe('Pagination on empty page', () => {
|
||||||
|
|
||||||
|
const username = `user-${Utils.random()}`;
|
||||||
|
|
||||||
|
const adminApi = new RepoClient();
|
||||||
|
|
||||||
|
const loginPage = new LoginPage();
|
||||||
|
const logoutPage = new LogoutPage();
|
||||||
|
const page = new BrowsingPage();
|
||||||
|
const { pagination } = page;
|
||||||
|
|
||||||
|
beforeAll(async (done) => {
|
||||||
|
await adminApi.people.createUser({ username });
|
||||||
|
await loginPage.loginWith(username);
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
|
||||||
|
afterAll(async (done) => {
|
||||||
|
await logoutPage.load();
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Favorites - pagination controls not displayed - [C280111]', async () => {
|
||||||
|
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FAVORITES);
|
||||||
|
expect(await pagination.range.isPresent()).toBe(false);
|
||||||
|
expect(await pagination.maxItems.isPresent()).toBe(false);
|
||||||
|
expect(await pagination.currentPage.isPresent()).toBe(false);
|
||||||
|
expect(await pagination.totalPages.isPresent()).toBe(false);
|
||||||
|
expect(await pagination.previousButton.isPresent()).toBe(false);
|
||||||
|
expect(await pagination.nextButton.isPresent()).toBe(false);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('File Libraries - pagination controls not displayed - [C280084]', async () => {
|
||||||
|
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FILE_LIBRARIES);
|
||||||
|
expect(await pagination.range.isPresent()).toBe(false);
|
||||||
|
expect(await pagination.maxItems.isPresent()).toBe(false);
|
||||||
|
expect(await pagination.currentPage.isPresent()).toBe(false);
|
||||||
|
expect(await pagination.totalPages.isPresent()).toBe(false);
|
||||||
|
expect(await pagination.previousButton.isPresent()).toBe(false);
|
||||||
|
expect(await pagination.nextButton.isPresent()).toBe(false);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Personal Files - pagination controls not displayed - [C280075]', async () => {
|
||||||
|
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES);
|
||||||
|
expect(await pagination.range.isPresent()).toBe(false);
|
||||||
|
expect(await pagination.maxItems.isPresent()).toBe(false);
|
||||||
|
expect(await pagination.currentPage.isPresent()).toBe(false);
|
||||||
|
expect(await pagination.totalPages.isPresent()).toBe(false);
|
||||||
|
expect(await pagination.previousButton.isPresent()).toBe(false);
|
||||||
|
expect(await pagination.nextButton.isPresent()).toBe(false);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Recent Files - pagination controls not displayed - [C280102]', async () => {
|
||||||
|
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.RECENT_FILES);
|
||||||
|
expect(await pagination.range.isPresent()).toBe(false);
|
||||||
|
expect(await pagination.maxItems.isPresent()).toBe(false);
|
||||||
|
expect(await pagination.currentPage.isPresent()).toBe(false);
|
||||||
|
expect(await pagination.totalPages.isPresent()).toBe(false);
|
||||||
|
expect(await pagination.previousButton.isPresent()).toBe(false);
|
||||||
|
expect(await pagination.nextButton.isPresent()).toBe(false);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Shared Files - pagination controls not displayed - [C280094]', async () => {
|
||||||
|
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.SHARED_FILES);
|
||||||
|
expect(await pagination.range.isPresent()).toBe(false);
|
||||||
|
expect(await pagination.maxItems.isPresent()).toBe(false);
|
||||||
|
expect(await pagination.currentPage.isPresent()).toBe(false);
|
||||||
|
expect(await pagination.totalPages.isPresent()).toBe(false);
|
||||||
|
expect(await pagination.previousButton.isPresent()).toBe(false);
|
||||||
|
expect(await pagination.nextButton.isPresent()).toBe(false);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Trash - pagination controls not displayed - [C280120]', async () => {
|
||||||
|
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH);
|
||||||
|
expect(await pagination.range.isPresent()).toBe(false);
|
||||||
|
expect(pagination.maxItems.isPresent()).toBe(false);
|
||||||
|
expect(pagination.currentPage.isPresent()).toBe(false);
|
||||||
|
expect(pagination.totalPages.isPresent()).toBe(false);
|
||||||
|
expect(pagination.previousButton.isPresent()).toBe(false);
|
||||||
|
expect(pagination.nextButton.isPresent()).toBe(false);
|
||||||
|
});
|
||||||
|
});
|
@ -29,210 +29,141 @@ import { LoginPage, LogoutPage, BrowsingPage } from '../../pages/pages';
|
|||||||
import { Utils } from '../../utilities/utils';
|
import { Utils } from '../../utilities/utils';
|
||||||
import { RepoClient } from '../../utilities/repo-client/repo-client';
|
import { RepoClient } from '../../utilities/repo-client/repo-client';
|
||||||
|
|
||||||
describe('Pagination on Favorites', () => {
|
describe('Pagination on multiple pages on Favorites', () => {
|
||||||
const username = `user-${Utils.random()}`;
|
const username = `user-${Utils.random()}`;
|
||||||
|
|
||||||
const apis = {
|
const apis = {
|
||||||
admin: new RepoClient(),
|
admin: new RepoClient(),
|
||||||
user: new RepoClient(username, username)
|
user: new RepoClient(username, username)
|
||||||
};
|
};
|
||||||
const { nodes: nodesApi, favorites: favoritesApi } = apis.user;
|
|
||||||
|
const parent = `parent-${Utils.random()}`; let parentId;
|
||||||
|
|
||||||
|
const files = Array(101)
|
||||||
|
.fill('file')
|
||||||
|
.map((name, index): string => `${name}-${index + 1}-${Utils.random()}.txt`);
|
||||||
|
let filesIds;
|
||||||
|
|
||||||
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, pagination } = page;
|
const { dataTable, pagination } = page;
|
||||||
|
|
||||||
const parent = `parent-${Utils.random()}`;
|
beforeAll(async (done) => {
|
||||||
const files = Array(101)
|
await apis.admin.people.createUser({ username });
|
||||||
.fill('file')
|
parentId = (await apis.user.nodes.createFolder(parent)).entry.id;
|
||||||
.map((name, index): string => `${name}-${index + 1}.txt`);
|
filesIds = (await apis.user.nodes.createFiles(files, parent)).list.entries.map(entries => entries.entry.id);
|
||||||
let filesIds;
|
await apis.user.favorites.addFavoritesByIds('file', filesIds);
|
||||||
|
await apis.user.favorites.waitForApi({ expect: 101 });
|
||||||
const file = `file-${Utils.random()}.txt`; let fileId;
|
await loginPage.loginWith(username);
|
||||||
|
done();
|
||||||
beforeAll(done => {
|
|
||||||
apis.admin.people.createUser({ username }).then(done);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
xit('');
|
beforeEach(async (done) => {
|
||||||
|
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FAVORITES);
|
||||||
describe('on empty page', () => {
|
await dataTable.waitForHeader();
|
||||||
beforeAll(done => {
|
done();
|
||||||
loginPage.loginWith(username).then(done);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
afterAll(done => {
|
afterEach(async (done) => {
|
||||||
logoutPage.load().then(done);
|
await browser.actions().mouseMove(browser.$('body'), { x: 0, y: 0 }).click().perform();
|
||||||
|
done();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('pagination controls not displayed - [C280111]', () => {
|
afterAll(async (done) => {
|
||||||
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FAVORITES)
|
await apis.user.nodes.deleteNodeById(parentId);
|
||||||
.then(() => {
|
await logoutPage.load();
|
||||||
expect(pagination.range.isPresent()).toBe(false);
|
await apis.user.favorites.waitForApi({ expect: 0 });
|
||||||
expect(pagination.maxItems.isPresent()).toBe(false);
|
done();
|
||||||
expect(pagination.currentPage.isPresent()).toBe(false);
|
|
||||||
expect(pagination.totalPages.isPresent()).toBe(false);
|
|
||||||
expect(pagination.previousButton.isPresent()).toBe(false);
|
|
||||||
expect(pagination.nextButton.isPresent()).toBe(false);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('on single page', () => {
|
it('Pagination control default values - [C280113]', async () => {
|
||||||
beforeAll(done => {
|
expect(await pagination.range.getText()).toContain('1-25 of 101');
|
||||||
nodesApi.createFile(file).then(resp => fileId = resp.entry.id)
|
expect(await pagination.maxItems.getText()).toContain('25');
|
||||||
.then(() => favoritesApi.addFavoriteById('file', fileId))
|
expect(await pagination.currentPage.getText()).toContain('Page 1');
|
||||||
.then(() => loginPage.loginWith(username))
|
expect(await pagination.totalPages.getText()).toContain('of 5');
|
||||||
.then(done);
|
expect(await pagination.previousButton.isEnabled()).toBe(false, 'Previous button is enabled');
|
||||||
|
expect(await pagination.nextButton.isEnabled()).toBe(true, 'Next button is not enabled');
|
||||||
});
|
});
|
||||||
|
|
||||||
afterAll(done => {
|
it('Items per page values - [C280114]', async () => {
|
||||||
Promise.all([
|
await pagination.openMaxItemsMenu();
|
||||||
nodesApi.deleteNodeById(fileId),
|
|
||||||
logoutPage.load()
|
|
||||||
])
|
|
||||||
.then(done);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('page selector not displayed when having a single page - [C280112]', () => {
|
|
||||||
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FAVORITES)
|
|
||||||
.then(() => dataTable.waitForHeader())
|
|
||||||
.then(() => expect(pagination.pagesButton.isPresent()).toBe(false, 'page selector displayed'));
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('on multiple pages', () => {
|
|
||||||
beforeAll(done => {
|
|
||||||
nodesApi.createFiles(files, parent)
|
|
||||||
.then(resp => filesIds = resp.list.entries.map(entries => entries.entry.id))
|
|
||||||
.then(() => favoritesApi.addFavoritesByIds('file', filesIds))
|
|
||||||
.then(() => favoritesApi.waitForApi({ expect: 101 }))
|
|
||||||
.then(() => loginPage.loginWith(username))
|
|
||||||
.then(done);
|
|
||||||
});
|
|
||||||
|
|
||||||
beforeEach(done => {
|
|
||||||
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FAVORITES)
|
|
||||||
.then(() => dataTable.waitForHeader())
|
|
||||||
.then(done);
|
|
||||||
});
|
|
||||||
|
|
||||||
afterEach(done => {
|
|
||||||
browser.actions().mouseMove(browser.$('body'), { x: 0, y: 0 }).click().perform().then(done);
|
|
||||||
});
|
|
||||||
|
|
||||||
afterAll(done => {
|
|
||||||
Promise.all([
|
|
||||||
nodesApi.deleteNodes([ parent ]),
|
|
||||||
logoutPage.load()
|
|
||||||
])
|
|
||||||
.then(done);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('Pagination control default values - [C280113]', () => {
|
|
||||||
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('Items per page values - [C280114]', () => {
|
|
||||||
pagination.openMaxItemsMenu()
|
|
||||||
.then(() => {
|
|
||||||
const [ first, second, third ] = [1, 2, 3]
|
const [ first, second, third ] = [1, 2, 3]
|
||||||
.map(nth => pagination.menu.getNthItem(nth).getText());
|
.map(async nth => await pagination.menu.getNthItem(nth).getText());
|
||||||
expect(first).toBe('25');
|
expect(first).toBe('25');
|
||||||
expect(second).toBe('50');
|
expect(second).toBe('50');
|
||||||
expect(third).toBe('100');
|
expect(third).toBe('100');
|
||||||
})
|
await pagination.menu.closeMenu();
|
||||||
.then(() => pagination.menu.closeMenu());
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('current page menu items - [C280115]', () => {
|
it('current page menu items - [C280115]', async () => {
|
||||||
pagination.openMaxItemsMenu()
|
await pagination.openMaxItemsMenu()
|
||||||
.then(() => pagination.menu.clickMenuItem('25'))
|
await pagination.menu.clickMenuItem('25');
|
||||||
.then(() => {
|
expect(await pagination.getText(pagination.maxItems)).toContain('25');
|
||||||
expect(pagination.getText(pagination.maxItems)).toContain('25');
|
expect(await pagination.getText(pagination.totalPages)).toContain('of 5');
|
||||||
expect(pagination.getText(pagination.totalPages)).toContain('of 5');
|
await pagination.openCurrentPageMenu();
|
||||||
})
|
expect(await pagination.menu.getItemsCount()).toBe(5);
|
||||||
.then(() => pagination.openCurrentPageMenu())
|
await pagination.menu.closeMenu();
|
||||||
.then(() => expect(pagination.menu.getItemsCount()).toBe(5))
|
|
||||||
.then(() => pagination.menu.closeMenu())
|
|
||||||
|
|
||||||
.then(() => pagination.openMaxItemsMenu())
|
await pagination.openMaxItemsMenu();
|
||||||
.then(() => pagination.menu.clickMenuItem('50'))
|
await pagination.menu.clickMenuItem('50');
|
||||||
.then(() => {
|
expect(await pagination.getText(pagination.maxItems)).toContain('50');
|
||||||
expect(pagination.getText(pagination.maxItems)).toContain('50');
|
expect(await pagination.getText(pagination.totalPages)).toContain('of 3');
|
||||||
expect(pagination.getText(pagination.totalPages)).toContain('of 3');
|
await pagination.openCurrentPageMenu();
|
||||||
})
|
expect(await pagination.menu.getItemsCount()).toBe(3);
|
||||||
.then(() => pagination.openCurrentPageMenu())
|
await pagination.menu.closeMenu();
|
||||||
.then(() => expect(pagination.menu.getItemsCount()).toBe(3))
|
|
||||||
.then(() => pagination.menu.closeMenu())
|
|
||||||
|
|
||||||
.then(() => pagination.openMaxItemsMenu())
|
await pagination.openMaxItemsMenu();
|
||||||
.then(() => pagination.menu.clickMenuItem('100'))
|
await pagination.menu.clickMenuItem('100');
|
||||||
.then(() => {
|
expect(await pagination.getText(pagination.maxItems)).toContain('100');
|
||||||
expect(pagination.getText(pagination.maxItems)).toContain('100');
|
expect(await pagination.getText(pagination.totalPages)).toContain('of 2');
|
||||||
expect(pagination.getText(pagination.totalPages)).toContain('of 2');
|
await pagination.openCurrentPageMenu();
|
||||||
})
|
expect(await pagination.menu.getItemsCount()).toBe(2);
|
||||||
.then(() => pagination.openCurrentPageMenu())
|
await pagination.menu.closeMenu();
|
||||||
.then(() => expect(pagination.menu.getItemsCount()).toBe(2))
|
|
||||||
.then(() => pagination.menu.closeMenu())
|
|
||||||
|
|
||||||
.then(() => pagination.resetToDefaultPageSize());
|
await pagination.resetToDefaultPageSize();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('change the current page from menu - [C280116]', () => {
|
it('change the current page from menu - [C280116]', async () => {
|
||||||
pagination.openCurrentPageMenu()
|
await pagination.openCurrentPageMenu();
|
||||||
.then(() => pagination.menu.clickNthItem(3))
|
await pagination.menu.clickNthItem(3);
|
||||||
.then(() => {
|
expect(await pagination.getText(pagination.range)).toContain('51-75 of 101');
|
||||||
expect(pagination.getText(pagination.range)).toContain('51-75 of 101');
|
expect(await pagination.getText(pagination.currentPage)).toContain('Page 3');
|
||||||
expect(pagination.getText(pagination.currentPage)).toContain('Page 3');
|
expect(await pagination.previousButton.isEnabled()).toBe(true, 'Previous button is not enabled');
|
||||||
expect(pagination.previousButton.isEnabled()).toBe(true, 'Previous button is not enabled');
|
expect(await pagination.nextButton.isEnabled()).toBe(true, 'Next button is not enabled');
|
||||||
expect(pagination.nextButton.isEnabled()).toBe(true, 'Next button is not enabled');
|
expect(await dataTable.getRowByName('file-40').isPresent()).toBe(true, 'File not found on page');
|
||||||
expect(dataTable.getRowByName('file-40.txt').isPresent()).toBe(true, 'File not found on page');
|
|
||||||
})
|
await pagination.resetToDefaultPageNumber();
|
||||||
.then(() => pagination.resetToDefaultPageNumber());
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('navigate to next and previous pages - [C280119]', () => {
|
it('navigate to next and previous pages - [C280119]', async () => {
|
||||||
pagination.nextButton.click()
|
await pagination.nextButton.click();
|
||||||
.then(() => dataTable.waitForHeader())
|
await dataTable.waitForHeader();
|
||||||
.then(() => {
|
expect(await pagination.range.getText()).toContain('26-50 of 101');
|
||||||
expect(pagination.range.getText()).toContain('26-50 of 101');
|
expect(await dataTable.getRowByName('file-70').isPresent()).toBe(true, 'File not found on page');
|
||||||
expect(dataTable.getRowByName('file-70.txt').isPresent()).toBe(true, 'File not found on page');
|
await pagination.resetToDefaultPageNumber();
|
||||||
})
|
|
||||||
.then(() => pagination.resetToDefaultPageNumber())
|
|
||||||
|
|
||||||
.then(() => pagination.openCurrentPageMenu())
|
await pagination.openCurrentPageMenu();
|
||||||
.then(() => pagination.menu.clickNthItem(2))
|
await pagination.menu.clickNthItem(2);
|
||||||
.then(() => dataTable.waitForHeader())
|
await dataTable.waitForHeader();
|
||||||
.then(() => pagination.previousButton.click())
|
await pagination.previousButton.click();
|
||||||
.then(() => dataTable.waitForHeader())
|
await dataTable.waitForHeader();
|
||||||
.then(() => {
|
expect(await pagination.range.getText()).toContain('1-25 of 101');
|
||||||
expect(pagination.range.getText()).toContain('1-25 of 101');
|
expect(await dataTable.getRowByName('file-88').isPresent()).toBe(true, 'File not found on page');
|
||||||
expect(dataTable.getRowByName('file-88.txt').isPresent())
|
|
||||||
.toBe(true, 'File not found on page');
|
await pagination.resetToDefaultPageNumber();
|
||||||
})
|
|
||||||
.then(() => pagination.resetToDefaultPageNumber());
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Previous button is disabled on first page - [C280117]', () => {
|
it('Previous button is disabled on first page - [C280117]', async () => {
|
||||||
expect(pagination.currentPage.getText()).toContain('Page 1');
|
expect(await pagination.currentPage.getText()).toContain('Page 1');
|
||||||
expect(pagination.previousButton.isEnabled()).toBe(false, 'Previous button is enabled on first page');
|
expect(await pagination.previousButton.isEnabled()).toBe(false, 'Previous button is enabled on first page');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Next button is disabled on last page - [C280118]', () => {
|
it('Next button is disabled on last page - [C280118]', async () => {
|
||||||
pagination.openCurrentPageMenu()
|
await pagination.openCurrentPageMenu();
|
||||||
.then(() => pagination.menu.clickNthItem(5))
|
await pagination.menu.clickNthItem(5);
|
||||||
.then(() => {
|
expect(await dataTable.countRows()).toBe(1, 'Incorrect number of items on the last page');
|
||||||
expect(dataTable.countRows()).toBe(1, 'Incorrect number of items on the last page');
|
expect(await pagination.currentPage.getText()).toContain('Page 5');
|
||||||
expect(pagination.currentPage.getText()).toContain('Page 5');
|
expect(await pagination.nextButton.isEnabled()).toBe(false, 'Next button is enabled on last page');
|
||||||
expect(pagination.nextButton.isEnabled()).toBe(false, 'Next button is enabled on last page');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -29,14 +29,13 @@ import { LoginPage, LogoutPage, BrowsingPage } from '../../pages/pages';
|
|||||||
import { Utils } from '../../utilities/utils';
|
import { Utils } from '../../utilities/utils';
|
||||||
import { RepoClient } from '../../utilities/repo-client/repo-client';
|
import { RepoClient } from '../../utilities/repo-client/repo-client';
|
||||||
|
|
||||||
describe('Pagination on File Libraries', () => {
|
describe('Pagination on multiple pages on File Libraries', () => {
|
||||||
const username = `user-${Utils.random()}`;
|
const username = `user-${Utils.random()}`;
|
||||||
|
|
||||||
const apis = {
|
const apis = {
|
||||||
admin: new RepoClient(),
|
admin: new RepoClient(),
|
||||||
user: new RepoClient(username, username)
|
user: new RepoClient(username, username)
|
||||||
};
|
};
|
||||||
|
|
||||||
const loginPage = new LoginPage();
|
const loginPage = new LoginPage();
|
||||||
const logoutPage = new LogoutPage();
|
const logoutPage = new LogoutPage();
|
||||||
const page = new BrowsingPage();
|
const page = new BrowsingPage();
|
||||||
@ -44,62 +43,11 @@ describe('Pagination on File Libraries', () => {
|
|||||||
|
|
||||||
const sites = Array(101)
|
const sites = Array(101)
|
||||||
.fill('site')
|
.fill('site')
|
||||||
.map((name, index): string => `${name}-${index + 1}`);
|
.map((name, index): string => `${name}-${index + 1}-${Utils.random()}`);
|
||||||
|
|
||||||
const site = `userSite-${Utils.random()}`; let siteId;
|
|
||||||
|
|
||||||
beforeAll(async (done) => {
|
beforeAll(async (done) => {
|
||||||
await apis.admin.people.createUser({ username });
|
await apis.admin.people.createUser({ username });
|
||||||
done();
|
await apis.user.sites.createSites(sites, SITE_VISIBILITY.PRIVATE);
|
||||||
});
|
|
||||||
|
|
||||||
xit('');
|
|
||||||
|
|
||||||
describe('on empty page', () => {
|
|
||||||
beforeAll(async (done) => {
|
|
||||||
await loginPage.loginWith(username);
|
|
||||||
done();
|
|
||||||
});
|
|
||||||
|
|
||||||
afterAll(async (done) => {
|
|
||||||
await logoutPage.load();
|
|
||||||
done();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('pagination controls not displayed - [C280084]', async () => {
|
|
||||||
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FILE_LIBRARIES);
|
|
||||||
expect(await pagination.range.isPresent()).toBe(false);
|
|
||||||
expect(await pagination.maxItems.isPresent()).toBe(false);
|
|
||||||
expect(await pagination.currentPage.isPresent()).toBe(false);
|
|
||||||
expect(await pagination.totalPages.isPresent()).toBe(false);
|
|
||||||
expect(await pagination.previousButton.isPresent()).toBe(false);
|
|
||||||
expect(await pagination.nextButton.isPresent()).toBe(false);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('on single page', () => {
|
|
||||||
beforeAll(async (done) => {
|
|
||||||
siteId = (await apis.user.sites.createSite(site)).entry.id;
|
|
||||||
await loginPage.loginWith(username);
|
|
||||||
done();
|
|
||||||
});
|
|
||||||
|
|
||||||
afterAll(async (done) => {
|
|
||||||
await apis.user.sites.deleteSite(siteId);
|
|
||||||
await logoutPage.load();
|
|
||||||
done();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('page selector not displayed when having a single page - [C280085]', async () => {
|
|
||||||
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FILE_LIBRARIES);
|
|
||||||
await dataTable.waitForHeader();
|
|
||||||
expect(await pagination.pagesButton.isPresent()).toBe(false, 'page selector displayed');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('on multiple pages', () => {
|
|
||||||
beforeAll(async (done) => {
|
|
||||||
await apis.user.sites.createSites(sites, SITE_VISIBILITY.PUBLIC);
|
|
||||||
await apis.user.sites.waitForApi({ expect: 101 });
|
await apis.user.sites.waitForApi({ expect: 101 });
|
||||||
await loginPage.loginWith(username);
|
await loginPage.loginWith(username);
|
||||||
done();
|
done();
|
||||||
@ -117,10 +65,12 @@ describe('Pagination on File Libraries', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
afterAll(async (done) => {
|
afterAll(async (done) => {
|
||||||
await apis.user.sites.deleteSites(sites);
|
await Promise.all([
|
||||||
await logoutPage.load();
|
apis.user.sites.deleteSites(sites),
|
||||||
|
logoutPage.load()
|
||||||
|
]);
|
||||||
done();
|
done();
|
||||||
});
|
})
|
||||||
|
|
||||||
it('Pagination control default values - [C280086]', async () => {
|
it('Pagination control default values - [C280086]', async () => {
|
||||||
expect(await pagination.range.getText()).toContain('1-25 of 101');
|
expect(await pagination.range.getText()).toContain('1-25 of 101');
|
||||||
@ -186,8 +136,7 @@ describe('Pagination on File Libraries', () => {
|
|||||||
await pagination.clickNext();
|
await pagination.clickNext();
|
||||||
await dataTable.waitForHeader();
|
await dataTable.waitForHeader();
|
||||||
expect(await pagination.range.getText()).toContain('26-50 of 101');
|
expect(await pagination.range.getText()).toContain('26-50 of 101');
|
||||||
expect(await dataTable.getRowByName('site-30').isPresent()).toBe(true, 'Site-30 not found on page');
|
expect(await dataTable.getRowByName('site-31').isPresent()).toBe(true, 'Site-31 not found on page');
|
||||||
|
|
||||||
await pagination.resetToDefaultPageNumber();
|
await pagination.resetToDefaultPageNumber();
|
||||||
|
|
||||||
await pagination.openCurrentPageMenu();
|
await pagination.openCurrentPageMenu();
|
||||||
@ -213,5 +162,4 @@ describe('Pagination on File Libraries', () => {
|
|||||||
expect(await pagination.currentPage.getText()).toContain('Page 5');
|
expect(await pagination.currentPage.getText()).toContain('Page 5');
|
||||||
expect(await pagination.nextButton.isEnabled()).toBe(false, 'Next button is enabled on last page');
|
expect(await pagination.nextButton.isEnabled()).toBe(false, 'Next button is enabled on last page');
|
||||||
});
|
});
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
@ -29,209 +29,140 @@ import { LoginPage, LogoutPage, BrowsingPage } from '../../pages/pages';
|
|||||||
import { Utils } from '../../utilities/utils';
|
import { Utils } from '../../utilities/utils';
|
||||||
import { RepoClient } from '../../utilities/repo-client/repo-client';
|
import { RepoClient } from '../../utilities/repo-client/repo-client';
|
||||||
|
|
||||||
describe('Pagination on Personal Files', () => {
|
describe('Pagination on multiple pages on Personal Files', () => {
|
||||||
const username = `user-${Utils.random()}`;
|
const username = `user-${Utils.random()}`;
|
||||||
|
|
||||||
const apis = {
|
const apis = {
|
||||||
admin: new RepoClient(),
|
admin: new RepoClient(),
|
||||||
user: new RepoClient(username, username)
|
user: new RepoClient(username, username)
|
||||||
};
|
};
|
||||||
const { nodes: nodesApi } = apis.user;
|
|
||||||
|
const parent = `parent-${Utils.random()}`; let parentId;
|
||||||
|
const files = Array(101)
|
||||||
|
.fill('file')
|
||||||
|
.map((name, index): string => `${name}-${index + 1}.txt`);
|
||||||
|
|
||||||
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, pagination } = page;
|
const { dataTable, pagination } = page;
|
||||||
|
|
||||||
const parent = `parent-${Utils.random()}`;
|
beforeAll(async (done) => {
|
||||||
const files = Array(101)
|
await apis.admin.people.createUser({ username });
|
||||||
.fill('file')
|
parentId = (await apis.user.nodes.createFolder(parent)).entry.id;
|
||||||
.map((name, index): string => `${name}-${index + 1}.txt`);
|
await apis.user.nodes.createFiles(files, parent);
|
||||||
|
await loginPage.loginWith(username);
|
||||||
const file = `file-${Utils.random()}.txt`; let fileId;
|
done();
|
||||||
|
|
||||||
beforeAll(done => {
|
|
||||||
apis.admin.people.createUser({ username }).then(done);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
xit('');
|
beforeEach(async (done) => {
|
||||||
|
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES);
|
||||||
describe('on empty page', () => {
|
await dataTable.waitForHeader();
|
||||||
beforeAll(done => {
|
await dataTable.doubleClickOnRowByName(parent);
|
||||||
loginPage.loginWith(username).then(done);
|
done();
|
||||||
});
|
});
|
||||||
|
|
||||||
afterAll(done => {
|
afterEach(async (done) => {
|
||||||
logoutPage.load().then(done);
|
await browser.actions().mouseMove(browser.$('body'), { x: 0, y: 0 }).click().perform();
|
||||||
|
done();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('pagination controls not displayed - [C280075]', () => {
|
afterAll(async (done) => {
|
||||||
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES)
|
await Promise.all([
|
||||||
.then(() => {
|
apis.user.nodes.deleteNodeById(parentId),
|
||||||
expect(pagination.range.isPresent()).toBe(false);
|
|
||||||
expect(pagination.maxItems.isPresent()).toBe(false);
|
|
||||||
expect(pagination.currentPage.isPresent()).toBe(false);
|
|
||||||
expect(pagination.totalPages.isPresent()).toBe(false);
|
|
||||||
expect(pagination.previousButton.isPresent()).toBe(false);
|
|
||||||
expect(pagination.nextButton.isPresent()).toBe(false);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('on single page', () => {
|
|
||||||
beforeAll(done => {
|
|
||||||
nodesApi.createFile(file).then(resp => fileId = resp.entry.id)
|
|
||||||
.then(() => loginPage.loginWith(username))
|
|
||||||
.then(done);
|
|
||||||
});
|
|
||||||
|
|
||||||
afterAll(done => {
|
|
||||||
Promise.all([
|
|
||||||
nodesApi.deleteNodeById(fileId),
|
|
||||||
logoutPage.load()
|
logoutPage.load()
|
||||||
])
|
]);
|
||||||
.then(done);
|
done();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('page selector not displayed when having a single page - [C280076]', () => {
|
it('Pagination control default values - [C280077]', async () => {
|
||||||
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES)
|
expect(await pagination.range.getText()).toContain('1-25 of 101');
|
||||||
.then(() => dataTable.waitForHeader())
|
expect(await pagination.maxItems.getText()).toContain('25');
|
||||||
.then(() => expect(pagination.pagesButton.isPresent()).toBe(false, 'page selector displayed'));
|
expect(await pagination.currentPage.getText()).toContain('Page 1');
|
||||||
});
|
expect(await pagination.totalPages.getText()).toContain('of 5');
|
||||||
|
expect(await pagination.previousButton.isEnabled()).toBe(false, 'Previous button is enabled');
|
||||||
|
expect(await pagination.nextButton.isEnabled()).toBe(true, 'Next button is not enabled');
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('on multiple pages', () => {
|
it('Items per page values - [C280078]', async () => {
|
||||||
beforeAll(done => {
|
await pagination.openMaxItemsMenu();
|
||||||
nodesApi.createFiles(files, parent)
|
|
||||||
.then(() => loginPage.loginWith(username))
|
|
||||||
.then(done);
|
|
||||||
});
|
|
||||||
|
|
||||||
beforeEach(done => {
|
|
||||||
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES)
|
|
||||||
.then(() => dataTable.waitForHeader())
|
|
||||||
.then(() => dataTable.doubleClickOnRowByName(parent))
|
|
||||||
.then(done);
|
|
||||||
});
|
|
||||||
|
|
||||||
afterEach(done => {
|
|
||||||
browser.actions().mouseMove(browser.$('body'), { x: 0, y: 0 }).click().perform().then(done);
|
|
||||||
});
|
|
||||||
|
|
||||||
afterAll(done => {
|
|
||||||
Promise.all([
|
|
||||||
nodesApi.deleteNodes([ parent ]),
|
|
||||||
logoutPage.load()
|
|
||||||
])
|
|
||||||
.then(done);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('Pagination control default values - [C280077]', () => {
|
|
||||||
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('Items per page values - [C280078]', () => {
|
|
||||||
pagination.openMaxItemsMenu()
|
|
||||||
.then(() => {
|
|
||||||
const [ first, second, third ] = [1, 2, 3]
|
const [ first, second, third ] = [1, 2, 3]
|
||||||
.map(nth => pagination.menu.getNthItem(nth).getText());
|
.map(async nth => await pagination.menu.getNthItem(nth).getText());
|
||||||
expect(first).toBe('25');
|
expect(first).toBe('25');
|
||||||
expect(second).toBe('50');
|
expect(second).toBe('50');
|
||||||
expect(third).toBe('100');
|
expect(third).toBe('100');
|
||||||
})
|
await pagination.menu.closeMenu();
|
||||||
.then(() => pagination.menu.closeMenu());
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('current page menu items - [C280079]', () => {
|
it('current page menu items - [C280079]', async () => {
|
||||||
pagination.openMaxItemsMenu()
|
await pagination.openMaxItemsMenu();
|
||||||
.then(() => pagination.menu.clickMenuItem('25'))
|
await pagination.menu.clickMenuItem('25');
|
||||||
.then(() => {
|
expect(await pagination.getText(pagination.maxItems)).toContain('25');
|
||||||
expect(pagination.getText(pagination.maxItems)).toContain('25');
|
expect(await pagination.getText(pagination.totalPages)).toContain('of 5');
|
||||||
expect(pagination.getText(pagination.totalPages)).toContain('of 5');
|
await pagination.openCurrentPageMenu();
|
||||||
})
|
expect(pagination.menu.getItemsCount()).toBe(5);
|
||||||
.then(() => pagination.openCurrentPageMenu())
|
await pagination.menu.closeMenu();
|
||||||
.then(() => expect(pagination.menu.getItemsCount()).toBe(5))
|
|
||||||
.then(() => pagination.menu.closeMenu())
|
|
||||||
|
|
||||||
.then(() => pagination.openMaxItemsMenu())
|
await pagination.openMaxItemsMenu();
|
||||||
.then(() => pagination.menu.clickMenuItem('50'))
|
await pagination.menu.clickMenuItem('50');
|
||||||
.then(() => {
|
expect(await pagination.getText(pagination.maxItems)).toContain('50');
|
||||||
expect(pagination.getText(pagination.maxItems)).toContain('50');
|
expect(await pagination.getText(pagination.totalPages)).toContain('of 3');
|
||||||
expect(pagination.getText(pagination.totalPages)).toContain('of 3');
|
await pagination.openCurrentPageMenu();
|
||||||
})
|
expect(pagination.menu.getItemsCount()).toBe(3);
|
||||||
.then(() => pagination.openCurrentPageMenu())
|
await pagination.menu.closeMenu();
|
||||||
.then(() => expect(pagination.menu.getItemsCount()).toBe(3))
|
|
||||||
.then(() => pagination.menu.closeMenu())
|
|
||||||
|
|
||||||
.then(() => pagination.openMaxItemsMenu())
|
await pagination.openMaxItemsMenu();
|
||||||
.then(() => pagination.menu.clickMenuItem('100'))
|
await pagination.menu.clickMenuItem('100');
|
||||||
.then(() => {
|
expect(await pagination.getText(pagination.maxItems)).toContain('100');
|
||||||
expect(pagination.getText(pagination.maxItems)).toContain('100');
|
expect(await pagination.getText(pagination.totalPages)).toContain('of 2');
|
||||||
expect(pagination.getText(pagination.totalPages)).toContain('of 2');
|
await pagination.openCurrentPageMenu();
|
||||||
})
|
expect(await pagination.menu.getItemsCount()).toBe(2);
|
||||||
.then(() => pagination.openCurrentPageMenu())
|
await pagination.menu.closeMenu();
|
||||||
.then(() => expect(pagination.menu.getItemsCount()).toBe(2))
|
|
||||||
.then(() => pagination.menu.closeMenu())
|
|
||||||
|
|
||||||
.then(() => pagination.resetToDefaultPageSize());
|
await pagination.resetToDefaultPageSize();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('change the current page from menu - [C280080]', () => {
|
it('change the current page from menu - [C280080]', async () => {
|
||||||
pagination.openCurrentPageMenu()
|
await pagination.openCurrentPageMenu();
|
||||||
.then(() => pagination.menu.clickNthItem(3))
|
await pagination.menu.clickNthItem(3);
|
||||||
.then(() => dataTable.waitForHeader())
|
await dataTable.waitForHeader();
|
||||||
.then(() => {
|
expect(await pagination.range.getText()).toContain('51-75 of 101');
|
||||||
expect(pagination.range.getText()).toContain('51-75 of 101');
|
expect(await pagination.currentPage.getText()).toContain('Page 3');
|
||||||
expect(pagination.currentPage.getText()).toContain('Page 3');
|
expect(await pagination.previousButton.isEnabled()).toBe(true, 'Previous button is not enabled');
|
||||||
expect(pagination.previousButton.isEnabled()).toBe(true, 'Previous button is not enabled');
|
expect(await pagination.nextButton.isEnabled()).toBe(true, 'Next button is not enabled');
|
||||||
expect(pagination.nextButton.isEnabled()).toBe(true, 'Next button is not enabled');
|
expect(await dataTable.getRowByName('file-60').isPresent()).toBe(true, 'File not found on page');
|
||||||
expect(dataTable.getRowByName('file-60.txt').isPresent()).toBe(true, 'File not found on page');
|
|
||||||
})
|
|
||||||
|
|
||||||
.then(() => pagination.resetToDefaultPageNumber());
|
await pagination.resetToDefaultPageNumber();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('navigate to next and previous pages - [C280083]', () => {
|
it('navigate to next and previous pages - [C280083]', async () => {
|
||||||
pagination.clickNext()
|
await pagination.clickNext();
|
||||||
.then(() => dataTable.waitForHeader())
|
await dataTable.waitForHeader();
|
||||||
.then(() => {
|
expect(await pagination.range.getText()).toContain('26-50 of 101');
|
||||||
expect(pagination.range.getText()).toContain('26-50 of 101');
|
expect(await dataTable.getRowByName('file-31').isPresent()).toBe(true, 'file-31 not found on page');
|
||||||
expect(dataTable.getRowByName('file-30.txt').isPresent()).toBe(true, 'File not found on page');
|
await pagination.resetToDefaultPageNumber();
|
||||||
})
|
|
||||||
|
|
||||||
.then(() => pagination.resetToDefaultPageNumber())
|
await pagination.openCurrentPageMenu();
|
||||||
|
await pagination.menu.clickNthItem(2);
|
||||||
|
await dataTable.waitForHeader();
|
||||||
|
await pagination.previousButton.click();
|
||||||
|
await dataTable.waitForHeader();
|
||||||
|
expect(await pagination.range.getText()).toContain('1-25 of 101');
|
||||||
|
expect(await dataTable.getRowByName('file-12').isPresent()).toBe(true, 'file-12 not found on page');
|
||||||
|
|
||||||
.then(() => pagination.openCurrentPageMenu())
|
await pagination.resetToDefaultPageNumber();
|
||||||
.then(() => pagination.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(() => pagination.resetToDefaultPageNumber());
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Previous button is disabled on first page - [C280081]', () => {
|
it('Previous button is disabled on first page - [C280081]', async () => {
|
||||||
expect(pagination.currentPage.getText()).toContain('Page 1');
|
expect(await pagination.currentPage.getText()).toContain('Page 1');
|
||||||
expect(pagination.previousButton.isEnabled()).toBe(false, 'Previous button is enabled on first page');
|
expect(await pagination.previousButton.isEnabled()).toBe(false, 'Previous button is enabled on first page');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Next button is disabled on last page - [C280082]', () => {
|
it('Next button is disabled on last page - [C280082]', async () => {
|
||||||
pagination.openCurrentPageMenu()
|
await pagination.openCurrentPageMenu();
|
||||||
.then(() => pagination.menu.clickNthItem(5))
|
await pagination.menu.clickNthItem(5);
|
||||||
.then(() => {
|
expect(await dataTable.countRows()).toBe(1, 'Incorrect number of items on the last page');
|
||||||
expect(dataTable.countRows()).toBe(1, 'Incorrect number of items on the last page');
|
expect(await pagination.currentPage.getText()).toContain('Page 5');
|
||||||
expect(pagination.currentPage.getText()).toContain('Page 5');
|
expect(await pagination.nextButton.isEnabled()).toBe(false, 'Next button is enabled on last page');
|
||||||
expect(pagination.nextButton.isEnabled()).toBe(false, 'Next button is enabled on last page');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -29,211 +29,140 @@ import { LoginPage, LogoutPage, BrowsingPage } from '../../pages/pages';
|
|||||||
import { Utils } from '../../utilities/utils';
|
import { Utils } from '../../utilities/utils';
|
||||||
import { RepoClient } from '../../utilities/repo-client/repo-client';
|
import { RepoClient } from '../../utilities/repo-client/repo-client';
|
||||||
|
|
||||||
describe('Pagination on Recent Files', () => {
|
describe('Pagination on multiple pages on Recent Files', () => {
|
||||||
const username = `user-${Utils.random()}`;
|
const username = `user-${Utils.random()}`;
|
||||||
|
|
||||||
|
const parent = `parent-${Utils.random()}`; let parentId;
|
||||||
|
const files = Array(101)
|
||||||
|
.fill('file')
|
||||||
|
.map((name, index): string => `${name}-${index + 1}.txt`);
|
||||||
|
|
||||||
const apis = {
|
const apis = {
|
||||||
admin: new RepoClient(),
|
admin: new RepoClient(),
|
||||||
user: new RepoClient(username, username)
|
user: new RepoClient(username, username)
|
||||||
};
|
};
|
||||||
const { nodes: nodesApi, search: searchApi } = apis.user;
|
|
||||||
|
|
||||||
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, pagination } = page;
|
const { dataTable, pagination } = page;
|
||||||
|
|
||||||
const parent = `parent-${Utils.random()}`;
|
beforeAll(async (done) => {
|
||||||
const files = Array(101)
|
await apis.admin.people.createUser({ username });
|
||||||
.fill('file')
|
parentId = (await apis.user.nodes.createFolder(parent)).entry.id;
|
||||||
.map((name, index): string => `${name}-${index + 1}.txt`);
|
await apis.user.nodes.createFiles(files, parent);
|
||||||
|
await apis.user.search.waitForApi(username, { expect: 101 });
|
||||||
const file = `file-${Utils.random()}.txt`; let fileId;
|
await loginPage.loginWith(username);
|
||||||
|
done();
|
||||||
beforeAll(done => {
|
|
||||||
apis.admin.people.createUser({ username }).then(done);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
xit('');
|
beforeEach(async (done) => {
|
||||||
|
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.RECENT_FILES);
|
||||||
describe('on empty page', () => {
|
await dataTable.waitForHeader();
|
||||||
beforeAll(done => {
|
done();
|
||||||
loginPage.loginWith(username).then(done);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
afterAll(done => {
|
afterEach(async (done) => {
|
||||||
logoutPage.load().then(done);
|
await browser.actions().mouseMove(browser.$('body'), { x: 0, y: 0 }).click().perform();
|
||||||
|
done();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('pagination controls not displayed - [C280102]', () => {
|
afterAll(async (done) => {
|
||||||
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.RECENT_FILES)
|
await Promise.all([
|
||||||
.then(() => {
|
apis.user.nodes.deleteNodeById(parentId),
|
||||||
expect(pagination.range.isPresent()).toBe(false);
|
|
||||||
expect(pagination.maxItems.isPresent()).toBe(false);
|
|
||||||
expect(pagination.currentPage.isPresent()).toBe(false);
|
|
||||||
expect(pagination.totalPages.isPresent()).toBe(false);
|
|
||||||
expect(pagination.previousButton.isPresent()).toBe(false);
|
|
||||||
expect(pagination.nextButton.isPresent()).toBe(false);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('on single page', () => {
|
|
||||||
beforeAll(done => {
|
|
||||||
nodesApi.createFile(file).then(resp => fileId = resp.entry.id)
|
|
||||||
.then(() => searchApi.waitForApi(username, { expect: 1 }))
|
|
||||||
.then(() => loginPage.loginWith(username))
|
|
||||||
.then(done);
|
|
||||||
});
|
|
||||||
|
|
||||||
afterAll(done => {
|
|
||||||
Promise.all([
|
|
||||||
nodesApi.deleteNodeById(fileId),
|
|
||||||
logoutPage.load()
|
logoutPage.load()
|
||||||
])
|
]);
|
||||||
.then(done);
|
done();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('page selector not displayed when having a single page - [C280103]', () => {
|
it('Pagination control default values - [C280104]', async () => {
|
||||||
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.RECENT_FILES)
|
expect(await pagination.range.getText()).toContain('1-25 of 101');
|
||||||
.then(() => dataTable.waitForHeader())
|
expect(await pagination.maxItems.getText()).toContain('25');
|
||||||
.then(() => expect(pagination.pagesButton.isPresent()).toBe(false, 'page selector displayed'));
|
expect(await pagination.currentPage.getText()).toContain('Page 1');
|
||||||
});
|
expect(await pagination.totalPages.getText()).toContain('of 5');
|
||||||
|
expect(await pagination.previousButton.isEnabled()).toBe(false, 'Previous button is enabled');
|
||||||
|
expect(await pagination.nextButton.isEnabled()).toBe(true, 'Next button is not enabled');
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('on multiple pages', () => {
|
it('Items per page values - [C280105]', async () => {
|
||||||
beforeAll(done => {
|
await pagination.openMaxItemsMenu();
|
||||||
nodesApi.createFiles(files, parent)
|
|
||||||
.then(() => searchApi.waitForApi(username, { expect: 101 }))
|
|
||||||
|
|
||||||
.then(() => loginPage.loginWith(username))
|
|
||||||
.then(done);
|
|
||||||
});
|
|
||||||
|
|
||||||
beforeEach(done => {
|
|
||||||
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.RECENT_FILES)
|
|
||||||
.then(() => dataTable.waitForHeader())
|
|
||||||
.then(done);
|
|
||||||
});
|
|
||||||
|
|
||||||
afterEach(done => {
|
|
||||||
browser.actions().mouseMove(browser.$('body'), { x: 0, y: 0 }).click().perform().then(done);
|
|
||||||
});
|
|
||||||
|
|
||||||
afterAll(done => {
|
|
||||||
Promise.all([
|
|
||||||
nodesApi.deleteNodes([ parent ]),
|
|
||||||
logoutPage.load()
|
|
||||||
])
|
|
||||||
.then(done);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('Pagination control default values - [C280104]', () => {
|
|
||||||
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('Items per page values - [C280105]', () => {
|
|
||||||
pagination.openMaxItemsMenu()
|
|
||||||
.then(() => {
|
|
||||||
const [ first, second, third ] = [1, 2, 3]
|
const [ first, second, third ] = [1, 2, 3]
|
||||||
.map(nth => pagination.menu.getNthItem(nth).getText());
|
.map(async nth => await pagination.menu.getNthItem(nth).getText());
|
||||||
expect(first).toBe('25');
|
expect(first).toBe('25');
|
||||||
expect(second).toBe('50');
|
expect(second).toBe('50');
|
||||||
expect(third).toBe('100');
|
expect(third).toBe('100');
|
||||||
})
|
await pagination.menu.closeMenu();
|
||||||
.then(() => pagination.menu.closeMenu());
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('current page menu items - [C280106]', () => {
|
it('current page menu items - [C280106]', async () => {
|
||||||
pagination.openMaxItemsMenu()
|
await pagination.openMaxItemsMenu();
|
||||||
.then(() => pagination.menu.clickMenuItem('25'))
|
await pagination.menu.clickMenuItem('25');
|
||||||
.then(() => {
|
expect(await pagination.getText(pagination.maxItems)).toContain('25');
|
||||||
expect(pagination.getText(pagination.maxItems)).toContain('25');
|
expect(await pagination.getText(pagination.totalPages)).toContain('of 5');
|
||||||
expect(pagination.getText(pagination.totalPages)).toContain('of 5');
|
await pagination.openCurrentPageMenu();
|
||||||
})
|
expect(await pagination.menu.getItemsCount()).toBe(5);
|
||||||
.then(() => pagination.openCurrentPageMenu())
|
await pagination.menu.closeMenu();
|
||||||
.then(() => expect(pagination.menu.getItemsCount()).toBe(5))
|
|
||||||
.then(() => pagination.menu.closeMenu())
|
|
||||||
|
|
||||||
.then(() => pagination.openMaxItemsMenu())
|
await pagination.openMaxItemsMenu();
|
||||||
.then(() => pagination.menu.clickMenuItem('50'))
|
await pagination.menu.clickMenuItem('50');
|
||||||
.then(() => {
|
expect(await pagination.getText(pagination.maxItems)).toContain('50');
|
||||||
expect(pagination.getText(pagination.maxItems)).toContain('50');
|
expect(await pagination.getText(pagination.totalPages)).toContain('of 3');
|
||||||
expect(pagination.getText(pagination.totalPages)).toContain('of 3');
|
await pagination.openCurrentPageMenu();
|
||||||
})
|
expect(await pagination.menu.getItemsCount()).toBe(3);
|
||||||
.then(() => pagination.openCurrentPageMenu())
|
await pagination.menu.closeMenu();
|
||||||
.then(() => expect(pagination.menu.getItemsCount()).toBe(3))
|
|
||||||
.then(() => pagination.menu.closeMenu())
|
|
||||||
|
|
||||||
.then(() => pagination.openMaxItemsMenu())
|
await pagination.openMaxItemsMenu();
|
||||||
.then(() => pagination.menu.clickMenuItem('100'))
|
await pagination.menu.clickMenuItem('100');
|
||||||
.then(() => {
|
expect(await pagination.getText(pagination.maxItems)).toContain('100');
|
||||||
expect(pagination.getText(pagination.maxItems)).toContain('100');
|
expect(await pagination.getText(pagination.totalPages)).toContain('of 2');
|
||||||
expect(pagination.getText(pagination.totalPages)).toContain('of 2');
|
await pagination.openCurrentPageMenu();
|
||||||
})
|
expect(await pagination.menu.getItemsCount()).toBe(2);
|
||||||
.then(() => pagination.openCurrentPageMenu())
|
await pagination.menu.closeMenu();
|
||||||
.then(() => expect(pagination.menu.getItemsCount()).toBe(2))
|
|
||||||
.then(() => pagination.menu.closeMenu())
|
|
||||||
|
|
||||||
.then(() => pagination.resetToDefaultPageSize());
|
await pagination.resetToDefaultPageSize();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('change the current page from menu - [C280107]', () => {
|
it('change the current page from menu - [C280107]', async () => {
|
||||||
pagination.openCurrentPageMenu()
|
await pagination.openCurrentPageMenu();
|
||||||
.then(() => pagination.menu.clickNthItem(3))
|
await pagination.menu.clickNthItem(3);
|
||||||
.then(() => dataTable.waitForHeader())
|
await dataTable.waitForHeader();
|
||||||
.then(() => {
|
expect(await pagination.range.getText()).toContain('51-75 of 101');
|
||||||
expect(pagination.range.getText()).toContain('51-75 of 101');
|
expect(await pagination.currentPage.getText()).toContain('Page 3');
|
||||||
expect(pagination.currentPage.getText()).toContain('Page 3');
|
expect(await pagination.previousButton.isEnabled()).toBe(true, 'Previous button is not enabled');
|
||||||
expect(pagination.previousButton.isEnabled()).toBe(true, 'Previous button is not enabled');
|
expect(await pagination.nextButton.isEnabled()).toBe(true, 'Next button is not enabled');
|
||||||
expect(pagination.nextButton.isEnabled()).toBe(true, 'Next button is not enabled');
|
expect(await dataTable.getRowByName('file-40').isPresent()).toBe(true, 'File not found on page');
|
||||||
expect(dataTable.getRowByName('file-40.txt').isPresent()).toBe(true, 'File not found on page');
|
|
||||||
})
|
|
||||||
|
|
||||||
.then(() => pagination.resetToDefaultPageNumber());
|
await pagination.resetToDefaultPageNumber();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('navigate to next and previous pages - [C280110]', () => {
|
it('navigate to next and previous pages - [C280110]', async () => {
|
||||||
pagination.nextButton.click()
|
await pagination.nextButton.click();
|
||||||
.then(() => dataTable.waitForHeader())
|
await dataTable.waitForHeader();
|
||||||
.then(() => {
|
expect(await pagination.range.getText()).toContain('26-50 of 101');
|
||||||
expect(pagination.range.getText()).toContain('26-50 of 101');
|
expect(await dataTable.getRowByName('file-70').isPresent()).toBe(true, 'File not found on page');
|
||||||
expect(dataTable.getRowByName('file-70.txt').isPresent()).toBe(true, 'File not found on page');
|
await pagination.resetToDefaultPageNumber();
|
||||||
})
|
|
||||||
|
|
||||||
.then(() => pagination.resetToDefaultPageNumber())
|
await pagination.openCurrentPageMenu();
|
||||||
|
await pagination.menu.clickNthItem(2);
|
||||||
.then(() => pagination.openCurrentPageMenu())
|
await dataTable.waitForHeader();
|
||||||
.then(() => pagination.menu.clickNthItem(2))
|
await pagination.previousButton.click();
|
||||||
.then(() => dataTable.waitForHeader())
|
await dataTable.waitForHeader();
|
||||||
.then(() => pagination.previousButton.click())
|
|
||||||
.then(() => dataTable.waitForHeader())
|
|
||||||
.then(() => {
|
|
||||||
expect(pagination.range.getText()).toContain('1-25 of 101');
|
expect(pagination.range.getText()).toContain('1-25 of 101');
|
||||||
expect(dataTable.getRowByName('file-88.txt').isPresent())
|
expect(dataTable.getRowByName('file-88').isPresent()).toBe(true, 'File not found on page');
|
||||||
.toBe(true, 'File not found on page');
|
|
||||||
})
|
await pagination.resetToDefaultPageNumber();
|
||||||
.then(() => pagination.resetToDefaultPageNumber());
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Previous button is disabled on first page - [C280108]', () => {
|
it('Previous button is disabled on first page - [C280108]', async () => {
|
||||||
expect(pagination.currentPage.getText()).toContain('Page 1');
|
expect(await pagination.currentPage.getText()).toContain('Page 1');
|
||||||
expect(pagination.previousButton.isEnabled()).toBe(false, 'Previous button is enabled on first page');
|
expect(await pagination.previousButton.isEnabled()).toBe(false, 'Previous button is enabled on first page');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Next button is disabled on last page - [C280109]', () => {
|
it('Next button is disabled on last page - [C280109]', async () => {
|
||||||
pagination.openCurrentPageMenu()
|
await pagination.openCurrentPageMenu();
|
||||||
.then(() => pagination.menu.clickNthItem(5))
|
await pagination.menu.clickNthItem(5);
|
||||||
.then(() => {
|
expect(await dataTable.countRows()).toBe(1, 'Incorrect number of items on the last page');
|
||||||
expect(dataTable.countRows()).toBe(1, 'Incorrect number of items on the last page');
|
expect(await pagination.currentPage.getText()).toContain('Page 5');
|
||||||
expect(pagination.currentPage.getText()).toContain('Page 5');
|
expect(await pagination.nextButton.isEnabled()).toBe(false, 'Next button is enabled on last page');
|
||||||
expect(pagination.nextButton.isEnabled()).toBe(false, 'Next button is enabled on last page');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -29,217 +29,144 @@ import { LoginPage, LogoutPage, BrowsingPage } from '../../pages/pages';
|
|||||||
import { Utils } from '../../utilities/utils';
|
import { Utils } from '../../utilities/utils';
|
||||||
import { RepoClient } from '../../utilities/repo-client/repo-client';
|
import { RepoClient } from '../../utilities/repo-client/repo-client';
|
||||||
|
|
||||||
describe('Pagination on Shared Files', () => {
|
describe('Pagination on multiple pages on Shared Files', () => {
|
||||||
const username = `user-${Utils.random()}`;
|
const username = `user-${Utils.random()}`;
|
||||||
|
|
||||||
|
const parent = `parent-${Utils.random()}`; let parentId;
|
||||||
|
const files = Array(101)
|
||||||
|
.fill('file')
|
||||||
|
.map((name, index): string => `${name}-${index + 1}.txt`);
|
||||||
|
let filesIds;
|
||||||
|
|
||||||
const apis = {
|
const apis = {
|
||||||
admin: new RepoClient(),
|
admin: new RepoClient(),
|
||||||
user: new RepoClient(username, username)
|
user: new RepoClient(username, username)
|
||||||
};
|
};
|
||||||
const { nodes: nodesApi, shared: sharedApi } = apis.user;
|
|
||||||
|
|
||||||
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, pagination } = page;
|
const { dataTable, pagination } = page;
|
||||||
|
|
||||||
const parent = `parent-${Utils.random()}`;
|
beforeAll(async (done) => {
|
||||||
const files = Array(101)
|
await apis.admin.people.createUser({ username });
|
||||||
.fill('file')
|
parentId = (await apis.user.nodes.createFolder(parent)).entry.id;
|
||||||
.map((name, index): string => `${name}-${index + 1}.txt`);
|
filesIds = (await apis.user.nodes.createFiles(files, parent)).list.entries.map(entries => entries.entry.id);
|
||||||
let filesIds;
|
|
||||||
|
|
||||||
const file = `file-${Utils.random()}.txt`; let fileId;
|
await apis.user.shared.shareFilesByIds(filesIds);
|
||||||
|
await apis.user.shared.waitForApi({ expect: 101 });
|
||||||
beforeAll(done => {
|
await loginPage.loginWith(username);
|
||||||
apis.admin.people.createUser({ username }).then(done);
|
done();
|
||||||
});
|
});
|
||||||
|
|
||||||
xit('');
|
beforeEach(async (done) => {
|
||||||
|
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.SHARED_FILES);
|
||||||
describe('on empty page', () => {
|
await dataTable.waitForHeader();
|
||||||
beforeAll(done => {
|
done();
|
||||||
loginPage.loginWith(username).then(done);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
afterAll(done => {
|
afterEach(async (done) => {
|
||||||
logoutPage.load().then(done);
|
await browser.actions().mouseMove(browser.$('body'), { x: 0, y: 0 }).click().perform();
|
||||||
|
done();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('pagination controls not displayed - [C280094]', () => {
|
afterAll(async (done) => {
|
||||||
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.SHARED_FILES)
|
await Promise.all([
|
||||||
.then(() => {
|
apis.user.nodes.deleteNodeById(parentId),
|
||||||
expect(pagination.range.isPresent()).toBe(false);
|
|
||||||
expect(pagination.maxItems.isPresent()).toBe(false);
|
|
||||||
expect(pagination.currentPage.isPresent()).toBe(false);
|
|
||||||
expect(pagination.totalPages.isPresent()).toBe(false);
|
|
||||||
expect(pagination.previousButton.isPresent()).toBe(false);
|
|
||||||
expect(pagination.nextButton.isPresent()).toBe(false);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('on single page', () => {
|
|
||||||
beforeAll(done => {
|
|
||||||
nodesApi.createFile(file).then(resp => fileId = resp.entry.id)
|
|
||||||
.then(() => sharedApi.shareFileById(fileId))
|
|
||||||
.then(() => sharedApi.waitForApi({ expect: 1 }))
|
|
||||||
.then(() => loginPage.loginWith(username))
|
|
||||||
.then(done);
|
|
||||||
});
|
|
||||||
|
|
||||||
afterAll(done => {
|
|
||||||
Promise.all([
|
|
||||||
nodesApi.deleteNodeById(fileId),
|
|
||||||
logoutPage.load()
|
logoutPage.load()
|
||||||
])
|
]);
|
||||||
.then(done);
|
done();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('page selector not displayed when having a single page - [C280094]', () => {
|
it('Pagination control default values - [C280095]', async () => {
|
||||||
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.SHARED_FILES)
|
expect(await pagination.range.getText()).toContain('1-25 of 101');
|
||||||
.then(() => dataTable.waitForHeader())
|
expect(await pagination.maxItems.getText()).toContain('25');
|
||||||
.then(() => expect(pagination.pagesButton.isPresent()).toBe(false, 'page selector displayed'));
|
expect(await pagination.currentPage.getText()).toContain('Page 1');
|
||||||
});
|
expect(await pagination.totalPages.getText()).toContain('of 5');
|
||||||
|
expect(await pagination.previousButton.isEnabled()).toBe(false, 'Previous button is enabled');
|
||||||
|
expect(await pagination.nextButton.isEnabled()).toBe(true, 'Next button is not enabled');
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('on multiple pages', () => {
|
it('Items per page values - [C280096]', async () => {
|
||||||
beforeAll(done => {
|
await pagination.openMaxItemsMenu();
|
||||||
nodesApi.createFiles(files, parent)
|
|
||||||
.then(resp => filesIds = resp.list.entries.map(entries => entries.entry.id))
|
|
||||||
|
|
||||||
.then(() => sharedApi.shareFilesByIds(filesIds))
|
|
||||||
.then(() => sharedApi.waitForApi({ expect: 101 }))
|
|
||||||
|
|
||||||
.then(() => loginPage.loginWith(username))
|
|
||||||
.then(done);
|
|
||||||
});
|
|
||||||
|
|
||||||
beforeEach(done => {
|
|
||||||
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.SHARED_FILES)
|
|
||||||
.then(() => dataTable.waitForHeader())
|
|
||||||
.then(done);
|
|
||||||
});
|
|
||||||
|
|
||||||
afterEach(done => {
|
|
||||||
browser.actions().mouseMove(browser.$('body'), { x: 0, y: 0 }).click().perform().then(done);
|
|
||||||
});
|
|
||||||
|
|
||||||
afterAll(done => {
|
|
||||||
Promise.all([
|
|
||||||
nodesApi.deleteNodes([ parent ]),
|
|
||||||
logoutPage.load()
|
|
||||||
])
|
|
||||||
.then(done);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('Pagination control default values - [C280095]', () => {
|
|
||||||
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('Items per page values - [C280096]', () => {
|
|
||||||
pagination.openMaxItemsMenu()
|
|
||||||
.then(() => {
|
|
||||||
const [ first, second, third ] = [1, 2, 3]
|
const [ first, second, third ] = [1, 2, 3]
|
||||||
.map(nth => pagination.menu.getNthItem(nth).getText());
|
.map(async nth => await pagination.menu.getNthItem(nth).getText());
|
||||||
expect(first).toBe('25');
|
expect(first).toBe('25');
|
||||||
expect(second).toBe('50');
|
expect(second).toBe('50');
|
||||||
expect(third).toBe('100');
|
expect(third).toBe('100');
|
||||||
})
|
|
||||||
.then(() => pagination.menu.closeMenu());
|
await pagination.menu.closeMenu();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('current page menu items - [C280097]', () => {
|
it('current page menu items - [C280097]', async () => {
|
||||||
pagination.openMaxItemsMenu()
|
await pagination.openMaxItemsMenu();
|
||||||
.then(() => pagination.menu.clickMenuItem('25'))
|
await pagination.menu.clickMenuItem('25');
|
||||||
.then(() => {
|
expect(await pagination.getText(pagination.maxItems)).toContain('25');
|
||||||
expect(pagination.getText(pagination.maxItems)).toContain('25');
|
expect(await pagination.getText(pagination.totalPages)).toContain('of 5');
|
||||||
expect(pagination.getText(pagination.totalPages)).toContain('of 5');
|
await pagination.openCurrentPageMenu();
|
||||||
})
|
expect(await pagination.menu.getItemsCount()).toBe(5);
|
||||||
.then(() => pagination.openCurrentPageMenu())
|
await pagination.menu.closeMenu();
|
||||||
.then(() => expect(pagination.menu.getItemsCount()).toBe(5))
|
|
||||||
.then(() => pagination.menu.closeMenu())
|
|
||||||
|
|
||||||
.then(() => pagination.openMaxItemsMenu())
|
await pagination.openMaxItemsMenu();
|
||||||
.then(() => pagination.menu.clickMenuItem('50'))
|
await pagination.menu.clickMenuItem('50');
|
||||||
.then(() => {
|
expect(await pagination.getText(pagination.maxItems)).toContain('50');
|
||||||
expect(pagination.getText(pagination.maxItems)).toContain('50');
|
expect(await pagination.getText(pagination.totalPages)).toContain('of 3');
|
||||||
expect(pagination.getText(pagination.totalPages)).toContain('of 3');
|
await pagination.openCurrentPageMenu();
|
||||||
})
|
expect(await pagination.menu.getItemsCount()).toBe(3);
|
||||||
.then(() => pagination.openCurrentPageMenu())
|
await pagination.menu.closeMenu();
|
||||||
.then(() => expect(pagination.menu.getItemsCount()).toBe(3))
|
|
||||||
.then(() => pagination.menu.closeMenu())
|
|
||||||
|
|
||||||
.then(() => pagination.openMaxItemsMenu())
|
await pagination.openMaxItemsMenu();
|
||||||
.then(() => pagination.menu.clickMenuItem('100'))
|
await pagination.menu.clickMenuItem('100');
|
||||||
.then(() => {
|
expect(await pagination.getText(pagination.maxItems)).toContain('100');
|
||||||
expect(pagination.getText(pagination.maxItems)).toContain('100');
|
expect(await pagination.getText(pagination.totalPages)).toContain('of 2');
|
||||||
expect(pagination.getText(pagination.totalPages)).toContain('of 2');
|
await pagination.openCurrentPageMenu();
|
||||||
})
|
expect(await pagination.menu.getItemsCount()).toBe(2);
|
||||||
.then(() => pagination.openCurrentPageMenu())
|
await pagination.menu.closeMenu();
|
||||||
.then(() => expect(pagination.menu.getItemsCount()).toBe(2))
|
|
||||||
.then(() => pagination.menu.closeMenu())
|
|
||||||
|
|
||||||
.then(() => pagination.resetToDefaultPageSize());
|
await pagination.resetToDefaultPageSize();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('change the current page from menu - [C280098]', () => {
|
it('change the current page from menu - [C280098]', async () => {
|
||||||
pagination.openCurrentPageMenu()
|
await pagination.openCurrentPageMenu();
|
||||||
.then(() => pagination.menu.clickNthItem(3))
|
await pagination.menu.clickNthItem(3);
|
||||||
.then(() => dataTable.waitForHeader())
|
await dataTable.waitForHeader();
|
||||||
.then(() => {
|
expect(await pagination.range.getText()).toContain('51-75 of 101');
|
||||||
expect(pagination.range.getText()).toContain('51-75 of 101');
|
expect(await pagination.currentPage.getText()).toContain('Page 3');
|
||||||
expect(pagination.currentPage.getText()).toContain('Page 3');
|
expect(await pagination.previousButton.isEnabled()).toBe(true, 'Previous button is not enabled');
|
||||||
expect(pagination.previousButton.isEnabled()).toBe(true, 'Previous button is not enabled');
|
expect(await pagination.nextButton.isEnabled()).toBe(true, 'Next button is not enabled');
|
||||||
expect(pagination.nextButton.isEnabled()).toBe(true, 'Next button is not enabled');
|
expect(await dataTable.getRowByName('file-40').isPresent()).toBe(true, 'File not found on page');
|
||||||
expect(dataTable.getRowByName('file-40.txt').isPresent())
|
|
||||||
.toBe(true, 'File not found on page');
|
|
||||||
})
|
|
||||||
|
|
||||||
.then(() => pagination.resetToDefaultPageNumber());
|
await pagination.resetToDefaultPageNumber();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('navigate to next and previous pages - [C280101]', () => {
|
it('navigate to next and previous pages - [C280101]', async () => {
|
||||||
pagination.nextButton.click()
|
await pagination.nextButton.click();
|
||||||
.then(() => dataTable.waitForHeader())
|
await dataTable.waitForHeader();
|
||||||
.then(() => {
|
expect(await pagination.range.getText()).toContain('26-50 of 101');
|
||||||
expect(pagination.range.getText()).toContain('26-50 of 101');
|
expect(await dataTable.getRowByName('file-70').isPresent()).toBe(true, 'File not found on page');
|
||||||
expect(dataTable.getRowByName('file-70.txt').isPresent()).toBe(true, 'File not found on page');
|
await pagination.resetToDefaultPageNumber();
|
||||||
})
|
|
||||||
|
|
||||||
.then(() => pagination.resetToDefaultPageNumber())
|
await pagination.openCurrentPageMenu();
|
||||||
|
await pagination.menu.clickNthItem(2);
|
||||||
|
await dataTable.waitForHeader();
|
||||||
|
await pagination.previousButton.click();
|
||||||
|
await dataTable.waitForHeader();
|
||||||
|
expect(await pagination.range.getText()).toContain('1-25 of 101');
|
||||||
|
expect(await dataTable.getRowByName('file-88').isPresent()).toBe(true, 'File not found on page');
|
||||||
|
|
||||||
.then(() => pagination.openCurrentPageMenu())
|
await pagination.resetToDefaultPageNumber();
|
||||||
.then(() => pagination.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(() => pagination.resetToDefaultPageNumber());
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Previous button is disabled on first page - [C280099]', () => {
|
it('Previous button is disabled on first page - [C280099]', async () => {
|
||||||
expect(pagination.currentPage.getText()).toContain('Page 1');
|
expect(await pagination.currentPage.getText()).toContain('Page 1');
|
||||||
expect(pagination.previousButton.isEnabled()).toBe(false, 'Previous button is enabled on first page');
|
expect(await pagination.previousButton.isEnabled()).toBe(false, 'Previous button is enabled on first page');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Next button is disabled on last page - [C280100]', () => {
|
it('Next button is disabled on last page - [C280100]', async () => {
|
||||||
pagination.openCurrentPageMenu()
|
await pagination.openCurrentPageMenu();
|
||||||
.then(() => pagination.menu.clickNthItem(5))
|
await pagination.menu.clickNthItem(5);
|
||||||
.then(() => {
|
expect(await dataTable.countRows()).toBe(1, 'Incorrect number of items on the last page');
|
||||||
expect(dataTable.countRows()).toBe(1, 'Incorrect number of items on the last page');
|
expect(await pagination.currentPage.getText()).toContain('Page 5');
|
||||||
expect(pagination.currentPage.getText()).toContain('Page 5');
|
expect(await pagination.nextButton.isEnabled()).toBe(false, 'Next button is enabled on last page');
|
||||||
expect(pagination.nextButton.isEnabled()).toBe(false, 'Next button is enabled on last page');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
120
e2e/suites/pagination/pag-single-page.test.ts
Executable file
120
e2e/suites/pagination/pag-single-page.test.ts
Executable file
@ -0,0 +1,120 @@
|
|||||||
|
/*!
|
||||||
|
* @license
|
||||||
|
* Alfresco Example Content Application
|
||||||
|
*
|
||||||
|
* Copyright (C) 2005 - 2018 Alfresco Software Limited
|
||||||
|
*
|
||||||
|
* This file is part of the Alfresco Example Content Application.
|
||||||
|
* If the software was purchased under a paid Alfresco license, the terms of
|
||||||
|
* the paid license agreement will prevail. Otherwise, the software is
|
||||||
|
* provided under the following open source license terms:
|
||||||
|
*
|
||||||
|
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { SIDEBAR_LABELS } from '../../configs';
|
||||||
|
import { LoginPage, LogoutPage, BrowsingPage } from '../../pages/pages';
|
||||||
|
import { Utils } from '../../utilities/utils';
|
||||||
|
import { RepoClient } from '../../utilities/repo-client/repo-client';
|
||||||
|
|
||||||
|
describe('Pagination on single page', () => {
|
||||||
|
const username = `user-${Utils.random()}`;
|
||||||
|
|
||||||
|
const siteName = `site-${Utils.random()}`; let siteId;
|
||||||
|
|
||||||
|
const file = `file-${Utils.random()}.txt`; let fileId;
|
||||||
|
const fileInTrash = `fileInTrash-${Utils.random()}.txt`; let fileInTrashId;
|
||||||
|
|
||||||
|
const apis = {
|
||||||
|
admin: new RepoClient(),
|
||||||
|
user: new RepoClient(username, username)
|
||||||
|
};
|
||||||
|
|
||||||
|
const loginPage = new LoginPage();
|
||||||
|
const logoutPage = new LogoutPage();
|
||||||
|
const page = new BrowsingPage();
|
||||||
|
const { dataTable, pagination } = page;
|
||||||
|
|
||||||
|
beforeAll(async (done) => {
|
||||||
|
await apis.admin.people.createUser({ username });
|
||||||
|
const [fileP, fileInTrashP, siteP] = await Promise.all([
|
||||||
|
apis.user.nodes.createFile(file),
|
||||||
|
apis.user.nodes.createFile(fileInTrash),
|
||||||
|
apis.user.sites.createSite(siteName)
|
||||||
|
]);
|
||||||
|
|
||||||
|
fileId = fileP.entry.id;
|
||||||
|
fileInTrashId = fileInTrashP.entry.id;
|
||||||
|
siteId = siteP.entry.id;
|
||||||
|
|
||||||
|
await apis.user.nodes.deleteNodeById(fileInTrashId, false);
|
||||||
|
await apis.user.favorites.addFavoriteById('file', fileId);
|
||||||
|
await apis.user.shared.shareFileById(fileId);
|
||||||
|
|
||||||
|
await apis.user.favorites.waitForApi({ expect: 2 });
|
||||||
|
await apis.user.search.waitForApi(username, { expect: 1 });
|
||||||
|
await apis.user.shared.waitForApi({ expect: 1 });
|
||||||
|
await apis.user.trashcan.waitForApi({ expect: 1 });
|
||||||
|
|
||||||
|
await loginPage.loginWith(username);
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
|
||||||
|
afterAll(async (done) => {
|
||||||
|
await Promise.all([
|
||||||
|
apis.user.nodes.deleteNodeById(fileId),
|
||||||
|
apis.user.sites.deleteSite(siteId),
|
||||||
|
apis.user.trashcan.emptyTrash(),
|
||||||
|
logoutPage.load()
|
||||||
|
]);
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('page selector not displayed on Favorites - [C280112]', async () => {
|
||||||
|
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FAVORITES);
|
||||||
|
await dataTable.waitForHeader();
|
||||||
|
expect(await pagination.pagesButton.isPresent()).toBe(false, 'page selector displayed');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('page selector not displayed on File Libraries - [C280085]', async () => {
|
||||||
|
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FILE_LIBRARIES);
|
||||||
|
await dataTable.waitForHeader();
|
||||||
|
expect(await pagination.pagesButton.isPresent()).toBe(false, 'page selector displayed');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('page selector not displayed on Personal Files - [C280076]', async () => {
|
||||||
|
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES);
|
||||||
|
await dataTable.waitForHeader();
|
||||||
|
expect(await pagination.pagesButton.isPresent()).toBe(false, 'page selector displayed');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('page selector not displayed on Recent Files - [C280103]', async () => {
|
||||||
|
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.RECENT_FILES);
|
||||||
|
await dataTable.waitForHeader();
|
||||||
|
expect(await pagination.pagesButton.isPresent()).toBe(false, 'page selector displayed');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('page selector not displayed on Shared Files - [C280094]', async () => {
|
||||||
|
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.SHARED_FILES);
|
||||||
|
await dataTable.waitForHeader();
|
||||||
|
expect(await pagination.pagesButton.isPresent()).toBe(false, 'page selector displayed');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('page selector not displayed on Trash - [C280121]', async () => {
|
||||||
|
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH);
|
||||||
|
await dataTable.waitForHeader();
|
||||||
|
expect(await pagination.pagesButton.isPresent()).toBe(false, 'page selector displayed');
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
@ -29,214 +29,139 @@ import { LoginPage, LogoutPage, BrowsingPage } from '../../pages/pages';
|
|||||||
import { Utils } from '../../utilities/utils';
|
import { Utils } from '../../utilities/utils';
|
||||||
import { RepoClient } from '../../utilities/repo-client/repo-client';
|
import { RepoClient } from '../../utilities/repo-client/repo-client';
|
||||||
|
|
||||||
describe('Pagination on Trash', () => {
|
describe('Pagination on multiple pages on Trash', () => {
|
||||||
const username = `user-${Utils.random()}`;
|
const username = `user-${Utils.random()}`;
|
||||||
|
const filesForDelete = Array(101)
|
||||||
|
.fill('file')
|
||||||
|
.map((name, index): string => `${name}-${index + 1}.txt`);
|
||||||
|
let filesDeletedIds;
|
||||||
|
|
||||||
const apis = {
|
const apis = {
|
||||||
admin: new RepoClient(),
|
admin: new RepoClient(),
|
||||||
user: new RepoClient(username, username)
|
user: new RepoClient(username, username)
|
||||||
};
|
};
|
||||||
const { nodes: nodesApi, trashcan: trashApi } = apis.user;
|
|
||||||
|
|
||||||
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, pagination } = page;
|
const { dataTable, pagination } = page;
|
||||||
|
|
||||||
const filesForDelete = Array(101)
|
beforeAll(async (done) => {
|
||||||
.fill('file')
|
await apis.admin.people.createUser({ username });
|
||||||
.map((name, index): string => `${name}-${index + 1}.txt`);
|
filesDeletedIds = (await apis.user.nodes.createFiles(filesForDelete)).list.entries.map(entries => entries.entry.id);
|
||||||
let filesDeletedIds;
|
await apis.user.nodes.deleteNodesById(filesDeletedIds, false);
|
||||||
|
await apis.user.trashcan.waitForApi({expect: 101});
|
||||||
const file = `file-${Utils.random()}.txt`; let fileId;
|
await loginPage.loginWith(username);
|
||||||
|
done();
|
||||||
beforeAll(done => {
|
|
||||||
apis.admin.people.createUser({ username }).then(done);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
xit('');
|
beforeEach(async (done) => {
|
||||||
|
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH);
|
||||||
describe('on empty page', () => {
|
await dataTable.waitForHeader();
|
||||||
beforeAll(done => {
|
done();
|
||||||
loginPage.loginWith(username).then(done);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
afterAll(done => {
|
afterEach(async (done) => {
|
||||||
logoutPage.load().then(done);
|
await browser.actions().mouseMove(browser.$('body'), { x: 0, y: 0 }).click().perform();
|
||||||
|
done();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('pagination controls not displayed - [C280120]', () => {
|
afterAll(async (done) => {
|
||||||
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH)
|
await Promise.all([
|
||||||
.then(() => {
|
apis.user.trashcan.emptyTrash(),
|
||||||
expect(pagination.range.isPresent()).toBe(false);
|
|
||||||
expect(pagination.maxItems.isPresent()).toBe(false);
|
|
||||||
expect(pagination.currentPage.isPresent()).toBe(false);
|
|
||||||
expect(pagination.totalPages.isPresent()).toBe(false);
|
|
||||||
expect(pagination.previousButton.isPresent()).toBe(false);
|
|
||||||
expect(pagination.nextButton.isPresent()).toBe(false);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('on single page', () => {
|
|
||||||
beforeAll(done => {
|
|
||||||
nodesApi.createFile(file).then(resp => fileId = resp.entry.id)
|
|
||||||
.then(() => nodesApi.deleteNodeById(fileId, false))
|
|
||||||
.then(() => trashApi.waitForApi({ expect: 1 }))
|
|
||||||
.then(() => loginPage.loginWith(username))
|
|
||||||
.then(done);
|
|
||||||
});
|
|
||||||
|
|
||||||
afterAll(done => {
|
|
||||||
Promise.all([
|
|
||||||
trashApi.emptyTrash(),
|
|
||||||
logoutPage.load()
|
logoutPage.load()
|
||||||
])
|
]);
|
||||||
.then(done);
|
done();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('page selector not displayed when having a single page - [C280121]', () => {
|
it('Pagination control default values - [C280122]', async () => {
|
||||||
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH)
|
expect(await pagination.range.getText()).toContain('1-25 of 101');
|
||||||
.then(() => dataTable.waitForHeader())
|
expect(await pagination.maxItems.getText()).toContain('25');
|
||||||
.then(() => expect(pagination.pagesButton.isPresent()).toBe(false, 'page selector displayed'));
|
expect(await pagination.currentPage.getText()).toContain('Page 1');
|
||||||
});
|
expect(await pagination.totalPages.getText()).toContain('of 5');
|
||||||
|
expect(await pagination.previousButton.isEnabled()).toBe(false, 'Previous button is enabled');
|
||||||
|
expect(await pagination.nextButton.isEnabled()).toBe(true, 'Next button is not enabled');
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('on multiple pages', () => {
|
it('Items per page values - [C280123]', async () => {
|
||||||
beforeAll(done => {
|
await pagination.openMaxItemsMenu();
|
||||||
nodesApi.createFiles(filesForDelete)
|
|
||||||
.then(resp => filesDeletedIds = resp.list.entries.map(entries => entries.entry.id))
|
|
||||||
.then(() => nodesApi.deleteNodesById(filesDeletedIds, false))
|
|
||||||
.then(() => trashApi.waitForApi({expect: 101}))
|
|
||||||
|
|
||||||
.then(() => loginPage.loginWith(username))
|
|
||||||
.then(done);
|
|
||||||
});
|
|
||||||
|
|
||||||
beforeEach(done => {
|
|
||||||
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH)
|
|
||||||
.then(() => dataTable.waitForHeader())
|
|
||||||
.then(done);
|
|
||||||
});
|
|
||||||
|
|
||||||
afterEach(done => {
|
|
||||||
browser.actions().mouseMove(browser.$('body'), { x: 0, y: 0 }).click().perform().then(done);
|
|
||||||
});
|
|
||||||
|
|
||||||
afterAll(done => {
|
|
||||||
Promise.all([
|
|
||||||
trashApi.emptyTrash(),
|
|
||||||
logoutPage.load()
|
|
||||||
])
|
|
||||||
.then(done);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('Pagination control default values - [C280122]', () => {
|
|
||||||
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('Items per page values - [C280123]', () => {
|
|
||||||
pagination.openMaxItemsMenu()
|
|
||||||
.then(() => {
|
|
||||||
const [ first, second, third ] = [1, 2, 3]
|
const [ first, second, third ] = [1, 2, 3]
|
||||||
.map(nth => pagination.menu.getNthItem(nth).getText());
|
.map(async nth => await pagination.menu.getNthItem(nth).getText());
|
||||||
expect(first).toBe('25');
|
expect(first).toBe('25');
|
||||||
expect(second).toBe('50');
|
expect(second).toBe('50');
|
||||||
expect(third).toBe('100');
|
expect(third).toBe('100');
|
||||||
})
|
await pagination.menu.closeMenu();
|
||||||
.then(() => pagination.menu.closeMenu());
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('current page menu items - [C280124]', () => {
|
it('current page menu items - [C280124]', async () => {
|
||||||
pagination.openMaxItemsMenu()
|
await pagination.openMaxItemsMenu();
|
||||||
.then(() => pagination.menu.clickMenuItem('25'))
|
await pagination.menu.clickMenuItem('25');
|
||||||
.then(() => {
|
expect(await pagination.getText(pagination.maxItems)).toContain('25');
|
||||||
expect(pagination.getText(pagination.maxItems)).toContain('25');
|
expect(await pagination.getText(pagination.totalPages)).toContain('of 5');
|
||||||
expect(pagination.getText(pagination.totalPages)).toContain('of 5');
|
await pagination.openCurrentPageMenu();
|
||||||
})
|
expect(await pagination.menu.getItemsCount()).toBe(5);
|
||||||
.then(() => pagination.openCurrentPageMenu())
|
await pagination.menu.closeMenu();
|
||||||
.then(() => expect(pagination.menu.getItemsCount()).toBe(5))
|
|
||||||
.then(() => pagination.menu.closeMenu())
|
|
||||||
|
|
||||||
.then(() => pagination.openMaxItemsMenu())
|
await pagination.openMaxItemsMenu();
|
||||||
.then(() => pagination.menu.clickMenuItem('50'))
|
await pagination.menu.clickMenuItem('50');
|
||||||
.then(() => {
|
expect(await pagination.getText(pagination.maxItems)).toContain('50');
|
||||||
expect(pagination.getText(pagination.maxItems)).toContain('50');
|
expect(await pagination.getText(pagination.totalPages)).toContain('of 3');
|
||||||
expect(pagination.getText(pagination.totalPages)).toContain('of 3');
|
await pagination.openCurrentPageMenu();
|
||||||
})
|
expect(await pagination.menu.getItemsCount()).toBe(3);
|
||||||
.then(() => pagination.openCurrentPageMenu())
|
await pagination.menu.closeMenu();
|
||||||
.then(() => expect(pagination.menu.getItemsCount()).toBe(3))
|
|
||||||
.then(() => pagination.menu.closeMenu())
|
|
||||||
|
|
||||||
.then(() => pagination.openMaxItemsMenu())
|
await pagination.openMaxItemsMenu();
|
||||||
.then(() => pagination.menu.clickMenuItem('100'))
|
await pagination.menu.clickMenuItem('100');
|
||||||
.then(() => {
|
expect(await pagination.getText(pagination.maxItems)).toContain('100');
|
||||||
expect(pagination.getText(pagination.maxItems)).toContain('100');
|
expect(await pagination.getText(pagination.totalPages)).toContain('of 2');
|
||||||
expect(pagination.getText(pagination.totalPages)).toContain('of 2');
|
await pagination.openCurrentPageMenu();
|
||||||
})
|
expect(await pagination.menu.getItemsCount()).toBe(2);
|
||||||
.then(() => pagination.openCurrentPageMenu())
|
await pagination.menu.closeMenu();
|
||||||
.then(() => expect(pagination.menu.getItemsCount()).toBe(2))
|
|
||||||
.then(() => pagination.menu.closeMenu())
|
|
||||||
|
|
||||||
.then(() => pagination.resetToDefaultPageSize());
|
await pagination.resetToDefaultPageSize();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('change the current page from menu - [C280125]', () => {
|
it('change the current page from menu - [C280125]', async () => {
|
||||||
pagination.openCurrentPageMenu()
|
await pagination.openCurrentPageMenu();
|
||||||
.then(() => pagination.menu.clickNthItem(3))
|
await pagination.menu.clickNthItem(3);
|
||||||
.then(() => dataTable.waitForHeader())
|
await dataTable.waitForHeader();
|
||||||
.then(() => {
|
expect(await pagination.range.getText()).toContain('51-75 of 101');
|
||||||
expect(pagination.range.getText()).toContain('51-75 of 101');
|
expect(await pagination.currentPage.getText()).toContain('Page 3');
|
||||||
expect(pagination.currentPage.getText()).toContain('Page 3');
|
expect(await pagination.previousButton.isEnabled()).toBe(true, 'Previous button is not enabled');
|
||||||
expect(pagination.previousButton.isEnabled()).toBe(true, 'Previous button is not enabled');
|
expect(await pagination.nextButton.isEnabled()).toBe(true, 'Next button is not enabled');
|
||||||
expect(pagination.nextButton.isEnabled()).toBe(true, 'Next button is not enabled');
|
expect(await dataTable.getRowByName('file-40').isPresent()).toBe(true, 'File not found on page');
|
||||||
expect(dataTable.getRowByName('file-40.txt').isPresent()).toBe(true, 'File not found on page');
|
|
||||||
})
|
|
||||||
|
|
||||||
.then(() => pagination.resetToDefaultPageNumber());
|
await pagination.resetToDefaultPageNumber();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('navigate to next and previous pages - [C280128]', () => {
|
it('navigate to next and previous pages - [C280128]', async () => {
|
||||||
pagination.nextButton.click()
|
await pagination.nextButton.click();
|
||||||
.then(() => dataTable.waitForHeader())
|
await dataTable.waitForHeader();
|
||||||
.then(() => {
|
|
||||||
expect(pagination.range.getText()).toContain('26-50 of 101');
|
expect(pagination.range.getText()).toContain('26-50 of 101');
|
||||||
expect(dataTable.getRowByName('file-70.txt').isPresent()).toBe(true, 'File not found on page');
|
expect(dataTable.getRowByName('file-70').isPresent()).toBe(true, 'File not found on page');
|
||||||
})
|
await pagination.resetToDefaultPageNumber();
|
||||||
|
|
||||||
.then(() => pagination.resetToDefaultPageNumber())
|
await pagination.openCurrentPageMenu();
|
||||||
|
await pagination.menu.clickNthItem(2);
|
||||||
|
await dataTable.waitForHeader();
|
||||||
|
await pagination.previousButton.click();
|
||||||
|
await dataTable.waitForHeader();
|
||||||
|
expect(await pagination.range.getText()).toContain('1-25 of 101');
|
||||||
|
expect(await dataTable.getRowByName('file-88').isPresent()).toBe(true, 'File not found on page');
|
||||||
|
|
||||||
.then(() => pagination.openCurrentPageMenu())
|
await pagination.resetToDefaultPageNumber();
|
||||||
.then(() => pagination.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(() => pagination.resetToDefaultPageNumber());
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Previous button is disabled on first page - [C280126]', () => {
|
it('Previous button is disabled on first page - [C280126]', async () => {
|
||||||
expect(pagination.currentPage.getText()).toContain('Page 1');
|
expect(await pagination.currentPage.getText()).toContain('Page 1');
|
||||||
expect(pagination.previousButton.isEnabled()).toBe(false, 'Previous button is enabled on first page');
|
expect(await pagination.previousButton.isEnabled()).toBe(false, 'Previous button is enabled on first page');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Next button is disabled on last page - [C280127]', () => {
|
it('Next button is disabled on last page - [C280127]', async () => {
|
||||||
pagination.openCurrentPageMenu()
|
await pagination.openCurrentPageMenu();
|
||||||
.then(() => pagination.menu.clickNthItem(5))
|
await pagination.menu.clickNthItem(5);
|
||||||
.then(() => {
|
expect(await dataTable.countRows()).toBe(1, 'Incorrect number of items on the last page');
|
||||||
expect(dataTable.countRows()).toBe(1, 'Incorrect number of items on the last page');
|
expect(await pagination.currentPage.getText()).toContain('Page 5');
|
||||||
expect(pagination.currentPage.getText()).toContain('Page 5');
|
expect(await pagination.nextButton.isEnabled()).toBe(false, 'Next button is enabled on last page');
|
||||||
expect(pagination.nextButton.isEnabled()).toBe(false, 'Next button is enabled on last page');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -90,9 +90,10 @@ export class FavoritesApi extends RepoApi {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async waitForApi(data) {
|
async waitForApi(data) {
|
||||||
|
try {
|
||||||
const favoriteFiles = async () => {
|
const favoriteFiles = async () => {
|
||||||
const totalItems = (await this.getFavorites()).list.pagination.totalItems;
|
const totalItems = (await this.getFavorites()).list.pagination.totalItems;
|
||||||
if ( totalItems < data.expect) {
|
if ( totalItems !== data.expect) {
|
||||||
return Promise.reject(totalItems);
|
return Promise.reject(totalItems);
|
||||||
} else {
|
} else {
|
||||||
return Promise.resolve(totalItems);
|
return Promise.resolve(totalItems);
|
||||||
@ -100,5 +101,9 @@ export class FavoritesApi extends RepoApi {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return await Utils.retryCall(favoriteFiles);
|
return await Utils.retryCall(favoriteFiles);
|
||||||
|
} catch (error) {
|
||||||
|
console.log('-----> catch favorites: ', error);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -51,9 +51,10 @@ export class SearchApi extends RepoApi {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async waitForApi(username, data) {
|
async waitForApi(username, data) {
|
||||||
|
try {
|
||||||
const recentFiles = async () => {
|
const recentFiles = async () => {
|
||||||
const totalItems = (await this.queryRecentFiles(username)).list.pagination.totalItems;
|
const totalItems = (await this.queryRecentFiles(username)).list.pagination.totalItems;
|
||||||
if ( totalItems < data.expect) {
|
if ( totalItems !== data.expect) {
|
||||||
return Promise.reject(totalItems);
|
return Promise.reject(totalItems);
|
||||||
} else {
|
} else {
|
||||||
return Promise.resolve(totalItems);
|
return Promise.resolve(totalItems);
|
||||||
@ -61,5 +62,8 @@ export class SearchApi extends RepoApi {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return await Utils.retryCall(recentFiles);
|
return await Utils.retryCall(recentFiles);
|
||||||
|
} catch (error) {
|
||||||
|
console.log('-----> catch search: ', error);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -62,9 +62,10 @@ export class SharedLinksApi extends RepoApi {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async waitForApi(data) {
|
async waitForApi(data) {
|
||||||
|
try {
|
||||||
const sharedFiles = async () => {
|
const sharedFiles = async () => {
|
||||||
const totalItems = (await this.getSharedLinks()).list.pagination.totalItems;
|
const totalItems = (await this.getSharedLinks()).list.pagination.totalItems;
|
||||||
if ( totalItems < data.expect ) {
|
if ( totalItems !== data.expect ) {
|
||||||
return Promise.reject(totalItems);
|
return Promise.reject(totalItems);
|
||||||
} else {
|
} else {
|
||||||
return Promise.resolve(totalItems);
|
return Promise.resolve(totalItems);
|
||||||
@ -72,5 +73,8 @@ export class SharedLinksApi extends RepoApi {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return await Utils.retryCall(sharedFiles);
|
return await Utils.retryCall(sharedFiles);
|
||||||
|
} catch (error) {
|
||||||
|
console.log('-----> catch shared: ', error);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -105,9 +105,10 @@ export class SitesApi extends RepoApi {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async waitForApi(data) {
|
async waitForApi(data) {
|
||||||
|
try {
|
||||||
const sites = async () => {
|
const sites = async () => {
|
||||||
const totalItems = (await this.getSites()).list.pagination.totalItems;
|
const totalItems = (await this.getSites()).list.pagination.totalItems;
|
||||||
if ( totalItems < data.expect ) {
|
if ( totalItems !== data.expect ) {
|
||||||
return Promise.reject(totalItems);
|
return Promise.reject(totalItems);
|
||||||
} else {
|
} else {
|
||||||
return Promise.resolve(totalItems);
|
return Promise.resolve(totalItems);
|
||||||
@ -115,5 +116,8 @@ export class SitesApi extends RepoApi {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return await Utils.retryCall(sites);
|
return await Utils.retryCall(sites);
|
||||||
|
} catch (error) {
|
||||||
|
console.log('-----> catch sites: ', error);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -60,9 +60,10 @@ export class TrashcanApi extends RepoApi {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async waitForApi(data) {
|
async waitForApi(data) {
|
||||||
|
try {
|
||||||
const deletedFiles = async () => {
|
const deletedFiles = async () => {
|
||||||
const totalItems = (await this.getDeletedNodes()).list.pagination.totalItems;
|
const totalItems = (await this.getDeletedNodes()).list.pagination.totalItems;
|
||||||
if ( totalItems < data.expect) {
|
if ( totalItems !== data.expect) {
|
||||||
return Promise.reject(totalItems);
|
return Promise.reject(totalItems);
|
||||||
} else {
|
} else {
|
||||||
return Promise.resolve(totalItems);
|
return Promise.resolve(totalItems);
|
||||||
@ -70,5 +71,8 @@ export class TrashcanApi extends RepoApi {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return await Utils.retryCall(deletedFiles);
|
return await Utils.retryCall(deletedFiles);
|
||||||
|
} catch (error) {
|
||||||
|
console.log('-----> catch trash: ', error);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user