graphql-engine/console/cypress/helpers/remoteSchemaHelpers.ts
hasura-bot 08ba8eda15 console: package modules from oss
GITHUB_PR_NUMBER: 6242
GITHUB_PR_URL: https://github.com/hasura/graphql-engine/pull/6242

Co-authored-by: Karthik Venkateswaran <25095884+karthikvt26@users.noreply.github.com>
Co-authored-by: Aleksandra Sikora <9019397+beerose@users.noreply.github.com>
Co-authored-by: Rishichandra Wawhal <27274869+wawhal@users.noreply.github.com>
Co-authored-by: Vladimir Ciobanu <1017953+vladciobanu@users.noreply.github.com>
Co-authored-by: Praveen Durairaju <14110316+praveenweb@users.noreply.github.com>
Co-authored-by: Sooraj <8408875+soorajshankar@users.noreply.github.com>
Co-authored-by: Sameer Kolhar <6604943+kolharsam@users.noreply.github.com>
GitOrigin-RevId: 029ac93967c14e634c1baa96f1e4c9b6bb198e91
2021-03-17 18:59:18 +00:00

39 lines
1.1 KiB
TypeScript

import { ADMIN_SECRET_HEADER_KEY } from './constants';
export const baseUrl = Cypress.config('baseUrl');
export const getRemoteSchemaName = (i: number, schemaName: string) =>
`test-remote-schema-${schemaName}-${i}`;
export const getRemoteGraphQLURL = () =>
'https://hasura-console-test.herokuapp.com/v1/graphql/';
export const getRemoteGraphQLURLFromEnv = () => 'GRAPHQL_URL';
export const getInvalidRemoteSchemaUrl = () => 'http://httpbin.org/post';
export const getHeaderAccessKey = (i: string) => `ACCESS_KEY-${i}`;
export const getHeaderAccessKeyValue = () => 'b94264abx98';
export const getElementFromAlias = (alias: string) => `[data-test=${alias}]`;
export const makeDataAPIUrl = (dataApiUrl: string) => `${dataApiUrl}/v1/query`;
export const makeDataAPIOptions = (
dataApiUrl: string,
key: string,
body: { [key: string]: any }
) => ({
method: 'POST',
url: makeDataAPIUrl(dataApiUrl),
headers: {
[ADMIN_SECRET_HEADER_KEY]: key,
},
body,
failOnStatusCode: false,
});
export const getRemoteSchemaRoleName = (i: number, roleName: string) =>
`test-role-${roleName}-${i}`;