mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-26 17:24:56 +00:00
[ADF-3535] Create automated test for Unshared file (#3773)
This commit is contained in:
parent
e99273139a
commit
decfa37003
98
e2e/content-services/unshare_file.e2e.ts
Normal file
98
e2e/content-services/unshare_file.e2e.ts
Normal file
@ -0,0 +1,98 @@
|
|||||||
|
/*!
|
||||||
|
* @license
|
||||||
|
* Copyright 2016 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 LoginPage = require('../pages/adf/loginPage');
|
||||||
|
import ContentServicesPage = require('../pages/adf/contentServicesPage');
|
||||||
|
import ContentListPage = require('../pages/adf/dialog/contentList');
|
||||||
|
import ErrorPage = require('../pages/adf/errorPage');
|
||||||
|
import { ShareDialog } from '../pages/adf/dialog/shareDialog';
|
||||||
|
|
||||||
|
import AcsUserModel = require('../models/ACS/acsUserModel');
|
||||||
|
import FileModel = require('../models/ACS/fileModel');
|
||||||
|
|
||||||
|
import TestConfig = require('../test.config');
|
||||||
|
import resources = require('../util/resources');
|
||||||
|
|
||||||
|
import AlfrescoApi = require('alfresco-js-api-node');
|
||||||
|
import { UploadActions } from '../actions/ACS/upload.actions';
|
||||||
|
import { browser } from "protractor";
|
||||||
|
|
||||||
|
describe('Unshare file', () => {
|
||||||
|
|
||||||
|
const loginPage = new LoginPage();
|
||||||
|
const contentServicesPage = new ContentServicesPage();
|
||||||
|
const contentListPage = new ContentListPage();
|
||||||
|
const errorPage = new ErrorPage();
|
||||||
|
const shareDialog = new ShareDialog();
|
||||||
|
|
||||||
|
let acsUser = new AcsUserModel();
|
||||||
|
let uploadActions = new UploadActions();
|
||||||
|
|
||||||
|
let pngFileModel = new FileModel({
|
||||||
|
'name': resources.Files.ADF_DOCUMENTS.PNG.file_name,
|
||||||
|
'location': resources.Files.ADF_DOCUMENTS.PNG.file_location
|
||||||
|
});
|
||||||
|
|
||||||
|
let nodeId;
|
||||||
|
|
||||||
|
beforeAll(async(done) => {
|
||||||
|
this.alfrescoJsApi = new AlfrescoApi({
|
||||||
|
provider: 'ECM',
|
||||||
|
hostEcm: TestConfig.adf.url
|
||||||
|
});
|
||||||
|
|
||||||
|
await this.alfrescoJsApi.login(TestConfig.adf.adminEmail, TestConfig.adf.adminPassword);
|
||||||
|
|
||||||
|
await this.alfrescoJsApi.core.peopleApi.addPerson(acsUser);
|
||||||
|
|
||||||
|
await this.alfrescoJsApi.login(acsUser.id, acsUser.password);
|
||||||
|
|
||||||
|
let pngUploadedFile = await uploadActions.uploadFile(this.alfrescoJsApi, pngFileModel.location, pngFileModel.name, '-my-');
|
||||||
|
|
||||||
|
nodeId = pngUploadedFile.entry.id;
|
||||||
|
|
||||||
|
loginPage.loginToContentServicesUsingUserModel(acsUser);
|
||||||
|
|
||||||
|
contentServicesPage.navigateToDocumentList();
|
||||||
|
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
|
||||||
|
afterAll(async(done) =>{
|
||||||
|
await uploadActions.deleteFilesOrFolder(this.alfrescoJsApi, nodeId);
|
||||||
|
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('[C280556] Unshared file should show 404 page', async()=> {
|
||||||
|
contentListPage.clickRowToSelect(pngFileModel.name);
|
||||||
|
|
||||||
|
contentServicesPage.clickShareButton();
|
||||||
|
|
||||||
|
shareDialog.checkDialogIsDisplayed();
|
||||||
|
shareDialog.clickShareToggle();
|
||||||
|
shareDialog.checkShareLinkIsDisplayed();
|
||||||
|
|
||||||
|
let sharedLink = await shareDialog.getShareLink();
|
||||||
|
|
||||||
|
shareDialog.clickShareToggle();
|
||||||
|
|
||||||
|
browser.get(sharedLink);
|
||||||
|
|
||||||
|
errorPage.checkErrorPage();
|
||||||
|
});
|
||||||
|
});
|
@ -59,6 +59,7 @@ var ContentServicesPage = function () {
|
|||||||
var cardViewContainer = element(by.css("div.document-list-container div.adf-data-table-card"));
|
var cardViewContainer = element(by.css("div.document-list-container div.adf-data-table-card"));
|
||||||
var copyButton = element(by.css('button[data-automation-id="content-node-selector-actions-choose"]'));
|
var copyButton = element(by.css('button[data-automation-id="content-node-selector-actions-choose"]'));
|
||||||
var searchInputElement = element(by.css('input[data-automation-id="content-node-selector-search-input"'));
|
var searchInputElement = element(by.css('input[data-automation-id="content-node-selector-search-input"'));
|
||||||
|
var shareNodeButton = element(by.cssContainingText("mat-icon", " share "));
|
||||||
|
|
||||||
this.checkRecentFileToBeShowed = function () {
|
this.checkRecentFileToBeShowed = function () {
|
||||||
Util.waitUntilElementIsVisible(recentFiles);
|
Util.waitUntilElementIsVisible(recentFiles);
|
||||||
@ -513,51 +514,51 @@ var ContentServicesPage = function () {
|
|||||||
let iconRow = element(by.css(`.document-list-container div.adf-data-table-cell[filename="${fileName}"] img`));
|
let iconRow = element(by.css(`.document-list-container div.adf-data-table-cell[filename="${fileName}"] img`));
|
||||||
Util.waitUntilElementIsVisible(iconRow);
|
Util.waitUntilElementIsVisible(iconRow);
|
||||||
return iconRow;
|
return iconRow;
|
||||||
}
|
};
|
||||||
|
|
||||||
this.getRowIconImageUrl = async function(fileName) {
|
this.getRowIconImageUrl = async function(fileName) {
|
||||||
let iconRow = this.checkIconForRowIsDisplayed(fileName);
|
let iconRow = this.checkIconForRowIsDisplayed(fileName);
|
||||||
return iconRow.getAttribute('src');
|
return iconRow.getAttribute('src');
|
||||||
}
|
};
|
||||||
|
|
||||||
this.checkGridViewButtonIsVisible = function () {
|
this.checkGridViewButtonIsVisible = function () {
|
||||||
Util.waitUntilElementIsVisible(gridViewButton);
|
Util.waitUntilElementIsVisible(gridViewButton);
|
||||||
}
|
};
|
||||||
|
|
||||||
this.clickGridViewButton = function() {
|
this.clickGridViewButton = function() {
|
||||||
this.checkGridViewButtonIsVisible();
|
this.checkGridViewButtonIsVisible();
|
||||||
gridViewButton.click();
|
gridViewButton.click();
|
||||||
}
|
};
|
||||||
|
|
||||||
this.checkCardViewContainerIsDisplayed = function () {
|
this.checkCardViewContainerIsDisplayed = function () {
|
||||||
Util.waitUntilElementIsVisible(cardViewContainer);
|
Util.waitUntilElementIsVisible(cardViewContainer);
|
||||||
}
|
};
|
||||||
|
|
||||||
this.getCardElementShowedInPage = function() {
|
this.getCardElementShowedInPage = function() {
|
||||||
this.checkCardViewContainerIsDisplayed();
|
this.checkCardViewContainerIsDisplayed();
|
||||||
let actualCards = $$('div.document-list-container div.adf-data-table-card div.cell-value img').count();
|
let actualCards = $$('div.document-list-container div.adf-data-table-card div.cell-value img').count();
|
||||||
return actualCards;
|
return actualCards;
|
||||||
}
|
};
|
||||||
|
|
||||||
this.getDocumentCardIconForElement = function(elementName){
|
this.getDocumentCardIconForElement = function(elementName){
|
||||||
let elementIcon = element(by.css(`.document-list-container div.adf-data-table-cell[filename="${elementName}"] img`));
|
let elementIcon = element(by.css(`.document-list-container div.adf-data-table-cell[filename="${elementName}"] img`));
|
||||||
return elementIcon.getAttribute('src');
|
return elementIcon.getAttribute('src');
|
||||||
}
|
};
|
||||||
|
|
||||||
this.checkDocumentCardPropertyIsShowed = function(elementName, propertyName) {
|
this.checkDocumentCardPropertyIsShowed = function(elementName, propertyName) {
|
||||||
let elementProperty = element(by.css(`.document-list-container div.adf-data-table-cell[filename="${elementName}"][title="${propertyName}"]`));
|
let elementProperty = element(by.css(`.document-list-container div.adf-data-table-cell[filename="${elementName}"][title="${propertyName}"]`));
|
||||||
Util.waitUntilElementIsVisible(elementProperty);
|
Util.waitUntilElementIsVisible(elementProperty);
|
||||||
}
|
};
|
||||||
|
|
||||||
this.getAttributeValueForElement = function(elementName, propertyName) {
|
this.getAttributeValueForElement = function(elementName, propertyName) {
|
||||||
let elementSize = element(by.css(`.document-list-container div.adf-data-table-cell[filename="${elementName}"][title="${propertyName}"] span`));
|
let elementSize = element(by.css(`.document-list-container div.adf-data-table-cell[filename="${elementName}"][title="${propertyName}"] span`));
|
||||||
return elementSize.getText();
|
return elementSize.getText();
|
||||||
}
|
};
|
||||||
|
|
||||||
this.checkMenuIsShowedForElementIndex = function(elementIndex) {
|
this.checkMenuIsShowedForElementIndex = function(elementIndex) {
|
||||||
let elementMenu = element(by.css(`button[data-automation-id="action_menu_${elementIndex}"]`));
|
let elementMenu = element(by.css(`button[data-automation-id="action_menu_${elementIndex}"]`));
|
||||||
Util.waitUntilElementIsVisible(elementMenu);
|
Util.waitUntilElementIsVisible(elementMenu);
|
||||||
}
|
};
|
||||||
|
|
||||||
this.navigateToCardFolder = function(folderName) {
|
this.navigateToCardFolder = function(folderName) {
|
||||||
let folderCard = element(by.css(`.document-list-container div.image-table-cell.adf-data-table-cell[filename="${folderName}"]`));
|
let folderCard = element(by.css(`.document-list-container div.image-table-cell.adf-data-table-cell[filename="${folderName}"]`));
|
||||||
@ -565,13 +566,13 @@ var ContentServicesPage = function () {
|
|||||||
let folderSelected = element(by.css(`.adf-datatable-row.is-selected div[filename="${folderName}"].adf-data-table-cell--image`));
|
let folderSelected = element(by.css(`.adf-datatable-row.is-selected div[filename="${folderName}"].adf-data-table-cell--image`));
|
||||||
Util.waitUntilElementIsVisible(folderSelected);
|
Util.waitUntilElementIsVisible(folderSelected);
|
||||||
browser.actions().sendKeys(protractor.Key.ENTER).perform();
|
browser.actions().sendKeys(protractor.Key.ENTER).perform();
|
||||||
}
|
};
|
||||||
|
|
||||||
this.getGridViewSortingDropdown = function() {
|
this.getGridViewSortingDropdown = function() {
|
||||||
let sortingDropdown = element(by.css('mat-select[data-automation-id="grid-view-sorting"]'));
|
let sortingDropdown = element(by.css('mat-select[data-automation-id="grid-view-sorting"]'));
|
||||||
Util.waitUntilElementIsVisible(sortingDropdown);
|
Util.waitUntilElementIsVisible(sortingDropdown);
|
||||||
return sortingDropdown;
|
return sortingDropdown;
|
||||||
}
|
};
|
||||||
|
|
||||||
this.selectGridSortingFromDropdown = function(sortingChosen){
|
this.selectGridSortingFromDropdown = function(sortingChosen){
|
||||||
let dropdownSorting = this.getGridViewSortingDropdown();
|
let dropdownSorting = this.getGridViewSortingDropdown();
|
||||||
@ -579,28 +580,33 @@ var ContentServicesPage = function () {
|
|||||||
let optionToClick = element(by.css(`mat-option[data-automation-id="grid-view-sorting-${sortingChosen}"]`));
|
let optionToClick = element(by.css(`mat-option[data-automation-id="grid-view-sorting-${sortingChosen}"]`));
|
||||||
Util.waitUntilElementIsPresent(optionToClick);
|
Util.waitUntilElementIsPresent(optionToClick);
|
||||||
optionToClick.click();
|
optionToClick.click();
|
||||||
}
|
};
|
||||||
|
|
||||||
this.checkRowIsDisplayed = function(rowName){
|
this.checkRowIsDisplayed = function(rowName){
|
||||||
let row = contentList.getRowByRowName(rowName);
|
let row = contentList.getRowByRowName(rowName);
|
||||||
Util.waitUntilElementIsVisible(row);
|
Util.waitUntilElementIsVisible(row);
|
||||||
}
|
};
|
||||||
|
|
||||||
this.typeIntoNodeSelectorSearchField = function(text) {
|
this.typeIntoNodeSelectorSearchField = function(text) {
|
||||||
Util.waitUntilElementIsVisible(searchInputElement);
|
Util.waitUntilElementIsVisible(searchInputElement);
|
||||||
searchInputElement.sendKeys(text);
|
searchInputElement.sendKeys(text);
|
||||||
}
|
};
|
||||||
|
|
||||||
this.clickContentNodeSelectorResult = function(name){
|
this.clickContentNodeSelectorResult = function(name){
|
||||||
let resultElement = element.all(by.css(`div[data-automation-id="content-node-selector-content-list"] div[filename="${name}"`)).first();
|
let resultElement = element.all(by.css(`div[data-automation-id="content-node-selector-content-list"] div[filename="${name}"`)).first();
|
||||||
Util.waitUntilElementIsVisible(resultElement);
|
Util.waitUntilElementIsVisible(resultElement);
|
||||||
resultElement.click();
|
resultElement.click();
|
||||||
}
|
};
|
||||||
|
|
||||||
this.clickCopyButton = function(){
|
this.clickCopyButton = function(){
|
||||||
Util.waitUntilElementIsClickable(copyButton);
|
Util.waitUntilElementIsClickable(copyButton);
|
||||||
copyButton.click();
|
copyButton.click();
|
||||||
}
|
};
|
||||||
|
|
||||||
|
this.clickShareButton = function(){
|
||||||
|
Util.waitUntilElementIsClickable(shareNodeButton);
|
||||||
|
shareNodeButton.click();
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = ContentServicesPage;
|
module.exports = ContentServicesPage;
|
||||||
|
46
e2e/pages/adf/dialog/shareDialog.ts
Normal file
46
e2e/pages/adf/dialog/shareDialog.ts
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
/*!
|
||||||
|
* @license
|
||||||
|
* Copyright 2016 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 { element, by } from 'protractor';
|
||||||
|
import Util = require('../../../util/util');
|
||||||
|
|
||||||
|
export class ShareDialog {
|
||||||
|
|
||||||
|
dialogTitle = element(by.id('adf-share-title'));
|
||||||
|
shareToggle = element(by.id('adf-share-toggle'));
|
||||||
|
shareLink = element(by.id('adf-share-link'));
|
||||||
|
|
||||||
|
checkDialogIsDisplayed() {
|
||||||
|
return Util.waitUntilElementIsVisible(this.dialogTitle);
|
||||||
|
}
|
||||||
|
|
||||||
|
clickShareToggle() {
|
||||||
|
Util.waitUntilElementIsVisible(this.shareToggle);
|
||||||
|
Util.waitUntilElementIsClickable(this.shareToggle);
|
||||||
|
return this.shareToggle.click();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
checkShareLinkIsDisplayed() {
|
||||||
|
return Util.waitUntilElementIsVisible(this.shareLink);
|
||||||
|
}
|
||||||
|
|
||||||
|
getShareLink() {
|
||||||
|
Util.waitUntilElementIsVisible(this.shareLink)
|
||||||
|
return this.shareLink.getAttribute('value');
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user