graphql-engine/console/cypress/helpers/eventHelpers.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

36 lines
1010 B
TypeScript

import { ADMIN_SECRET_HEADER_KEY } from './constants';
export const baseUrl = Cypress.config('baseUrl');
export const queryTypes = ['insert', 'update', 'delete'];
export const getTriggerName = (i: number, testName = '') =>
`Apic_test_trigger_${testName}_${i}`;
export const getTableName = (i: number, testName = '') =>
`Apic_test_table_${testName}_${i}`;
export const getWebhookURL = () => 'http://httpbin.org/post';
export const getNoOfRetries = () => '5';
export const getIntervalSeconds = () => '10';
export const getTimeoutSeconds = () => '25';
export const getElementFromAlias = (alias: string) => `[data-test=${alias}]`;
export const makeDataAPIUrl = (dataApiUrl: string) => `${dataApiUrl}/v1/query`;
interface APIPayload {
[key: string]: any;
}
export const makeDataAPIOptions = (
dataApiUrl: string,
key: string,
body: APIPayload
) => ({
method: 'POST',
url: makeDataAPIUrl(dataApiUrl),
headers: {
[ADMIN_SECRET_HEADER_KEY]: key,
},
body,
failOnStatusCode: false,
});