mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2026-09-09 18:02:54 +00:00
[ACA-1759] use async / await in test suites (#667)
* use async / await in authentication suites * use async / await on application suites * use async / await in navigation suites * use async / await in actions suites
This commit is contained in:
committed by
Denys Vuika
parent
b2b0da4c86
commit
341b93c2fa
@@ -30,56 +30,44 @@ import { RepoClient } from '../../utilities/repo-client/repo-client';
|
||||
import { Utils } from '../../utilities/utils';
|
||||
|
||||
describe('General', () => {
|
||||
const loginPage = new LoginPage();
|
||||
const logoutPage = new LogoutPage();
|
||||
const page = new BrowsingPage();
|
||||
const createDialog = new CreateOrEditFolderDialog();
|
||||
const adminApi = new RepoClient();
|
||||
const { nodes: nodesApi, authentication: authApi } = adminApi;
|
||||
const folder = `folder-${Utils.random()}`;
|
||||
let folderId;
|
||||
xit('');
|
||||
|
||||
describe('on session expire', () => {
|
||||
beforeAll(async () => {
|
||||
folderId = (await nodesApi.createFolder(folder)).entry.id;
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
await nodesApi.deleteNodeById(folderId);
|
||||
await logoutPage.load();
|
||||
});
|
||||
|
||||
it('should redirect user to login page' , async () => {
|
||||
await loginPage.loginWithAdmin();
|
||||
|
||||
await page.sidenav.openCreateDialog();
|
||||
await createDialog.waitForDialogToOpen();
|
||||
await createDialog.enterName(folder);
|
||||
|
||||
await authApi.logout();
|
||||
|
||||
await createDialog.clickCreate();
|
||||
expect(await browser.getTitle()).toContain('Sign in');
|
||||
});
|
||||
|
||||
it('should close opened dialogs', async () => {
|
||||
await loginPage.loginWithAdmin();
|
||||
|
||||
await page.sidenav.openCreateDialog();
|
||||
await createDialog.waitForDialogToOpen();
|
||||
await createDialog.enterName(folder);
|
||||
|
||||
await authApi.logout();
|
||||
|
||||
await createDialog.clickCreate();
|
||||
const message = await page.getSnackBarMessage();
|
||||
expect(message).toEqual('The action was unsuccessful. Try again or contact your IT Team.');
|
||||
|
||||
await createDialog.waitForDialogToClose();
|
||||
expect(createDialog.component.isPresent()).not.toBe(true, 'dialog is present');
|
||||
});
|
||||
const loginPage = new LoginPage();
|
||||
const logoutPage = new LogoutPage();
|
||||
const page = new BrowsingPage();
|
||||
const createDialog = new CreateOrEditFolderDialog();
|
||||
const adminApi = new RepoClient();
|
||||
const { nodes: nodesApi, authentication: authApi } = adminApi;
|
||||
const folder = `folder-${Utils.random()}`;
|
||||
let folderId;
|
||||
xit('');
|
||||
|
||||
describe('on session expire', () => {
|
||||
beforeAll(async (done) => {
|
||||
folderId = (await nodesApi.createFolder(folder)).entry.id;
|
||||
done();
|
||||
});
|
||||
|
||||
afterAll(async (done) => {
|
||||
await nodesApi.deleteNodeById(folderId);
|
||||
await logoutPage.load();
|
||||
done();
|
||||
});
|
||||
|
||||
it('should close opened dialogs - [C286473]', async () => {
|
||||
await loginPage.loginWithAdmin();
|
||||
|
||||
await page.sidenav.openCreateDialog();
|
||||
await createDialog.waitForDialogToOpen();
|
||||
await createDialog.enterName(folder);
|
||||
|
||||
await authApi.logout();
|
||||
|
||||
await createDialog.clickCreate();
|
||||
expect(await browser.getTitle()).toContain('Sign in');
|
||||
const message = await page.getSnackBarMessage();
|
||||
expect(message).toEqual('The action was unsuccessful. Try again or contact your IT Team.');
|
||||
|
||||
await createDialog.waitForDialogToClose();
|
||||
expect(createDialog.component.isPresent()).not.toBe(true, 'dialog is present');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -32,148 +32,109 @@ import { Utils } from '../../utilities/utils';
|
||||
|
||||
|
||||
describe('Page titles', () => {
|
||||
const loginPage = new LoginPage();
|
||||
const logoutPage = new LogoutPage();
|
||||
const page = new BrowsingPage();
|
||||
const adminApi = new RepoClient();
|
||||
const { nodes: nodesApi } = adminApi;
|
||||
const file = `file-${Utils.random()}.txt`; let fileId;
|
||||
const header = page.header;
|
||||
const loginPage = new LoginPage();
|
||||
const logoutPage = new LogoutPage();
|
||||
const page = new BrowsingPage();
|
||||
const adminApi = new RepoClient();
|
||||
const { nodes: nodesApi } = adminApi;
|
||||
const file = `file-${Utils.random()}.txt`; let fileId;
|
||||
const header = page.header;
|
||||
|
||||
xit('');
|
||||
xit('');
|
||||
|
||||
|
||||
describe('on Login / Logout pages', () => {
|
||||
it('on Login page - [C217155]', () => {
|
||||
loginPage.load()
|
||||
.then(() => {
|
||||
expect(browser.getTitle()).toContain('Sign in');
|
||||
});
|
||||
});
|
||||
|
||||
it('after logout - [C217156]', () => {
|
||||
loginPage.loginWithAdmin()
|
||||
.then(() => page.signOut())
|
||||
.then(() => {
|
||||
expect(browser.getTitle()).toContain('Sign in');
|
||||
});
|
||||
});
|
||||
|
||||
it('when pressing Back after Logout - [C280414]', () => {
|
||||
loginPage.loginWithAdmin()
|
||||
.then(() => page.signOut())
|
||||
.then(() => browser.navigate().back())
|
||||
.then(() => {
|
||||
expect(browser.getTitle()).toContain('Sign in');
|
||||
});
|
||||
});
|
||||
describe('on Login / Logout pages', () => {
|
||||
it('on Login page - [C217155]', async () => {
|
||||
await loginPage.load();
|
||||
expect(await browser.getTitle()).toContain('Sign in');
|
||||
});
|
||||
|
||||
describe('on list views', () => {
|
||||
beforeAll(done => {
|
||||
loginPage.loginWithAdmin().then(done);
|
||||
});
|
||||
|
||||
afterAll(done => {
|
||||
logoutPage.load()
|
||||
.then(done);
|
||||
});
|
||||
|
||||
it('Personal Files page - [C217157]', () => {
|
||||
const label = SIDEBAR_LABELS.PERSONAL_FILES;
|
||||
|
||||
page.sidenav.navigateToLinkByLabel(label)
|
||||
.then(() => {
|
||||
expect(browser.getTitle()).toContain(label);
|
||||
});
|
||||
});
|
||||
|
||||
it('File Libraries page - [C217158]', () => {
|
||||
const label = SIDEBAR_LABELS.FILE_LIBRARIES;
|
||||
|
||||
page.sidenav.navigateToLinkByLabel(label)
|
||||
.then(() => {
|
||||
expect(browser.getTitle()).toContain(label);
|
||||
});
|
||||
});
|
||||
|
||||
it('Shared Files page - [C217159]', () => {
|
||||
const label = SIDEBAR_LABELS.SHARED_FILES;
|
||||
|
||||
page.sidenav.navigateToLinkByLabel(label)
|
||||
.then(() => {
|
||||
expect(browser.getTitle()).toContain(label);
|
||||
});
|
||||
});
|
||||
|
||||
it('Recent Files page - [C217160]', () => {
|
||||
const label = SIDEBAR_LABELS.RECENT_FILES;
|
||||
|
||||
page.sidenav.navigateToLinkByLabel(label)
|
||||
.then(() => {
|
||||
expect(browser.getTitle()).toContain(label);
|
||||
});
|
||||
});
|
||||
|
||||
it('Favorites page - [C217161]', () => {
|
||||
const label = SIDEBAR_LABELS.FAVORITES;
|
||||
|
||||
page.sidenav.navigateToLinkByLabel(label)
|
||||
.then(() => {
|
||||
expect(browser.getTitle()).toContain(label);
|
||||
});
|
||||
});
|
||||
|
||||
it('Trash page - [C217162]', () => {
|
||||
const label = SIDEBAR_LABELS.TRASH;
|
||||
|
||||
page.sidenav.navigateToLinkByLabel(label)
|
||||
.then(() => {
|
||||
expect(browser.getTitle()).toContain(label);
|
||||
});
|
||||
});
|
||||
|
||||
it('after logout - [C217156]', async () => {
|
||||
await loginPage.loginWithAdmin();
|
||||
await page.signOut();
|
||||
expect(await browser.getTitle()).toContain('Sign in');
|
||||
});
|
||||
|
||||
describe('on File Viewer', () => {
|
||||
beforeAll( async (done) => {
|
||||
fileId = (await nodesApi.createFile(file)).entry.id;
|
||||
await loginPage.loginWithAdmin();
|
||||
done();
|
||||
});
|
||||
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');
|
||||
});
|
||||
});
|
||||
|
||||
afterAll( async (done) => {
|
||||
await logoutPage.load();
|
||||
await adminApi.nodes.deleteNodeById(fileId);
|
||||
done();
|
||||
});
|
||||
|
||||
it('File Preview page - [C280415]', async () => {
|
||||
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES);
|
||||
await page.dataTable.waitForHeader();
|
||||
await page.dataTable.doubleClickOnRowByName(file);
|
||||
expect(await browser.getTitle()).toContain(PAGE_TITLES.VIEWER);
|
||||
});
|
||||
describe('on app pages', () => {
|
||||
beforeAll(async (done) => {
|
||||
fileId = (await nodesApi.createFile(file)).entry.id;
|
||||
await loginPage.loginWithAdmin();
|
||||
done();
|
||||
});
|
||||
|
||||
describe ('on Search query', () => {
|
||||
beforeAll( async (done) => {
|
||||
await loginPage.loginWithAdmin();
|
||||
done();
|
||||
});
|
||||
|
||||
afterAll( async (done) => {
|
||||
await logoutPage.load();
|
||||
done();
|
||||
});
|
||||
|
||||
it('Search Results page - [C280413]', async () => {
|
||||
await header.waitForSearchButton();
|
||||
await header.searchButton.click();
|
||||
await page.dataTable.waitForHeader();
|
||||
await header.waitForSearchBar();
|
||||
await header.searchForText(file);
|
||||
expect(await browser.getTitle()).toContain(PAGE_TITLES.SEARCH);
|
||||
});
|
||||
afterAll(async (done) => {
|
||||
await Promise.all([
|
||||
logoutPage.load(),
|
||||
adminApi.nodes.deleteNodeById(fileId)
|
||||
]);
|
||||
done();
|
||||
});
|
||||
|
||||
it('Personal Files page - [C217157]', async () => {
|
||||
const label = SIDEBAR_LABELS.PERSONAL_FILES;
|
||||
|
||||
await page.sidenav.navigateToLinkByLabel(label);
|
||||
expect(await browser.getTitle()).toContain(label);
|
||||
});
|
||||
|
||||
it('File Libraries page - [C217158]', async () => {
|
||||
const label = SIDEBAR_LABELS.FILE_LIBRARIES;
|
||||
|
||||
await page.sidenav.navigateToLinkByLabel(label);
|
||||
expect(await browser.getTitle()).toContain(label);
|
||||
});
|
||||
|
||||
it('Shared Files page - [C217159]', async () => {
|
||||
const label = SIDEBAR_LABELS.SHARED_FILES;
|
||||
|
||||
await page.sidenav.navigateToLinkByLabel(label);
|
||||
expect(await browser.getTitle()).toContain(label);
|
||||
});
|
||||
|
||||
it('Recent Files page - [C217160]', async () => {
|
||||
const label = SIDEBAR_LABELS.RECENT_FILES;
|
||||
|
||||
await page.sidenav.navigateToLinkByLabel(label);
|
||||
expect(await browser.getTitle()).toContain(label);
|
||||
});
|
||||
|
||||
it('Favorites page - [C217161]', async () => {
|
||||
const label = SIDEBAR_LABELS.FAVORITES;
|
||||
|
||||
await page.sidenav.navigateToLinkByLabel(label);
|
||||
expect(await browser.getTitle()).toContain(label);
|
||||
});
|
||||
|
||||
it('Trash page - [C217162]', async () => {
|
||||
const label = SIDEBAR_LABELS.TRASH;
|
||||
|
||||
await page.sidenav.navigateToLinkByLabel(label);
|
||||
expect(await browser.getTitle()).toContain(label);
|
||||
});
|
||||
|
||||
it('File Preview page - [C280415]', async () => {
|
||||
await page.sidenav.navigateToLinkByLabel(SIDEBAR_LABELS.PERSONAL_FILES);
|
||||
await page.dataTable.waitForHeader();
|
||||
await page.dataTable.doubleClickOnRowByName(file);
|
||||
expect(await browser.getTitle()).toContain(PAGE_TITLES.VIEWER);
|
||||
await Utils.pressEscape();
|
||||
});
|
||||
|
||||
it('Search Results page - [C280413]', async () => {
|
||||
await header.waitForSearchButton();
|
||||
await header.searchButton.click();
|
||||
await page.dataTable.waitForHeader();
|
||||
await header.waitForSearchBar();
|
||||
await header.searchForText(file);
|
||||
expect(await browser.getTitle()).toContain(PAGE_TITLES.SEARCH);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user