@alfresco/aca-playwright-shared 7.5.0-26018627801 → 7.5.0-26089953239
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/api/file-actions.d.ts
CHANGED
|
@@ -41,5 +41,6 @@ export declare class FileActionsApi {
|
|
|
41
41
|
waitForNodesSearchHighlight(searchTerm: string, data: {
|
|
42
42
|
expect: number;
|
|
43
43
|
}): Promise<void>;
|
|
44
|
-
updateNodeContent(nodeId: string, content: string, majorVersion?: boolean, comment?: string, newName?: string): Promise<NodeEntry>;
|
|
44
|
+
updateNodeContent(nodeId: string, content: string | Buffer, majorVersion?: boolean, comment?: string, newName?: string): Promise<NodeEntry>;
|
|
45
|
+
updateNodeContentFromFile(nodeId: string, fileLocation: string, majorVersion?: boolean, comment?: string, newName?: string): Promise<NodeEntry>;
|
|
45
46
|
}
|
|
@@ -2702,7 +2702,7 @@ class ViewerComponent extends BaseComponent {
|
|
|
2702
2702
|
this.thumbnailsCloseButton = this.getChild('[data-automation-id="adf-thumbnails-close"]');
|
|
2703
2703
|
this.viewerPage = this.getChild('[data-automation-id="adf-page-selector"]');
|
|
2704
2704
|
this.viewerMedia = this.getChild('adf-media-player');
|
|
2705
|
-
this.viewerSpinner = this.getChild('.adf-viewer-render__loading-
|
|
2705
|
+
this.viewerSpinner = this.getChild('.adf-viewer-render__loading-screen__spinner');
|
|
2706
2706
|
this.zoomInButton = this.getChild('#viewer-zoom-in-button');
|
|
2707
2707
|
this.zoomOutButton = this.getChild('#viewer-zoom-out-button');
|
|
2708
2708
|
this.zoomScale = this.getChild('[data-automation-id="adf-page-scale"]');
|
|
@@ -2725,14 +2725,9 @@ class ViewerComponent extends BaseComponent {
|
|
|
2725
2725
|
await this.waitForViewerLoaderToFinish();
|
|
2726
2726
|
await this.viewerLocator.waitFor({ state: 'visible', timeout: timeouts.large });
|
|
2727
2727
|
}
|
|
2728
|
-
async waitForViewerLoaderToFinish(
|
|
2729
|
-
|
|
2730
|
-
|
|
2731
|
-
}
|
|
2732
|
-
catch (error) {
|
|
2733
|
-
this.logger.log('waitForViewerLoaderToFinish: Timeout reached while waiting for viewer loader to finish.');
|
|
2734
|
-
throw error;
|
|
2735
|
-
}
|
|
2728
|
+
async waitForViewerLoaderToFinish() {
|
|
2729
|
+
await this.viewerSpinner.waitFor({ state: 'attached', timeout: timeouts.medium }).catch(() => { });
|
|
2730
|
+
await this.viewerSpinner.waitFor({ state: 'detached', timeout: timeouts.fortySeconds }).catch(() => { });
|
|
2736
2731
|
}
|
|
2737
2732
|
async checkViewerActivePage(pageNumber) {
|
|
2738
2733
|
await expect(this.viewerPage).toHaveValue(pageNumber.toString());
|
|
@@ -2751,7 +2746,7 @@ class ViewerComponent extends BaseComponent {
|
|
|
2751
2746
|
async waitForZoomPercentageToDisplay() {
|
|
2752
2747
|
await this.zoomScale.waitFor({ state: 'visible', timeout: timeouts.normal });
|
|
2753
2748
|
const startTime = Date.now();
|
|
2754
|
-
let textContent;
|
|
2749
|
+
let textContent = '';
|
|
2755
2750
|
while (Date.now() - startTime <= timeouts.medium) {
|
|
2756
2751
|
textContent = await this.zoomScale.innerText();
|
|
2757
2752
|
if (textContent.trim() !== '') {
|
|
@@ -2766,11 +2761,23 @@ class ViewerComponent extends BaseComponent {
|
|
|
2766
2761
|
async getFileTitle() {
|
|
2767
2762
|
await this.fileTitleButtonLocator.waitFor({ state: 'visible', timeout: timeouts.normal });
|
|
2768
2763
|
await this.waitForViewerLoaderToFinish();
|
|
2769
|
-
|
|
2764
|
+
const title = await this.fileTitleButtonLocator.textContent();
|
|
2765
|
+
if (!title) {
|
|
2766
|
+
const errorMessage = 'File title is not displayed in the viewer';
|
|
2767
|
+
this.logger.error(errorMessage);
|
|
2768
|
+
throw new Error(errorMessage);
|
|
2769
|
+
}
|
|
2770
|
+
return title;
|
|
2770
2771
|
}
|
|
2771
2772
|
async getCloseButtonTooltip() {
|
|
2772
2773
|
await this.closeButtonLocator.waitFor({ state: 'visible', timeout: timeouts.normal });
|
|
2773
|
-
|
|
2774
|
+
const tooltip = await this.closeButtonLocator.getAttribute('title');
|
|
2775
|
+
if (!tooltip) {
|
|
2776
|
+
const errorMessage = 'Close button tooltip is not available';
|
|
2777
|
+
this.logger.error(errorMessage);
|
|
2778
|
+
throw new Error(errorMessage);
|
|
2779
|
+
}
|
|
2780
|
+
return tooltip;
|
|
2774
2781
|
}
|
|
2775
2782
|
async verifyViewerPrimaryActions(expectedToolbarPrimary) {
|
|
2776
2783
|
const toRemove = ['Close', 'Previous File', 'Next File', 'View details'];
|
|
@@ -5217,13 +5224,17 @@ class FileActionsApi {
|
|
|
5217
5224
|
if (newName !== undefined) {
|
|
5218
5225
|
opts['name'] = newName;
|
|
5219
5226
|
}
|
|
5220
|
-
return await this.apiService.nodes.updateNodeContent(nodeId, content, opts);
|
|
5227
|
+
return await this.apiService.nodes.updateNodeContent(nodeId, content, opts); // NOSONAR
|
|
5221
5228
|
}
|
|
5222
5229
|
catch (error) {
|
|
5223
5230
|
logger.error(`${this.constructor.name} ${this.updateNodeContent.name}: ${error}`);
|
|
5224
5231
|
return Promise.reject(error);
|
|
5225
5232
|
}
|
|
5226
5233
|
}
|
|
5234
|
+
async updateNodeContentFromFile(nodeId, fileLocation, majorVersion = true, comment, newName) {
|
|
5235
|
+
const fileContent = await fs.promises.readFile(fileLocation);
|
|
5236
|
+
return this.updateNodeContent(nodeId, fileContent, majorVersion, comment, newName);
|
|
5237
|
+
}
|
|
5227
5238
|
}
|
|
5228
5239
|
|
|
5229
5240
|
/*!
|