From d8bdc02f09e6e3f3a5a5c2f6f606ec849ad38c0d Mon Sep 17 00:00:00 2001 From: Mihajlo Date: Wed, 2 Jun 2021 11:00:08 +0200 Subject: [PATCH] chore: sasjs-tests compute only on viya, login order fix --- sasjs-tests/package-lock.json | 68 ++++++++++++++++++++++++++++++----- sasjs-tests/src/App.tsx | 11 ++++-- src/auth/AuthManager.ts | 15 ++++---- 3 files changed, 75 insertions(+), 19 deletions(-) diff --git a/sasjs-tests/package-lock.json b/sasjs-tests/package-lock.json index d198432..d354e81 100644 --- a/sasjs-tests/package-lock.json +++ b/sasjs-tests/package-lock.json @@ -2005,12 +2005,15 @@ }, "@sasjs/adapter": { "version": "file:../build/sasjs-adapter-5.0.0.tgz", - "integrity": "sha512-DxoQbdJqzqOTIuT7qwSfAbmNTWdpOx5zGkiMuZBSwoi9lSsRNoARiWnJq5Vl6h4RXJlc/FVdBFt35RZm4Mc0ZQ==", + "integrity": "sha512-nP9O64IslMipxSKAG8PV/X2fRr+0E4/RqwD8jXP2bqZ/QraiKZG0bQPC5hSKqEp7bho8+XpZ4HaXW3Vr9kEZ8Q==", "requires": { - "@sasjs/utils": "^2.10.2", + "@sasjs/utils": "^2.14.0", "axios": "^0.21.1", + "axios-cookiejar-support": "^1.0.1", "form-data": "^4.0.0", - "https": "^1.0.0" + "https": "^1.0.0", + "tough-cookie": "^4.0.0", + "url": "^0.11.0" }, "dependencies": { "form-data": { @@ -2022,6 +2025,21 @@ "combined-stream": "^1.0.8", "mime-types": "^2.1.12" } + }, + "tough-cookie": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-4.0.0.tgz", + "integrity": "sha512-tHdtEpQCMrc1YLrMaqXXcj6AxhYi/xgit6mZu1+EDWUn+qhUf8wMQoFIy9NXuq23zAwtcB0t/MjACGR18pcRbg==", + "requires": { + "psl": "^1.1.33", + "punycode": "^2.1.1", + "universalify": "^0.1.2" + } + }, + "universalify": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", + "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==" } } }, @@ -2046,14 +2064,15 @@ } }, "@sasjs/utils": { - "version": "2.12.1", - "resolved": "https://registry.npmjs.org/@sasjs/utils/-/utils-2.12.1.tgz", - "integrity": "sha512-6gZS5zW0J70P7XaVuEczyfHVaVa8Ks/aWr4PIlpJcxWD0enJtCEmos2DdnezdSoNvODkPq/8rzMPqko5jaXK1Q==", + "version": "2.15.5", + "resolved": "https://registry.npmjs.org/@sasjs/utils/-/utils-2.15.5.tgz", + "integrity": "sha512-5HSWX5fy8D0Zy+Le+LgeRZG4vb5quLqhNiHw3dl0MS2hpsWACSRKia060jZk9LNHayKwBuusjlz5Ba0SyyaiEQ==", "requires": { "@types/prompts": "^2.0.11", "chalk": "^4.1.1", "cli-table": "^0.3.6", "consola": "^2.15.0", + "fs-extra": "^10.0.0", "prompts": "^2.4.1", "valid-url": "^1.0.9" }, @@ -2088,6 +2107,16 @@ "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" }, + "fs-extra": { + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.0.0.tgz", + "integrity": "sha512-C5owb14u9eJwizKGdchcDUQeFtlSHHthBk8pbX9Vc1PFZrLombudjDnNns88aYslCyF6IY5SUw3Roz6xShcEIQ==", + "requires": { + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" + } + }, "has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", @@ -2422,9 +2451,9 @@ "integrity": "sha512-6gOkRe7OIioWAXfnO/2lFiv+SJichKVSys1mSsgyrYHSEjk8Ctv4tSR/Odvnu+HWlH2C8j53dahU03XmQdd5fA==" }, "@types/prompts": { - "version": "2.0.11", - "resolved": "https://registry.npmjs.org/@types/prompts/-/prompts-2.0.11.tgz", - "integrity": "sha512-dcF5L3rU9VfpLEJIV++FEyhGhuIpJllNEwllVuJ5g8eoVqjf048tW9+spivIwjzgPbtaGAl7mIZW3cmhDAq2UQ==", + "version": "2.0.12", + "resolved": "https://registry.npmjs.org/@types/prompts/-/prompts-2.0.12.tgz", + "integrity": "sha512-Hr6osqfNg3IcQT3pJDXCsSnb0KnldY/hXeJCKJriwbZLnedN9n1e8kcZwLc25GIWULDb6h5aEyOBbf33XpZBXQ==", "requires": { "@types/node": "*" } @@ -3467,6 +3496,22 @@ "follow-redirects": "^1.10.0" } }, + "axios-cookiejar-support": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/axios-cookiejar-support/-/axios-cookiejar-support-1.0.1.tgz", + "integrity": "sha512-IZJxnAJ99XxiLqNeMOqrPbfR7fRyIfaoSLdPUf4AMQEGkH8URs0ghJK/xtqBsD+KsSr3pKl4DEQjCn834pHMig==", + "requires": { + "is-redirect": "^1.0.0", + "pify": "^5.0.0" + }, + "dependencies": { + "pify": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-5.0.0.tgz", + "integrity": "sha512-eW/gHNMlxdSP6dmG6uJip6FXN0EQBwm2clYYd8Wul42Cwu/DK8HEftzsapcNdYe2MfLiIwZqsDk2RDEsTE79hA==" + } + } + }, "axobject-query": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/axobject-query/-/axobject-query-2.2.0.tgz", @@ -8557,6 +8602,11 @@ "resolved": "https://registry.npmjs.org/is-potential-custom-element-name/-/is-potential-custom-element-name-1.0.0.tgz", "integrity": "sha1-DFLlS8yjkbssSUsh6GJtczbG45c=" }, + "is-redirect": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-redirect/-/is-redirect-1.0.0.tgz", + "integrity": "sha1-HQPd7VO9jbDzDCbk+V02/HyH3CQ=" + }, "is-regex": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.0.tgz", diff --git a/sasjs-tests/src/App.tsx b/sasjs-tests/src/App.tsx index e360241..14f6729 100644 --- a/sasjs-tests/src/App.tsx +++ b/sasjs-tests/src/App.tsx @@ -13,14 +13,19 @@ const App = (): ReactElement<{}> => { useEffect(() => { if (adapter) { - setTestSuites([ + let testSuites = [ basicTests(adapter, config.userName, config.password), sendArrTests(adapter), sendObjTests(adapter), specialCaseTests(adapter), sasjsRequestTests(adapter), - computeTests(adapter) - ]) + ] + + if (adapter.getSasjsConfig().serverType === 'SASVIYA') { + testSuites.push(computeTests(adapter)) + } + + setTestSuites(testSuites) } }, [adapter, config]) diff --git a/src/auth/AuthManager.ts b/src/auth/AuthManager.ts index 82fa4dd..aa1492f 100644 --- a/src/auth/AuthManager.ts +++ b/src/auth/AuthManager.ts @@ -34,7 +34,8 @@ export class AuthManager { this.userName = loginParams.username - const { isLoggedIn, loginForm } = await this.checkSession() + let { isLoggedIn, loginForm } = await this.checkSession() + if (isLoggedIn) { await this.loginCallback() @@ -46,15 +47,15 @@ export class AuthManager { let loginResponse = await this.sendLoginRequest(loginForm, loginParams) - if (isCredentialsVerifyError(loginResponse)) { - let newLoginForm = await this.getLoginForm(loginResponse) - - loginResponse = await this.sendLoginRequest(newLoginForm, loginParams) - } - let loggedIn = isLogInSuccess(loginResponse) if (!loggedIn) { + if (isCredentialsVerifyError(loginResponse)) { + let newLoginForm = await this.getLoginForm(loginResponse) + + loginResponse = await this.sendLoginRequest(newLoginForm, loginParams) + } + const currentSession = await this.checkSession() loggedIn = currentSession.isLoggedIn }