graphql-engine/console/cypress/e2e/data/create-table/test.ts
Stefano Magni fc753ffb42 console: Update Cypress to v10 and run the migration guide
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4849
GitOrigin-RevId: 10e0fd62344a0c5c7028ad480b747b7f64c9c773
2022-07-05 08:51:35 +00:00

49 lines
1.4 KiB
TypeScript

import { testMode } from '../../../helpers/common';
import { setMetaData } from '../../validators/validators';
import {
checkCreateTableRoute,
failCTWithoutColumns,
failCTWithoutPK,
failCTDuplicateColumns,
failCTWrongDefaultValue,
passCT,
failCTDuplicateTable,
deleteCTTestTables,
passCTWithFK,
} from './spec';
import { getIndexRoute } from '../../../helpers/dataHelpers';
const setup = () => {
describe('Setup route', () => {
it('Visit the index route', () => {
// Visit the index route
cy.visit(getIndexRoute());
// 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);
it('Successfuly creates table', passCT);
it(
'Successfuly creates table with composite foreign and unique key',
passCTWithFK
);
it('Fails to create duplicate table', failCTDuplicateTable);
it('Delete the test tables', deleteCTTestTables);
});
};
if (testMode !== 'cli') {
setup();
runCreateTableTests();
}