|
| 1 | +describe("TESTS: Configuration => Subsystem => MicroProfile LRA Participant", () => { |
| 2 | + const address = ["subsystem", "microprofile-lra-participant"]; |
| 3 | + const configurationFormId = "model-browser-model-browser-root-form"; |
| 4 | + |
| 5 | + const coordinatorUrlAttr = { |
| 6 | + name: "lra-coordinator-url", |
| 7 | + customValue: "http://lra-coordinator:8080/lra-coordinator/lra-coordinator", |
| 8 | + expressionProperty: "lra.participant.coordinator.url", |
| 9 | + expressionPropertyValue: "http://expression-coordinator:8080/lra-coordinator/lra-coordinator", |
| 10 | + expressionValue: "${lra.participant.coordinator.url}", |
| 11 | + }; |
| 12 | + |
| 13 | + const proxyServerAttr = { |
| 14 | + name: "proxy-server", |
| 15 | + customValue: "custom-proxy-server", |
| 16 | + expressionProperty: "lra.participant.proxy.server", |
| 17 | + expressionPropertyValue: "expression-proxy-server", |
| 18 | + expressionValue: "${lra.participant.proxy.server}", |
| 19 | + }; |
| 20 | + |
| 21 | + const proxyHostAttr = { |
| 22 | + name: "proxy-host", |
| 23 | + customValue: "custom-proxy-host", |
| 24 | + expressionProperty: "lra.participant.proxy.host", |
| 25 | + expressionPropertyValue: "expression-proxy-host", |
| 26 | + expressionValue: "${lra.participant.proxy.host}", |
| 27 | + }; |
| 28 | + |
| 29 | + let managementEndpoint: string; |
| 30 | + |
| 31 | + function navigateToLRAParticipantPage() { |
| 32 | + cy.navigateToGenericSubsystemPage(managementEndpoint, address); |
| 33 | + cy.get('#model-browser-resource-tab-container a[href="#model-browser-resource-data-tab"]').click(); |
| 34 | + } |
| 35 | + |
| 36 | + before(function () { |
| 37 | + cy.startWildflyContainer().then((result) => { |
| 38 | + managementEndpoint = result as string; |
| 39 | + cy.addAddress(managementEndpoint, ["extension", "org.wildfly.extension.microprofile.lra-participant"], {}); |
| 40 | + cy.addAddress(managementEndpoint, address, {}); |
| 41 | + cy.addAddress(managementEndpoint, ["system-property", coordinatorUrlAttr.expressionProperty], { |
| 42 | + value: coordinatorUrlAttr.expressionPropertyValue, |
| 43 | + }); |
| 44 | + cy.addAddress(managementEndpoint, ["system-property", proxyServerAttr.expressionProperty], { |
| 45 | + value: proxyServerAttr.expressionPropertyValue, |
| 46 | + }); |
| 47 | + cy.addAddress(managementEndpoint, ["system-property", proxyHostAttr.expressionProperty], { |
| 48 | + value: proxyHostAttr.expressionPropertyValue, |
| 49 | + }); |
| 50 | + }); |
| 51 | + }); |
| 52 | + |
| 53 | + after(() => { |
| 54 | + cy.task("stop:containers"); |
| 55 | + }); |
| 56 | + |
| 57 | + it("Edit lra-coordinator-url", () => { |
| 58 | + navigateToLRAParticipantPage(); |
| 59 | + cy.editForm(configurationFormId); |
| 60 | + cy.text(configurationFormId, coordinatorUrlAttr.name, coordinatorUrlAttr.customValue); |
| 61 | + cy.saveForm(configurationFormId); |
| 62 | + cy.verifySuccess(); |
| 63 | + cy.verifyAttribute(managementEndpoint, address, coordinatorUrlAttr.name, coordinatorUrlAttr.customValue); |
| 64 | + }); |
| 65 | + |
| 66 | + it("Edit proxy-server", () => { |
| 67 | + navigateToLRAParticipantPage(); |
| 68 | + cy.editForm(configurationFormId); |
| 69 | + cy.text(configurationFormId, proxyServerAttr.name, proxyServerAttr.customValue); |
| 70 | + cy.saveForm(configurationFormId); |
| 71 | + cy.verifySuccess(); |
| 72 | + cy.verifyAttribute(managementEndpoint, address, proxyServerAttr.name, proxyServerAttr.customValue); |
| 73 | + }); |
| 74 | + |
| 75 | + it("Edit proxy-host", () => { |
| 76 | + navigateToLRAParticipantPage(); |
| 77 | + cy.editForm(configurationFormId); |
| 78 | + cy.text(configurationFormId, proxyHostAttr.name, proxyHostAttr.customValue); |
| 79 | + cy.saveForm(configurationFormId); |
| 80 | + cy.verifySuccess(); |
| 81 | + cy.verifyAttribute(managementEndpoint, address, proxyHostAttr.name, proxyHostAttr.customValue); |
| 82 | + }); |
| 83 | + |
| 84 | + it("Edit lra-coordinator-url with expression", () => { |
| 85 | + const selector = `input#${configurationFormId}-${coordinatorUrlAttr.name}-editing.form-control`; |
| 86 | + navigateToLRAParticipantPage(); |
| 87 | + cy.editForm(configurationFormId); |
| 88 | + cy.textExpression(configurationFormId, coordinatorUrlAttr.name, coordinatorUrlAttr.expressionValue, { selector }); |
| 89 | + cy.saveForm(configurationFormId); |
| 90 | + cy.get(".toast-notifications-list-pf .alert").should("be.visible"); |
| 91 | + cy.verifyAttributeAsExpression( |
| 92 | + managementEndpoint, |
| 93 | + address, |
| 94 | + coordinatorUrlAttr.name, |
| 95 | + coordinatorUrlAttr.expressionValue, |
| 96 | + ); |
| 97 | + }); |
| 98 | + |
| 99 | + it("Edit proxy-server with expression", () => { |
| 100 | + const selector = `input#${configurationFormId}-${proxyServerAttr.name}-editing.form-control`; |
| 101 | + navigateToLRAParticipantPage(); |
| 102 | + cy.editForm(configurationFormId); |
| 103 | + cy.textExpression(configurationFormId, proxyServerAttr.name, proxyServerAttr.expressionValue, { selector }); |
| 104 | + cy.saveForm(configurationFormId); |
| 105 | + cy.get(".toast-notifications-list-pf .alert").should("be.visible"); |
| 106 | + cy.verifyAttributeAsExpression(managementEndpoint, address, proxyServerAttr.name, proxyServerAttr.expressionValue); |
| 107 | + }); |
| 108 | + |
| 109 | + it("Edit proxy-host with expression", () => { |
| 110 | + const selector = `input#${configurationFormId}-${proxyHostAttr.name}-editing.form-control`; |
| 111 | + navigateToLRAParticipantPage(); |
| 112 | + cy.editForm(configurationFormId); |
| 113 | + cy.textExpression(configurationFormId, proxyHostAttr.name, proxyHostAttr.expressionValue, { selector }); |
| 114 | + cy.saveForm(configurationFormId); |
| 115 | + cy.get(".toast-notifications-list-pf .alert").should("be.visible"); |
| 116 | + cy.verifyAttributeAsExpression(managementEndpoint, address, proxyHostAttr.name, proxyHostAttr.expressionValue); |
| 117 | + }); |
| 118 | + |
| 119 | + it("Reset configuration", () => { |
| 120 | + navigateToLRAParticipantPage(); |
| 121 | + cy.get('#model-browser-model-browser-root-form-links > [data-toggle="tooltip"]'); |
| 122 | + cy.resetForm(configurationFormId, managementEndpoint, address); |
| 123 | + }); |
| 124 | +}); |
0 commit comments