Linden Crandall 5075f5c5d8
Some checks are pending
Automatisch Backend Tests / test (push) Waiting to run
Automatisch CI / linter (push) Waiting to run
Automatisch CI / start-backend-server (push) Waiting to run
Automatisch CI / start-backend-worker (push) Waiting to run
Automatisch CI / build-web (push) Waiting to run
Automatisch UI Tests / test (push) Waiting to run
commit upstream files
2025-02-06 04:14:18 +09:00

47 lines
1.5 KiB
JavaScript

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 }
});
}
}