Fetch passwords from secretsmanager (#2138)

* add aws secretsmanagerclient

* create custom globalsetup

* consume secret password and enable tests

* update npm
This commit is contained in:
Severiano Badajoz
2021-04-05 14:16:10 -07:00
committed by GitHub
parent 6ecdfa4940
commit 4510c8c8a4
7 changed files with 1397 additions and 1261 deletions
+3 -6
View File
@@ -16,7 +16,7 @@ import {
goToPage,
} from "./puppeteerUtils";
import { appUrlBase } from "./config";
import { appUrlBase, TEST_EMAIL, TEST_PASSWORD } from "./config";
export async function drag(testId, start, end, lasso = false) {
const layout = await waitByID(testId);
@@ -317,9 +317,6 @@ export async function assertCategoryDoesNotExist(categoryName) {
}
export async function login() {
const email = ``;
const password = "";
await goToPage(appUrlBase);
await clickOn("log-in");
@@ -328,8 +325,8 @@ export async function login() {
await waitUntilFormFieldStable('[name="email"]');
await expect(page).toFillForm("form", {
email,
password,
email: TEST_EMAIL,
password: TEST_PASSWORD,
});
await Promise.all([
+2
View File
@@ -6,3 +6,5 @@ export const appUrlBase =
export const DATASET = "pbmc3k";
export const isDev = jestEnv === ENV_DEFAULT.DEV;
export const isDebug = jestEnv === ENV_DEFAULT.DEBUG;
export const TEST_EMAIL = "user@example.com";
export const TEST_PASSWORD = process.env.TEST_ACCOUNT_PASS ?? "";
+2 -1
View File
@@ -368,7 +368,8 @@ describeIfCalledByMakeFileTarget("auth buttons", () => {
});
});
const conditionalDescribe = describe.skip;
const conditionalDescribe =
process.env.TEST_AUTH_INTEGRATION === "true" ? describe : describe.skip;
conditionalDescribe("AuthN Integration", () => {
it("logs in", async () => {
+1 -1
View File
@@ -4,7 +4,7 @@
"testMatch": ["**/__tests__/**/?(*.)(spec|test).js?(x)"],
"setupFiles": ["../setupMissingGlobals.js"],
"setupFilesAfterEnv": ["expect-puppeteer", "./puppeteer.setup.js"],
"globalSetup": "jest-environment-puppeteer/setup",
"globalSetup": "../globalSetup.js",
"globalTeardown": "jest-environment-puppeteer/teardown",
"testEnvironment": "./screenshot_env.js"
}
+25
View File
@@ -0,0 +1,25 @@
const {
SecretsManagerClient,
GetSecretValueCommand,
} = require("@aws-sdk/client-secrets-manager");
const { setup } = require("jest-environment-puppeteer");
const client = new SecretsManagerClient();
const secretValueRequest = {
SecretId: "corpora/backend/dev/auth0-secret",
};
const command = new GetSecretValueCommand(secretValueRequest);
module.exports = async () => {
await setup();
try {
const secret = JSON.parse((await client.send(command)).SecretString);
process.env.TEST_ACCOUNT_PASS = secret.test_account_password;
} catch (error) {
console.error(error);
}
console.log(process.env.TEST_ACCOUNT_PASS);
};
+1363 -1253
View File
File diff suppressed because it is too large Load Diff
+1
View File
@@ -38,6 +38,7 @@
"not Explorer > 0"
],
"dependencies": {
"@aws-sdk/client-secrets-manager": "^3.10.0",
"@blueprintjs/core": "^3.30.0",
"@blueprintjs/icons": "^3.19.0",
"@blueprintjs/popover2": "^0.3.0",