test: write tests for role management (#1396)
This commit is contained in:
47
packages/e2e-tests/fixtures/admin/role-conditions-modal.js
Normal file
47
packages/e2e-tests/fixtures/admin/role-conditions-modal.js
Normal file
@@ -0,0 +1,47 @@
|
||||
export class RoleConditionsModal {
|
||||
|
||||
/**
|
||||
* @param {import('@playwright/test').Page} page
|
||||
* @param {('Connection'|'Execution'|'Flow')} subject
|
||||
*/
|
||||
constructor (page, subject) {
|
||||
this.page = page;
|
||||
this.modal = page.getByTestId(`${subject}-role-conditions-modal`);
|
||||
this.modalBody = this.modal.getByTestId('role-conditions-modal-body');
|
||||
this.createCheckbox = this.modal.getByTestId(
|
||||
'isCreator-create-checkbox'
|
||||
).locator('input');
|
||||
this.readCheckbox = this.modal.getByTestId(
|
||||
'isCreator-read-checkbox'
|
||||
).locator('input');
|
||||
this.updateCheckbox = this.modal.getByTestId(
|
||||
'isCreator-update-checkbox'
|
||||
).locator('input');
|
||||
this.deleteCheckbox = this.modal.getByTestId(
|
||||
'isCreator-delete-checkbox'
|
||||
).locator('input');
|
||||
this.publishCheckbox = this.modal.getByTestId(
|
||||
'isCreator-publish-checkbox'
|
||||
).locator('input');
|
||||
this.applyButton = this.modal.getByTestId('confirmation-confirm-button');
|
||||
this.cancelButton = this.modal.getByTestId('confirmation-cancel-button');
|
||||
}
|
||||
|
||||
async getAvailableConditions () {
|
||||
let conditions = {};
|
||||
const actions = ['create', 'read', 'update', 'delete', 'publish'];
|
||||
for (let action of actions) {
|
||||
const locator = this[`${action}Checkbox`];
|
||||
if (locator && await locator.count() > 0) {
|
||||
conditions[action] = locator;
|
||||
}
|
||||
}
|
||||
return conditions;
|
||||
}
|
||||
|
||||
async close () {
|
||||
await this.page.click('body', {
|
||||
position: { x: 10, y: 10 }
|
||||
});
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user