Skip to content

Commit

Permalink
[ACA-2387] rebalance suites (#1107)
Browse files Browse the repository at this point in the history
* rebalance suites

* try to fix flaky test

* fix more related tests

* fix retry

* reorganise some more suites

* move file to another suite
  • Loading branch information
adinapitul authored and Martin Muller committed May 15, 2019
1 parent 39f528a commit 1c18f6c
Show file tree
Hide file tree
Showing 6 changed files with 64 additions and 32 deletions.
35 changes: 12 additions & 23 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,26 +36,15 @@ jobs:
- name: 'Prepare dist cache'
script: npm run build.e2e
- stage: e2e
name: Test Suite authentication
script: SUITE="--suite authentication" npm run e2e:docker
- name: Test Suite listViews
script: SUITE="--suite listViews" npm run e2e:docker
- name: Test Suite application
script: SUITE="--suite application" npm run e2e:docker
- name: Test Suite navigation
script: SUITE="--suite navigation" npm run e2e:docker
- name: Test Suite pagination
script: SUITE="--suite pagination" npm run e2e:docker
- name: Test Suite search
script: SUITE="--suite search" npm run e2e:docker
- name: Test Suite actionsAvailable
script: SUITE="--suite actionsAvailable" npm run e2e:docker
- stage: e2e
name: Test Suite actions
script: SUITE="--suite actions" npm run e2e:docker
- name: Test Suite viewer
script: SUITE="--suite viewer" npm run e2e:docker
- name: Test Suite infoDrawer
script: SUITE="--suite infoDrawer" npm run e2e:docker
- name: Test Suite extensions
script: SUITE="--suite extensions" npm run e2e:docker
name: Test Suite appNavigation
script: SUITE="--suite authentication,listViews,navigation,application,pagination" npm run e2e:docker
- name: Test Suite search&actionsAvailable
script: SUITE="--suite search,actionsAvailable" npm run e2e:docker
- name: Test Suite addRemoveContent
script: SUITE="--suite addRemoveContent" npm run e2e:docker
- name: Test Suite manageContent
script: SUITE="--suite manageContent" npm run e2e:docker
- name: Test Suite sharingContent&markFavorite
script: SUITE="--suite sharingContent" npm run e2e:docker
- name: Test Suite viewContent&metadata&extensions
script: SUITE="--suite viewer,infoDrawer,extensions" npm run e2e:docker
3 changes: 0 additions & 3 deletions e2e/suites/actions/upload-new-version.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,6 @@ describe('Upload new version', () => {
});

afterEach(async (done) => {
// await Utils.pressEscape();
await page.refresh();
done();
});
Expand Down Expand Up @@ -411,7 +410,6 @@ describe('Upload new version', () => {
});

afterEach(async (done) => {
// await Utils.pressEscape();
await page.refresh();
done();
});
Expand Down Expand Up @@ -559,7 +557,6 @@ describe('Upload new version', () => {
});

afterEach(async (done) => {
// await Utils.pressEscape();
await page.refresh();
done();
});
Expand Down
File renamed without changes.
10 changes: 5 additions & 5 deletions e2e/suites/viewer/viewer-actions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ describe('Viewer actions', () => {
await viewer.waitForViewerToOpen();
await toolbar.clickMoreActionsCancelEditing();

expect(await apis.user.nodes.isFileLockedWrite(fileForCancelEditingId)).toBe(false, `${fileForCancelEditing} is still locked`);
expect(await apis.user.nodes.isFileLockedWriteWithRetry(fileForCancelEditingId, false)).toBe(false, `${fileForCancelEditing} is still locked`);
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not open');
});

Expand Down Expand Up @@ -506,7 +506,7 @@ describe('Viewer actions', () => {
await viewer.waitForViewerToOpen();
await toolbar.clickMoreActionsCancelEditing();

expect(await apis.user.nodes.isFileLockedWrite(fileForCancelEditingId)).toBe(false, `${fileForCancelEditing} is still locked`);
expect(await apis.user.nodes.isFileLockedWriteWithRetry(fileForCancelEditingId, false)).toBe(false, `${fileForCancelEditing} is still locked`);
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not open');
});

Expand Down Expand Up @@ -739,7 +739,7 @@ describe('Viewer actions', () => {
await viewer.waitForViewerToOpen();
await toolbar.clickMoreActionsCancelEditing();

expect(await apis.user.nodes.isFileLockedWrite(fileForCancelEditingId)).toBe(false, `${fileForCancelEditing} is still locked`);
expect(await apis.user.nodes.isFileLockedWriteWithRetry(fileForCancelEditingId, false)).toBe(false, `${fileForCancelEditing} is still locked`);
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not open');
});

Expand Down Expand Up @@ -971,7 +971,7 @@ describe('Viewer actions', () => {
await viewer.waitForViewerToOpen();
await toolbar.clickMoreActionsCancelEditing();

expect(await apis.user.nodes.isFileLockedWrite(fileForCancelEditingId)).toBe(false, `${fileForCancelEditing} is still locked`);
expect(await apis.user.nodes.isFileLockedWriteWithRetry(fileForCancelEditingId, false)).toBe(false, `${fileForCancelEditing} is still locked`);
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not open');
});

Expand Down Expand Up @@ -1205,7 +1205,7 @@ describe('Viewer actions', () => {
await viewer.waitForViewerToOpen();
await toolbar.clickMoreActionsCancelEditing();

expect(await apis.user.nodes.isFileLockedWrite(fileForCancelEditingId)).toBe(false, `${fileForCancelEditing} is still locked`);
expect(await apis.user.nodes.isFileLockedWriteWithRetry(fileForCancelEditingId, false)).toBe(false, `${fileForCancelEditing} is still locked`);
expect(await viewer.isViewerOpened()).toBe(true, 'Viewer is not open');
});

Expand Down
23 changes: 23 additions & 0 deletions e2e/utilities/repo-client/apis/nodes/nodes-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import { RepoApi } from '../repo-api';
import { NodeBodyCreate } from './node-body-create';
import { NodeContentTree, flattenNodeContentTree } from './node-content-tree';
import { NodesApi as AdfNodeApi, NodeBodyLock} from '@alfresco/js-api';
import { Utils } from '../../../../utilities/utils';

export class NodesApi extends RepoApi {
nodesApi = new AdfNodeApi(this.alfrescoJsApi);
Expand Down Expand Up @@ -264,6 +265,28 @@ export class NodesApi extends RepoApi {
return (await this.getLockType(nodeId)) === 'WRITE_LOCK';
}

async isFileLockedWriteWithRetry(nodeId: string, expect: boolean) {
const data = {
expect: expect,
retry: 5
};
let isLocked;
try {
const locked = async () => {
isLocked = (await this.getLockType(nodeId)) === 'WRITE_LOCK';
if ( isLocked !== data.expect ) {
return Promise.reject(isLocked);
} else {
return Promise.resolve(isLocked);
}
}
return await Utils.retryCall(locked, data.retry);
} catch (error) {
console.log('-----> catch isLockedWriteWithRetry: ', error);
}
return isLocked;
}

async isFileLockedByName(fileName: string, parentId: string) {
const id = await this.getNodeIdFromParent(fileName, parentId);
return await this.isFileLockedWrite(id);
Expand Down
25 changes: 24 additions & 1 deletion protractor.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,30 @@ exports.config = {
pagination: './e2e/suites/pagination/*.test.ts',
search: './e2e/suites/search/*.test.ts',
actionsAvailable: './e2e/suites/actions-available/*.test.ts',
actions: './e2e/suites/actions/*.test.ts',
addRemoveContent: [
'./e2e/suites/actions/new-menu.test.ts',
'./e2e/suites/actions/create-folder.test.ts',
'./e2e/suites/actions/create-library.test.ts',
'./e2e/suites/actions/upload-file.test.ts',
'./e2e/suites/actions/upload-new-version.test.ts',
'./e2e/suites/actions/delete-undo-delete.test.ts',
'./e2e/suites/actions/permanently-delete.test.ts',
'./e2e/suites/actions/restore.test.ts',
'./e2e/suites/actions/download.test.ts'
],
manageContent: [
'./e2e/suites/actions/copy.test.ts',
'./e2e/suites/actions/move.test.ts',
'./e2e/suites/actions/library-actions.test.ts',
'./e2e/suites/actions/edit-folder.test.ts',
'./e2e/suites/actions/edit-offline.test.ts'
],
sharingContent: [
'./e2e/suites/actions/mark-favorite.test.ts',
'./e2e/suites/actions/share-file.test.ts',
'./e2e/suites/actions/unshare-file-search-results.test.ts',
'./e2e/suites/actions/unshare-file.test.ts'
],
viewer: './e2e/suites/viewer/*.test.ts',
infoDrawer: './e2e/suites/info-drawer/*.test.ts',
extensions: './e2e/suites/extensions/*.test.ts'
Expand Down

0 comments on commit 1c18f6c

Please sign in to comment.