From b1bf0383550223f4effbd5ae51ca856d1628230c Mon Sep 17 00:00:00 2001 From: Alexey Zinoviev Date: Fri, 19 Jul 2024 15:38:30 +0400 Subject: [PATCH] Qfix: qms signature dialog login info in tests (#6100) Signed-off-by: Alexey Zinoviev --- .../src/components/SignatureDialog.svelte | 5 +++-- qms-tests/create-local.sh | 16 ++++++++++++++ qms-tests/restore-local.sh | 22 +++++++++++++++++++ qms-tests/tool-local.sh | 12 ++++++++++ 4 files changed, 53 insertions(+), 2 deletions(-) create mode 100755 qms-tests/create-local.sh create mode 100755 qms-tests/restore-local.sh create mode 100755 qms-tests/tool-local.sh diff --git a/plugins/controlled-documents-resources/src/components/SignatureDialog.svelte b/plugins/controlled-documents-resources/src/components/SignatureDialog.svelte index 36ec1ee8c7..fdd0ec3a95 100644 --- a/plugins/controlled-documents-resources/src/components/SignatureDialog.svelte +++ b/plugins/controlled-documents-resources/src/components/SignatureDialog.svelte @@ -18,7 +18,7 @@ import { createEventDispatcher } from 'svelte' import login from '@hcengineering/login' import { ERROR, IntlString, OK, Severity, Status, getMetadata, translate } from '@hcengineering/platform' - import { EditBox, StylishEdit, ModernDialog } from '@hcengineering/ui' + import { EditBox, StylishEdit, ModernDialog, fetchMetadataLocalStorage } from '@hcengineering/ui' import documents from '../plugin' import StatusControl from './requests/StatusControl.svelte' @@ -33,7 +33,8 @@ let rejectionNote = '' const accountsUrl = getMetadata(login.metadata.AccountsUrl) ?? '' - const email: string = getMetadata(login.metadata.LoginEmail) ?? '' + const email: string = + getMetadata(login.metadata.LoginEmail) ?? fetchMetadataLocalStorage(login.metadata.LoginEmail) ?? '' const disableEmailField = email !== '' const object: LoginInfo = { diff --git a/qms-tests/create-local.sh b/qms-tests/create-local.sh new file mode 100755 index 0000000000..52006c07bb --- /dev/null +++ b/qms-tests/create-local.sh @@ -0,0 +1,16 @@ +# Create init workspace +./tool-local.sh create-workspace init-ws-qms -w InitTest +./tool-local.sh configure init-ws-qms --enable=* +./tool-local.sh configure init-ws-qms --list + +# Create workspace record in accounts +./tool-local.sh create-workspace sanity-ws-qms -w SanityTest +# Create user record in accounts +./tool-local.sh create-account user1 -f John -l Appleseed -p 1234 +./tool-local.sh confirm-email user1 +# Create second user record in accounts +./tool-local.sh create-account user2 -f Kainin -l Dirak -p 1234 +./tool-local.sh confirm-email user2 + +./tool-local.sh create-account user_qara -f Qara -l Admin -p 1234 +./tool-local.sh confirm-email user_qara \ No newline at end of file diff --git a/qms-tests/restore-local.sh b/qms-tests/restore-local.sh new file mode 100755 index 0000000000..432daedbb9 --- /dev/null +++ b/qms-tests/restore-local.sh @@ -0,0 +1,22 @@ + +export MINIO_ACCESS_KEY=minioadmin +export MINIO_SECRET_KEY=minioadmin +export MINIO_ENDPOINT=localhost:9000 +export MONGO_URL=mongodb://localhost:27017 +export ELASTIC_URL=http://localhost:9200 +export SERVER_SECRET=secret + +# Restore workspace contents in mongo/elastic +./tool-local.sh backup-restore ./sanity-ws-qms sanity-ws-qms + +./tool-local.sh upgrade-workspace sanity-ws-qms + +# Re-assign user to workspace. +./tool-local.sh assign-workspace user1 sanity-ws-qms +./tool-local.sh assign-workspace user2 sanity-ws-qms +./tool-local.sh assign-workspace user_qara sanity-ws-qms +./tool-local.sh set-user-role user1 sanity-ws-qms OWNER +./tool-local.sh set-user-role user2 sanity-ws-qms OWNER + +./tool-local.sh configure sanity-ws-qms --enable=* +./tool-local.sh configure sanity-ws-qms --list \ No newline at end of file diff --git a/qms-tests/tool-local.sh b/qms-tests/tool-local.sh new file mode 100755 index 0000000000..c4f89ce13e --- /dev/null +++ b/qms-tests/tool-local.sh @@ -0,0 +1,12 @@ + +export MINIO_ACCESS_KEY=minioadmin +export MINIO_SECRET_KEY=minioadmin +export MINIO_ENDPOINT=localhost:9000 +export MONGO_URL=mongodb://localhost:27017 +export ACCOUNTS_URL=http://localhost:3000 +export TRANSACTOR_URL=ws://localhost:3333 +export ELASTIC_URL=http://localhost:9200 +export SERVER_SECRET=secret + +# Restore workspace contents in mongo/elastic +node ../dev/tool/bundle/bundle.js $@ \ No newline at end of file