mirror of
https://github.com/chanzuckerberg/cellxgene.git
synced 2026-10-05 23:38:12 +08:00
Fetch passwords from secretsmanager (#2138)
* add aws secretsmanagerclient * create custom globalsetup * consume secret password and enable tests * update npm
This commit is contained in:
@@ -16,7 +16,7 @@ import {
|
|||||||
goToPage,
|
goToPage,
|
||||||
} from "./puppeteerUtils";
|
} from "./puppeteerUtils";
|
||||||
|
|
||||||
import { appUrlBase } from "./config";
|
import { appUrlBase, TEST_EMAIL, TEST_PASSWORD } from "./config";
|
||||||
|
|
||||||
export async function drag(testId, start, end, lasso = false) {
|
export async function drag(testId, start, end, lasso = false) {
|
||||||
const layout = await waitByID(testId);
|
const layout = await waitByID(testId);
|
||||||
@@ -317,9 +317,6 @@ export async function assertCategoryDoesNotExist(categoryName) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function login() {
|
export async function login() {
|
||||||
const email = ``;
|
|
||||||
const password = "";
|
|
||||||
|
|
||||||
await goToPage(appUrlBase);
|
await goToPage(appUrlBase);
|
||||||
|
|
||||||
await clickOn("log-in");
|
await clickOn("log-in");
|
||||||
@@ -328,8 +325,8 @@ export async function login() {
|
|||||||
await waitUntilFormFieldStable('[name="email"]');
|
await waitUntilFormFieldStable('[name="email"]');
|
||||||
|
|
||||||
await expect(page).toFillForm("form", {
|
await expect(page).toFillForm("form", {
|
||||||
email,
|
email: TEST_EMAIL,
|
||||||
password,
|
password: TEST_PASSWORD,
|
||||||
});
|
});
|
||||||
|
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
|
|||||||
@@ -6,3 +6,5 @@ export const appUrlBase =
|
|||||||
export const DATASET = "pbmc3k";
|
export const DATASET = "pbmc3k";
|
||||||
export const isDev = jestEnv === ENV_DEFAULT.DEV;
|
export const isDev = jestEnv === ENV_DEFAULT.DEV;
|
||||||
export const isDebug = jestEnv === ENV_DEFAULT.DEBUG;
|
export const isDebug = jestEnv === ENV_DEFAULT.DEBUG;
|
||||||
|
export const TEST_EMAIL = "user@example.com";
|
||||||
|
export const TEST_PASSWORD = process.env.TEST_ACCOUNT_PASS ?? "";
|
||||||
|
|||||||
@@ -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", () => {
|
conditionalDescribe("AuthN Integration", () => {
|
||||||
it("logs in", async () => {
|
it("logs in", async () => {
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
"testMatch": ["**/__tests__/**/?(*.)(spec|test).js?(x)"],
|
"testMatch": ["**/__tests__/**/?(*.)(spec|test).js?(x)"],
|
||||||
"setupFiles": ["../setupMissingGlobals.js"],
|
"setupFiles": ["../setupMissingGlobals.js"],
|
||||||
"setupFilesAfterEnv": ["expect-puppeteer", "./puppeteer.setup.js"],
|
"setupFilesAfterEnv": ["expect-puppeteer", "./puppeteer.setup.js"],
|
||||||
"globalSetup": "jest-environment-puppeteer/setup",
|
"globalSetup": "../globalSetup.js",
|
||||||
"globalTeardown": "jest-environment-puppeteer/teardown",
|
"globalTeardown": "jest-environment-puppeteer/teardown",
|
||||||
"testEnvironment": "./screenshot_env.js"
|
"testEnvironment": "./screenshot_env.js"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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);
|
||||||
|
};
|
||||||
Generated
+1363
-1253
File diff suppressed because it is too large
Load Diff
@@ -38,6 +38,7 @@
|
|||||||
"not Explorer > 0"
|
"not Explorer > 0"
|
||||||
],
|
],
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@aws-sdk/client-secrets-manager": "^3.10.0",
|
||||||
"@blueprintjs/core": "^3.30.0",
|
"@blueprintjs/core": "^3.30.0",
|
||||||
"@blueprintjs/icons": "^3.19.0",
|
"@blueprintjs/icons": "^3.19.0",
|
||||||
"@blueprintjs/popover2": "^0.3.0",
|
"@blueprintjs/popover2": "^0.3.0",
|
||||||
|
|||||||
Reference in New Issue
Block a user