add tests for Upload New Version (#960)

This commit is contained in:
Adina Parpalita
2019-02-20 09:13:15 +02:00
committed by Cilibiu Bogdan
parent 9ceefff5e6
commit a2df75a6dc
18 changed files with 1837 additions and 84 deletions

View File

@@ -58,6 +58,21 @@ export class NodesApi extends RepoApi {
return '';
}
async getFileVersionType(nodeId: string) {
const prop = await this.getNodeProperty(nodeId, 'cm:versionType');
if ( prop ) {
return prop;
}
return '';
}
async getFileVersionLabel(nodeId: string) {
const prop = await this.getNodeProperty(nodeId, 'cm:versionLabel');
if ( prop ) {
return prop;
}
return '';
}
async getSharedId(nodeId: string) {
return await this.getNodeProperty(nodeId, 'qshare:sharedId');
@@ -121,7 +136,7 @@ export class NodesApi extends RepoApi {
return await this.createNode('cm:content', name, parentId, title, description, imageProps);
}
async createNode(nodeType: string, name: string, parentId: string = '-my-', title: string = '', description: string = '', imageProps: any = null) {
async createNode(nodeType: string, name: string, parentId: string = '-my-', title: string = '', description: string = '', imageProps: any = null, majorVersion: boolean = true) {
const nodeBody = {
name,
nodeType,
@@ -135,11 +150,11 @@ export class NodesApi extends RepoApi {
}
await this.apiAuth();
return await this.nodesApi.createNode(parentId, nodeBody);
return await this.nodesApi.createNode(parentId, nodeBody, { majorVersion: true });
}
async createFile(name: string, parentId: string = '-my-', title: string = '', description: string = '') {
return await this.createNode('cm:content', name, parentId, title, description);
async createFile(name: string, parentId: string = '-my-', title: string = '', description: string = '', majorVersion: boolean = true) {
return await this.createNode('cm:content', name, parentId, title, description, majorVersion);
}
async createImage(name: string, parentId: string = '-my-', title: string = '', description: string = '') {
@@ -220,4 +235,17 @@ export class NodesApi extends RepoApi {
await this.apiAuth();
return await this.nodesApi.unlockNode(nodeId);
}
async getLockType(nodeId: string) {
return await this.getNodeProperty(nodeId, 'cm:lockType');
}
async getLockOwner(nodeId: string) {
return await this.getNodeProperty(nodeId, 'cm:lockOwner');
}
async isFileLockedWrite(nodeId: string) {
await this.apiAuth();
return (await this.getLockType(nodeId)) === 'WRITE_LOCK';
}
}

View File

@@ -23,11 +23,13 @@
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
import { browser, protractor, promise, ElementFinder, ExpectedConditions as EC } from 'protractor';
import { browser, protractor, promise, ElementFinder, ExpectedConditions as EC, by } from 'protractor';
import { BROWSER_WAIT_TIMEOUT, E2E_ROOT_PATH, EXTENSIBILITY_CONFIGS } from '../configs';
const path = require('path');
const fs = require('fs');
export class Utils {
static string257 = 'assembly doctor offender limit clearance inspiration baker fraud active apples trait brainstorm concept breaks down presidential \
reluctance summary communication patience books opponent banana economist head develop project swear unanimous read conservation';
@@ -130,4 +132,10 @@ export class Utils {
return new Date(date).toLocaleDateString('en-US');
}
static async uploadFileNewVersion(fileFromOS: string) {
const el = browser.element(by.id('app-upload-file-version'));
await el.sendKeys(`${E2E_ROOT_PATH}/resources/test-files/${fileFromOS}`);
}
}