Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AddNewsMethodsInABT #122

Merged
merged 1 commit into from
Jun 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions pages/abTesting.js
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,61 @@ export class ABTesting {
.type("{meta+downarrow}",{force:true});
}

/**
* This method configures assignment rules for task control in the process modeler
* @param elementName: element
* @param assignmentConfig: type to assign rules like: User/Group, Previous Task Assignee, Requester Started, Process Variable,Rule Expression, Process Manager
* for example:
* abTesting.verifyAssignmentRulesInTask({
elementName: "Form task",
assignmentType: "User/Groups",
userGroup: 'Group1',
variableName: "Groups",
value: "value",
});
*/

verifyAssignmentRulesInTask(assignmentConfig,iframeOption = 'a') {
const { elementName, assignmentType, userGroup, variableName,value } = assignmentConfig
let iframeSelector = iframeOption === 'a' ? selectors.iframeA : selectors.iframeB
const elementTaskXapth = "//*[text()='nameElem']/ancestor::*[@data-type='processmaker.components.nodes.task.Shape']";
cy.iframe(iframeSelector).xpath(elementTaskXapth.replace('nameElem', elementName)).first().should('be.visible');
cy.iframe(iframeSelector).xpath(elementTaskXapth.replace('nameElem', elementName)).first().click();
this.clickOnAssignmentRules();
switch (assignmentType) {
case 'Users/Groups':
cy.iframe(iframeSelector).find(selectors.selectList).select('Users / Groups').should('have.value',"user_group");
this.selectUserOrGroup('Assigned Users/Groups',userGroup,iframeOption);
break;
case 'Previous Task Assignee':
cy.iframe(iframeSelector).find(selectors.selectList).select('Previous Task Assignee').should('have.value',"previous_task_assignee");
break;
case 'Requester Started':
cy.iframe(iframeSelector).find(selectors.selectList).select('Request Starter').should('have.value',"requester");
break;
case 'Process Variable':
cy.iframe(iframeSelector).find(selectors.selectList).select('Process Variable').should('have.value',"process_variable");
this.fillProcessVariable(variableName,value,iframeOption)
break;
case 'Rule Expression':
cy.iframe(iframeSelector).find(selectors.selectList).select('Rule Expression').should('have.value',"rule_expression");
this.selectUserOrGroup('Default Assignment',userGroup,iframeOption);
break;
case 'Process Manager':
cy.iframe(iframeSelector).find(selectors.selectList).select('Process Manager').should('have.value',"process_manager");
break;
default:
break;
}
this.publishNewVersion('withoutAB');
}

clickOnAssignmentRules(iframeOption = 'a'){
let iframeSelector = iframeOption === 'a' ? selectors.iframeA : selectors.iframeB
cy.iframe(iframeSelector).find(selectors.asssignmentRuleAcordion).first().should('be.visible');
cy.iframe(iframeSelector).find(selectors.asssignmentRuleAcordion).first().click();
}

selectUserOrGroup(label,userGroup,iframeOption = 'a'){
let iframeSelector = iframeOption === 'a' ? selectors.iframeA : selectors.iframeB
const userGroupSelected = `//label[text()="${label}"]/parent::div//div[@class='multiselect__tags']//span`;
Expand Down
Loading