-
Notifications
You must be signed in to change notification settings - Fork 2.7k
/
test.ts
75 lines (71 loc) · 2.35 KB
/
test.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
import {
passMTCheckRoute,
passMTMoveToTable,
passMTCreateTable,
failMTWithoutColName,
failMTWithoutColType,
passMTAddColumn,
passMTDeleteTableCancel,
passMTDeleteCol,
passMTDeleteTable,
passMCWithRightDefaultValue,
failMCWithWrongDefaultValue,
passCreateForeignKey,
passRemoveForeignKey,
passMTRenameTable,
passMTRenameColumn,
passModifyPkey,
passCreateUniqueKey,
passModifyUniqueKey,
passRemoveUniqueKey,
passMTChangeDefaultValueForPKey,
passMTFunctionList,
} from './spec';
import { testMode } from '../../../helpers/common';
import { setMetaData } from '../../validators/validators';
import { getIndexRoute } from '../../../helpers/dataHelpers';
const setup = () => {
describe('Check Data Tab', () => {
it('Clicking on Data tab opens the correct route', () => {
// Visit the index route
cy.visit(getIndexRoute());
// Get and set validation metadata
setMetaData();
});
});
};
export const runModifyTableTests = () => {
describe('Modify Table', () => {
it('Creating a table', passMTCreateTable);
it('Moving to the table', passMTMoveToTable);
it('Modify table button opens the correct route', passMTCheckRoute);
it(
'Can create computed field with compatible functions',
passMTFunctionList
);
it('Pass renaming table', passMTRenameTable);
it('Pass renaming column', passMTRenameColumn);
it('Fails to add column without column name', failMTWithoutColName);
it('Fails without type selected', failMTWithoutColType);
it('Add a column', passMTAddColumn);
it('Fail modify with wrong default value', failMCWithWrongDefaultValue);
it('Pass modify with wrong default value', passMCWithRightDefaultValue);
it('Pass create foreign-key', passCreateForeignKey);
it('Pass remove foreign-key', passRemoveForeignKey);
it(
'Pass edit default value for primary key',
passMTChangeDefaultValueForPKey
);
it('Pass modifying a primary key', passModifyPkey);
it('Pass creating a unique key', passCreateUniqueKey);
it('Pass modifying a unique key', passModifyUniqueKey);
it('Pass removing a unique key', passRemoveUniqueKey);
it('Delete the column', passMTDeleteCol);
it('Delete Table Cancel', passMTDeleteTableCancel);
it('Delete table', passMTDeleteTable);
});
};
if (testMode !== 'cli') {
setup();
runModifyTableTests();
}