diff --git a/package-lock.json b/package-lock.json index 6458a56..7a476de 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8,6 +8,9 @@ "name": "@processmaker/cypress-utils", "version": "1.0.215", "license": "AGPL-3.0", + "dependencies": { + "@processmaker/cypress-utils": "^1.0.215" + }, "devDependencies": { "@4tw/cypress-drag-drop": "^2.2.5", "cypress-downloadfile": "^1.2.3", @@ -87,6 +90,11 @@ "ms": "^2.1.1" } }, + "node_modules/@processmaker/cypress-utils": { + "version": "1.0.215", + "resolved": "https://registry.npmjs.org/@processmaker/cypress-utils/-/cypress-utils-1.0.215.tgz", + "integrity": "sha512-pfq3QqcV96hLA02VDMpx1JDrTG8NiFLuP0XOtwoy111QMnUn/rUiAjVRurSx7i8cDo64Qmjwadv1OlslkHHveg==" + }, "node_modules/@types/node": { "version": "20.12.5", "resolved": "https://registry.npmjs.org/@types/node/-/node-20.12.5.tgz", @@ -2332,6 +2340,11 @@ } } }, + "@processmaker/cypress-utils": { + "version": "1.0.215", + "resolved": "https://registry.npmjs.org/@processmaker/cypress-utils/-/cypress-utils-1.0.215.tgz", + "integrity": "sha512-pfq3QqcV96hLA02VDMpx1JDrTG8NiFLuP0XOtwoy111QMnUn/rUiAjVRurSx7i8cDo64Qmjwadv1OlslkHHveg==" + }, "@types/node": { "version": "20.12.5", "resolved": "https://registry.npmjs.org/@types/node/-/node-20.12.5.tgz", diff --git a/package.json b/package.json index a6cea34..88fcd28 100644 --- a/package.json +++ b/package.json @@ -19,5 +19,8 @@ "cypress-file-upload": "^5.0.8", "cypress-promise": "^1.1.0", "date-fns": "^3.6.0" + }, + "dependencies": { + "@processmaker/cypress-utils": "^1.0.215" } } diff --git a/pages/taskPreviewPane.js b/pages/taskPreviewPane.js index 45f0e0b..244ef78 100644 --- a/pages/taskPreviewPane.js +++ b/pages/taskPreviewPane.js @@ -1,45 +1,11 @@ import selectors from "#selectors/taskPreviewPane"; export class taskPreviewPane{ - searchForTaskAndProcessFilterOneStatus(process,status){ - cy.xpath(selectors.taskFilter).should('be.visible').click(); - cy.xpath(selectors.taskFilterRequest).click({force:true}).type(process, {delay:250}).should('have.value', process); - cy.xpath(selectors.taskFilterRequest).type('{enter}', {force:true}); - cy.xpath(selectors.labelSelected.replace('label', process)).should('be.visible'); - switch(status){ - case 'In Progress': - cy.xpath(selectors.labelSelected.replace('label', status)).should('be.visible'); - cy.xpath(selectors.applyFilterButton) - .should('be.visible') - .click(); - break; - case 'Self Service': - cy.xpath(selectors.inProgressRemoveElement) - .should('be.visible') - .click(); - cy.xpath(selectors.taskFilterStatus) - .click({force:true}) - .type(status) - .type('{enter}'); - cy.xpath(selectors.labelSelected.replace('label', status)).should('be.visible'); - cy.xpath(selectors.applyFilterButton) - .should('be.visible') - .click(); - break; - case 'Completed': - cy.xpath(selectors.inProgressRemoveElement) - .should('be.visible') - .click(); - cy.xpath(selectors.taskFilterStatus) - .click({force:true}) - .type(status) - .type('{enter}'); - cy.xpath(selectors.labelSelected.replace('label', status)).should('be.visible'); - cy.xpath(selectors.applyFilterButton) - .should('be.visible') - .click(); - - break; - } - } + searchForTaskAndProcessFilterOneStatus(status){ + cy.xpath(taskFilter).should('be.visible').click({force:true}); + cy.xpath('//select[@data-cy="value0"]').select(status); + cy.xpath(applyFilterButton) + .should('be.visible') + .click(); + } } diff --git a/pages/taskPreviewPaneExecution.js b/pages/taskPreviewPaneExecution.js index 14a7feb..1b79601 100644 --- a/pages/taskPreviewPaneExecution.js +++ b/pages/taskPreviewPaneExecution.js @@ -6,70 +6,62 @@ const taskPreview = new taskPreviewPane(); export class taskPreviewPaneExecution{ ExecutionTCP43112TaskA(){ - navHelper.navigateToTasksPage(); - taskPreview.searchForTaskAndProcessFilterOneStatus('Task Preview Pane Data Connector','Self Service'); - cy.xpath('(//td[contains(text(),"Self Service")])[1]').should('be.visible'); - cy.xpath('(//a[contains(text(),"A")]/ancestor::tr/td/span/i)[1]') - .should('be.visible'); - cy.xpath('(//a[contains(text(),"A")]/ancestor::tr/td/span/i)[1]').click((err, runnable) => { - return false - }); - cy.frameLoaded('#tasksFrame1'); - cy.iframe('#tasksFrame1') - .find('button').eq(0) - .should('be.visible') - .click({force:true}); - navHelper.navigateToTasksPage(); - taskPreview.searchForTaskAndProcessFilterOneStatus('Task Preview Pane Data Connector','In Progress'); - cy.xpath('(//a[contains(text(),"A")]/ancestor::tr/td/span/i)[1]').click((err, runnable) => { - return false - }); - cy.frameLoaded('#tasksFrame1'); - cy.iframe('#tasksFrame1') - .find('button').eq(0) - .should('be.visible') - .click({force:true}); - cy.iframe('#tasksFrame1') - .find('input').eq(0).type('Bolivia',{force:true}) - .should('have.value', 'Bolivia').type('{enter}',{force:true}); - cy.iframe('#tasksFrame1') - .find('input').eq(1).type('Chile',{force:true}) - .should('have.value', 'Chile').type('{enter}', {force:true}); - cy.iframe('#tasksFrame1') - .find('button').eq(2) - .should('be.visible') - .click({force:true}); - cy.reload(); + navHelper.navigateToTasksPage(); + searchForTaskAndProcessFilterOneStatus('Self Service'); + cy.xpath(eyeTaskPreview.replace('task','Task Preview Pane A')).eq(0).trigger('mouseover', {force:true}).invoke('show'); + cy.xpath(eyeButton.replace('task','Task Preview Pane A')).eq(0).should('be.visible').click(); + cy.frameLoaded(".iframe"); + cy.iframe(".iframe") + .find('button').eq(0) + .should('be.visible') + .click({force:true}); + navHelper.navigateToTasksPage(); + searchForTaskAndProcessFilterOneStatus('In Progress'); + cy.xpath(eyeTaskPreview.replace('task','Task Preview Pane A')).eq(0).trigger('mouseover', {force:true}).invoke('show'); + cy.xpath(eyeButton.replace('task','Task Preview Pane A')).eq(0).should('be.visible').click(); + cy.frameLoaded(".iframe"); + cy.iframe(".iframe") + .find('button').eq(0) + .should('be.visible') + .click({force:true}); + cy.iframe(".iframe") + .find('input').eq(0).type('Bolivia',{force:true}) + .should('have.value', 'Bolivia').type('{enter}',{force:true}); + cy.iframe('.iframe') + .find('input').eq(1).type('Chile',{force:true}) + .should('have.value', 'Chile').type('{enter}', {force:true}); + cy.iframe('.iframe') + .find('button').eq(2) + .should('be.visible') + .click({force:true}); + cy.reload(); } ExecutionTCP43112TaskB(){ navHelper.navigateToTasksPage(); taskPreview.searchForTaskAndProcessFilterOneStatus('Task Preview Pane Data Connector','In Progress'); - cy.xpath('(//a[contains(text(),"B")]/ancestor::tr/td/span/i)[1]').click((err, runnable) => { - return false - }); - cy.iframe('#tasksFrame1') + cy.iframe('.iframe') .find('.multiselect__single').eq(0) .should('have.text', 'Bolivia'); - cy.iframe('#tasksFrame1') + cy.iframe('.iframe') .find('.multiselect__single').eq(1) .should('have.text', 'Chile'); - cy.iframe('#tasksFrame1') + cy.iframe('.iframe') .find('.multiselect__single').eq(2) .should('have.text', 'Bolivia'); - cy.iframe('#tasksFrame1') + cy.iframe('.iframe') .find('p').eq(0) .should('have.text', 'BOL'); - cy.iframe('#tasksFrame1') + cy.iframe('.iframe') .find('p').eq(1) .should('have.text', 'Bolivia'); - cy.iframe('#tasksFrame1') + cy.iframe('.iframe') .find('p').eq(2) .should('contain.text', 'Latin America & Caribbean'); - cy.iframe('#tasksFrame1') + cy.iframe('.iframe') .find('p').eq(3) .should('have.text', 'La Paz'); - cy.iframe('#tasksFrame1') + cy.iframe('.iframe') .find('button').eq(5) .should('be.visible') .click({force:true}); diff --git a/selectors/taskPreviewPane.js b/selectors/taskPreviewPane.js index e412cc8..4151da6 100644 --- a/selectors/taskPreviewPane.js +++ b/selectors/taskPreviewPane.js @@ -1,7 +1,8 @@ export default { - taskFilter: '//span[text()="Filter"]', - taskFilterRequest:'//input[@id="process_request_filter"]', - applyFilterButton: '//button[text()="Apply"]', + taskFilter: '//span[text()="Status"]/ancestor::th/div[".pm-table-filter-button"]/div/button', + applyFilterButton: '//button[contains(text(),"Apply")]', + eyeTaskPreview: "//a[contains(text(),'task')]/ancestor::tr/td/div['.pm-task-row-buttons']/div['.pm-floating-buttons']", + eyeButton: '//a[contains(text(),"task")]/ancestor::tr/td/div[".pm-task-row-buttons"]/div[".pm-floating-buttons"]/span/button["#openPreviewButton0"]', inProgressRemoveElement:'//span[text()="In Progress"]/ancestor::span/i[@aria-label="Remove Element"]', taskFilterStatus: '//input[@id="process_status_options_filter"]', labelSelected: "//div/span/span[contains(text(),'label')]"