ESLint: cleanup await expect from protractor tests (#9630)

This commit is contained in:
Denys Vuika
2024-04-30 08:07:10 -04:00
committed by GitHub
parent 4109f272ea
commit f401b8c13e
114 changed files with 2096 additions and 1908 deletions

View File

@@ -15,14 +15,7 @@
* limitations under the License.
*/
import { createApiService,
LoginPage,
StringUtil,
UploadActions,
UserModel,
UsersActions,
ViewerPage
} from '@alfresco/adf-testing';
import { createApiService, LoginPage, StringUtil, UploadActions, UserModel, UsersActions, ViewerPage } from '@alfresco/adf-testing';
import { ContentServicesPage } from '../../core/pages/content-services.page';
import { CommentsPage } from '../../core/pages/comments.page';
import { NavigationBarPage } from '../../core/pages/navigation-bar.page';
@@ -66,7 +59,6 @@ describe('Comment', () => {
});
describe('component', () => {
beforeEach(async () => {
await apiService.login(acsUser.username, acsUser.password);
@@ -100,9 +92,9 @@ describe('Comment', () => {
await commentsPage.checkCommentInputIsDisplayed();
await commentsPage.getTotalNumberOfComments('Comments (1)');
await expect(await commentsPage.getMessage(0)).toEqual(comments.test);
await expect(await commentsPage.getUserName(0)).toEqual(userFullName);
await expect(await commentsPage.getTime(0)).toMatch(/(ago|few)/);
expect(await commentsPage.getMessage(0)).toEqual(comments.test);
expect(await commentsPage.getUserName(0)).toEqual(userFullName);
expect(await commentsPage.getTime(0)).toMatch(/(ago|few)/);
});
it('[C276948] Should be able to add a comment on a file', async () => {
@@ -116,9 +108,9 @@ describe('Comment', () => {
await commentsPage.checkUserIconIsDisplayed();
await commentsPage.getTotalNumberOfComments('Comments (1)');
await expect(await commentsPage.getMessage(0)).toEqual(comments.first);
await expect(await commentsPage.getUserName(0)).toEqual(userFullName);
await expect(await commentsPage.getTime(0)).toMatch(/(ago|few)/);
expect(await commentsPage.getMessage(0)).toEqual(comments.first);
expect(await commentsPage.getUserName(0)).toEqual(userFullName);
expect(await commentsPage.getTime(0)).toMatch(/(ago|few)/);
});
it('[C280021] Should be able to add a multiline comment on a file', async () => {
@@ -132,17 +124,17 @@ describe('Comment', () => {
await commentsPage.checkUserIconIsDisplayed();
await commentsPage.getTotalNumberOfComments('Comments (1)');
await expect(await commentsPage.getMessage(0)).toEqual(comments.multiline);
await expect(await commentsPage.getUserName(0)).toEqual(userFullName);
await expect(await commentsPage.getTime(0)).toMatch(/(ago|few)/);
expect(await commentsPage.getMessage(0)).toEqual(comments.multiline);
expect(await commentsPage.getUserName(0)).toEqual(userFullName);
expect(await commentsPage.getTime(0)).toMatch(/(ago|few)/);
await commentsPage.addComment(comments.second);
await commentsPage.checkUserIconIsDisplayed();
await commentsPage.getTotalNumberOfComments('Comments (2)');
await expect(await commentsPage.getMessage(0)).toEqual(comments.second);
await expect(await commentsPage.getUserName(0)).toEqual(userFullName);
await expect(await commentsPage.getTime(0)).toMatch(/(ago|few)/);
expect(await commentsPage.getMessage(0)).toEqual(comments.second);
expect(await commentsPage.getUserName(0)).toEqual(userFullName);
expect(await commentsPage.getTime(0)).toMatch(/(ago|few)/);
});
});

View File

@@ -169,16 +169,16 @@ describe('Content Services Viewer', () => {
const initialHeight = await viewerPage.getCanvasHeight();
await viewerPage.clickZoomInButton();
await expect(+(await viewerPage.getCanvasWidth())).toBeGreaterThan(+initialWidth);
await expect(+(await viewerPage.getCanvasHeight())).toBeGreaterThan(+initialHeight);
expect(+(await viewerPage.getCanvasWidth())).toBeGreaterThan(+initialWidth);
expect(+(await viewerPage.getCanvasHeight())).toBeGreaterThan(+initialHeight);
await viewerPage.clickActualSize();
await expect(+(await viewerPage.getCanvasWidth())).toEqual(+initialWidth);
await expect(+(await viewerPage.getCanvasHeight())).toEqual(+initialHeight);
expect(+(await viewerPage.getCanvasWidth())).toEqual(+initialWidth);
expect(+(await viewerPage.getCanvasHeight())).toEqual(+initialHeight);
await viewerPage.clickZoomOutButton();
await expect(+(await viewerPage.getCanvasWidth())).toBeLessThan(+initialWidth);
await expect(+(await viewerPage.getCanvasHeight())).toBeLessThan(+initialHeight);
expect(+(await viewerPage.getCanvasWidth())).toBeLessThan(+initialWidth);
expect(+(await viewerPage.getCanvasHeight())).toBeLessThan(+initialHeight);
await viewerPage.clickCloseButton();
});
@@ -298,7 +298,7 @@ describe('Content Services Viewer', () => {
await viewerPage.checkZoomInButtonIsNotDisplayed();
await viewerPage.checkUnknownFormatIsDisplayed();
await expect(await viewerPage.getUnknownFormatMessage()).toBe("Couldn't load preview. Unknown format.");
expect(await viewerPage.getUnknownFormatMessage()).toBe(`Couldn't load preview. Unknown format.`);
await viewerPage.clickCloseButton();
});
@@ -397,6 +397,12 @@ describe('Content Services Viewer', () => {
});
});
/**
* Upload a new version of a file
*
* @param originalFileName The name of the original file
* @param newVersionLocation The location of the new version
*/
async function uploadNewVersion(originalFileName: string, newVersionLocation: string): Promise<void> {
await contentServicesPage.doubleClickRow(originalFileName);
await viewerPage.waitTillContentLoaded();
@@ -410,14 +416,25 @@ describe('Content Services Viewer', () => {
await browser.refresh();
}
/**
* Preview an unsupported file
*
* @param unsupportedFileName The name of the unsupported file
*/
async function previewUnsupportedFile(unsupportedFileName: string): Promise<void> {
await contentServicesPage.doubleClickRow(unsupportedFileName);
await viewerPage.waitTillContentLoaded();
await viewerPage.checkUnknownFormatIsDisplayed();
await expect(await viewerPage.getUnknownFormatMessage()).toBe("Couldn't load preview. Unknown format.");
expect(await viewerPage.getUnknownFormatMessage()).toBe(`Couldn't load preview. Unknown format.`);
await viewerPage.clickCloseButton();
}
/**
* Change the name of the file in the viewer
*
* @param fileName The name of the file to be changed
* @param newName The new name of the file
*/
async function changeFileNameInViewer(fileName: string, newName: string): Promise<void> {
await contentServicesPage.doubleClickRow(fileName);
await viewerPage.waitTillContentLoaded();