graphql-engine/console/cypress/helpers/remoteSchemaHelpers.ts
Daniele Cammareri 2120c601d3 console: remove new create remote schema add page feature flag
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5529
GitOrigin-RevId: cf487e53137cb884236bfa0a394a719506e11b1b
2022-08-23 07:36:56 +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://graphql-pokemon2.vercel.app/';
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}`;