Skip to content

Commit

Permalink
Applying feedback on code review (#31045)
Browse files Browse the repository at this point in the history
### Proposed Changes
* Applying feedback on code review 
* Fixing flaky test 

### Checklist
- [x] Tests
- [x] Documentation
  • Loading branch information
bryanboza authored Jan 3, 2025
1 parent 5fd88d8 commit 570bb5c
Showing 1 changed file with 20 additions and 20 deletions.
40 changes: 20 additions & 20 deletions e2e/dotcms-e2e-node/frontend/utils/contentUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,13 @@ export class ContentUtils {
await dotIframe.locator('#title').fill(title);
//Fill body
await dotIframe.locator('#block-editor-body div').nth(1).fill(body);

//await dotIframe.locator(iFramesLocators.wysiwygFrame).contentFrame().locator('#tinymce').fill(body);
//Click on action
await dotIframe.getByText(action).first().click();
}

/**
* Fill the file asset form
* @param params
* @param params
*/
async fillFileAssetForm(params: FileAssetFormParams) {
const { page, host, title, action, fromURL, newFileName, newFileText } = params;
Expand Down Expand Up @@ -77,8 +75,9 @@ export class ContentUtils {
async workflowExecutionValidationAndClose(page: Page, message: string) {
const dotIframe = page.frameLocator(iFramesLocators.dot_iframe);

await expect(dotIframe.getByText(message)).toBeVisible({timeout: 9000});
await expect(dotIframe.getByText(message)).toBeHidden();
const executionConfirmation = dotIframe.getByText(message);
await waitForVisibleAndCallback(executionConfirmation, () => expect(executionConfirmation).toBeVisible());
await expect(executionConfirmation).toBeHidden();
//Click on close
const closeBtnLocator = page.getByTestId('close-button').getByRole('button');
await waitForVisibleAndCallback(closeBtnLocator, () => closeBtnLocator.click());
Expand All @@ -97,8 +96,8 @@ export class ContentUtils {
await waitForVisibleAndCallback(structureINodeLocator, () => expect(structureINodeLocator).toBeVisible());
await this.selectTypeOnFilter(page, typeLocator);

await iframe.locator('#dijit_form_DropDownButton_0').click();
await expect(iframe.getByLabel('actionPrimaryMenu')).toBeVisible();
await waitForVisibleAndCallback(iframe.locator('#dijit_form_DropDownButton_0'), () => iframe.locator('#dijit_form_DropDownButton_0').click());
await waitForVisibleAndCallback(iframe.getByLabel('actionPrimaryMenu'), async () => {});
await iframe.getByLabel('▼').getByText('Add New Content').click();
const headingLocator = page.getByRole('heading');
await waitForVisibleAndCallback(headingLocator, () => expect(headingLocator).toHaveText(typeString));
Expand Down Expand Up @@ -154,12 +153,12 @@ export class ContentUtils {
const cellText = await cell.textContent();

if (cellText && cellText.includes(text)) {
console.log(`The text "${text}" exists in the second row of the table.`);
console.log(`The text "${text}" exists in the results table.`);
return true;
}
}

console.log(`The text "${text}" does not exist in the second row of the table.`);
console.log(`The text "${text}" does not exist in the results table.`);
return false;
}

Expand Down Expand Up @@ -319,38 +318,39 @@ export class ContentUtils {

}


/**
* Parameters for the fillFileAssetForm method
* Base form params
*/
interface FileAssetFormParams {
interface BaseFormParams {
page: Page;
host: string;
title: string;
action?: string;
}

/**
* Parameter to fill the file asset form params
*/
interface FileAssetFormParams extends BaseFormParams {
host: string;
fileName?: string;
fromURL?: string;
newFileName?: string;
newFileText?: string;
}

/**
* Parameters for the fillPageAssetForm method
* Parameter to fill the page asset form params
*/
interface PageAssetFormParams {
page: Page;
title: string;
interface PageAssetFormParams extends BaseFormParams {
url?: string;
host?: string;
action?: string;
template?: string;
friendlyName?: string;
showOnMenu?: boolean;
sortOrder?: string;
cacheTTL?: number
cacheTTL?: number;
}





0 comments on commit 570bb5c

Please sign in to comment.