Adina Parpalita ca67da3657 [ACA-1946] automate tests for Favourite Libraries list ()
* automate part of the Favourite Libraries tests
refactor File Libraries tests to include My Libraries

* rephrasing

* forgotten changes

* fix tests
2018-11-16 15:43:16 +02:00

135 lines
4.5 KiB
TypeScript
Executable File

/*!
* @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 { browser } from 'protractor';
import { SIDEBAR_LABELS, PAGE_TITLES } from '../../configs';
import { LoginPage, BrowsingPage } from '../../pages/pages';
import { RepoClient } from '../../utilities/repo-client/repo-client';
import { Utils } from '../../utilities/utils';
describe('Page titles', () => {
const loginPage = new LoginPage();
const page = new BrowsingPage();
const adminApi = new RepoClient();
const { nodes: nodesApi } = adminApi;
const file = `file-${Utils.random()}.txt`; let fileId;
const { searchInput } = page.header;
xit('');
describe('on Login / Logout pages', () => {
it('on Login page - [C217155]', async () => {
await loginPage.load();
expect(await browser.getTitle()).toContain('Sign in');
});
it('after logout - [C217156]', async () => {
await loginPage.loginWithAdmin();
await page.signOut();
expect(await browser.getTitle()).toContain('Sign in');
});
it('when pressing Back after Logout - [C280414]', async () => {
await loginPage.loginWithAdmin();
await page.signOut();
await browser.navigate().back();
expect(await browser.getTitle()).toContain('Sign in');
});
});
describe('on app pages', () => {
beforeAll(async (done) => {
fileId = (await nodesApi.createFile(file)).entry.id;
await loginPage.loginWithAdmin();
done();
});
afterAll(async (done) => {
await adminApi.nodes.deleteNodeById(fileId);
done();
});
it('Personal Files page - [C217157]', async () => {
const label = SIDEBAR_LABELS.PERSONAL_FILES;
await page.sidenav.navigateToLink(label);
expect(await browser.getTitle()).toContain(label);
});
it('My Libraries page - [C217158]', async () => {
await page.goToMyLibraries();
expect(await browser.getTitle()).toContain(PAGE_TITLES.MY_LIBRARIES);
});
it('Favorite Libraries page - [C289907]', async () => {
await page.goToFavoriteLibraries();
expect(await browser.getTitle()).toContain(PAGE_TITLES.FAVORITE_LIBRARIES);
});
it('Shared Files page - [C217159]', async () => {
const label = SIDEBAR_LABELS.SHARED_FILES;
await page.sidenav.navigateToLink(label);
expect(await browser.getTitle()).toContain(label);
});
it('Recent Files page - [C217160]', async () => {
const label = SIDEBAR_LABELS.RECENT_FILES;
await page.sidenav.navigateToLink(label);
expect(await browser.getTitle()).toContain(label);
});
it('Favorites page - [C217161]', async () => {
const label = SIDEBAR_LABELS.FAVORITES;
await page.sidenav.navigateToLink(label);
expect(await browser.getTitle()).toContain(label);
});
it('Trash page - [C217162]', async () => {
const label = SIDEBAR_LABELS.TRASH;
await page.sidenav.navigateToLink(label);
expect(await browser.getTitle()).toContain(label);
});
it('File Preview page - [C280415]', async () => {
await page.clickPersonalFilesAndWait();
await page.dataTable.doubleClickOnRowByName(file);
expect(await browser.getTitle()).toContain(PAGE_TITLES.VIEWER);
await Utils.pressEscape();
});
it('Search Results page - [C280413]', async () => {
await searchInput.clickSearchButton();
await searchInput.searchForText(file);
expect(await browser.getTitle()).toContain(PAGE_TITLES.SEARCH);
});
});
});