diff --git a/cypress/integration/singleTests/PersonEdit_view/CreatePerson.ts b/cypress/integration/singleTests/PersonEdit_view/CreatePerson.ts index 6323a91af4735dedea1aa7b0ef1d0649eb566854..84d6620f57a60673154a442f152a0c1e6979e0d8 100644 --- a/cypress/integration/singleTests/PersonEdit_view/CreatePerson.ts +++ b/cypress/integration/singleTests/PersonEdit_view/CreatePerson.ts @@ -17,7 +17,7 @@ describe("Create Person", () => cy.get(".neon-multiple-value-edit[data-test-component-name='GenericMultiple'] .neon-combobox[data-test-component-type='COMBOBOX']").last().type("gering"); cy.get(".neon-multiple-value-edit[data-test-component-name='GenericMultiple'] .neon-combobox[data-test-component-type='COMBOBOX']").last().type("{enter}"); - cy.saveEdit(true); + cy.saveEdit(true, true); cy.filterField("Nachname", lastname, FilterType.TEXT, [{type: 'ist gleich', count: 1}], "Person"); cy.openMainFromFilter(null, 0); cy.deleteAfterCreation("Person"); diff --git a/cypress/integration/singleTests/PersonEdit_view/CreatePerson_AllFields.ts b/cypress/integration/singleTests/PersonEdit_view/CreatePerson_AllFields.ts index 949d6b465ff983188b48670c72a4eac2c4c58da3..8eeb22d5360098486cec2c69fd2f170c425c07ba 100644 --- a/cypress/integration/singleTests/PersonEdit_view/CreatePerson_AllFields.ts +++ b/cypress/integration/singleTests/PersonEdit_view/CreatePerson_AllFields.ts @@ -44,7 +44,7 @@ describe("Create Person", () => cy.get(".is-required[data-test-component-name='VALUE']").type("gering"); cy.get(".is-required[data-test-component-name='VALUE']").type("{enter}"); - cy.saveEdit(true); + cy.saveEdit(true, true); cy.filterField("Kommunikation: Webseite", "tm-testoteles.de", FilterType.TEXT, [{type: 'ist gleich', count: 1}], "Person"); cy.openMainFromFilter(null, 0); cy.deleteAfterCreation("Person"); diff --git a/cypress/integration/singleTests/PersonFilter_view/PersonFilter_testButtons.ts b/cypress/integration/singleTests/PersonFilter_view/PersonFilter_testButtons.ts index 666fb39670aed35a6d94ad7d2bd82b1c363ec77e..a4fc89370f0f0ca5e6aa1af97ccc68fa4d9ad980 100644 --- a/cypress/integration/singleTests/PersonFilter_view/PersonFilter_testButtons.ts +++ b/cypress/integration/singleTests/PersonFilter_view/PersonFilter_testButtons.ts @@ -30,6 +30,7 @@ describe("Press different buttons", () => cy.openContext("Person", "PersonFilter_view", PresentationMode.FILTER); cy.selectValue(0); cy.pressButton(0, ButtonType.THREE_POINT_PREVIEW); + cy.wait(200); cy.pressButton(4, ButtonType.DROPDOWNITEM); cy.get(".neon-preview-display[data-test-display-entity-name='CampaignAddParticipants_entity']").should('be.visible'); }); diff --git a/cypress/integration/singleTests/PersonMain_view/PersonMain_testButtons.ts b/cypress/integration/singleTests/PersonMain_view/PersonMain_testButtons.ts new file mode 100644 index 0000000000000000000000000000000000000000..c38bca106a528dc9debe7c600c190180eeeeef05 --- /dev/null +++ b/cypress/integration/singleTests/PersonMain_view/PersonMain_testButtons.ts @@ -0,0 +1,24 @@ +beforeEach(() => { + cy.resetData(); +}) + +describe("Press different buttons in the preview of the main view", () => +{ + it([Tag.DEFAULT], "Should click a button in the preview dropdown menu while in the main view", () => + { + cy.login(); + cy.openMainFromFilter("Person", 4); + cy.pressButton(0, ButtonType.THREE_POINT_PREVIEW_MAIN); + cy.wait(200); + cy.pressButton(4, ButtonType.DROPDOWNITEM); + cy.get(".neon-preview-display[data-test-display-entity-name='CampaignAddParticipants_entity']").should('be.visible'); + }); + + it([Tag.DEFAULT], "Should click a button in the preview while in the main view", () => + { + cy.login(); + cy.openMainFromFilter("Person", 0); + cy.pressButton(1, ButtonType.PREVIEW_MAIN); + cy.url().should('include', 'Activity'); + }); +}); \ No newline at end of file diff --git a/cypress/support/actions.ts b/cypress/support/actions.ts index fe228dc16b3b61b3fbf21d6aaa2df47f9d0829f2..840d221ac2a3f4392457db227bd905b6a21a811c 100644 --- a/cypress/support/actions.ts +++ b/cypress/support/actions.ts @@ -18,8 +18,11 @@ declare namespace Cypress * dropdown: presses a button that opens a dropdown * dropdownItem: presses a button in the dropdown * preview: presses a button in the preview + * preview-main: presses a button in the preview when you are in the main view * three-points: presses the [...] button to open the dropdown; the value is irrelevant for this * three-points-preview: presses the [...] button in the preview to open the dropdown; the value is irrelevant for this + * three-points-preview-main: presses the [...] button in the preview when in a main view to open the dropdown; the value is irrelevant for this + *@param pMainView : set to true if the buttonpress of the preview is within a main view */ pressButton( pValue: number | string, @@ -58,25 +61,30 @@ Cypress.Commands.add('pressInsert', () => Cypress.Commands.add('pressButton', (pValue, pButtonType) => { - cy.wait(100); if(pButtonType == ButtonType.THREE_POINT_PREVIEW) { - cy.get(".neon-preview-display .neon-button-strip .neon-button-strip-chunk .neon-icononly-square-accent-button").first().click({force: true}); + cy.get(".neon-preview-display .neon-button-strip .neon-button-strip-chunk .neon-icononly-square-accent-button").last().click(); } - - if(pButtonType == ButtonType.THREE_POINT) + else if(pButtonType == ButtonType.THREE_POINT_PREVIEW_MAIN) + { + cy.get(".neon-details-display .neon-button-strip .neon-button-strip-chunk .neon-icononly-square-accent-button").last().click(); + } + else if(pButtonType == ButtonType.THREE_POINT) { cy.get(".neon-main-display .neon-button-strip .neon-button-strip-chunk .neon-icononly-square-accent-button").first().click({force: true}); } - if(typeof pValue == "number" && pButtonType != ButtonType.THREE_POINT && pButtonType != ButtonType.THREE_POINT_PREVIEW) + if(typeof pValue == "number" && pButtonType != ButtonType.THREE_POINT && pButtonType != ButtonType.THREE_POINT_PREVIEW && pButtonType != ButtonType.THREE_POINT_PREVIEW_MAIN) { switch(pButtonType) { case ButtonType.PREVIEW: cy.get(".neon-preview-display .neon-button-strip .neon-button-strip-chunk .neon-icononly-accent-button").eq(pValue).click({force: true}); break; + case ButtonType.PREVIEW_MAIN: + cy.get(".neon-button-strip .neon-button-strip-chunk .neon-icononly-accent-button").eq(pValue).click({force: true}); + break; case ButtonType.DROPDOWN: cy.get(".neon-main-display .neon-button-strip .neon-button-strip-chunk .neon-icononly-accent-button").eq(pValue).click({force: true}); break; diff --git a/cypress/support/enum.ts b/cypress/support/enum.ts index 61d856d90389045f9614cf9ca25885b6fdc2bc65..774cf10a6ce1db904f053c241e875efeb09fcbb8 100644 --- a/cypress/support/enum.ts +++ b/cypress/support/enum.ts @@ -22,7 +22,9 @@ enum ButtonType DROPDOWNITEM = "dropdownItem", PREVIEW = "preview", THREE_POINT = "three-points", - THREE_POINT_PREVIEW = "three-points-preview" + PREVIEW_MAIN = "preview-main", + THREE_POINT_PREVIEW = "three-points-preview", + THREE_POINT_PREVIEW_MAIN = "three-points-preview-main" }; (window as { ButtonType?: typeof ButtonType }).ButtonType = ButtonType; @@ -47,4 +49,12 @@ enum FilterType NUMBER = "number" }; -(window as { FilterType?: typeof FilterType }).FilterType = FilterType; \ No newline at end of file +(window as { FilterType?: typeof FilterType }).FilterType = FilterType; + +enum ViewTemplateType +{ + GENERIC = "neon-viewtemplate-generic", + MULTI = "neon-multiple-value-edit" +}; + +(window as { ViewTemplateType?: typeof ViewTemplateType }).ViewTemplateType = ViewTemplateType; \ No newline at end of file diff --git a/cypress/support/fields.ts b/cypress/support/fields.ts index 19f69ab11ab4dee866b971ae7e26be7d0debf428..7892ba61f3273a175fa5e71a2e426d9afd605a0e 100644 --- a/cypress/support/fields.ts +++ b/cypress/support/fields.ts @@ -8,36 +8,52 @@ declare namespace Cypress * gets the location of a simple edit field * * @param pFieldName name of the field + * @param pViewTemplateName name of the viewtemplate, i.e. 'Edit' - found in property 'data-test-component-name' + * @param pViewTemplateType type of the viewtemplate. i.e. GENERIC (see ENUM ViewTemplateType) */ getEditField( pFieldName: string, + pViewTemplateName?: string, + pViewTemplateType?: ViewTemplateType ): Chainable<any>; /** * gets the location of a large edit field * * @param pFieldName name of the field + * @param pViewTemplateName name of the viewtemplate, i.e. 'Edit' - found in property 'data-test-component-name' + * @param pViewTemplateType type of the viewtemplate. i.e. GENERIC (see ENUM ViewTemplateType) */ getLargeEditField( pFieldName: string, + pViewTemplateName?: string, + pViewTemplateType?: ViewTemplateType ): Chainable<any>; /** * gets the location of an advanced html field * * @param pFieldName name of the field + * @param pViewTemplateName name of the viewtemplate, i.e. 'Edit' - found in property 'data-test-component-name' + * @param pViewTemplateType type of the viewtemplate. i.e. GENERIC (see ENUM ViewTemplateType) */ getHTMLField( pFieldName: string, + pViewTemplateName?: string, + pViewTemplateType?: ViewTemplateType ): Chainable<any>; /** * gets the location of a date field * * @param pFieldName name of the field + * @param pViewTemplateName name of the viewtemplate, i.e. 'Edit' - found in property 'data-test-component-name' + * @param pViewTemplateType type of the viewtemplate. i.e. GENERIC (see ENUM ViewTemplateType) */ getDateField( pFieldName: string, + pViewTemplateName?: string, + pViewTemplateType?: ViewTemplateType ): Chainable<any>; /** @@ -85,10 +101,12 @@ declare namespace Cypress /** * click save button in current edit-view * + *@param pMain check if the test goes into the main view of the dataset after saving *@param pDsgvo true when person to confirm dsgvo message */ saveEdit( - pDsgvo?: boolean + pMain?: boolean, + pDsgvo?: boolean, ): Chainable<any>; /** @@ -123,19 +141,19 @@ declare namespace Cypress } } -Cypress.Commands.add('getEditField', (pFieldName) => +Cypress.Commands.add('getEditField', (pFieldName, pViewTemplateName, pViewTemplateType) => { - cy.get(".neon-viewtemplate-generic[data-test-component-name='Edit'] .neon-textfield[data-test-component-type='EDITFIELD'][data-test-component-vt-generic-field='" + pFieldName + "']"); + cy.get(_getViewtemplate(pViewTemplateName, pViewTemplateType) + ".neon-textfield[data-test-component-type='EDITFIELD'][data-test-component-vt-generic-field='" + pFieldName + "']"); }); -Cypress.Commands.add('getLargeEditField', (pFieldName) => +Cypress.Commands.add('getLargeEditField', (pFieldName, pViewTemplateName, pViewTemplateType) => { - cy.get(".neon-viewtemplate-generic[data-test-component-name='Edit'] .neon-textarea[data-test-component-type='MEMOFIELD'][data-test-component-vt-generic-field='" + pFieldName + "']"); + cy.get(_getViewtemplate(pViewTemplateName, pViewTemplateType) + ".neon-textarea[data-test-component-type='MEMOFIELD'][data-test-component-vt-generic-field='" + pFieldName + "']"); }); -Cypress.Commands.add('getHTMLField', (pFieldName) => +Cypress.Commands.add('getHTMLField', (pFieldName, pViewTemplateName, pViewTemplateType) => { - cy.get(".neon-viewtemplate-generic[data-test-component-name='Edit'] .neon-richtextarea[data-test-component-vt-generic-field='" + pFieldName + "'] iframe") + cy.get(_getViewtemplate(pViewTemplateName, pViewTemplateType) + ".neon-richtextarea[data-test-component-vt-generic-field='" + pFieldName + "'] iframe") .then(($element) => { const $body = $element.contents().find("body"); @@ -144,9 +162,9 @@ Cypress.Commands.add('getHTMLField', (pFieldName) => }); }); -Cypress.Commands.add('getDateField', (pFieldName) => +Cypress.Commands.add('getDateField', (pFieldName, pViewTemplateName, pViewTemplateType) => { - cy.get(".neon-viewtemplate-generic[data-test-component-name='Edit'] .neon-datefield[data-test-component-vt-generic-field='" + pFieldName + "']"); + cy.get(_getViewtemplate(pViewTemplateName, pViewTemplateType) + ".neon-datefield[data-test-component-vt-generic-field='" + pFieldName + "']"); }); Cypress.Commands.add('getLookUpField', (pFieldName) => @@ -207,17 +225,20 @@ Cypress.Commands.add('fillComboField', (pFieldName, pText) => cy.get(".neon-combobox[data-test-component-vt-generic-field='" + pFieldName + "'] .v-filterselect-input").first().type(pText + "{enter}"); }); -Cypress.Commands.add('saveEdit', (pDsgvo) => +Cypress.Commands.add('saveEdit', (pMain, pDsgvo) => { cy.get(".neon-button-strip-menu > .neon-button-strip-menu-do-action").first().click({force: true}); cy.get(".neon-button-strip-menu > .neon-button-strip-menu-do-action").first().click({force: true}); - if(pDsgvo == true) { cy.get(".neon-question-window .neon-window-footer .neon-accent-button").first().click({force: true}); } - + if(pMain == true) + { + cy.wait(500); + cy.get(".neon-main-display[data-test-display-type='main']").should("be.visible"); + } }); Cypress.Commands.add('deleteAfterCreation', (pContext) => @@ -256,3 +277,23 @@ Cypress.Commands.add('uploadDocument', (pDocumentName, pDocType) => }); }); + +//return a string for different combinations of viewtemplatename & -type +function _getViewtemplate(pViewTemplateName: string, pViewTemplateType: ViewTemplateType) +{ + var result = ""; + if(pViewTemplateName && pViewTemplateType) + { + result = "." + pViewTemplateType + "[data-test-component-name='" + pViewTemplateName + "'] "; + } + else if(!pViewTemplateName && pViewTemplateType) + { + throw new Error("Combination invalid, please enter a view template name, i.e. 'Edit'"); + } + else if(pViewTemplateName && !pViewTemplateType) + { + result = ".neon-viewtemplate-generic[data-test-component-name='" + pViewTemplateName + "'] "; + } + + return result; +}