mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-05-19 17:14:45 +00:00
Merge pull request #51 from Alfresco/adina-empty-page-tests
[ACA-990] Add tests for empty pages
This commit is contained in:
commit
7fbd5775bb
@ -31,11 +31,21 @@ export class DataTable extends Component {
|
|||||||
`,
|
`,
|
||||||
|
|
||||||
body: 'table > tbody',
|
body: 'table > tbody',
|
||||||
row: 'tr'
|
row: 'tr',
|
||||||
|
|
||||||
|
emptyListContainer: 'td.adf-no-content-container',
|
||||||
|
emptyFolderDragAndDrop: '.adf-empty-list_template .adf-empty-folder',
|
||||||
|
|
||||||
|
emptyListTitle: 'div .empty-list__title',
|
||||||
|
emptyListText: 'div .empty-list__text'
|
||||||
};
|
};
|
||||||
|
|
||||||
private head: ElementFinder = this.component.element(by.css(DataTable.selectors.head));
|
head: ElementFinder = this.component.element(by.css(DataTable.selectors.head));
|
||||||
private body: ElementFinder = this.component.element(by.css(DataTable.selectors.body));
|
body: ElementFinder = this.component.element(by.css(DataTable.selectors.body));
|
||||||
|
emptyList: ElementFinder = this.component.element(by.css(DataTable.selectors.emptyListContainer));
|
||||||
|
emptyFolderDragAndDrop: ElementFinder = this.component.element(by.css(DataTable.selectors.emptyFolderDragAndDrop));
|
||||||
|
emptyListTitle: ElementFinder = this.component.element(by.css(DataTable.selectors.emptyListTitle));
|
||||||
|
emptyListText: ElementArrayFinder = this.component.all(by.css(DataTable.selectors.emptyListText));
|
||||||
|
|
||||||
constructor(ancestor?: ElementFinder) {
|
constructor(ancestor?: ElementFinder) {
|
||||||
super(DataTable.selectors.root, ancestor);
|
super(DataTable.selectors.root, ancestor);
|
||||||
@ -46,7 +56,9 @@ export class DataTable extends Component {
|
|||||||
return browser.wait(EC.presenceOf(this.head), BROWSER_WAIT_TIMEOUT);
|
return browser.wait(EC.presenceOf(this.head), BROWSER_WAIT_TIMEOUT);
|
||||||
}
|
}
|
||||||
|
|
||||||
// waitForEmptyState() {}
|
waitForEmptyState() {
|
||||||
|
return browser.wait(EC.presenceOf(this.emptyList), BROWSER_WAIT_TIMEOUT);
|
||||||
|
}
|
||||||
|
|
||||||
// Header/Column methods
|
// Header/Column methods
|
||||||
getColumnHeaders(): ElementArrayFinder {
|
getColumnHeaders(): ElementArrayFinder {
|
||||||
@ -107,4 +119,37 @@ export class DataTable extends Component {
|
|||||||
|
|
||||||
return click.perform();
|
return click.perform();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// empty state methods
|
||||||
|
isEmptyList(): promise.Promise<boolean> {
|
||||||
|
return this.emptyList.isPresent();
|
||||||
|
}
|
||||||
|
|
||||||
|
isEmptyWithDragAndDrop(): promise.Promise<boolean> {
|
||||||
|
return this.emptyFolderDragAndDrop.isDisplayed();
|
||||||
|
}
|
||||||
|
|
||||||
|
getEmptyDragAndDropText(): promise.Promise<string> {
|
||||||
|
return this.isEmptyWithDragAndDrop()
|
||||||
|
.then(() => {
|
||||||
|
return this.emptyFolderDragAndDrop.getText();
|
||||||
|
})
|
||||||
|
.catch(() => '');
|
||||||
|
}
|
||||||
|
|
||||||
|
getEmptyStateTitle(): promise.Promise<string> {
|
||||||
|
return this.isEmptyList()
|
||||||
|
.then(() => {
|
||||||
|
return this.emptyListTitle.getText();
|
||||||
|
})
|
||||||
|
.catch(() => '');
|
||||||
|
}
|
||||||
|
|
||||||
|
getEmptyStateText(): promise.Promise<string> {
|
||||||
|
return this.isEmptyList()
|
||||||
|
.then(() => {
|
||||||
|
return this.emptyListText.getText();
|
||||||
|
})
|
||||||
|
.catch(() => '');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -47,12 +47,10 @@ export class LoginPage extends Page {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
loginWith(username: string, password?: string): promise.Promise<void> {
|
loginWith(username: string, password?: string): promise.Promise<any> {
|
||||||
const pass = password || username;
|
const pass = password || username;
|
||||||
return this.login.enterCredentials(username, pass).submit()
|
return this.login.enterCredentials(username, pass).submit()
|
||||||
.then(() => {
|
.then(() => super.waitForApp());
|
||||||
super.waitForApp();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
loginWithAdmin(): promise.Promise<any> {
|
loginWithAdmin(): promise.Promise<any> {
|
||||||
|
103
e2e/suites/list-views/empty-list.test.ts
Normal file
103
e2e/suites/list-views/empty-list.test.ts
Normal file
@ -0,0 +1,103 @@
|
|||||||
|
/*!
|
||||||
|
* @license
|
||||||
|
* Copyright 2017 Alfresco Software, Ltd.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { browser, by } from 'protractor';
|
||||||
|
|
||||||
|
import { APP_ROUTES, SITE_VISIBILITY, SITE_ROLES, SIDEBAR_LABELS } from '../../configs';
|
||||||
|
import { LoginPage, LogoutPage, BrowsingPage } from '../../pages/pages';
|
||||||
|
import { Utils } from '../../utilities/utils';
|
||||||
|
import { RepoClient, NodeContentTree } from '../../utilities/repo-client/repo-client';
|
||||||
|
|
||||||
|
describe('Empty list views', () => {
|
||||||
|
const username = `user-${Utils.random()}`;
|
||||||
|
const password = username;
|
||||||
|
|
||||||
|
const apis = {
|
||||||
|
admin: new RepoClient(),
|
||||||
|
user: new RepoClient(username, password)
|
||||||
|
};
|
||||||
|
|
||||||
|
const loginPage = new LoginPage();
|
||||||
|
const logoutPage = new LogoutPage();
|
||||||
|
const page = new BrowsingPage();
|
||||||
|
const { dataTable } = page;
|
||||||
|
|
||||||
|
beforeAll(done => {
|
||||||
|
apis.admin.people.createUser(username)
|
||||||
|
.then(() => loginPage.load())
|
||||||
|
.then(() => loginPage.loginWith(username))
|
||||||
|
.then(done);
|
||||||
|
});
|
||||||
|
|
||||||
|
afterAll(done => {
|
||||||
|
logoutPage.load().then(done);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('empty Personal Files', () => {
|
||||||
|
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES)
|
||||||
|
.then(() => {
|
||||||
|
expect(dataTable.isEmptyList()).toBe(true, 'list is not empty');
|
||||||
|
expect(dataTable.getEmptyDragAndDropText()).toContain('Drag and drop');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('empty File Libraries', () => {
|
||||||
|
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FILE_LIBRARIES)
|
||||||
|
.then(() => {
|
||||||
|
expect(dataTable.isEmptyList()).toBe(true, 'list is not empty');
|
||||||
|
expect(dataTable.getEmptyStateTitle()).toContain(`You aren't a member of any File Libraries yet`);
|
||||||
|
expect(dataTable.getEmptyStateText()).toContain('Join sites to upload, view, and share files.');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('empty Shared Files', () => {
|
||||||
|
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.SHARED_FILES)
|
||||||
|
.then(() => {
|
||||||
|
expect(dataTable.isEmptyList()).toBe(true, 'list is not empty');
|
||||||
|
expect(dataTable.getEmptyStateTitle()).toContain('No shared files or folders');
|
||||||
|
expect(dataTable.getEmptyStateText()).toContain('Items you share using the Share option are shown here.');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('empty Recent Files', () => {
|
||||||
|
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.RECENT_FILES)
|
||||||
|
.then(() => {
|
||||||
|
expect(dataTable.isEmptyList()).toBe(true, 'list is not empty');
|
||||||
|
expect(dataTable.getEmptyStateTitle()).toContain('No recent files');
|
||||||
|
expect(dataTable.getEmptyStateText()).toContain('Items you upload or edit in the last 30 days are shown here.');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('empty Favorites', () => {
|
||||||
|
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.FAVORITES)
|
||||||
|
.then(() => {
|
||||||
|
expect(dataTable.isEmptyList()).toBe(true, 'list is not empty');
|
||||||
|
expect(dataTable.getEmptyStateTitle()).toContain('No favorite files or folders');
|
||||||
|
expect(dataTable.getEmptyStateText()).toContain('Favorite items that you want to easily find later.');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('empty Trash', () => {
|
||||||
|
page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.TRASH)
|
||||||
|
.then(() => {
|
||||||
|
expect(dataTable.isEmptyList()).toBe(true, 'list is not empty');
|
||||||
|
expect(dataTable.getEmptyStateTitle()).toContain('Trash is empty');
|
||||||
|
expect(dataTable.getEmptyStateText()).toContain('Items you delete are moved to the Trash.');
|
||||||
|
expect(dataTable.getEmptyStateText()).toContain('Empty Trash to permanently delete items.');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
Loading…
x
Reference in New Issue
Block a user