diff --git a/tests/integration/composer.lock b/tests/integration/composer.lock index e8cb1bd8ca..be8007ea32 100644 --- a/tests/integration/composer.lock +++ b/tests/integration/composer.lock @@ -1586,16 +1586,16 @@ }, { "name": "phpunit/phpunit", - "version": "9.6.18", + "version": "9.6.19", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "32c2c2d6580b1d8ab3c10b1e9e4dc263cc69bb04" + "reference": "a1a54a473501ef4cdeaae4e06891674114d79db8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/32c2c2d6580b1d8ab3c10b1e9e4dc263cc69bb04", - "reference": "32c2c2d6580b1d8ab3c10b1e9e4dc263cc69bb04", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/a1a54a473501ef4cdeaae4e06891674114d79db8", + "reference": "a1a54a473501ef4cdeaae4e06891674114d79db8", "shasum": "" }, "require": { @@ -1669,7 +1669,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", "security": "https://github.com/sebastianbergmann/phpunit/security/policy", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.18" + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.19" }, "funding": [ { @@ -1685,7 +1685,7 @@ "type": "tidelift" } ], - "time": "2024-03-21T12:07:32+00:00" + "time": "2024-04-05T04:35:58+00:00" }, { "name": "psr-discovery/discovery", @@ -3902,23 +3902,23 @@ }, { "name": "symfony/http-client", - "version": "v5.4.37", + "version": "v5.4.38", "source": { "type": "git", "url": "https://github.com/symfony/http-client.git", - "reference": "63d93fd99523b9608929a38172da3365a6c0821c" + "reference": "2a292194f6d4cf22d2348248d1c637750f72309d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-client/zipball/63d93fd99523b9608929a38172da3365a6c0821c", - "reference": "63d93fd99523b9608929a38172da3365a6c0821c", + "url": "https://api.github.com/repos/symfony/http-client/zipball/2a292194f6d4cf22d2348248d1c637750f72309d", + "reference": "2a292194f6d4cf22d2348248d1c637750f72309d", "shasum": "" }, "require": { "php": ">=7.2.5", "psr/log": "^1|^2|^3", "symfony/deprecation-contracts": "^2.1|^3", - "symfony/http-client-contracts": "^2.4", + "symfony/http-client-contracts": "^2.5.3", "symfony/polyfill-php73": "^1.11", "symfony/polyfill-php80": "^1.16", "symfony/service-contracts": "^1.0|^2|^3" @@ -3934,7 +3934,7 @@ "amphp/http-client": "^4.2.1", "amphp/http-tunnel": "^1.0", "amphp/socket": "^1.1", - "guzzlehttp/promises": "^1.4", + "guzzlehttp/promises": "^1.4|^2.0", "nyholm/psr7": "^1.0", "php-http/httplug": "^1.0|^2.0", "php-http/message-factory": "^1.0", @@ -3973,7 +3973,7 @@ "http" ], "support": { - "source": "https://github.com/symfony/http-client/tree/v5.4.37" + "source": "https://github.com/symfony/http-client/tree/v5.4.38" }, "funding": [ { @@ -3989,20 +3989,20 @@ "type": "tidelift" } ], - "time": "2024-02-28T15:18:15+00:00" + "time": "2024-04-01T18:54:44+00:00" }, { "name": "symfony/http-client-contracts", - "version": "v2.5.2", + "version": "v2.5.3", "source": { "type": "git", "url": "https://github.com/symfony/http-client-contracts.git", - "reference": "ba6a9f0e8f3edd190520ee3b9a958596b6ca2e70" + "reference": "e5cc97c2b4a4db0ba26bebc154f1426e3fd1d2f1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-client-contracts/zipball/ba6a9f0e8f3edd190520ee3b9a958596b6ca2e70", - "reference": "ba6a9f0e8f3edd190520ee3b9a958596b6ca2e70", + "url": "https://api.github.com/repos/symfony/http-client-contracts/zipball/e5cc97c2b4a4db0ba26bebc154f1426e3fd1d2f1", + "reference": "e5cc97c2b4a4db0ba26bebc154f1426e3fd1d2f1", "shasum": "" }, "require": { @@ -4051,7 +4051,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/http-client-contracts/tree/v2.5.2" + "source": "https://github.com/symfony/http-client-contracts/tree/v2.5.3" }, "funding": [ { @@ -4067,7 +4067,7 @@ "type": "tidelift" } ], - "time": "2022-04-12T15:48:08+00:00" + "time": "2024-03-26T19:42:53+00:00" }, { "name": "symfony/polyfill-ctype", @@ -5184,16 +5184,16 @@ }, { "name": "libresign/nextcloud-behat", - "version": "v0.14.1", + "version": "v0.14.2", "source": { "type": "git", "url": "https://github.com/LibreSign/nextcloud-behat.git", - "reference": "6ba7c59e59f0b4aaaa5ce67d16affb9479874d0d" + "reference": "114818c0f0f160ebe8345f77cf17252ebee71916" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/LibreSign/nextcloud-behat/zipball/6ba7c59e59f0b4aaaa5ce67d16affb9479874d0d", - "reference": "6ba7c59e59f0b4aaaa5ce67d16affb9479874d0d", + "url": "https://api.github.com/repos/LibreSign/nextcloud-behat/zipball/114818c0f0f160ebe8345f77cf17252ebee71916", + "reference": "114818c0f0f160ebe8345f77cf17252ebee71916", "shasum": "" }, "require": { @@ -5238,9 +5238,9 @@ ], "support": { "issues": "https://github.com/LibreSign/nextcloud-behat/issues", - "source": "https://github.com/LibreSign/nextcloud-behat/tree/v0.14.1" + "source": "https://github.com/LibreSign/nextcloud-behat/tree/v0.14.2" }, - "time": "2024-03-22T16:35:47+00:00" + "time": "2024-04-05T20:28:06+00:00" }, { "name": "symfony/process", diff --git a/tests/integration/features/bootstrap/FeatureContext.php b/tests/integration/features/bootstrap/FeatureContext.php index f8fc8471e0..f0a79259fd 100644 --- a/tests/integration/features/bootstrap/FeatureContext.php +++ b/tests/integration/features/bootstrap/FeatureContext.php @@ -125,15 +125,12 @@ protected function beforeRequest(string $fullUrl, array $options): array { } protected function parseText(string $text): string { - $patterns = [ - '//', - '//', - ]; - $replacements = [ - $this->signer['sign_uuid'] ?? null, - $this->baseUrl . '/index.php', - ]; - foreach ($this->fields as $key => $value) { + $fields = $this->fields; + if (!empty($this->signer['sign_uuid'])) { + $fields['SIGN_UUID'] = $this->signer['sign_uuid']; + } + $fields['BASE_URL'] = $this->baseUrl . '/index.php'; + foreach ($fields as $key => $value) { $patterns[] = '/<' . $key . '>/'; $replacements[] = $value; } @@ -188,7 +185,7 @@ public function iSendAFileToBeSigned(TableNode $body): void { /** * @When follow the link on opened email */ - public function iDoSomethingWithTheOpenedEmail(): void { + public function followTheLinkOnOpenedEmail(): void { if (!$this->openedEmailStorage->hasOpenedEmail()) { throw new RuntimeException('No email opened, unable to do something!'); } diff --git a/tests/integration/features/sign/request.feature b/tests/integration/features/sign/request.feature index 2454d7f430..2e38bda1ab 100644 --- a/tests/integration/features/sign/request.feature +++ b/tests/integration/features/sign/request.feature @@ -314,6 +314,43 @@ Feature: request-signature | type | signature | Then the response should have a status code 200 + Scenario: Sign file + Given as user "admin" + And user "signer1" exists + And run the command "libresign:install --java" with result code 0 + And run the command "libresign:install --jsignpdf" with result code 0 + And run the command "libresign:install --pdftk" with result code 0 + And run the command "libresign:configure:openssl --cn=Common\ Name --c=BR --o=Organization --st=State\ of\ Company --l=City\ Name --ou=Organization\ Unit" with result code 0 + And run the command "config:app:set libresign add_footer --value=1" with result code 0 + And run the command "config:app:set libresign write_qrcode_on_footer --value=1" with result code 0 + And sending "post" to ocs "/apps/provisioning_api/api/v1/config/apps/libresign/identify_methods" + | value | (string)[{"name":"account","enabled":true,"mandatory":true,"signatureMethods":{"password":{"name":"password","enabled":true}},"signatureMethodEnabled":"password"}] | + And the response should have a status code 200 + And my inbox is empty + When sending "post" to ocs "/apps/libresign/api/v1/request-signature" + | file | {"url":"/apps/libresign/develop/pdf"} | + | users | [{"displayName": "Signer Name","description": "Please, sign this document","identify": {"account": "signer1"}}] | + | name | Document Name | + And the response should have a status code 200 + And as user "signer1" + And sending "get" to ocs "/apps/libresign/api/v1/file/list" + Then the response should be a JSON array with the following mandatory values + | key | value | + | data | (jq).[].name == "Document Name"| + And fetch field "(SIGN_URL)data.0.url" from prevous JSON response + And fetch field "(SIGN_UUID)data.0.signers.0.sign_uuid" from prevous JSON response + And fetch field "(FILE_UUID)data.0.uuid" from prevous JSON response + And sending "post" to ocs "/apps/libresign/api/v1/account/signature" + | signPassword | TheComplexPfxPasswordHere | + And sending "post" to ocs "/apps/libresign/api/v1/sign/uuid/" + | method | password | + | token | TheComplexPfxPasswordHere | + And the response should have a status code 200 + Then the response should be a JSON array with the following mandatory values + | key | value | + | message | File signed | + | (jq).file.uuid | | + Scenario: Request to sign with success using multiple users Given as user "admin" And user "signer1" exists