graphql-engine/console/cypress/e2e/data/create-table/test.ts

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

49 lines
1.4 KiB
TypeScript
Raw Normal View History

import { testMode } from '../../../helpers/common';
2018-06-28 07:57:37 +03:00
import { setMetaData } from '../../validators/validators';
import {
checkCreateTableRoute,
failCTWithoutColumns,
failCTWithoutPK,
failCTDuplicateColumns,
failCTWrongDefaultValue,
2018-06-28 07:57:37 +03:00
passCT,
failCTDuplicateTable,
deleteCTTestTables,
passCTWithFK,
2018-06-28 07:57:37 +03:00
} from './spec';
import { getIndexRoute } from '../../../helpers/dataHelpers';
2018-06-28 07:57:37 +03:00
const setup = () => {
describe('Setup route', () => {
it('Visit the index route', () => {
// Visit the index route
cy.visit(getIndexRoute());
2018-06-28 07:57:37 +03:00
// Get and set validation metadata
setMetaData();
});
});
};
export const runCreateTableTests = () => {
describe('Create Table', () => {
it('Create table button opens the correct route', checkCreateTableRoute);
it('Fails to create table without columns', failCTWithoutColumns);
it('Fails to create table without primary key', failCTWithoutPK);
it('Fails to create with duplicate columns', failCTDuplicateColumns);
it('Fails to create with wrong default value', failCTWrongDefaultValue);
2018-06-28 07:57:37 +03:00
it('Successfuly creates table', passCT);
it(
'Successfuly creates table with composite foreign and unique key',
passCTWithFK
);
2018-06-28 07:57:37 +03:00
it('Fails to create duplicate table', failCTDuplicateTable);
it('Delete the test tables', deleteCTTestTables);
2018-06-28 07:57:37 +03:00
});
};
if (testMode !== 'cli') {
setup();
runCreateTableTests();
}