mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2026-09-09 18:02:54 +00:00
[ACS-12186] add-e2e test for repository automation (#5277)
* [ACS-12186] add-repository-e2e-automation * [ACS-12186] remove unused code and jira id * add fix for review comment * add fix for comment ppr review * add fix for comment ppr review * Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
co-authored by
Copilot Autofix powered by AI
parent
fe4cdc054f
commit
9a8726b000
+8
@@ -33,6 +33,7 @@ export class ContentNodeSelectorDialog extends BaseComponent {
|
||||
public cancelButton = this.getChild('[data-automation-id="content-node-selector-actions-cancel"]');
|
||||
public actionButton = this.getChild('[data-automation-id="content-node-selector-actions-choose"]');
|
||||
public locationDropDown = this.getChild('[id="site-dropdown-container"] .adf-sites-dropdown-form-field');
|
||||
public searchInput = this.getChild('[data-automation-id="content-node-selector-search-input"]');
|
||||
|
||||
getOptionLocator = (optionName: string): Locator => this.page.locator('[role=listbox] [role=option]', { hasText: optionName }).first();
|
||||
getDialogTitle = (text: string) => this.getChild('[data-automation-id="content-node-selector-title"]', { hasText: text });
|
||||
@@ -74,4 +75,11 @@ export class ContentNodeSelectorDialog extends BaseComponent {
|
||||
timeout: 20_000
|
||||
});
|
||||
}
|
||||
|
||||
async searchAndSelectDestination(folderName: string): Promise<void> {
|
||||
await expect(this.searchInput).toBeVisible();
|
||||
await this.searchInput.fill(folderName);
|
||||
await this.spinnerWaitForReload();
|
||||
await this.selectDestination(folderName);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,3 +32,4 @@ export * from './config';
|
||||
export * from './error-strings';
|
||||
export * from './api';
|
||||
export * from './logger';
|
||||
export * from './repository-test-data';
|
||||
|
||||
@@ -0,0 +1,73 @@
|
||||
/*!
|
||||
* Copyright © 2005-2025 Hyland Software, Inc. and its affiliates. All rights reserved.
|
||||
*
|
||||
* Alfresco Example Content Application
|
||||
*
|
||||
* This file is part of the Alfresco Example Content Application.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
* the paid license agreement will prevail. Otherwise, the software is
|
||||
* provided under the following open source license terms:
|
||||
*
|
||||
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { NodesApi } from '../api';
|
||||
import { Utils } from './utils';
|
||||
|
||||
export interface RepositoryTestData {
|
||||
repoFolder: { id: string; name: string };
|
||||
repoFile: { id: string; name: string };
|
||||
personalFile: { id: string; name: string };
|
||||
}
|
||||
|
||||
export interface RepositoryTestDataApis {
|
||||
userNodesApi: NodesApi;
|
||||
adminNodesApi: NodesApi;
|
||||
}
|
||||
|
||||
export async function seedRepositoryTestData(apis: RepositoryTestDataApis): Promise<RepositoryTestData> {
|
||||
const { userNodesApi, adminNodesApi } = apis;
|
||||
|
||||
const repoFolderName = `repo-folder-${Utils.random()}`;
|
||||
const repoFileName = `repo-file-${Utils.random()}.txt`;
|
||||
const personalFileName = `personal-file-${Utils.random()}.txt`;
|
||||
|
||||
const repoFolder = (await adminNodesApi.createFolder(repoFolderName, '-root-')).entry;
|
||||
const repoFile = (await adminNodesApi.createFile(repoFileName, repoFolder.id)).entry;
|
||||
const personalFile = (await userNodesApi.createFile(personalFileName)).entry;
|
||||
|
||||
return {
|
||||
repoFolder: { id: repoFolder.id, name: repoFolderName },
|
||||
repoFile: { id: repoFile.id, name: repoFileName },
|
||||
personalFile: { id: personalFile.id, name: personalFileName }
|
||||
};
|
||||
}
|
||||
|
||||
export async function cleanupRepositoryTestData(
|
||||
testData: RepositoryTestData | undefined,
|
||||
apis: Pick<RepositoryTestDataApis, 'adminNodesApi'>
|
||||
): Promise<void> {
|
||||
if (!testData) {
|
||||
return;
|
||||
}
|
||||
const { adminNodesApi } = apis;
|
||||
|
||||
if (testData.personalFile?.id) {
|
||||
await adminNodesApi.deleteNodes([testData.personalFile.id], true);
|
||||
}
|
||||
|
||||
if (testData.repoFolder?.id) {
|
||||
await adminNodesApi.deleteNodes([testData.repoFolder.id], true);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user