From ef7d30eb3414b8c05378125161ed3bb0c820bf15 Mon Sep 17 00:00:00 2001 From: Howard Zhang Date: Fri, 8 Dec 2023 00:29:34 -0700 Subject: [PATCH] e2e - updated tests for the UI changes of removing roles in grids (#2371) * Updates * Test updates for button updates * More updates for buttons * Button updates * Test updates for UI components * Updates for event log, status, notifications * e2e updates * File service, configuration service, welcome * Updates on PDF, script and notifications * subscription and service status updates * Updates on events and directory * e2e updates for status, directory and tenant admin * directory and service status * Notifications test updates * One comment for roles in notification type modal * e2e test updates for status and notifications * Changed var to let * e2e test updates for configuration * e2e test updates for welcome page * Removed unused element * e2e updates * test updates for events and script * e2e updates on welcome page and notifications * Fixes for service status * updates for file service * e2e test updates for event, file, notification * Update for pdf * update for status * Update * e2e updates * e2e updates * e2e updates * e2e updates * Added a config setting * Commented out edit PDF template steps * Update * update * Updated file tests * Updated pdf test * Removed headless=true command parameter * Switch e2e test run from Chrome to Electron * Switch e2e test run from headless to headed * e2e fixes * e2e updates * e2e updates * Test fixes * Updated cs-322 with validation of open icon * Added validation of pdf template body * Added a couple of steps of selecting filters * Added a walkaround * Walkaround for 30 second refresh * Added more wait to avoid random test failures * File service test updates * Put accessiblity test step back * Commented out accessibility step for file types * Added support info validation on subscriber app * Fixed a timestamp bug * Added more delay on file type name * test updates * subscriber app test update * Updated load more button page object * e2e test updates * Fixed a typo * Added a wait * Updates of subscription management tests * test updates for calendar and script * Test updates * test updates * enabled api doc link tests * Re-enabled tenant creation test * Adjusted wait for 2 failed tests * added shadow() for shadow dom element * Updated tests for UI changes of removing roles * Chnaged from let to const --------- Co-authored-by: Howard Zhang --- .../src/integration/calendar.feature | 12 +- .../src/integration/calendar/calendar.step.ts | 265 +++++++++--------- .../src/integration/comment.feature | 26 +- .../src/integration/comment/comment.step.ts | 110 ++------ .../src/integration/file-service.feature | 14 +- .../file-service/file-service.step.ts | 101 +++---- .../src/integration/form.feature | 19 +- .../src/integration/form/form.step.ts | 105 ++----- .../src/integration/script.feature | 10 +- .../src/integration/script/script.step.ts | 66 ++--- .../src/integration/task.feature | 16 +- .../src/integration/task/task.step.ts | 104 +++---- 12 files changed, 320 insertions(+), 528 deletions(-) diff --git a/apps/tenant-management-webapp-e2e/src/integration/calendar.feature b/apps/tenant-management-webapp-e2e/src/integration/calendar.feature index 7f4368b0b5..12fe7fef09 100644 --- a/apps/tenant-management-webapp-e2e/src/integration/calendar.feature +++ b/apps/tenant-management-webapp-e2e/src/integration/calendar.feature @@ -22,7 +22,7 @@ Feature: Calendar When the user clicks Cancel button in Add calendar modal Then the user views Calendar tab table header on calendars page And no critical or serious accessibility issues on "calendar calendars page" - When the user clicks "Edit" button for the calendar of "autotest-calendarAccessibility", "DO NOT DELETE", "auto-test-role1" + When the user clicks "Edit" button for the calendar of "autotest-calendarAccessibility", "DO NOT DELETE" Then the user views Edit calendar modal And no critical or serious accessibility issues on "calendar edit calendar modal" @@ -43,15 +43,15 @@ Feature: Calendar # Validate data When the user enters "autotest-addcalendar", "autotest calendar desc", "auto-test-role1, urn:ads:autotest:chat-service:chat-admin" in Add calendar modal And the user clicks Save button in Add calendar modal - Then the user "views" the calendar of "autotest-addcalendar", "autotest calendar desc", "auto-test-role1, urn:ads:autotest:chat-service:chat-admin" + Then the user "views" the calendar of "autotest-addcalendar", "autotest calendar desc" # Edit - When the user clicks "Edit" button for the calendar of "autotest-addcalendar", "autotest calendar desc", "auto-test-role1, urn:ads:autotest:chat-service:chat-admin" + When the user clicks "Edit" button for the calendar of "autotest-addcalendar", "autotest calendar desc" Then the user views Edit calendar modal When the user enters "autotest calendar desc edit" as description and selects "auto-test-role2" as role in Edit calendar modal And the user clicks Save button in Edit calendar modal - Then the user "views" the calendar of "autotest-addcalendar", "autotest calendar desc edit", "auto-test-role2" + Then the user "views" the calendar of "autotest-addcalendar", "autotest calendar desc edit" # Delete - When the user clicks "Delete" button for the calendar of "autotest-addcalendar", "autotest calendar desc edit", "auto-test-role2" + When the user clicks "Delete" button for the calendar of "autotest-addcalendar", "autotest calendar desc edit" Then the user views delete "calendar" confirmation modal for "autotest-addcalendar" When the user clicks Delete button in delete confirmation modal - Then the user "should not view" the calendar of "autotest-addcalendar", "autotest script desc edit", "auto-test-role2" + Then the user "should not view" the calendar of "autotest-addcalendar", "autotest script desc edit" diff --git a/apps/tenant-management-webapp-e2e/src/integration/calendar/calendar.step.ts b/apps/tenant-management-webapp-e2e/src/integration/calendar/calendar.step.ts index 3c3541391c..8aead34aca 100644 --- a/apps/tenant-management-webapp-e2e/src/integration/calendar/calendar.step.ts +++ b/apps/tenant-management-webapp-e2e/src/integration/calendar/calendar.step.ts @@ -38,7 +38,7 @@ When('the user clicks Cancel button in Add calendar modal', function () { }); Then('the user views Calendar tab table header on calendars page', function () { -calendarObj.calendarTableHeader().should('be.visible'); + calendarObj.calendarTableHeader().should('be.visible'); }); When('the user enters {string} in name field in calendar modal', function (name) { @@ -54,78 +54,73 @@ Then('the user views the error message of {string} on namespace in calendar moda .should('contain', errorMsg); }); -When('the user enters {string}, {string}, {string} in Add calendar modal', - function (name, desc, role) { - cy.viewport(1920, 1080); - calendarObj.addCalendarModalNameField().shadow().find('input').clear().type(name, { delay: 100, force: true }); - calendarObj.addCalendarModalDescriptionField().shadow().find('.goa-textarea').clear().type(desc, { force: true }); - // Select roles or client roles - const roles = role.split(','); - for (let i = 0; i < roles.length; i++) { - if (roles[i].includes(':')) { - const clientRoleStringArray = roles[i].split(':'); - let clientName = ''; - for (let j = 0; j < clientRoleStringArray.length - 1; j++) { - if (j !== clientRoleStringArray.length - 2) { - clientName = clientName + clientRoleStringArray[j].trim() + ':'; - } else { - clientName = clientName + clientRoleStringArray[j]; - } - } - const roleName = clientRoleStringArray[clientRoleStringArray.length - 1]; - calendarObj - .addCalendarModalClientRolesTable(clientName) - .shadow() - .find('.role-name') - .contains(roleName) - .next() - .find('goa-checkbox') - .shadow() - .find('.goa-checkbox-container') - .scrollIntoView() - .click({ force: true }); +When('the user enters {string}, {string}, {string} in Add calendar modal', function (name, desc, role) { + cy.viewport(1920, 1080); + calendarObj.addCalendarModalNameField().shadow().find('input').clear().type(name, { delay: 100, force: true }); + calendarObj.addCalendarModalDescriptionField().shadow().find('.goa-textarea').clear().type(desc, { force: true }); + // Select roles or client roles + const roles = role.split(','); + for (let i = 0; i < roles.length; i++) { + if (roles[i].includes(':')) { + const clientRoleStringArray = roles[i].split(':'); + let clientName = ''; + for (let j = 0; j < clientRoleStringArray.length - 1; j++) { + if (j !== clientRoleStringArray.length - 2) { + clientName = clientName + clientRoleStringArray[j].trim() + ':'; + } else { + clientName = clientName + clientRoleStringArray[j]; + } + } + const roleName = clientRoleStringArray[clientRoleStringArray.length - 1]; + calendarObj + .addCalendarModalClientRolesTable(clientName) + .shadow() + .find('.role-name') + .contains(roleName) + .next() + .find('goa-checkbox') + .shadow() + .find('.goa-checkbox-container') + .scrollIntoView() + .click({ force: true }); } else { - calendarObj - .addCalendarModalRolesTable() - .shadow() - .find('.role-name') - .contains(roles[i].trim()) - .next() - .find('goa-checkbox') - .shadow() - .find('.goa-checkbox-container') - .scrollIntoView() - .click({ force: true }); - } - } + calendarObj + .addCalendarModalRolesTable() + .shadow() + .find('.role-name') + .contains(roles[i].trim()) + .next() + .find('goa-checkbox') + .shadow() + .find('.goa-checkbox-container') + .scrollIntoView() + .click({ force: true }); + } + } }); -Then('the user {string} the calendar of {string}, {string}, {string}', function (viewOrNot, name, desc, role) { - findCalendar(name, desc, role).then((rowNumber) => { +Then('the user {string} the calendar of {string}, {string}', function (viewOrNot, name, desc) { + findCalendar(name, desc).then((rowNumber) => { switch (viewOrNot) { case 'views': - expect(rowNumber).to.be.greaterThan( - 0, - 'Calendar of ' + name + ', ' + desc + ', ' + role + ' has row #' + rowNumber - ); + expect(rowNumber).to.be.greaterThan(0, 'Calendar of ' + name + ', ' + desc + ' has row #' + rowNumber); break; case 'should not view': - expect(rowNumber).to.equal(0, 'Calendar of ' + name + ', ' + desc + ', ' + role + ' has row #' + rowNumber); + expect(rowNumber).to.equal(0, 'Calendar of ' + name + ', ' + desc + ' has row #' + rowNumber); break; default: expect(viewOrNot).to.be.oneOf(['views', 'should not view']); } }); }); -//Find a calendar with name, description and role(s) -//Input: calendar name, calendar description, role(s) in a string separated with comma +//Find a calendar with name, description +//Input: calendar name, calendar descriptionin a string separated with comma //Return: row number if the calendar is found; zero if the script isn't found -function findCalendar(name, desc, role) { +function findCalendar(name, desc) { return new Cypress.Promise((resolve, reject) => { try { let rowNumber = 0; - const roles = role.split(','); - const targetedNumber = roles.length + 2; // Name, description and roles all need to match to find the calendar + const targetedNumber = 2; // Name and description need to match to find the calendar calendarObj .calendarTableBody() .find('tr') @@ -140,12 +135,6 @@ function findCalendar(name, desc, role) { if (rowElement.cells[2].innerHTML.includes(desc)) { counter = counter + 1; } - // cy.log(rowElement.cells[3].innerHTML); // Print out the role cell innerHTML for debug purpose - roles.forEach((runningRole) => { - if (rowElement.cells[3].innerHTML.includes(runningRole.trim())) { - counter = counter + 1; - } - }); Cypress.log({ name: 'Number of matched items for row# ' + rowElement.rowIndex + ': ', message: String(String(counter)), @@ -166,92 +155,94 @@ function findCalendar(name, desc, role) { }); } -When( - 'the user clicks {string} button for the calendar of {string}, {string}, {string}', - function (button, name, desc, role) { - findCalendar(name, desc, role).then((rowNumber) => { - expect(rowNumber).to.be.greaterThan( - 0, - 'Script of ' + name + ', ' + desc + ', ' + role + ' has row #' + rowNumber - ); - cy.wait(1000); // Wait for buttons to show up - switch (button.toLowerCase()) { - case 'edit': - calendarObj.calendarEditButton(rowNumber).shadow().find('button').click({ force: true }); - break; - case 'delete': - calendarObj.calendarDeleteButton(rowNumber).shadow().find('button').click({ force: true }); - break; - default: - expect(button).to.be.oneOf(['edit', 'delete']); - } - }); - } -); +When('the user clicks {string} button for the calendar of {string}, {string}', function (button, name, desc) { + findCalendar(name, desc).then((rowNumber) => { + expect(rowNumber).to.be.greaterThan(0, 'Script of ' + name + ', ' + desc + ' has row #' + rowNumber); + cy.wait(1000); // Wait for buttons to show up + switch (button.toLowerCase()) { + case 'edit': + calendarObj.calendarEditButton(rowNumber).shadow().find('button').click({ force: true }); + break; + case 'delete': + calendarObj.calendarDeleteButton(rowNumber).shadow().find('button').click({ force: true }); + break; + default: + expect(button).to.be.oneOf(['edit', 'delete']); + } + }); +}); Then('the user views Edit calendar modal', function () { calendarObj.editCalendarModal().should('exist'); }); -When('the user enters {string} as description and selects {string} as role in Edit calendar modal', function (description, role) { - calendarObj.editCalendarModalDescriptionField().shadow().find('.goa-textarea').clear().type(description, { force: true }); - //Unselect all checkboxes - calendarObj - .editCalendarModalTable() - .shadow() - .find('goa-checkbox') - .shadow() - .find('.goa-checkbox-container') - .then((elements) => { - for (let i = 0; i < elements.length; i++) { - if (elements[i].getAttribute('class')?.includes('--selected')) { - elements[i].click(); - } - } - }); - // Select roles - const roles = role.split(','); +When( + 'the user enters {string} as description and selects {string} as role in Edit calendar modal', + function (description, role) { + calendarObj + .editCalendarModalDescriptionField() + .shadow() + .find('.goa-textarea') + .clear() + .type(description, { force: true }); + //Unselect all checkboxes + calendarObj + .editCalendarModalTable() + .shadow() + .find('goa-checkbox') + .shadow() + .find('.goa-checkbox-container') + .then((elements) => { + for (let i = 0; i < elements.length; i++) { + if (elements[i].getAttribute('class')?.includes('--selected')) { + elements[i].click(); + } + } + }); + // Select roles + const roles = role.split(','); for (let i = 0; i < roles.length; i++) { if (roles[i].includes(':')) { - const clientRoleStringArray = roles[i].split(':'); - let clientName = ''; - for (let j = 0; j < clientRoleStringArray.length - 1; j++) { - if (j !== clientRoleStringArray.length - 2) { - clientName = clientName + clientRoleStringArray[j].trim() + ':'; - } else { - clientName = clientName + clientRoleStringArray[j]; - } - } - const roleName = clientRoleStringArray[clientRoleStringArray.length - 1]; - calendarObj - .addCalendarModalClientRolesTable(clientName) - .shadow() - .find('.role-name') - .contains(roleName) - .next() - .find('goa-checkbox') - .shadow() - .find('.goa-checkbox-container') - .scrollIntoView() - .click({ force: true }); - } else { - calendarObj - .addCalendarModalRolesTable() - .shadow() - .find('.role-name') - .contains(roles[i].trim()) - .next() - .find('goa-checkbox') - .shadow() - .find('.goa-checkbox-container') - .scrollIntoView() - .click({ force: true }); + const clientRoleStringArray = roles[i].split(':'); + let clientName = ''; + for (let j = 0; j < clientRoleStringArray.length - 1; j++) { + if (j !== clientRoleStringArray.length - 2) { + clientName = clientName + clientRoleStringArray[j].trim() + ':'; + } else { + clientName = clientName + clientRoleStringArray[j]; + } + } + const roleName = clientRoleStringArray[clientRoleStringArray.length - 1]; + calendarObj + .addCalendarModalClientRolesTable(clientName) + .shadow() + .find('.role-name') + .contains(roleName) + .next() + .find('goa-checkbox') + .shadow() + .find('.goa-checkbox-container') + .scrollIntoView() + .click({ force: true }); + } else { + calendarObj + .addCalendarModalRolesTable() + .shadow() + .find('.role-name') + .contains(roles[i].trim()) + .next() + .find('goa-checkbox') + .shadow() + .find('.goa-checkbox-container') + .scrollIntoView() + .click({ force: true }); } + } } -}); +); When('the user clicks Save button in Edit calendar modal', function () { cy.wait(1000); // Wait for the button to enable calendarObj.calendarModalSaveButton().shadow().find('button').scrollIntoView().click({ force: true }); cy.wait(2000); // Wait for the save operation -}); \ No newline at end of file +}); diff --git a/apps/tenant-management-webapp-e2e/src/integration/comment.feature b/apps/tenant-management-webapp-e2e/src/integration/comment.feature index 3eba7815ca..ba154d6d5f 100644 --- a/apps/tenant-management-webapp-e2e/src/integration/comment.feature +++ b/apps/tenant-management-webapp-e2e/src/integration/comment.feature @@ -22,32 +22,32 @@ Feature: Comment When the user enters "auto-test-1-$" in Add topic type modal Then the user views the error message of "Allowed characters are: a-z, A-Z, 0-9, -, [space]" for Name field in Add topic type modal # Validate data - When the user enters "autotest-topicType" in Add topic type modal + When the user enters "autotest-addEditDeleteTopicType" in Add topic type modal And the user clicks Save button in Add topic type modal - Then the user views topic type editor for "autotest-topicType" + Then the user views topic type editor for "autotest-addEditDeleteTopicType" And the user views "Protected A" as default selection for security classification And the user views "Public, Protected A, Protected B, Protected C" in Select a security classification dropdown When the user enters "skip" as classification, "auto-test-role1" as admin roles, "auto-test-role2" as commenter roles, "empty" as reader roles And the user clicks Save button on topic type editor - Then the user "views" the topic type of "autotest-topicType", "auto-test-role1", "auto-test-role2", "empty", "Protected A" + Then the user "views" the topic type of "autotest-addEditDeleteTopicType", "Protected A" # Edit and back - When the user clicks "Edit" button for the topic type of "autotest-topicType", "auto-test-role1", "auto-test-role2", "empty", "Protected A" - Then the user views topic type editor for "autotest-topicType" + When the user clicks "Edit" button for the topic type of "autotest-addEditDeleteTopicType", "Protected A" + Then the user views topic type editor for "autotest-addEditDeleteTopicType" When the user enters "Protected B" as classification, "auto-test-role2" as admin roles, "auto-test-role1" as commenter roles, "auto-test-role3" as reader roles And the user clicks Back button on topic type editor And the user clicks "Don't save" button on unsaved changes modal - Then the user "should not view" the topic type of "autotest-topicType", "auto-test-role2", "auto-test-role1", "auto-test-role3", "Protected B" + Then the user "should not view" the topic type of "autotest-addEditDeleteTopicType", "Protected B" # Edit and save - When the user clicks "Edit" button for the topic type of "autotest-topicType", "auto-test-role1", "auto-test-role2", "empty", "Protected A" - Then the user views topic type editor for "autotest-topicType" + When the user clicks "Edit" button for the topic type of "autotest-addEditDeleteTopicType", "Protected A" + Then the user views topic type editor for "autotest-addEditDeleteTopicType" When the user enters "Protected B" as classification, "auto-test-role2" as admin roles, "auto-test-role1" as commenter roles, "auto-test-role3" as reader roles And the user clicks Save button on topic type editor - Then the user "views" the topic type of "autotest-topicType", "auto-test-role2", "auto-test-role1", "auto-test-role3", "Protected B" + Then the user "views" the topic type of "autotest-addEditDeleteTopicType", "Protected B" # Delete - When the user clicks "Delete" button for the topic type of "autotest-topicType", "auto-test-role2", "auto-test-role1", "auto-test-role3", "Protected B" - Then the user views delete "topic type" confirmation modal for "autotest-topicType" + When the user clicks "Delete" button for the topic type of "autotest-addEditDeleteTopicType", "Protected B" + Then the user views delete "topic type" confirmation modal for "autotest-addEditDeleteTopicType" When the user clicks Delete button in delete confirmation modal - Then the user "should not view" the topic type of "autotest-topicType", "auto-test-role2", "auto-test-role1", "auto-test-role3", "Protected B" + Then the user "should not view" the topic type of "autotest-addEditDeleteTopicType", "Protected B" #TEST DATA: precreated topic type of "autotest-topicTypesAccessibility", "auto-test-role1", "auto-test-role1", "auto-test-role1", "Protected A" @accessibility @regression @@ -60,6 +60,6 @@ Feature: Comment When the user clicks Cancel button in Add topic type modal Then the user views topic types page And no critical or serious accessibility issues on "comment topic types page" - When the user clicks "Edit" button for the topic type of "autotest-topicTypesAccessibility", "auto-test-role1", "auto-test-role1", "auto-test-role1", "Protected A" + When the user clicks "Edit" button for the topic type of "autotest-topicTypesAccessibility", "Protected A" Then the user views topic type editor for "autotest-topicTypesAccessibility" And no critical or serious accessibility issues on "comment topic type editor page" diff --git a/apps/tenant-management-webapp-e2e/src/integration/comment/comment.step.ts b/apps/tenant-management-webapp-e2e/src/integration/comment/comment.step.ts index ed429a2302..f39cc0128c 100644 --- a/apps/tenant-management-webapp-e2e/src/integration/comment/comment.step.ts +++ b/apps/tenant-management-webapp-e2e/src/integration/comment/comment.step.ts @@ -257,73 +257,33 @@ Then('the user clicks Save button on topic type editor', function () { cy.wait(2000); }); -Then( - 'the user {string} the topic type of {string}, {string}, {string}, {string}, {string}', - function (action, name, adminRole, commenterRole, readerRole, classification) { - cy.wait(1000); //Wait for the grid to load all data - findTopicType(name, adminRole, commenterRole, readerRole, classification).then((rowNumber) => { - switch (action) { - case 'views': - expect(rowNumber).to.be.greaterThan( - 0, - 'Topic type of ' + - name + - ', ' + - adminRole + - ', ' + - commenterRole + - ', ' + - readerRole + - ', ' + - classification + - ' has row #' + - rowNumber - ); - break; - case 'should not view': - expect(rowNumber).to.equal( - 0, - 'Topic type of ' + - name + - ', ' + - adminRole + - ', ' + - commenterRole + - ', ' + - readerRole + - ', ' + - classification + - ' has row #' + - rowNumber - ); - break; - default: - expect(action).to.be.oneOf(['views', 'should not view']); - } - }); - } -); +Then('the user {string} the topic type of {string}, {string}', function (action, name, classification) { + cy.wait(1000); //Wait for the grid to load all data + findTopicType(name, classification).then((rowNumber) => { + switch (action) { + case 'views': + expect(rowNumber).to.be.greaterThan( + 0, + 'Topic type of ' + name + ', ' + classification + ' has row #' + rowNumber + ); + break; + case 'should not view': + expect(rowNumber).to.equal(0, 'Topic type of ' + name + ', ' + classification + ' has row #' + rowNumber); + break; + default: + expect(action).to.be.oneOf(['views', 'should not view']); + } + }); +}); -//Find topic type with name, admin role(s), commenter role(s), reader role(s) -//Input: name, admin role(s) & commenter role(s) & reader role(s) in a string separated with comma +//Find topic type with name, classification +//Input: name, classificationin a string separated with comma //Return: row number if the topic type is found; zero if the item isn't found -function findTopicType(name, adminRole, commenterRole, readerRole, classification) { +function findTopicType(name, classification) { return new Cypress.Promise((resolve, reject) => { try { let rowNumber = 0; let targetedNumber = 1; - const adminRoles = adminRole.split(','); - const commenterRoles = commenterRole.split(','); - const readerRoles = readerRole.split(','); - if (adminRole.toLowerCase() != 'empty') { - targetedNumber = targetedNumber + adminRoles.length; - } - if (commenterRole.toLowerCase() != 'empty') { - targetedNumber = targetedNumber + commenterRoles.length; - } - if (readerRole.toLowerCase() != 'empty') { - targetedNumber = targetedNumber + readerRoles.length; - } if (classification.toLowerCase() != 'empty') { targetedNumber = targetedNumber + 1; } @@ -337,26 +297,8 @@ function findTopicType(name, adminRole, commenterRole, readerRole, classificatio if (rowElement.cells[0].innerHTML.includes(name)) { counter = counter + 1; } - // cy.log(rowElement.cells[2].innerHTML); // Print out the assigner role cell innerHTML for debug purpose - adminRoles.forEach((aRole) => { - if (rowElement.cells[2].innerHTML.includes(aRole.trim())) { - counter = counter + 1; - } - }); - // cy.log(rowElement.cells[3].innerHTML); // Print out the worker role cell innerHTML for debug purpose - commenterRoles.forEach((cRole) => { - if (rowElement.cells[3].innerHTML.includes(cRole.trim())) { - counter = counter + 1; - } - }); - // cy.log(rowElement.cells[4].innerHTML); // Print out the worker role cell innerHTML for debug purpose - readerRoles.forEach((rRole) => { - if (rowElement.cells[4].innerHTML.includes(rRole.trim())) { - counter = counter + 1; - } - }); - // cy.log(rowElement.cells[5].innerHTML); // Print out the worker role cell innerHTML for debug purpose - if (rowElement.cells[5].innerHTML.includes(classification.toLowerCase())) { + // cy.log(rowElement.cells[2].innerHTML); // Print out the worker role cell innerHTML for debug purpose + if (rowElement.cells[2].innerHTML.includes(classification.toLowerCase())) { counter = counter + 1; } Cypress.log({ @@ -380,9 +322,9 @@ function findTopicType(name, adminRole, commenterRole, readerRole, classificatio } When( - 'the user clicks {string} button for the topic type of {string}, {string}, {string}, {string}, {string}', - function (button, name, adminRole, commenterRole, readerRol, classification) { - findTopicType(name, adminRole, commenterRole, readerRol, classification).then((rowNumber) => { + 'the user clicks {string} button for the topic type of {string}, {string}', + function (button, name, classification) { + findTopicType(name, classification).then((rowNumber) => { switch (button) { case 'Edit': commentObj.topicTypeEditButton(rowNumber).shadow().find('button').click({ force: true }); diff --git a/apps/tenant-management-webapp-e2e/src/integration/file-service.feature b/apps/tenant-management-webapp-e2e/src/integration/file-service.feature index aa3a05fb51..ce1ab625c6 100644 --- a/apps/tenant-management-webapp-e2e/src/integration/file-service.feature +++ b/apps/tenant-management-webapp-e2e/src/integration/file-service.feature @@ -125,16 +125,16 @@ Feature: File service Then the user views file type page of "autotest-addEditDelete" When the user enters "public", "auto-test-role1", "30" on file type page And the user clicks Save button on file type page - Then the user "views" the file type of "autotest-addEditDelete", "public", "auto-test-role1", "30" - When the user clicks "Edit" button for the file type of "autotest-addEditDelete", "public", "auto-test-role1", "30" + Then the user "views" the file type of "autotest-addEditDelete", "30" + When the user clicks "Edit" button for the file type of "autotest-addEditDelete", "30" Then the user views file type page of "autotest-addEditDelete" When the user enters "auto-test-role1", "auto-test-role2", "10" on file type page And the user clicks Save button on file type page - Then the user "views" the file type of "autotest-addEditDelete", "auto-test-role1", "auto-test-role2", "10" - When the user clicks "Delete" button for the file type of "autotest-addEditDelete", "auto-test-role1", "auto-test-role2", "10" + Then the user "views" the file type of "autotest-addEditDelete", "10" + When the user clicks "Delete" button for the file type of "autotest-addEditDelete", "10" Then the user views Delete file type modal for "autotest-addEditDelete" When the user clicks Delete button on file type modal - Then the user "should not view" the file type of "autotest-addEditDelete", "auto-test-role1", "auto-test-role2", "10" + Then the user "should not view" the file type of "autotest-addEditDelete", "10" # TODO: This is broken after removal of the file service specific 'feedback zone'; re-enable after feedback zone implementation. @FileTypes @regression @ignore @@ -166,10 +166,10 @@ Feature: File service Given a service owner user is on Files overview page When the user selects "File types" tab for "File" Then the user views file types page - When the user clicks "Delete" button for the file type of "autotest-type5", "public", "file-service-admin", "N/A" + When the user clicks "Delete" button for the file type of "autotest-type5", "N/A" Then the user views file type current in use modal for "autotest-type5" When the user clicks Okay button on file type current in use modal - Then the user "views" the file type of "autotest-type5", "public", "file-service-admin", "N/A" + Then the user "views" the file type of "autotest-type5", "N/A" @TEST_CS-1411 @REQ_CS-1358 @FileTypes @regression Scenario: As a tenant admin, can see core file types diff --git a/apps/tenant-management-webapp-e2e/src/integration/file-service/file-service.step.ts b/apps/tenant-management-webapp-e2e/src/integration/file-service/file-service.step.ts index d44a7b2d86..217e13afc8 100644 --- a/apps/tenant-management-webapp-e2e/src/integration/file-service/file-service.step.ts +++ b/apps/tenant-management-webapp-e2e/src/integration/file-service/file-service.step.ts @@ -612,48 +612,36 @@ When('the user clicks Cancel button on file type modal', function () { cy.wait(1000); // Wait the file type list to refresh }); -Then( - 'the user {string} the file type of {string}, {string}, {string}, {string}', - function (action, name, readRole, updateRole, retention) { - findFileType(name, readRole, updateRole, retention).then((rowNumber) => { - switch (action) { - case 'views': - expect(rowNumber).to.be.greaterThan( - 0, - 'File type of ' + name + ', ' + readRole + ', ' + updateRole + ' has row #' + rowNumber - ); - break; - case 'should not view': - expect(rowNumber).to.equal( - 0, - 'File type of ' + name + ', ' + readRole + ', ' + updateRole + ' has row #' + rowNumber - ); - break; - default: - expect(action).to.be.oneOf(['views', 'should not view']); - } - }); - } -); +Then('the user {string} the file type of {string}, {string}', function (action, name, retention) { + findFileType(name, retention).then((rowNumber) => { + switch (action) { + case 'views': + expect(rowNumber).to.be.greaterThan(0, 'File type of ' + name + ' has row #' + rowNumber); + break; + case 'should not view': + expect(rowNumber).to.equal(0, 'File type of ' + name + ' has row #' + rowNumber); + break; + default: + expect(action).to.be.oneOf(['views', 'should not view']); + } + }); +}); -When( - 'the user clicks {string} button for the file type of {string}, {string}, {string}, {string}', - function (button, name, readRole, updateRole, retention) { - findFileType(name, readRole, updateRole, retention).then((rowNumber) => { - switch (button) { - case 'Edit': - fileServiceObj.fileTypeEditButton(rowNumber).shadow().find('button').click({ force: true }); - break; - case 'Delete': - cy.wait(1000); // Wait to avoid no modal showing up for delete button clicking - fileServiceObj.fileTypeDeleteButton(rowNumber).shadow().find('button').click({ force: true }); - break; - default: - expect(button).to.be.oneOf(['Edit', 'Delete']); - } - }); - } -); +When('the user clicks {string} button for the file type of {string}, {string}', function (button, name, retention) { + findFileType(name, retention).then((rowNumber) => { + switch (button) { + case 'Edit': + fileServiceObj.fileTypeEditButton(rowNumber).shadow().find('button').click({ force: true }); + break; + case 'Delete': + cy.wait(1000); // Wait to avoid no modal showing up for delete button clicking + fileServiceObj.fileTypeDeleteButton(rowNumber).shadow().find('button').click({ force: true }); + break; + default: + expect(button).to.be.oneOf(['Edit', 'Delete']); + } + }); +}); Then('the user views Delete file type modal for {string}', function (fileTypeName) { cy.wait(1000); // Wait for modal @@ -668,23 +656,14 @@ When('the user clicks Delete button on file type modal', function () { cy.wait(2000); //Wait the file type list to refresh }); -//Find file type with name, read role(s), update role(s), and retention number -//Input: file name, file read role(s) in a string separated with comma, file update role(s) in a string separated with comma, retention number +//Find file type with name and retention number +//Input: file name and retention number //Return: row number if the file type is found; zero if the file type isn't found -function findFileType(name, readRole, updateRole, retention) { +function findFileType(name, retention) { return new Cypress.Promise((resolve, reject) => { try { let rowNumber = 0; - let targetedNumber = 2; - const readRoles = readRole.split(','); - const updateRoles = updateRole.split(','); - if (readRole.toLowerCase() != 'empty') { - targetedNumber = targetedNumber + readRoles.length; - } - if (updateRole.toLowerCase() != 'empty') { - targetedNumber = targetedNumber + updateRoles.length; - } - // targetedNumber = readRoles.length + updateRoles.length + 1; // Name, read roles and update roles all need to match to find the file type + const targetedNumber = 2; fileServiceObj .fileTypeTableBody() .find('tr') @@ -695,19 +674,7 @@ function findFileType(name, readRole, updateRole, retention) { if (rowElement.cells[0].innerHTML.includes(name)) { counter = counter + 1; } - // cy.log(rowElement.cells[1].innerHTML); // Print out the read role cell innerHTML for debug purpose - readRoles.forEach((rRole) => { - if (rowElement.cells[1].innerHTML.includes(rRole.trim())) { - counter = counter + 1; - } - }); - // cy.log(rowElement.cells[2].innerHTML); // Print out the update role cell innerHTML for debug purpose - updateRoles.forEach((uRole) => { - if (rowElement.cells[2].innerHTML.includes(uRole.trim())) { - counter = counter + 1; - } - }); - if (rowElement.cells[4].innerHTML.includes(retention)) { + if (rowElement.cells[2].innerHTML.includes(retention)) { counter = counter + 1; } Cypress.log({ diff --git a/apps/tenant-management-webapp-e2e/src/integration/form.feature b/apps/tenant-management-webapp-e2e/src/integration/form.feature index 8072374356..d4cf9a7fcc 100644 --- a/apps/tenant-management-webapp-e2e/src/integration/form.feature +++ b/apps/tenant-management-webapp-e2e/src/integration/form.feature @@ -9,7 +9,8 @@ Feature: Form And the user views the link of See the code for "form-service" And the user views the link of "Get support" under Support - @TEST_CS-2366 @TEST_CS-2356 @TEST_CS-2332 @TEST_CS-2406 @REQ_CS-1848 @REQ_CS-2170 @REQ_CS-2169 @REQ_CS-2254 @regression + # Ignore this test due to the pending task to change the test for the recent UI change of roles + @TEST_CS-2366 @TEST_CS-2356 @TEST_CS-2332 @TEST_CS-2406 @REQ_CS-1848 @REQ_CS-2170 @REQ_CS-2169 @REQ_CS-2254 @regression @ignore Scenario: As a tenant admin, I can add and delete a form definition Given a tenant admin user is on form service overview page When the user clicks Add definition button on form service overview page @@ -27,25 +28,25 @@ Feature: Form Then the user views form definition editor for "autotest-formDef", "autotest desc" When the user enters "auto-test-role1" as applicant roles, "auto-test-role2" as clerk roles, "empty" as assessor roles And the user clicks Save button on form definition editor - Then the user "views" the form definition of "autotest-formDef", "autotest desc", "auto-test-role1", "auto-test-role2", "empty" + Then the user "views" the form definition of "autotest-formDef", "autotest desc" # Edit and back - When the user clicks "Edit" button for the form definition of "autotest-formDef", "autotest desc", "auto-test-role1", "auto-test-role2", "empty" + When the user clicks "Edit" button for the form definition of "autotest-formDef", "autotest desc" Then the user views form definition editor for "autotest-formDef", "autotest desc" When the user enters "auto-test-role2" as applicant roles, "auto-test-role1" as clerk roles, "auto-test-role3" as assessor roles And the user clicks Back button on form definition editor And the user clicks "Don't save" button on unsaved changes modal - Then the user "should not view" the form definition of "autotest-formDef", "autotest desc", "auto-test-role2", "auto-test-role1", "auto-test-role3" + Then the user "should not view" the form definition of "autotest-formDef", "autotest desc" # Edit and save - When the user clicks "Edit" button for the form definition of "autotest-formDef", "autotest desc", "auto-test-role1", "auto-test-role2", "empty" + When the user clicks "Edit" button for the form definition of "autotest-formDef", "autotest desc" Then the user views form definition editor for "autotest-formDef", "autotest desc" When the user enters "auto-test-role2" as applicant roles, "auto-test-role1" as clerk roles, "auto-test-role3" as assessor roles And the user clicks Save button on form definition editor - Then the user "views" the form definition of "autotest-formDef", "autotest desc", "auto-test-role2", "auto-test-role1", "auto-test-role3" + Then the user "views" the form definition of "autotest-formDef", "autotest desc" # Delete - When the user clicks "Delete" button for the form definition of "autotest-formDef", "autotest desc", "auto-test-role2", "auto-test-role1", "auto-test-role3" + When the user clicks "Delete" button for the form definition of "autotest-formDef", "autotest desc" Then the user views delete "form definition" confirmation modal for "autotest-formDef" When the user clicks Delete button in delete confirmation modal - Then the user "should not view" the form definition of "autotest-formDef", "autotest desc", "auto-test-role2", "auto-test-role1", "auto-test-role3" + Then the user "should not view" the form definition of "autotest-formDef", "autotest desc" #TEST DATA: precreated form definition of "autotest-formDefAccessibility", "DO NOT DELETE", "auto-test-role1", "auto-test-role1", "auto-test-role1" @accessibility @regression @@ -59,6 +60,6 @@ Feature: Form Then the user views form definitions page And no critical or serious accessibility issues on "form definitions page" ## Cypress crashes on accessibility test on form definition editor. -# When the user clicks "Edit" button for the form definition of "autotest-formDefAccessibility", "DO NOT DELETE", "auto-test-role1", "auto-test-role1", "auto-test-role1" +# When the user clicks "Edit" button for the form definition of "autotest-formDefAccessibility", "DO NOT DELETE" # Then the user views form definition editor for "autotest-formDefAccessibility", "DO NOT DELETE" # And no critical or serious accessibility issues on "form definition editor page" diff --git a/apps/tenant-management-webapp-e2e/src/integration/form/form.step.ts b/apps/tenant-management-webapp-e2e/src/integration/form/form.step.ts index ab3185e8ef..d9e432c5b4 100644 --- a/apps/tenant-management-webapp-e2e/src/integration/form/form.step.ts +++ b/apps/tenant-management-webapp-e2e/src/integration/form/form.step.ts @@ -227,73 +227,30 @@ Then('the user clicks Save button on form definition editor', function () { cy.wait(2000); }); -Then( - 'the user {string} the form definition of {string}, {string}, {string}, {string}, {string}', - function (action, name, description, applicantRole, clerkRole, assessorRole) { - cy.wait(1000); //Wait for the grid to load all data - findDefinition(name, description, applicantRole, clerkRole, assessorRole).then((rowNumber) => { - switch (action) { - case 'views': - expect(rowNumber).to.be.greaterThan( - 0, - 'Definition of ' + - name + - ', ' + - description + - ', ' + - applicantRole + - ', ' + - clerkRole + - ', ' + - assessorRole + - ' has row #' + - rowNumber - ); - break; - case 'should not view': - expect(rowNumber).to.equal( - 0, - 'Definition of ' + - name + - ', ' + - description + - ', ' + - applicantRole + - ', ' + - clerkRole + - ', ' + - assessorRole + - ' has row #' + - rowNumber - ); - break; - default: - expect(action).to.be.oneOf(['views', 'should not view']); - } - }); - } -); +Then('the user {string} the form definition of {string}, {string}', function (action, name, description) { + cy.wait(1000); //Wait for the grid to load all data + findDefinition(name, description).then((rowNumber) => { + switch (action) { + case 'views': + expect(rowNumber).to.be.greaterThan(0, 'Definition of ' + name + ', ' + description + ' has row #' + rowNumber); + break; + case 'should not view': + expect(rowNumber).to.equal(0, 'Definition of ' + name + ', ' + description + ' has row #' + rowNumber); + break; + default: + expect(action).to.be.oneOf(['views', 'should not view']); + } + }); +}); -//Find definition with name, description, applicant role(s), clerk role(s), assessor role(s) -//Input: name, description, applicant role(s) & clerk role(s) & assessor role(s) in a string separated with comma +//Find definition with name, description +//Input: name, description in a string separated with comma //Return: row number if the form definition is found; zero if the definition isn't found -function findDefinition(name, description, applicantRole, clerkRole, assessorRole) { +function findDefinition(name, description) { return new Cypress.Promise((resolve, reject) => { try { let rowNumber = 0; - let targetedNumber = 2; - const applicantRoles = applicantRole.split(','); - const clerkRoles = clerkRole.split(','); - const assessorRoles = assessorRole.split(','); - if (applicantRole.toLowerCase() != 'empty') { - targetedNumber = targetedNumber + applicantRoles.length; - } - if (clerkRole.toLowerCase() != 'empty') { - targetedNumber = targetedNumber + clerkRoles.length; - } - if (assessorRole.toLowerCase() != 'empty') { - targetedNumber = targetedNumber + assessorRoles.length; - } + const targetedNumber = 2; formObj .definitionsTableBody() .find('tr') @@ -308,24 +265,6 @@ function findDefinition(name, description, applicantRole, clerkRole, assessorRol if (rowElement.cells[2].innerHTML.includes(description)) { counter = counter + 1; } - // cy.log(rowElement.cells[3].innerHTML); // Print out the assigner role cell innerHTML for debug purpose - applicantRoles.forEach((atRole) => { - if (rowElement.cells[3].innerHTML.includes(atRole.trim())) { - counter = counter + 1; - } - }); - // cy.log(rowElement.cells[4].innerHTML); // Print out the worker role cell innerHTML for debug purpose - clerkRoles.forEach((ckRole) => { - if (rowElement.cells[4].innerHTML.includes(ckRole.trim())) { - counter = counter + 1; - } - }); - // cy.log(rowElement.cells[5].innerHTML); // Print out the worker role cell innerHTML for debug purpose - assessorRoles.forEach((arRole) => { - if (rowElement.cells[5].innerHTML.includes(arRole.trim())) { - counter = counter + 1; - } - }); Cypress.log({ name: 'Number of matched items for row# ' + rowElement.rowIndex + ': ', message: String(String(counter)), @@ -347,9 +286,9 @@ function findDefinition(name, description, applicantRole, clerkRole, assessorRol } When( - 'the user clicks {string} button for the form definition of {string}, {string}, {string}, {string}, {string}', - function (button, name, description, applicantRole, clerkRole, assessorRole) { - findDefinition(name, description, applicantRole, clerkRole, assessorRole).then((rowNumber) => { + 'the user clicks {string} button for the form definition of {string}, {string}', + function (button, name, description) { + findDefinition(name, description).then((rowNumber) => { switch (button) { case 'Edit': formObj.definitionEditButton(rowNumber).shadow().find('button').click({ force: true }); diff --git a/apps/tenant-management-webapp-e2e/src/integration/script.feature b/apps/tenant-management-webapp-e2e/src/integration/script.feature index daf4ba7acd..f5ce03c959 100644 --- a/apps/tenant-management-webapp-e2e/src/integration/script.feature +++ b/apps/tenant-management-webapp-e2e/src/integration/script.feature @@ -12,9 +12,9 @@ Feature: Script # Validate data When the user enters "autotest-addscript", "autotest script desc", "yes", "auto-test-role1, urn:ads:autotest:chat-service:chat-admin" in Add script modal And the user clicks Save button in Add script modal - Then the user "views" the script of "autotest-addscript", "autotest script desc", "auto-test-role1, urn:ads:autotest:chat-service:chat-admin" + Then the user "views" the script of "autotest-addscript", "autotest script desc" # Edit - When the user clicks "Edit" button for the script of "autotest-addscript", "autotest script desc", "auto-test-role1, urn:ads:autotest:chat-service:chat-admin" + When the user clicks "Edit" button for the script of "autotest-addscript", "autotest script desc" Then the user views the script editor for "autotest-addscript", "autotest script desc" When the user clicks Edit button in script editor Then the user views Edit script modal @@ -24,12 +24,12 @@ Feature: Script And the user selects "Roles" tab in script editor And the user enters "auto-test-role2, urn:ads:autotest:chat-service:chatter" for roles in script editor And the user clicks Save button in script editor - Then the user "views" the script of "autotest-modifiedscript", "autotest script desc 2", "auto-test-role2, urn:ads:autotest:chat-service:chatter" + Then the user "views" the script of "autotest-modifiedscript", "autotest script desc 2" # Delete - When the user clicks "Delete" button for the script of "autotest-modifiedscript", "autotest script desc 2", "auto-test-role2, urn:ads:autotest:chat-service:chatter" + When the user clicks "Delete" button for the script of "autotest-modifiedscript", "autotest script desc 2" Then the user views delete "script" confirmation modal for "autotest-modifiedscript" When the user clicks Delete button in delete confirmation modal - Then the user "should not view" the script of "autotest-modifiedscript", "autotest script desc 2", "auto-test-role2, urn:ads:autotest:chat-service:chatter" + Then the user "should not view" the script of "autotest-modifiedscript", "autotest script desc 2" @TEST_CS-1739 @REQ_CS-1655 @regression Scenario: As a tenant admin, I can see the overview for a script service, so I know about the service diff --git a/apps/tenant-management-webapp-e2e/src/integration/script/script.step.ts b/apps/tenant-management-webapp-e2e/src/integration/script/script.step.ts index 8e39c3d8f3..c88dd2406b 100644 --- a/apps/tenant-management-webapp-e2e/src/integration/script/script.step.ts +++ b/apps/tenant-management-webapp-e2e/src/integration/script/script.step.ts @@ -103,17 +103,14 @@ When('the user clicks Cancel button in Add script modal', function () { cy.wait(1000); }); -Then('the user {string} the script of {string}, {string}, {string}', function (viewOrNot, name, desc, role) { - findScript(name, desc, role).then((rowNumber) => { +Then('the user {string} the script of {string}, {string}', function (viewOrNot, name, desc) { + findScript(name, desc).then((rowNumber) => { switch (viewOrNot) { case 'views': - expect(rowNumber).to.be.greaterThan( - 0, - 'Script of ' + name + ', ' + desc + ', ' + role + ' has row #' + rowNumber - ); + expect(rowNumber).to.be.greaterThan(0, 'Script of ' + name + ', ' + desc + ' has row #' + rowNumber); break; case 'should not view': - expect(rowNumber).to.equal(0, 'Script of ' + name + ', ' + desc + ', ' + role + ' has row #' + rowNumber); + expect(rowNumber).to.equal(0, 'Script of ' + name + ', ' + desc + ', ' + ' has row #' + rowNumber); break; default: expect(viewOrNot).to.be.oneOf(['views', 'should not view']); @@ -121,15 +118,14 @@ Then('the user {string} the script of {string}, {string}, {string}', function (v }); }); -//Find a script with name, description and role(s) -//Input: script name, script description, role(s) in a string separated with comma +//Find a script with name, description +//Input: script name, script description in a string separated with comma //Return: row number if the script is found; zero if the script isn't found -function findScript(name, desc, role) { +function findScript(name, desc) { return new Cypress.Promise((resolve, reject) => { try { let rowNumber = 0; - const roles = role.split(','); - const targetedNumber = roles.length + 2; // Name, description and roles all need to match to find the script + const targetedNumber = 2; // Name and description need to match to find the script scriptObj .scriptTableBody() .find('tr') @@ -144,12 +140,6 @@ function findScript(name, desc, role) { if (rowElement.cells[2].innerHTML.includes(desc)) { counter = counter + 1; } - // cy.log(rowElement.cells[3].innerHTML); // Print out the role cell innerHTML for debug purpose - roles.forEach((runningRole) => { - if (rowElement.cells[3].innerHTML.includes(runningRole.trim())) { - counter = counter + 1; - } - }); Cypress.log({ name: 'Number of matched items for row# ' + rowElement.rowIndex + ': ', message: String(String(counter)), @@ -170,29 +160,23 @@ function findScript(name, desc, role) { }); } -When( - 'the user clicks {string} button for the script of {string}, {string}, {string}', - function (button, name, desc, role) { - findScript(name, desc, role).then((rowNumber) => { - expect(rowNumber).to.be.greaterThan( - 0, - 'Script of ' + name + ', ' + desc + ', ' + role + ' has row #' + rowNumber - ); - cy.wait(1000); // Wait for buttons to show up - switch (button.toLowerCase()) { - case 'edit': - scriptObj.scriptEditButton(rowNumber).shadow().find('button').click({ force: true }); - break; - break; - case 'delete': - scriptObj.scriptDeleteButton(rowNumber).shadow().find('button').click({ force: true }); - break; - default: - expect(button).to.be.oneOf(['edit', 'delete']); - } - }); - } -); +When('the user clicks {string} button for the script of {string}, {string}', function (button, name, desc) { + findScript(name, desc).then((rowNumber) => { + expect(rowNumber).to.be.greaterThan(0, 'Script of ' + name + ', ' + desc + ' has row #' + rowNumber); + cy.wait(1000); // Wait for buttons to show up + switch (button.toLowerCase()) { + case 'edit': + scriptObj.scriptEditButton(rowNumber).shadow().find('button').click({ force: true }); + break; + break; + case 'delete': + scriptObj.scriptDeleteButton(rowNumber).shadow().find('button').click({ force: true }); + break; + default: + expect(button).to.be.oneOf(['edit', 'delete']); + } + }); +}); Then('the user views Edit script modal', function () { scriptObj.editScriptModal().should('be.visible'); diff --git a/apps/tenant-management-webapp-e2e/src/integration/task.feature b/apps/tenant-management-webapp-e2e/src/integration/task.feature index 97b03481c6..45959f52ba 100644 --- a/apps/tenant-management-webapp-e2e/src/integration/task.feature +++ b/apps/tenant-management-webapp-e2e/src/integration/task.feature @@ -18,25 +18,25 @@ Feature: Task Then the user views Queue page for "autotest", "addEditDeleteQueue" When the user enters "auto-test-role1" as Assigner roles and "empty" as Worker roles And the user clicks Save button on Queue page - Then the user "views" the queue of "autotest", "addEditDeleteQueue", "auto-test-role1", "empty" + Then the user "views" the queue of "autotest", "addEditDeleteQueue" # Edit and back - When the user clicks "Edit" button for the queue of "autotest", "addEditDeleteQueue", "auto-test-role1", "empty" + When the user clicks "Edit" button for the queue of "autotest", "addEditDeleteQueue" Then the user views Queue page for "autotest", "addEditDeleteQueue" When the user enters "auto-test-role2" as Assigner roles and "auto-test-role2, urn:ads:autotest:chat-service:chat-admin" as Worker roles And the user clicks Back button on Queue page And the user clicks "Don't save" button on unsaved changes modal - Then the user "views" the queue of "autotest", "addEditDeleteQueue", "auto-test-role1", "empty" + Then the user "views" the queue of "autotest", "addEditDeleteQueue" # Edit and save - When the user clicks "Edit" button for the queue of "autotest", "addEditDeleteQueue", "auto-test-role1", "empty" + When the user clicks "Edit" button for the queue of "autotest", "addEditDeleteQueue" Then the user views Queue page for "autotest", "addEditDeleteQueue" When the user enters "auto-test-role2" as Assigner roles and "auto-test-role2, urn:ads:autotest:chat-service:chat-admin" as Worker roles And the user clicks Save button on Queue page - Then the user "views" the queue of "autotest", "addEditDeleteQueue", "auto-test-role2", "auto-test-role2, urn:ads:autotest:chat-service:chat-admin" + Then the user "views" the queue of "autotest", "addEditDeleteQueue" # Delete - When the user clicks "Delete" button for the queue of "autotest", "addEditDeleteQueue", "auto-test-role2", "auto-test-role2, urn:ads:autotest:chat-service:chat-admin" + When the user clicks "Delete" button for the queue of "autotest", "addEditDeleteQueue" Then the user views delete "task queue" confirmation modal for "addEditDeleteQueue" When the user clicks Delete button in delete confirmation modal - Then the user "should not view" the queue of "autotest", "addEditDeleteQueue", "auto-test-role2", "auto-test-role2, urn:ads:autotest:chat-service:chat-admin" + Then the user "should not view" the queue of "autotest", "addEditDeleteQueue" @TEST_CS-2296 @REQ_CS-1747 @regression Scenario: As a tenant admin, I can see the overview for a task service, so I know about it @@ -57,6 +57,6 @@ Feature: Task When the user clicks Cancel button in Add queue modal Then the user views Queues page And no critical or serious accessibility issues on "task queues page" - When the user clicks "Edit" button for the queue of "autotest", "accessibility-test", "auto-test-role1", "auto-test-role1" + When the user clicks "Edit" button for the queue of "autotest", "accessibility-test" Then the user views Queue page for "autotest", "accessibility-test" And no critical or serious accessibility issues on "task queue editor page" \ No newline at end of file diff --git a/apps/tenant-management-webapp-e2e/src/integration/task/task.step.ts b/apps/tenant-management-webapp-e2e/src/integration/task/task.step.ts index 33b9818721..c5dab6458e 100644 --- a/apps/tenant-management-webapp-e2e/src/integration/task/task.step.ts +++ b/apps/tenant-management-webapp-e2e/src/integration/task/task.step.ts @@ -55,7 +55,7 @@ When('the user clicks Save button in Add queue modal', function () { Then('the user views Queue page for {string}, {string}', function (namespace, name) { cy.viewport(1920, 1080); - cy.wait(1000); + cy.wait(2000); taskObj.queueNamespaceValue().should('have.text', namespace); taskObj.queueNameValue().should('have.text', name); }); @@ -143,47 +143,30 @@ Then('the user clicks Save button on Queue page', function () { cy.wait(4000); }); -Then( - 'the user {string} the queue of {string}, {string}, {string}, {string}', - function (action, namespace, name, assignerRole, workerRole) { - cy.wait(1000); //Wait for the grid to load all data - findQueue(namespace, name, assignerRole, workerRole).then((rowNumber) => { - switch (action) { - case 'views': - expect(rowNumber).to.be.greaterThan( - 0, - 'Queue of ' + namespace + ', ' + name + ', ' + assignerRole + ', ' + workerRole + ' has row #' + rowNumber - ); - break; - case 'should not view': - expect(rowNumber).to.equal( - 0, - 'Queue of ' + namespace + ', ' + name + ', ' + assignerRole + ', ' + workerRole + ' has row #' + rowNumber - ); - break; - default: - expect(action).to.be.oneOf(['views', 'should not view']); - } - }); - } -); +Then('the user {string} the queue of {string}, {string}', function (action, namespace, name) { + cy.wait(1000); //Wait for the grid to load all data + findQueue(namespace, name).then((rowNumber) => { + switch (action) { + case 'views': + expect(rowNumber).to.be.greaterThan(0, 'Queue of ' + namespace + ', ' + name + ' has row #' + rowNumber); + break; + case 'should not view': + expect(rowNumber).to.equal(0, 'Queue of ' + namespace + ', ' + name + ' has row #' + rowNumber); + break; + default: + expect(action).to.be.oneOf(['views', 'should not view']); + } + }); +}); -//Find queue with namespace, name, assigner role(s), worker role(s) -//Input: namespace, name, assigner role(s) in a string separated with comma, worker role(s) in a string separated with comma +//Find queue with namespace, name +//Input: namespace, name in a string //Return: row number if the queue is found; zero if the queue isn't found -function findQueue(namespace, name, assignerRole, workerRole) { +function findQueue(namespace, name) { return new Cypress.Promise((resolve, reject) => { try { let rowNumber = 0; - let targetedNumber = 2; - const assignerRoles = assignerRole.split(','); - const workerRoles = workerRole.split(','); - if (assignerRole.toLowerCase() != 'empty') { - targetedNumber = targetedNumber + assignerRoles.length; - } - if (workerRole.toLowerCase() != 'empty') { - targetedNumber = targetedNumber + workerRoles.length; - } + const targetedNumber = 2; taskObj .queueTableBody() .find('tr') @@ -198,18 +181,6 @@ function findQueue(namespace, name, assignerRole, workerRole) { if (rowElement.cells[1].innerHTML.includes(name)) { counter = counter + 1; } - // cy.log(rowElement.cells[2].innerHTML); // Print out the assigner role cell innerHTML for debug purpose - assignerRoles.forEach((rRole) => { - if (rowElement.cells[2].innerHTML.includes(rRole.trim())) { - counter = counter + 1; - } - }); - // cy.log(rowElement.cells[3].innerHTML); // Print out the worker role cell innerHTML for debug purpose - workerRoles.forEach((uRole) => { - if (rowElement.cells[3].innerHTML.includes(uRole.trim())) { - counter = counter + 1; - } - }); Cypress.log({ name: 'Number of matched items for row# ' + rowElement.rowIndex + ': ', message: String(String(counter)), @@ -230,25 +201,22 @@ function findQueue(namespace, name, assignerRole, workerRole) { }); } -When( - 'the user clicks {string} button for the queue of {string}, {string}, {string}, {string}', - function (button, namespace, name, assignerRole, workerRole) { - findQueue(namespace, name, assignerRole, workerRole).then((rowNumber) => { - switch (button) { - case 'Edit': - taskObj.queueEditButton(rowNumber).shadow().find('button').click({ force: true }); - cy.wait(2000); - break; - case 'Delete': - taskObj.queueDeleteButton(rowNumber).shadow().find('button').click({ force: true }); - cy.wait(2000); - break; - default: - expect(button).to.be.oneOf(['Edit', 'Delete']); - } - }); - } -); +When('the user clicks {string} button for the queue of {string}, {string}', function (button, namespace, name) { + findQueue(namespace, name).then((rowNumber) => { + switch (button) { + case 'Edit': + taskObj.queueEditButton(rowNumber).shadow().find('button').click({ force: true }); + cy.wait(2000); + break; + case 'Delete': + taskObj.queueDeleteButton(rowNumber).shadow().find('button').click({ force: true }); + cy.wait(2000); + break; + default: + expect(button).to.be.oneOf(['Edit', 'Delete']); + } + }); +}); When('the user clicks Back button on Queue page', function () { taskObj.queuePageBackButton().shadow().find('button').click({ force: true });