2018-07-09 11:04:53 +03:00
|
|
|
export const baseUrl = Cypress.config('baseUrl');
|
2018-06-28 07:57:37 +03:00
|
|
|
export const dataTypes = [
|
|
|
|
'serial',
|
|
|
|
'bigserial',
|
|
|
|
'integer',
|
|
|
|
'bigint',
|
|
|
|
'text',
|
|
|
|
'numeric',
|
|
|
|
'date',
|
|
|
|
'timestamptz',
|
|
|
|
'timetz',
|
|
|
|
'boolean',
|
|
|
|
];
|
|
|
|
export const typeDefaults = {
|
|
|
|
integer: '5555',
|
|
|
|
bigint: '5555555555',
|
|
|
|
text: 'test-text',
|
|
|
|
numeric: '0.55555',
|
|
|
|
date: 'now()',
|
|
|
|
timestamptz: 'now()',
|
|
|
|
timetz: 'now()',
|
|
|
|
boolean: 'false',
|
|
|
|
};
|
|
|
|
export const queryTypes = ['insert', 'select', 'update', 'delete'];
|
|
|
|
export const getColName = i => `apic_test_column_${i}`;
|
2018-07-09 11:23:05 +03:00
|
|
|
export const getTableName = (i, testName = '') =>
|
|
|
|
`apic_test_table_${testName}_${i}`;
|
2018-06-28 07:57:37 +03:00
|
|
|
export const getElementFromAlias = alias => `[data-test=${alias}]`;
|
|
|
|
export const makeDataAPIUrl = dataApiUrl => `${dataApiUrl}/v1/query`;
|
|
|
|
export const makeDataAPIOptions = (dataApiUrl, key, body) => ({
|
|
|
|
method: 'POST',
|
|
|
|
url: makeDataAPIUrl(dataApiUrl),
|
|
|
|
headers: {
|
|
|
|
'x-hasura-access-key': key,
|
|
|
|
},
|
|
|
|
body,
|
|
|
|
failOnStatusCode: false,
|
|
|
|
});
|