forked from liferay/liferay-portal
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4d1c84d
commit e41255a
Showing
8 changed files
with
150 additions
and
101 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
* SPDX-License-Identifier: LGPL-2.1-or-later OR LicenseRef-Liferay-DXP-EULA-2.0.0-2023-06 | ||
*/ | ||
|
||
import { getRandomInt } from '../utils/getRandomInt'; | ||
import {getRandomInt} from '../utils/getRandomInt'; | ||
import {ApiHelpers} from './ApiHelpers'; | ||
|
||
type TNotificationTemplate = { | ||
|
@@ -66,11 +66,10 @@ export class NotificationApiHelper { | |
|
||
async postRandomNotificationTemplate( | ||
name?: string | ||
) : Promise<TNotificationTemplate> { | ||
|
||
): Promise<TNotificationTemplate> { | ||
const requestBody = { | ||
editorType: 'richText', | ||
name: name, | ||
name, | ||
recipientType: 'email', | ||
recipients: [ | ||
{ | ||
|
@@ -79,12 +78,12 @@ export class NotificationApiHelper { | |
en_US: '[email protected]', | ||
}, | ||
to: { | ||
en_US: 'to' + getRandomInt()+"@liferay.com", | ||
en_US: 'to' + getRandomInt() + '@liferay.com', | ||
}, | ||
}, | ||
], | ||
subject: { | ||
en_US: 'subject' + getRandomInt() | ||
en_US: 'subject' + getRandomInt(), | ||
}, | ||
type: 'email', | ||
} as TNotificationTemplate; | ||
|
19 changes: 12 additions & 7 deletions
19
modules/test/playwright/pages/object-web/EditObjectDefinitionPage.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,18 @@ | ||
import { Locator, Page } from "@playwright/test"; | ||
/** | ||
* SPDX-FileCopyrightText: (c) 2000 Liferay, Inc. https://liferay.com | ||
* SPDX-License-Identifier: LGPL-2.1-or-later OR LicenseRef-Liferay-DXP-EULA-2.0.0-2023-06 | ||
*/ | ||
|
||
import {Locator, Page} from '@playwright/test'; | ||
|
||
export class EditObjectDefinitionPage { | ||
readonly actionsTab: Locator; | ||
readonly actionsTab: Locator; | ||
|
||
constructor(page: Page) { | ||
this.actionsTab = page.getByRole('link', { name: 'Actions' }); | ||
} | ||
constructor(page: Page) { | ||
this.actionsTab = page.getByRole('link', {name: 'Actions'}); | ||
} | ||
|
||
async openActionsTab() { | ||
async openActionsTab() { | ||
await this.actionsTab.click(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 27 additions & 14 deletions
41
modules/test/playwright/pages/object-web/object-action/ActionBuilderPage.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,35 @@ | ||
import { Locator, Page } from "@playwright/test"; | ||
/** | ||
* SPDX-FileCopyrightText: (c) 2000 Liferay, Inc. https://liferay.com | ||
* SPDX-License-Identifier: LGPL-2.1-or-later OR LicenseRef-Liferay-DXP-EULA-2.0.0-2023-06 | ||
*/ | ||
|
||
import {Locator, Page} from '@playwright/test'; | ||
|
||
export class ActionBuilderPage { | ||
readonly inputNotificationsCombo: Locator; | ||
readonly inputThenCombo: Locator; | ||
readonly optionNotification: Locator; | ||
readonly inputNotificationsCombo: Locator; | ||
readonly inputThenCombo: Locator; | ||
readonly optionNotification: Locator; | ||
|
||
constructor(page: Page) { | ||
this.inputNotificationsCombo = page.frameLocator('iframe').getByRole('combobox').getByText('Select an Option') | ||
this.inputThenCombo = page.frameLocator('iframe').getByRole('combobox').getByText('Choose an Action'); | ||
this.optionNotification = page.frameLocator('iframe').getByRole('option', { name: 'Notification' }); | ||
} | ||
constructor(page: Page) { | ||
this.inputNotificationsCombo = page | ||
.frameLocator('iframe') | ||
.getByRole('combobox') | ||
.getByText('Select an Option'); | ||
this.inputThenCombo = page | ||
.frameLocator('iframe') | ||
.getByRole('combobox') | ||
.getByText('Choose an Action'); | ||
this.optionNotification = page | ||
.frameLocator('iframe') | ||
.getByRole('option', {name: 'Notification'}); | ||
} | ||
|
||
async chooseNotificationOption() { | ||
async chooseNotificationOption() { | ||
await this.inputThenCombo.click(); | ||
await this.optionNotification.click(); | ||
await this.optionNotification.click(); | ||
} | ||
async clickInputNotificationsCombo() { | ||
|
||
async clickInputNotificationsCombo() { | ||
await this.inputNotificationsCombo.click(); | ||
} | ||
} | ||
} |
21 changes: 14 additions & 7 deletions
21
modules/test/playwright/pages/object-web/object-action/SidePanelObjectActionPage.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,20 @@ | ||
import { Locator, Page } from "@playwright/test"; | ||
/** | ||
* SPDX-FileCopyrightText: (c) 2000 Liferay, Inc. https://liferay.com | ||
* SPDX-License-Identifier: LGPL-2.1-or-later OR LicenseRef-Liferay-DXP-EULA-2.0.0-2023-06 | ||
*/ | ||
|
||
import {Locator, Page} from '@playwright/test'; | ||
|
||
export class SidePanelObjectActionPage { | ||
readonly actionBuilderTab: Locator; | ||
readonly actionBuilderTab: Locator; | ||
|
||
constructor(page: Page) { | ||
this.actionBuilderTab = page.frameLocator('iframe').getByRole('tab', { name: 'Action Builder' }); | ||
} | ||
constructor(page: Page) { | ||
this.actionBuilderTab = page | ||
.frameLocator('iframe') | ||
.getByRole('tab', {name: 'Action Builder'}); | ||
} | ||
|
||
async openActionBuilderTab() { | ||
async openActionBuilderTab() { | ||
await this.actionBuilderTab.click(); | ||
} | ||
} | ||
} |
19 changes: 12 additions & 7 deletions
19
modules/test/playwright/pages/object-web/object-action/ViewObjectActionsPage.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,18 @@ | ||
import { Locator, Page } from "@playwright/test"; | ||
/** | ||
* SPDX-FileCopyrightText: (c) 2000 Liferay, Inc. https://liferay.com | ||
* SPDX-License-Identifier: LGPL-2.1-or-later OR LicenseRef-Liferay-DXP-EULA-2.0.0-2023-06 | ||
*/ | ||
|
||
import {Locator, Page} from '@playwright/test'; | ||
|
||
export class ViewObjectActionsPage { | ||
readonly addObjectActionButton: Locator; | ||
readonly addObjectActionButton: Locator; | ||
|
||
constructor(page: Page) { | ||
this.addObjectActionButton = page.getByLabel('Add Object Action'); | ||
} | ||
constructor(page: Page) { | ||
this.addObjectActionButton = page.getByLabel('Add Object Action'); | ||
} | ||
|
||
async openObjectActionSidePanel() { | ||
async openObjectActionSidePanel() { | ||
await this.addObjectActionButton.click(); | ||
} | ||
} | ||
} |
134 changes: 77 additions & 57 deletions
134
modules/test/playwright/tests/object-web/objectActions.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,64 +1,84 @@ | ||
import { expect, mergeTests } from "@playwright/test"; | ||
import { apiHelpersTest } from "../../fixtures/apiHelpersTest"; | ||
import { loginTest } from "../../fixtures/loginTest"; | ||
import { objectPagesTest } from "../../fixtures/objectPagesTest"; | ||
import { getRandomInt } from "../../utils/getRandomInt"; | ||
import { editObjectDefinitionPagesTest } from "../../fixtures/editObjectDefinitionPagesTest"; | ||
/** | ||
* SPDX-FileCopyrightText: (c) 2000 Liferay, Inc. https://liferay.com | ||
* SPDX-License-Identifier: LGPL-2.1-or-later OR LicenseRef-Liferay-DXP-EULA-2.0.0-2023-06 | ||
*/ | ||
|
||
export const test = mergeTests(apiHelpersTest, editObjectDefinitionPagesTest,loginTest(), objectPagesTest); | ||
import {expect, mergeTests} from '@playwright/test'; | ||
|
||
import {apiHelpersTest} from '../../fixtures/apiHelpersTest'; | ||
import {editObjectDefinitionPagesTest} from '../../fixtures/editObjectDefinitionPagesTest'; | ||
import {loginTest} from '../../fixtures/loginTest'; | ||
import {objectPagesTest} from '../../fixtures/objectPagesTest'; | ||
import {getRandomInt} from '../../utils/getRandomInt'; | ||
|
||
export const test = mergeTests( | ||
apiHelpersTest, | ||
editObjectDefinitionPagesTest, | ||
loginTest(), | ||
objectPagesTest | ||
); | ||
|
||
test.describe('manage object actions through object actions tab', () => { | ||
test('notification action section must display all persisted notifications', async ({ | ||
actionBuilderPage, | ||
apiHelpers, | ||
editObjectDefinitionPage, | ||
page, | ||
sidePanelObjectActionPage, | ||
viewObjectActionsPage, | ||
apiHelpers, | ||
editObjectDefinitionPage, | ||
page, | ||
sidePanelObjectActionPage, | ||
viewObjectActionsPage, | ||
viewObjectDefinitionsPage, | ||
}) => { | ||
const ids: number[] = []; | ||
const names: string[] = []; | ||
|
||
for(let index=1;index <= 21;index++){ | ||
const notificationTemplate = await apiHelpers.notification.postRandomNotificationTemplate( | ||
"notification template test " + getRandomInt() | ||
) | ||
ids.push(notificationTemplate.id) | ||
names.push(notificationTemplate.name + " " + notificationTemplate.type) | ||
} | ||
|
||
const objectDefinition = | ||
await apiHelpers.objectAdmin.postRandomObjectDefinition( | ||
'default' | ||
); | ||
|
||
await viewObjectDefinitionsPage.goto() | ||
|
||
await viewObjectDefinitionsPage.clickEditObjectDefinitionLink(objectDefinition.name); | ||
|
||
await editObjectDefinitionPage.openActionsTab(); | ||
|
||
await viewObjectActionsPage.openObjectActionSidePanel(); | ||
|
||
await sidePanelObjectActionPage.openActionBuilderTab(); | ||
|
||
await actionBuilderPage.chooseNotificationOption(); | ||
|
||
await actionBuilderPage.clickInputNotificationsCombo(); | ||
|
||
for (let index = 0; index < names.length; index++) { | ||
await expect( | ||
page.frameLocator('iframe').getByRole('option', { name: names[index] }) | ||
).toBeVisible(); | ||
} | ||
|
||
// Clean up | ||
|
||
await apiHelpers.objectAdmin.deleteObjectDefinition(objectDefinition.id); | ||
|
||
for (let index = 0; index < ids.length; index++) { | ||
await apiHelpers.notification.deleteNotificationTemplate(ids[index]); | ||
} | ||
}); | ||
}); | ||
const ids: number[] = []; | ||
const names: string[] = []; | ||
|
||
for (let index = 1; index <= 21; index++) { | ||
const notificationTemplate = | ||
await apiHelpers.notification.postRandomNotificationTemplate( | ||
'notification template test ' + getRandomInt() | ||
); | ||
ids.push(notificationTemplate.id); | ||
names.push( | ||
notificationTemplate.name + ' ' + notificationTemplate.type | ||
); | ||
} | ||
|
||
const objectDefinition = | ||
await apiHelpers.objectAdmin.postRandomObjectDefinition('default'); | ||
|
||
await viewObjectDefinitionsPage.goto(); | ||
|
||
await viewObjectDefinitionsPage.clickEditObjectDefinitionLink( | ||
objectDefinition.name | ||
); | ||
|
||
await editObjectDefinitionPage.openActionsTab(); | ||
|
||
await viewObjectActionsPage.openObjectActionSidePanel(); | ||
|
||
await sidePanelObjectActionPage.openActionBuilderTab(); | ||
|
||
await actionBuilderPage.chooseNotificationOption(); | ||
|
||
await actionBuilderPage.clickInputNotificationsCombo(); | ||
|
||
for (let index = 0; index < names.length; index++) { | ||
await expect( | ||
page | ||
.frameLocator('iframe') | ||
.getByRole('option', {name: names[index]}) | ||
).toBeVisible(); | ||
} | ||
|
||
// Clean up | ||
|
||
await apiHelpers.objectAdmin.deleteObjectDefinition( | ||
objectDefinition.id | ||
); | ||
|
||
for (let index = 0; index < ids.length; index++) { | ||
await apiHelpers.notification.deleteNotificationTemplate( | ||
ids[index] | ||
); | ||
} | ||
}); | ||
}); |