console: more tests (#35)

This commit is contained in:
aswinmprabhu 2018-07-04 18:27:56 +05:30 committed by Shahidh K Muhammed
parent a2a85b8952
commit 2cab15ede4
25 changed files with 3285 additions and 3539 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
npm-debug.log

View File

@ -29,6 +29,7 @@ To run the tests for the modules individually (say for create table),
- Go to the `cypress.json` and set the `env > TEST_MODE` variable to `ui`.
```
{
"env": {

View File

@ -8,9 +8,9 @@ import { setMetaData, validateCT } from '../../validators/validators';
export const checkCreateTableRoute = () => {
// Click on the create table button
cy.get('button')
.contains('Create Table')
.click();
cy.visit('/data/schema');
cy.wait(15000);
cy.get(getElementFromAlias('data-create-table')).click();
// Match the URL
cy.url().should('eq', `${baseUrl}/data/schema/public/table/add`);
};
@ -19,11 +19,10 @@ export const failCTWithoutColumns = () => {
// Type table name
cy.get(getElementFromAlias('tableName')).type(getTableName(0));
// Click on create
cy.get('button')
.contains('Create')
.click();
cy.get(getElementFromAlias('table-create')).click();
// Check for an error
cy.get('div').contains('Column name cannot be empty');
// cy.get('div').contains('Column name cannot be empty');
cy.get('.notification-error');
// Check if the route didn't change
cy.url().should('eq', `${baseUrl}/data/schema/public/table/add`);
// Validate
@ -35,13 +34,9 @@ export const failCTWithoutPK = () => {
cy.get(getElementFromAlias('column-0')).type(getColName(0));
cy.get(getElementFromAlias('col-type-0')).select('serial');
// Click on create
cy.get('button')
.contains('Create')
.click();
cy.get(getElementFromAlias('table-create')).click();
// Check for an error
cy.get('div').contains(
'You should have atleast one column as a primary key.'
);
cy.get('.notification-error');
// Check if the route didn't change
cy.url().should('eq', `${baseUrl}/data/schema/public/table/add`);
// Validate
@ -55,9 +50,7 @@ export const failCTDuplicateColumns = () => {
// Set primary key
cy.get(getElementFromAlias('primary-key-select-0')).select('0');
// Click on create
cy.get('button')
.contains('Create')
.click();
cy.get(getElementFromAlias('table-create')).click();
// Check for an alert
cy.on('window:alert', str => {
expect(
@ -80,7 +73,7 @@ export const passCT = () => {
cy.get(getElementFromAlias('primary-key-select-0')).select('0');
// Click on create
cy.get(getElementFromAlias('table-create')).click();
cy.wait(7000);
cy.wait(10000);
// Check if the table got created and navigatied to modify table
cy.url().should(
'eq',
@ -93,9 +86,7 @@ export const passCT = () => {
export const failCTDuplicateTable = () => {
// Visit data page
cy.get('button')
.contains('Add Table')
.click();
cy.get(getElementFromAlias('sidebar-add-table')).click();
// Type table name
cy.get(getElementFromAlias('tableName')).type(getTableName(0));
// Set column
@ -104,24 +95,18 @@ export const failCTDuplicateTable = () => {
// Set primary key
cy.get(getElementFromAlias('primary-key-select-0')).select('0');
// Click on create
cy.get('button')
.contains('Create')
.click();
cy.wait(5000);
cy.get(getElementFromAlias('table-create')).click();
cy.wait(7000);
// Detect error
cy.get('div').contains('Create table failed');
cy.get('.notification-error');
};
export const deleteCTTestTable = () => {
// Go to the modify section of the table
cy.get('a')
.contains(`${getTableName(0)}`)
.click();
cy.get(getElementFromAlias(`${getTableName(0)}`)).click();
cy.get(getElementFromAlias('table-modify')).click();
// Click on delete
cy.get('button')
.contains('Delete table')
.click();
cy.get(getElementFromAlias('delete-table')).click();
// Confirm
cy.on('window:confirm', str => {
expect(str === 'Are you sure?').to.be.true;

View File

@ -44,13 +44,9 @@ const setColumns = () => {
const clickSaveOrInsert = (firstIndex, currentIndex) => {
if (currentIndex === firstIndex) {
cy.get('button')
.contains('Save')
.click();
cy.get(getElementFromAlias('insert-save-button')).click();
} else {
cy.get('button')
.contains('Insert Again')
.click();
cy.get(getElementFromAlias('insert-save-button')).click();
}
cy.wait(2000);
};
@ -95,9 +91,7 @@ const checkOrder = order => {
export const passBICreateTable = () => {
cy.wait(7000);
// Click create table button
cy.get('button')
.contains('Create Table')
.click();
cy.get(getElementFromAlias('data-create-table')).click();
// Type table name
cy.get(getElementFromAlias('tableName')).type(getTableName(0));
// Set columns with all fields
@ -112,9 +106,7 @@ export const passBICreateTable = () => {
export const checkInsertRoute = () => {
// Click on Insert tab
cy.get('a')
.contains(getTableName(0))
.click();
cy.get(getElementFromAlias(getTableName(0))).click();
cy.get(getElementFromAlias('table-insert-rows')).click();
// Match URL
cy.url().should(
@ -134,10 +126,11 @@ export const failBIWrongDataType = () => {
// Click the Save/Insert Again button.
clickSaveOrInsert(2, i);
// Check for error and dismiss it
cy.get('[class=notification-title]')
.contains('Insert failed')
.click();
// Check the default radio of current column
// cy.get('[class=notification-title]')
// .contains('Insert failed')
// .click();
cy.get('.notification-error').click();
// Check the default radio of curret column
cy.get(getElementFromAlias(`typed-input-default-${i}`)).check();
}
@ -157,9 +150,7 @@ export const passBIInsert20Rows = () => {
cy.get(getElementFromAlias(`typed-input-${textIndex}`)).type(
'filter-text'
);
cy.get('button')
.contains('Insert Again')
.click();
cy.get(getElementFromAlias('insert-save-button')).click();
continue; // eslint-disable-line
}
cy.get(getElementFromAlias(`typed-input-${textIndex}`)).type(
@ -172,9 +163,7 @@ export const passBIInsert20Rows = () => {
.toString(36)
.substring(7)
);
cy.get('button')
.contains('Insert Again')
.click();
cy.get(getElementFromAlias('insert-save-button')).click();
validateInsert(getTableName(0), i + 1);
}
// Wait for insert notifications to disappear
@ -183,9 +172,7 @@ export const passBIInsert20Rows = () => {
export const checkBrowseRoute = () => {
// Click on Browse tab
cy.get('a')
.contains(getTableName(0))
.click();
cy.get(getElementFromAlias(getTableName(0))).click();
cy.get(getElementFromAlias('table-browse-rows')).click();
cy.wait(2000);
// Match URL
@ -198,7 +185,30 @@ export const checkBrowseRoute = () => {
export const passBI20RowsExist = () => {
// Check if the 20 inserted elements reflect in the UI
cy.get(getElementFromAlias('table-browse-rows')).contains('21');
// Check pagination string
};
export const checkPagination = () => {
// Check if the current page is 1
cy.get('.-pageJump > input').should('have.value', '1');
// Check if the total number of pages is 3
cy.get('.-totalPages').contains('3');
// Check if the default value of rows displayed is 10
cy.get('.-pageSizeOptions > select').should('have.value', '10');
cy.get('.-next > button').click();
cy.wait(3000);
// Check if the page changed
cy.get(
'.rt-tbody > div:nth-child(1) > div > div:nth-child(2) > div'
).contains('11');
cy.get('.-pageJump > input').should('have.value', '2');
cy.get('.-previous > button').click();
cy.wait(3000);
// Check if the page changed
cy.get('.-pageJump > input').should('have.value', '1');
cy.get('.-pageSizeOptions > select').select('5 rows');
cy.wait(3000);
// Check if the total number of pages changed
cy.get('.-totalPages').contains('5');
};
export const passBISort = order => {
@ -213,9 +223,7 @@ export const passBISort = order => {
order === 'asc' ? 'Asc' : 'Desc'
);
// Run query
cy.get('button')
.contains('Run query')
.click();
cy.get(getElementFromAlias('run-query')).click();
cy.wait(5000);
// Check order
checkOrder(order);
@ -223,9 +231,7 @@ export const passBISort = order => {
// Clear filter
cy.get(getElementFromAlias('clear-sorts-0')).click();
// Run query
cy.get('button')
.contains('Run query')
.click();
cy.get(getElementFromAlias('run-query')).click();
cy.wait(5000);
};
@ -240,9 +246,7 @@ export const passBIFilterQueryEq = () => {
.last()
.type('filter-text');
// Run query
cy.get('button')
.contains('Run query')
.click();
cy.get(getElementFromAlias('run-query')).click();
cy.wait(2000);
// Check if the query was successful
checkQuerySuccess();
@ -250,9 +254,7 @@ export const passBIFilterQueryEq = () => {
// Clear filter
cy.get(getElementFromAlias('clear-filter-0')).click();
// Run query
cy.get('button')
.contains('Run query')
.click();
cy.get(getElementFromAlias('run-query')).click();
cy.wait(5000);
};
@ -261,9 +263,7 @@ export const deleteBITestTable = () => {
cy.get(getElementFromAlias('table-modify')).click();
cy.wait(2000);
// Click on delete
cy.get('button')
.contains('Delete table')
.click();
cy.get(getElementFromAlias('delete-table')).click();
// Confirm
cy.on('window:confirm', str => {
expect(str === 'Are you sure?').to.be.true;
@ -287,13 +287,9 @@ export const failBINullKeys = () => {
.type('{selectall}{del}');
// Click the Insert Again button.
cy.get('button')
.contains('Insert Again')
.click();
cy.get(getElementFromAlias('insert-save-button')).click();
cy.get('[class=notification-title]')
.contains('Insert failed')
.click();
cy.get('.notification-error').click();
// Wait for insert notifications to disappear
cy.wait(7000);
validateInsert(getTableName(0), 20);
@ -317,9 +313,7 @@ export const failBIUniqueKeys = () => {
cy.get('input[placeholder="text"]')
.first()
.type('name');
cy.get('button')
.contains('Insert Again')
.click();
cy.get(getElementFromAlias('insert-save-button')).click();
// Check default for next insert
cy.get(getElementFromAlias(`typed-input-default-${textIndex}`)).check();
@ -336,13 +330,9 @@ export const failBIUniqueKeys = () => {
cy.get('input[placeholder="text"]')
.first()
.type('name');
cy.get('button')
.contains('Insert Again')
.click();
cy.get(getElementFromAlias('insert-save-button')).click();
cy.get('[class=notification-title]')
.contains('Insert failed')
.click();
cy.get('.notification-error').click();
cy.wait(7000);
validateInsert(getTableName(0), 21);
};
@ -365,11 +355,10 @@ export const passEditButton = () => {
'{selectall}{del}'
);
cy.get(getElementFromAlias(`typed-input-${textIndex}`)).type('new-text');
cy.get('button')
.contains('Save')
.last()
.click();
cy.get('h4').contains('Edited!', { timeout: 7000 });
cy.get(getElementFromAlias('save-button')).click();
// cy.get('h4').contains('Edited!', { timeout: 7000 });
cy.get('.notification-success');
cy.wait(7000);
};
export const passCloneButton = () => {
@ -389,6 +378,6 @@ export const passDeleteRow = () => {
cy.on('window:confirm', str => {
expect(str === 'Permanently delete this row?').to.be.true;
});
cy.get('h4').contains('Row deleted!', { timeout: 7000 });
cy.wait(7000);
cy.get('.notification-success');
cy.wait(14000);
};

View File

@ -13,6 +13,7 @@ import {
passBIInsert20Rows,
checkBrowseRoute,
passBI20RowsExist,
checkPagination,
passBISort,
passBIFilterQueryEq,
passEditButton,
@ -42,6 +43,7 @@ export const runInsertBrowseTests = () => {
it('Fail for adding same data for Unique keys', failBIUniqueKeys);
it('Check browser rows route', checkBrowseRoute);
it('20 Inserted rows reflect in browse rows', passBI20RowsExist);
it('Check pagination in Browse Rows table', checkPagination);
it('Ascending sort works as expected', () => passBISort('asc'));
it('Descending sort works as expected', () => passBISort('desc'));
it('FIlter query works as expected with $eq', passBIFilterQueryEq);

View File

@ -11,21 +11,13 @@ import {
} from '../../validators/validators';
export const passMTCreateTable = () => {
cy.get('button')
.contains('Create Table')
.click();
cy.get(getElementFromAlias('data-create-table')).click();
cy.url().should('eq', `${baseUrl}/data/schema/public/table/add`);
cy.get(getElementFromAlias('tableName')).type(getTableName(0));
cy.get('input[placeholder="column_name"]').type('id');
cy.get('select')
.first()
.select('Integer');
cy.get('select')
.last()
.select('id');
cy.get('button')
.contains('Create')
.click();
cy.get(getElementFromAlias('column-0')).type('id');
cy.get(getElementFromAlias('col-type-0')).select('Integer');
cy.get(getElementFromAlias('primary-key-select-0')).select('id');
cy.get(getElementFromAlias('table-create')).click();
cy.wait(7000);
cy.url().should(
'eq',
@ -48,9 +40,7 @@ export const makeid = () => {
export const passMTCheckRoute = () => {
// Click on the create table button
cy.get('a')
.contains('Modify')
.click();
cy.get(getElementFromAlias('table-modify')).click();
// Match the URL
cy.url().should(
'eq',
@ -59,9 +49,7 @@ export const passMTCheckRoute = () => {
};
export const passMTMoveToTable = () => {
cy.get('a')
.contains(getTableName(0))
.click();
cy.get(getElementFromAlias(getTableName(0))).click();
cy.url().should(
'eq',
`${baseUrl}/data/schema/public/tables/${getTableName(0)}/browse`
@ -69,12 +57,8 @@ export const passMTMoveToTable = () => {
};
export const failMTWithoutColName = () => {
cy.get('button')
.contains('+ Add column')
.click();
cy.get('[class=notification-title]')
.contains('Error adding column!')
.click();
cy.get(getElementFromAlias('add-column-button')).click();
cy.get('.notification-error').click();
cy.url().should(
'eq',
`${baseUrl}/data/schema/public/tables/${getTableName(0)}/modify`
@ -84,13 +68,9 @@ export const failMTWithoutColName = () => {
};
export const failMTWithoutColType = () => {
cy.get('input[placeholder = "column name"]').type('something');
cy.get('button')
.contains('+ Add column')
.click();
cy.get('[class=notification-title]')
.contains('Error creating column!')
.click();
cy.get(getElementFromAlias('column-name')).type('something');
cy.get(getElementFromAlias('add-column-button')).click();
cy.get('.notification-error').click();
cy.url().should(
'eq',
`${baseUrl}/data/schema/public/tables/${getTableName(0)}/modify`
@ -99,47 +79,46 @@ export const failMTWithoutColType = () => {
};
export const failMTDuplicateColumns = () => {
cy.get('input[placeholder = "column name"]').type('{selectall}{del}');
cy.get('input[placeholder = "column name"]').type('id');
cy.get('select').select('integer');
cy.get('button')
.contains('+ Add column')
.click();
cy.wait(5000);
cy.get('[class=notification-title]')
.contains('Adding column failed')
.click();
cy.get(getElementFromAlias('column-name')).type('{selectall}{del}');
cy.get(getElementFromAlias('column-name')).type('id');
cy.get(getElementFromAlias('data-type')).select('integer');
cy.get(getElementFromAlias('add-column-button')).click();
// Check for an alert
cy.wait(5500);
cy.get('.notification-error').click();
// Check if the route didn't change
cy.url().should(
'eq',
`${baseUrl}/data/schema/public/tables/${getTableName(0)}/modify`
);
};
export const Addcolumn = () => {
cy.get('input[placeholder = "column name"]').type('{selectall}{del}');
cy.get(getElementFromAlias('column-name')).type('{selectall}{del}');
const name = makeid();
cy.get('input[placeholder = "column name"]').type(name);
cy.get(getElementFromAlias('column-name')).type(name);
cy.get(getElementFromAlias('data-type')).select('integer');
cy.get('input[placeholder = "default value"]').type('{selectall}{del}');
cy.get('[data-test=nullable-checkbox]').check();
cy.get('button')
.contains('+ Add column')
.click();
cy.wait(5000);
cy.get('[class=notification-title]').contains('Column added');
cy.wait(5000);
cy.get(getElementFromAlias('default-value')).type('{selectall}{del}');
cy.get(getElementFromAlias('nullable-checkbox')).check();
cy.get(getElementFromAlias('add-column-button')).click();
cy.wait(5500);
cy.get('.notification-success').click();
cy.wait(7000);
cy.url().should(
'eq',
`${baseUrl}/data/schema/public/tables/${getTableName(0)}/modify`
);
validateColumn(getTableName(0), [name], 'success');
};
export const Addcolumnnullable = () => {
cy.get('input[placeholder = "column name"]').type('{selectall}{del}');
cy.get('input[placeholder = "column name"]').type('some');
cy.get('select').select('Text');
cy.get('[data-test=nullable-checkbox]').uncheck();
cy.get('button')
.contains('+ Add column')
.click();
cy.wait(5000);
cy.get('[class=notification-title]')
.contains('Adding column failed')
.click();
cy.get(getElementFromAlias('column-name')).type('{selectall}{del}');
cy.get(getElementFromAlias('column-name')).type('some');
cy.get(getElementFromAlias('data-type')).select('Text');
cy.get(getElementFromAlias('nullable-checkbox')).uncheck();
cy.get(getElementFromAlias('add-column-button')).click();
cy.wait(5500);
cy.get('.notification-error').click();
cy.url().should(
'eq',
`${baseUrl}/data/schema/public/tables/${getTableName(0)}/modify`
@ -148,15 +127,13 @@ export const Addcolumnnullable = () => {
};
export const failMTWrongDefault = () => {
cy.get('input[placeholder = "column name"]').type('{selectall}{del}');
cy.get('input[placeholder = "column name"]').type('some');
cy.get('input[placeholder = "default value"]').type('some');
cy.get('select').select('Integer');
cy.get('button')
.contains('+ Add column')
.click();
cy.wait(5000);
cy.get('[class=notification-title]').contains('Adding column failed');
cy.get(getElementFromAlias('column-name')).type('{selectall}{del}');
cy.get(getElementFromAlias('column-name')).type('some');
cy.get(getElementFromAlias('default-value')).type('some');
cy.get(getElementFromAlias('data-type')).select('Integer');
cy.get(getElementFromAlias('add-column-button')).click();
cy.wait(5500);
cy.get('.notification-error').click();
cy.url().should(
'eq',
`${baseUrl}/data/schema/public/tables/${getTableName(0)}/modify`
@ -165,17 +142,13 @@ export const failMTWrongDefault = () => {
};
export const Addcolumnname = name => {
cy.get('input[placeholder = "column name"]').type('{selectall}{del}');
cy.get('input[placeholder = "column name"]').type(name);
cy.get('select').select('integer');
cy.get(getElementFromAlias('column-name')).type('{selectall}{del}');
cy.get(getElementFromAlias('column-name')).type(name);
cy.get(getElementFromAlias('data-type')).select('integer');
cy.get('button')
.contains('+ Add column')
.click();
cy.wait(5000);
cy.get('[class=notification-title]')
.contains('Column added')
.click();
cy.get(getElementFromAlias('add-column-button')).click();
cy.wait(5500);
cy.get('.notification-success').click();
cy.url().should(
'eq',
`${baseUrl}/data/schema/public/tables/${getTableName(0)}/modify`
@ -190,11 +163,7 @@ export const passMTAddTwoCols = () => {
export const Movetocolumn = () => {
Addcolumnname('somes');
cy.get('h5')
.contains('somes')
.parent()
.contains('Edit')
.click();
cy.get(getElementFromAlias('edit-somes')).click();
};
export const passMTChangeColType = () => {
@ -204,13 +173,9 @@ export const passMTChangeColType = () => {
.get('select')
.first()
.select('Text');
cy.get('button')
.contains('Save')
.click();
cy.wait(5000);
cy.get('[class=notification-title]')
.contains('Column modified')
.click();
cy.get(getElementFromAlias('save-button')).click();
cy.wait(5500);
cy.get('.notification-success').click();
cy.get('button')
.contains('Close')
.click();
@ -222,21 +187,15 @@ export const passMTChangeColType = () => {
};
export const passMTDeleteCol = () => {
cy.get('h5')
.contains('somes')
.parent()
.contains('Edit')
.click();
cy.get(getElementFromAlias('edit-somes')).click();
cy.get('button')
.contains('Remove')
.click();
cy.on('window:alert', str => {
expect(str === 'Are you sure you want to delete?').to.be.true;
});
cy.wait(5000);
cy.get('[class=notification-title]')
.contains('Column deleted')
.click();
cy.wait(5500);
cy.get('.notification-success').click();
cy.url().should(
'eq',
`${baseUrl}/data/schema/public/tables/${getTableName(0)}/modify`
@ -245,9 +204,7 @@ export const passMTDeleteCol = () => {
};
export const passMTDeleteTableCancel = () => {
cy.get('button')
.contains('Delete table')
.click();
cy.get(getElementFromAlias('delete-table')).click();
cy.on('window:confirm', () => false);
cy.url().should(
'eq',
@ -258,9 +215,7 @@ export const passMTDeleteTableCancel = () => {
};
export const passMTDeleteTable = () => {
cy.get('button')
.contains('Delete table')
.click();
cy.get(getElementFromAlias('delete-table')).click();
cy.on('window:confirm', () => true);
cy.wait(5000);
cy.url().should('eq', `${baseUrl}/data/schema/public`);
@ -268,22 +223,14 @@ export const passMTDeleteTable = () => {
};
export const failMTRemoveNullable = () => {
cy.get('a')
.contains('Insert Row')
.click();
cy.get(getElementFromAlias('table-insert-rows')).click();
cy.get('input[placeholder = "integer"]').type('{selectall}{del}');
cy.get('input[placeholder="integer"]').type(123);
cy.get('button')
.contains('Save')
.click();
cy.get(getElementFromAlias('insert-save-button')).click();
cy.get('input[placeholder = "integer"]').type('{selectall}{del}');
cy.get('input[placeholder="integer"]').type(1234);
cy.get('button')
.contains('Insert Again')
.click();
cy.get('a')
.contains('Modify')
.click();
cy.get(getElementFromAlias('insert-save-button')).click();
cy.get(getElementFromAlias('table-modify')).click();
Addcolumnnullable();
};
@ -313,9 +260,7 @@ export const Createtable = (name, dict) => {
cy.get('select')
.last()
.select('id');
cy.get('button')
.contains('Create')
.click();
cy.get(getElementFromAlias('table-create')).click();
cy.wait(7000);
cy.url().should(
'eq',
@ -326,13 +271,9 @@ export const Createtable = (name, dict) => {
};
export const Createtables = () => {
cy.get('button')
.contains('Create Table')
.click();
cy.get(getElementFromAlias('data-create-table')).click();
Createtable('author', { id: 'Integer', name: 'Text' });
cy.get('button')
.contains('Add Table')
.click();
cy.get(getElementFromAlias('sidebar-add-table')).click();
Createtable('article', {
id: 'Integer',
title: 'Text',
@ -343,53 +284,35 @@ export const Createtables = () => {
};
export const Createview = () => {
cy.get('a')
.contains('SQL')
.click();
cy.get(getElementFromAlias('sql-link')).click();
cy.get('textarea').type(`CREATE VIEW author_average_rating AS
SELECT author_table.id, avg(article_table.rating)
From author_table, article_table
WHERE author_table.id = article_table.author_id
GROUP BY author_table.id`);
cy.get('button')
.contains('Run!')
.click();
cy.get(getElementFromAlias('run-sql')).click();
validateCT('author_average_rating', 'success');
};
export const Checkviewtable = () => {
cy.get('a')
.contains('author_average_rating')
.click();
cy.get(getElementFromAlias('author_average_rating')).click();
cy.url().should(
'eq',
`${baseUrl}/data/schema/public/views/author_average_rating/browse`
);
cy.get('a')
.contains('Modify')
.click();
cy.get('button')
.contains('Modify')
.last()
.click();
cy.get(getElementFromAlias('table-modify')).click();
cy.get(getElementFromAlias('modify-view')).click();
cy.url().should('eq', `${baseUrl}/data/sql`);
};
export const Checkviewtabledelete = () => {
cy.get('a')
.contains('author_average_rating')
.click();
cy.get(getElementFromAlias('author_average_rating')).click();
cy.url().should(
'eq',
`${baseUrl}/data/schema/public/views/author_average_rating/browse`
);
cy.get('a')
.contains('Modify')
.click();
cy.get('button')
.contains('Delete view')
.last()
.click();
cy.get(getElementFromAlias('table-modify')).click();
cy.get(getElementFromAlias('delete-view')).click();
cy.on('window:confirm', str => {
expect(str === 'Are you sure?').to.be.true;
return true;

View File

@ -12,9 +12,7 @@ import { testPermissions, permRemove, createView, trackView } from './utils';
export const passPTCreateTable = () => {
// Click on create tabel
cy.get('button')
.contains('Create Table')
.click();
cy.get(getElementFromAlias('data-create-table')).click();
// Match the URL
cy.url().should('eq', `${baseUrl}/data/schema/public/table/add`);
// Type table name
@ -31,9 +29,7 @@ export const passPTCreateTable = () => {
// Set primary key
cy.get(getElementFromAlias('primary-key-select-0')).select('0');
// Create
cy.get('button')
.contains('Create')
.click();
cy.get(getElementFromAlias('table-create')).click();
cy.wait(7000);
cy.url().should(
'eq',
@ -90,13 +86,9 @@ export const passPVRemovePerms = () => {
export const passPVDeleteView = () => {
// Go to modify table
cy.get('a')
.contains('Modify')
.click();
cy.get(getElementFromAlias('table-modify')).click();
// Delete table
cy.get('button')
.contains('Delete view')
.click();
cy.get(getElementFromAlias('delete-view')).click();
cy.wait(7000);
};
@ -107,9 +99,7 @@ export const passPTDeleteTable = () => {
// Go to modify table
cy.get(getElementFromAlias('table-modify')).click();
// Delete table
cy.get('button')
.contains('Delete table')
.click();
cy.get(getElementFromAlias('delete-table')).click();
cy.wait(7000);
};

View File

@ -9,12 +9,10 @@ import {
import { validatePermission } from '../../validators/validators';
export const savePermission = () => {
cy.get('button')
.contains('Save permissions')
.click();
cy.wait(5000);
cy.get(getElementFromAlias('Save-permissions-button')).click();
cy.wait(5500);
// Check for success notif
cy.get('[class=notification-title]').contains('Permissions updated');
cy.get('.notification-success').click();
};
export const permNoCheck = (tableName, query, first) => {
@ -91,12 +89,10 @@ export const permRemove = (tableName, query) => {
// click on the query type to edit permission
cy.get(getElementFromAlias(`role0-${query}`)).click();
// Remove permission
cy.get('button')
.contains('Remove all access')
.click();
cy.wait(5000);
cy.get(getElementFromAlias('Remove-all-access-button')).click();
cy.wait(5500);
// Check for notif
cy.get('[class=notification-title]').contains('Permissions deleted');
cy.get('.notification-success').click();
cy.wait(5000);
// Validate
validatePermission(tableName, 'role0', query, 'custom', 'failure');
@ -128,9 +124,7 @@ export const trackView = () => {
cy.get(getElementFromAlias(`add-track-table-${getTableName(1)}`)).click();
cy.wait(10000);
// Move to permissions
cy.get('a')
.contains('Permissions')
.click();
cy.get(getElementFromAlias('table-permissions')).click();
};
export const createView = (viewName, tableName) => {

View File

@ -1,6 +1,7 @@
/* eslint import/prefer-default-export: 0 */
import { baseUrl } from '../../../helpers/dataHelpers';
import { getElementFromAlias } from '../../../helpers/dataHelpers';
export const openRawSQL = () => {
// eslint-disable-line
@ -9,9 +10,7 @@ export const openRawSQL = () => {
.contains('Data')
.click();
cy.wait(3000);
cy.get('a')
.contains('SQL')
.click();
cy.get(getElementFromAlias('sql-link')).click();
cy.wait(3000);
// Match URL
cy.url().should('eq', `${baseUrl}/data/sql`);

View File

@ -12,23 +12,12 @@ export const Createtable = (name, dict) => {
const keys = Object.keys(dict).map(k => k);
const values = Object.keys(dict).map(k => dict[k]);
for (let i = 0; i < keys.length; i += 1) {
cy.get('input[placeholder="column_name"]')
.last()
.type(keys[i]);
cy.get('select')
.find('option')
.contains('-- type --')
.parent()
.last()
.select(values[i]);
cy.get(getElementFromAlias(`column-${i}`)).type(keys[i]);
cy.get(getElementFromAlias(`col-type-${i}`)).select(values[i]);
}
cy.get('select')
.last()
.select('id');
cy.get('button')
.contains('Create')
.click();
cy.get(getElementFromAlias('primary-key-select-0')).select('id');
cy.get(getElementFromAlias('table-create')).click();
cy.wait(10000);
cy.url().should(
'eq',
@ -39,13 +28,9 @@ export const Createtable = (name, dict) => {
};
export const passRTCreateTables = () => {
cy.get('button')
.contains('Create Table')
.click();
cy.get(getElementFromAlias('data-create-table')).click();
Createtable('author', { id: 'Integer', name: 'Text' });
cy.get('button')
.contains('Add Table')
.click();
cy.get(getElementFromAlias('sidebar-add-table')).click();
Createtable('article', {
id: 'Integer',
title: 'Text',
@ -53,9 +38,7 @@ export const passRTCreateTables = () => {
author_id: 'Integer',
rating: 'Integer',
});
cy.get('button')
.contains('Add Table')
.click();
cy.get(getElementFromAlias('sidebar-add-table')).click();
Createtable('comment', {
id: 'Integer',
user_id: 'Integer',
@ -65,24 +48,14 @@ export const passRTCreateTables = () => {
};
export const passRTMoveToTable = () => {
cy.get('a')
.contains('article_table')
.click();
cy.get('a')
.contains('Relationships')
.click();
cy.get(getElementFromAlias('article_table')).click();
cy.get(getElementFromAlias('table-relationships')).click();
};
export const Deletetable = name => {
cy.get('a')
.contains(name)
.click();
cy.get('a')
.contains('Modify')
.click();
cy.get('button')
.contains('Delete table')
.click();
cy.get(getElementFromAlias(name)).click();
cy.get(getElementFromAlias('table-modify')).click();
cy.get(getElementFromAlias('delete-table')).click();
cy.on('window:alert', str => {
expect(str === 'Are you sure?').to.be.true;
});
@ -97,12 +70,8 @@ export const passRTDeleteTables = () => {
};
export const passRTAddDataarticle = data => {
cy.get('a')
.contains('article_table')
.click();
cy.get('a')
.contains('Insert Row')
.click();
cy.get(getElementFromAlias('article_table')).click();
cy.get(getElementFromAlias('table-insert-rows')).click();
cy.get('label')
.contains('id')
.next()
@ -140,12 +109,8 @@ export const passRTAddDataarticle = data => {
};
export const passRTAddDataauthor = data => {
cy.get('a')
.contains('author_table')
.click();
cy.get('a')
.contains('Insert Row')
.click();
cy.get(getElementFromAlias('author_table')).click();
cy.get(getElementFromAlias('table-insert-rows')).click();
cy.get('label')
.contains('id')
.next()
@ -158,19 +123,13 @@ export const passRTAddDataauthor = data => {
.find('input')
.last()
.type(data[1]);
cy.get('button')
.contains('Save')
.click();
cy.get(getElementFromAlias('insert-save-button')).click();
cy.wait(7000);
};
export const passRTAddDatacomment = data => {
cy.get('a')
.contains('comment_table')
.click();
cy.get('a')
.contains('Insert Row')
.click();
cy.get(getElementFromAlias('comment_table')).click();
cy.get(getElementFromAlias('table-insert-rows')).click();
cy.get('label')
.contains('id')
.next()
@ -195,9 +154,7 @@ export const passRTAddDatacomment = data => {
.find('input')
.last()
.type(data[3]);
cy.get('button')
.contains('Save')
.click();
cy.get(getElementFromAlias('insert-save-button')).click();
cy.wait(7000);
};
@ -222,15 +179,9 @@ export const passRTAddData = () => {
};
export const passRTAddManualObjRel = () => {
cy.get('a')
.contains('article_table')
.click();
cy.get('a')
.contains('Relationships')
.click();
cy.get('button')
.contains('+ Add a manual relationship')
.click();
cy.get(getElementFromAlias('article_table')).click();
cy.get(getElementFromAlias('table-relationships')).click();
cy.get(getElementFromAlias('add-manual-relationship')).click();
cy.get('select')
.first()
.select('Object Relationship');
@ -261,15 +212,9 @@ export const passRTAddManualObjRel = () => {
};
export const passRTAddManualArrayRel = () => {
cy.get('a')
.contains('article_table')
.click();
cy.get('a')
.contains('Relationships')
.click();
cy.get('button')
.contains('+ Add a manual relationship')
.click();
cy.get(getElementFromAlias('article_table')).click();
cy.get(getElementFromAlias('table-relationships')).click();
cy.get(getElementFromAlias('add-manual-relationship')).click();
cy.get('select')
.first()
.select('Array Relationship');
@ -300,12 +245,8 @@ export const passRTAddManualArrayRel = () => {
};
export const passRTAddForeignKey = () => {
cy.get('a')
.contains('article_table')
.click();
cy.get('a')
.contains('Modify')
.click();
cy.get(getElementFromAlias('article_table')).click();
cy.get(getElementFromAlias('table-modify')).click();
cy.get('b')
.contains('author_id')
.prev()
@ -321,16 +262,10 @@ export const passRTAddForeignKey = () => {
.contains('Reference column')
.parent()
.select('id');
cy.get('button')
.contains('Save')
.click();
cy.get(getElementFromAlias('save-button')).click();
cy.wait(7000);
cy.get('a')
.contains('comment_table')
.click();
cy.get('a')
.contains('Modify')
.click();
cy.get(getElementFromAlias('comment_table')).click();
cy.get(getElementFromAlias('table-modify')).click();
cy.get('b')
.contains('article_id')
.prev()
@ -346,21 +281,14 @@ export const passRTAddForeignKey = () => {
.contains('Reference column')
.parent()
.select('id');
cy.get('button')
.contains('Save')
.click();
cy.get(getElementFromAlias('save-button')).click();
cy.wait(7000);
};
export const passRTDeleteRelationships = () => {
cy.get('a')
.contains('article_table')
.click();
cy.get('a')
.contains('Relationships')
.click();
cy.get('button')
.contains('Remove')
cy.get(getElementFromAlias('article_table')).click();
cy.get(getElementFromAlias('table-relationships')).click();
cy.get(getElementFromAlias('remove-button'))
.first()
.click();
cy.on('window:alert', str => {
@ -372,14 +300,9 @@ export const passRTDeleteRelationships = () => {
['title', { name: 'author', columns: ['name'] }],
'failure'
);
cy.get('a')
.contains('article_table')
.click();
cy.get('a')
.contains('Relationships')
.click();
cy.get('button')
.contains('Remove')
cy.get(getElementFromAlias('article_table')).click();
cy.get(getElementFromAlias('table-relationships')).click();
cy.get(getElementFromAlias('remove-button'))
.first()
.click();
cy.on('window:alert', str => {
@ -394,12 +317,8 @@ export const passRTDeleteRelationships = () => {
};
export const passRTAddSuggestedRel = () => {
cy.get('a')
.contains('article_table')
.click();
cy.get('a')
.contains('Relationships')
.click();
cy.get(getElementFromAlias('article_table')).click();
cy.get(getElementFromAlias('table-relationships')).click();
cy.get(getElementFromAlias('obj-rel-add-0'))
.contains('Add')
.last()
@ -407,21 +326,15 @@ export const passRTAddSuggestedRel = () => {
cy.get('input')
.last()
.type('author');
cy.get('button')
.contains('Save')
.click();
cy.get(getElementFromAlias('obj-rel-save-0')).click();
cy.wait(7000);
validateColumn(
'article_table',
['title', { name: 'author', columns: ['name'] }],
'success'
);
cy.get('a')
.contains('article_table')
.click();
cy.get('a')
.contains('Relationships')
.click();
cy.get(getElementFromAlias('article_table')).click();
cy.get(getElementFromAlias('table-relationships')).click();
cy.get(getElementFromAlias('arr-rel-add-0'))
.contains('Add')
.last()
@ -429,9 +342,7 @@ export const passRTAddSuggestedRel = () => {
cy.get('input')
.last()
.type('comments');
cy.get('button')
.contains('Save')
.click();
cy.get(getElementFromAlias('arr-rel-save-0')).click();
cy.wait(7000);
validateColumn(
'article_table',
@ -441,20 +352,14 @@ export const passRTAddSuggestedRel = () => {
};
export const failRTAddSuggestedRel = () => {
cy.get('a')
.contains('article_table')
.click();
cy.get('a')
.contains('Relationships')
.click();
cy.get(getElementFromAlias('article_table')).click();
cy.get(getElementFromAlias('table-relationships')).click();
cy.get(getElementFromAlias('obj-rel-add-0'))
.contains('Add')
.last()
.click();
cy.get('button')
.contains('Save')
.click();
cy.get('h4').contains('Error adding relationship!');
cy.get(getElementFromAlias('obj-rel-save-0')).click();
cy.get('.notification-error');
cy.wait(7000);
cy.get('input')
.last()
@ -462,41 +367,30 @@ export const failRTAddSuggestedRel = () => {
cy.get('button')
.contains('Save')
.click();
cy.get('h4').contains('Error adding relationship!');
cy.get('.notification-error');
cy.wait(10000);
validateColumn(
'article_table',
['title', { name: 'author', columns: ['name'] }],
'failure'
);
cy.get('a')
.contains('article_table')
.click();
cy.get('a')
.contains('Relationships')
.click();
cy.get(getElementFromAlias('article_table')).click();
cy.get(getElementFromAlias('table-relationships')).click();
cy.get(getElementFromAlias('obj-rel-add-0'))
.contains('Add')
.last()
.click();
cy.get('input')
.last()
.type('author');
cy.get('button')
.contains('Save')
.click();
cy.get(getElementFromAlias('obj-rel-save-0')).click();
cy.wait(10000);
validateColumn(
'article_table',
['title', { name: 'author', columns: ['name'] }],
'success'
);
cy.get('a')
.contains('article_table')
.click();
cy.get('a')
.contains('Relationships')
.click();
cy.get(getElementFromAlias('article_table')).click();
cy.get(getElementFromAlias('table-relationships')).click();
cy.get(getElementFromAlias('arr-rel-add-0'))
.contains('Add')
.last()
@ -508,16 +402,11 @@ export const failRTAddSuggestedRel = () => {
.contains('Save')
.click();
cy.wait(7000);
cy.get('h4').contains('Creating relationship failed');
cy.get('.notification-error');
cy.wait(7000);
cy.get('a')
.contains('article_table')
.click();
cy.get('a')
.contains('Relationships')
.click();
cy.get('button')
.contains('Remove')
cy.get(getElementFromAlias('article_table')).click();
cy.get(getElementFromAlias('table-relationships')).click();
cy.get(getElementFromAlias('remove-button'))
.first()
.click();
cy.on('window:alert', str => {

View File

@ -16,23 +16,11 @@ export const Createtable = (name, dict) => {
const keys = Object.keys(dict).map(k => k);
const values = Object.keys(dict).map(k => dict[k]);
for (let i = 0; i < keys.length; i += 1) {
cy.get('input[placeholder="column_name"]')
.last()
.type(keys[i]);
cy.get('select')
.find('option')
.contains('-- type --')
.parent()
.last()
.select(values[i]);
cy.get(getElementFromAlias(`column-${i}`)).type(keys[i]);
cy.get(getElementFromAlias(`col-type-${i}`)).select(values[i]);
}
cy.get('select')
.last()
.select('id');
cy.get('button')
.contains('Create')
.click();
cy.get(getElementFromAlias('primary-key-select-0')).select('id');
cy.get(getElementFromAlias('table-create')).click();
cy.wait(7000);
cy.url().should(
'eq',
@ -43,13 +31,9 @@ export const Createtable = (name, dict) => {
};
export const passVCreateTables = () => {
cy.get('button')
.contains('Create Table')
.click();
cy.get(getElementFromAlias('data-create-table')).click();
Createtable('author', { id: 'Integer', name: 'Text' });
cy.get('button')
.contains('Add Table')
.click();
cy.get(getElementFromAlias('sidebar-add-table')).click();
Createtable('article', {
id: 'Integer',
title: 'Text',
@ -57,9 +41,7 @@ export const passVCreateTables = () => {
author_id: 'Integer',
rating: 'Integer',
});
cy.get('button')
.contains('Add Table')
.click();
cy.get(getElementFromAlias('sidebar-add-table')).click();
Createtable('comment', {
id: 'Integer',
user_id: 'Integer',
@ -83,15 +65,13 @@ export const passTrackTable = () => {
.click();
cy.wait(7000);
cy.get(getElementFromAlias('add-track-table-author_average_rating')).click();
cy.wait(5000);
cy.get('h4').contains('Existing table/view added');
cy.wait(7000);
cy.get('.notification-success');
validateView('author_average_rating', 'success');
};
export const passViewRoute = () => {
cy.get('a')
.contains('author_average_rating')
.click();
cy.get(getElementFromAlias('author_average_rating')).click();
cy.url().should(
'eq',
`${baseUrl}/data/schema/public/views/author_average_rating/browse`
@ -161,13 +141,9 @@ export const passVAddDataarticle = (data, index) => {
.last()
.type(data[4]);
if (index) {
cy.get('button')
.contains('Insert Again')
.click();
cy.get(getElementFromAlias('insert-save-button')).click();
} else {
cy.get('button')
.contains('Save')
.click();
cy.get(getElementFromAlias('insert-save-button')).click();
}
cy.wait(5000);
@ -199,13 +175,9 @@ export const passVAddDataauthor = (data, index) => {
.last()
.type(data[1]);
if (index) {
cy.get('button')
.contains('Insert Again')
.click();
cy.get(getElementFromAlias('insert-save-button')).click();
} else {
cy.get('button')
.contains('Save')
.click();
cy.get(getElementFromAlias('insert-save-button')).click();
}
cy.wait(5000);
};
@ -260,13 +232,9 @@ export const passVAddDatacomment = (data, index) => {
.last()
.type(data[3]);
if (index) {
cy.get('button')
.contains('Insert Again')
.click();
cy.get(getElementFromAlias('insert-save-button')).click();
} else {
cy.get('button')
.contains('Save')
.click();
cy.get(getElementFromAlias('insert-save-button')).click();
}
cy.wait(5000);
};
@ -281,9 +249,7 @@ const checkQuerySuccess = () => {
export const passVAddData = () => {
let data;
cy.get('a')
.contains('article_table')
.click();
cy.get(getElementFromAlias('article_table')).click();
cy.get(getElementFromAlias('table-insert-rows')).click();
data = [1, 'A', 'Sontent', userId, 4];
passVAddDataarticle(data, 0);
@ -291,18 +257,14 @@ export const passVAddData = () => {
passVAddDataarticle(data, 1);
data = [3, 'C', 'Sontentb', userId, 4];
passVAddDataarticle(data, 2);
cy.get('a')
.contains('author_table')
.click();
cy.get(getElementFromAlias('author_table')).click();
cy.get(getElementFromAlias('table-insert-rows')).click();
data = [userId, 'A'];
passVAddDataauthor(data, 0);
data = [2, 'B'];
passVAddDataauthor(data, 1);
cy.get('a')
.contains('comment_table')
.click();
cy.get(getElementFromAlias('comment_table')).click();
cy.get(getElementFromAlias('table-insert-rows')).click();
data = [1, 1, 1, 'new comment'];
@ -333,9 +295,7 @@ export const passVFilterQueryEq = () => {
.last()
.type(userId);
// Run query
cy.get('button')
.contains('Run query')
.click();
cy.get(getElementFromAlias('run-query')).click();
cy.wait(5000);
// Check if the query was successful
checkQuerySuccess();
@ -389,17 +349,13 @@ export const passVAscendingSort = () => {
.last()
.select('id');
// Run query
cy.get('button')
.contains('Run query')
.click();
cy.get(getElementFromAlias('run-query')).click();
// Check order
checkOrder('asc');
};
export const passModifyView = () => {
cy.get('a')
.contains('Modify')
.click();
cy.get(getElementFromAlias('table-modify')).click();
cy.get('button')
.contains('Modify')
.last()
@ -408,13 +364,9 @@ export const passModifyView = () => {
};
export const passVAddManualObjRel = () => {
cy.get('a')
.contains('author_average_rating')
.click();
cy.get(getElementFromAlias('author_average_rating')).click();
cy.wait(2000);
cy.get('a')
.contains('Relationships')
.click();
cy.get(getElementFromAlias('table-relationships')).click();
cy.wait(2000);
cy.get(getElementFromAlias('data-rel-type')).select('object_rel');
cy.get("input[placeholder='Enter relationship name']").type('author');
@ -441,12 +393,8 @@ export const passVAddManualObjRel = () => {
};
export const passVDeleteRelationships = () => {
cy.get('a')
.contains('author_average_rating')
.click();
cy.get('a')
.contains('Relationships')
.click();
cy.get(getElementFromAlias('author_average_rating')).click();
cy.get(getElementFromAlias('table-relationships')).click();
cy.get('button')
.contains('Remove')
.first()
@ -463,30 +411,20 @@ export const passVDeleteRelationships = () => {
};
export const passVDeleteView = () => {
cy.get('a')
.contains('Modify')
.click();
cy.get('button')
.contains('Delete view')
.click();
cy.get(getElementFromAlias('table-modify')).click();
cy.get(getElementFromAlias('delete-view')).click();
cy.on('window:confirm', str => {
expect(str === 'Are you sure').to.be.true;
});
cy.wait(5000);
cy.get('h4').contains('View deleted');
cy.get('.notification-success');
validateView('author_average_rating', 'failure');
};
export const Deletetable = name => {
cy.get('a')
.contains(name)
.click();
cy.get('a')
.contains('Modify')
.click();
cy.get('button')
.contains('Delete table')
.click();
cy.get(getElementFromAlias(name)).click();
cy.get(getElementFromAlias('table-modify')).click();
cy.get(getElementFromAlias('delete-table')).click();
cy.on('window:alert', str => {
expect(str === 'Are you sure?').to.be.true;
});

View File

@ -11,7 +11,6 @@
// This function is called when a project is opened or re-opened (e.g. due to
// the project's config changing)
// module.exports = (on, config) => {
module.exports = () => {
// `on` is used to hook into various events Cypress emits
// `config` is the resolved Cypress config

5950
console/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -111,7 +111,9 @@ const DataHeader = ({
currentLocation.indexOf('sql') !== -1 ? styles.active : ''
}
>
<Link to={appPrefix + '/sql'}>SQL</Link>
<Link to={appPrefix + '/sql'} data-test="sql-link">
SQL
</Link>
</li>
{migrationSection}
</ul>

View File

@ -54,11 +54,11 @@ const PageContainer = ({
tableName +
'/browse'
}
data-test={tableName}
>
<i
className={styles.tableIcon + ' fa fa-table'}
aria-hidden="true"
data-test={tableName}
/>
{tableName}
</Link>
@ -76,6 +76,7 @@ const PageContainer = ({
tableName +
'/browse'
}
data-test={tableName}
>
<i
className={styles.tableIcon + ' fa fa-table'}
@ -145,6 +146,7 @@ const PageContainer = ({
>
<button
className={styles.add_mar_right + ' btn btn-xs btn-default'}
data-test="sidebar-add-table"
>
Add Table
</button>

View File

@ -272,6 +272,7 @@ const RawSQL = ({
dispatch(executeSQL(false));
}
}}
data-test="run-sql"
>
Run!
</button>

View File

@ -316,6 +316,7 @@ class EditItem extends Component {
});
dispatch(editItem(tableName, inputValues));
}}
data-test="save-button"
>
{buttonText}
</button>

View File

@ -201,7 +201,11 @@ class FilterQuery extends Component {
</div>
</div>
<div className={`${styles.padd_right} ${styles.clear_fix}`}>
<button type="submit" className={`btn ${styles.yellow_button}`}>
<button
type="submit"
className={`btn ${styles.yellow_button}`}
data-test="run-query"
>
Run query
</button>
{/* <div className={styles.count + ' alert alert-info'}><i>Total <b>{tableName}</b> rows in the database for current query: {count} </i></div> */}

View File

@ -67,6 +67,7 @@ const ViewHeader = ({ tableName, tabName, tableComment, currentSchema }) => {
tableName +
'/browse'
}
data-test="table-browse-rows"
>
Browse Rows
</Link>
@ -84,6 +85,7 @@ const ViewHeader = ({ tableName, tabName, tableComment, currentSchema }) => {
tableName +
'/modify'
}
data-test="table-modify"
>
Modify
</Link>
@ -101,6 +103,7 @@ const ViewHeader = ({ tableName, tabName, tableComment, currentSchema }) => {
tableName +
'/relationships'
}
data-test="table-relationships"
>
Relationships
</Link>
@ -118,6 +121,7 @@ const ViewHeader = ({ tableName, tabName, tableComment, currentSchema }) => {
tableName +
'/permissions'
}
data-test="table-permissions"
>
Permissions
</Link>

View File

@ -70,7 +70,6 @@ const TableHeader = ({
<li
role="presentation"
className={tabName === 'view' ? styles.active : ''}
data-test="table-browse-rows"
>
<Link
to={
@ -81,6 +80,7 @@ const TableHeader = ({
tableName +
'/browse'
}
data-test="table-browse-rows"
>
Browse Rows {showCount}
</Link>
@ -88,7 +88,6 @@ const TableHeader = ({
<li
role="presentation"
className={tabName === 'insert' ? styles.active : ''}
data-test="table-insert-rows"
>
<Link
to={
@ -99,6 +98,7 @@ const TableHeader = ({
tableName +
'/insert'
}
data-test="table-insert-rows"
>
Insert Row
</Link>
@ -107,7 +107,6 @@ const TableHeader = ({
<li
role="presentation"
className={tabName === 'modify' ? styles.active : ''}
data-test="table-modify"
>
<Link
to={
@ -118,6 +117,7 @@ const TableHeader = ({
tableName +
'/modify'
}
data-test="table-modify"
>
Modify
</Link>
@ -126,7 +126,6 @@ const TableHeader = ({
<li
role="presentation"
className={tabName === 'relationships' ? styles.active : ''}
data-test="table-relationships"
>
<Link
to={
@ -137,6 +136,7 @@ const TableHeader = ({
tableName +
'/relationships'
}
data-test="table-relationships"
>
Relationships
</Link>
@ -144,7 +144,6 @@ const TableHeader = ({
<li
role="presentation"
className={tabName === 'permissions' ? styles.active : ''}
data-test="table-permissions"
>
<Link
to={
@ -155,6 +154,7 @@ const TableHeader = ({
tableName +
'/permissions'
}
data-test="table-permissions"
>
Permissions
</Link>

View File

@ -449,6 +449,7 @@ class InsertItem extends Component {
this.nextInsert();
});
}}
data-test="insert-save-button"
>
{this.state.insertedRows > 0 ? 'Insert Again' : 'Save'}
</button>

View File

@ -270,7 +270,11 @@ const ColumnEditor = ({
</div>
{checkExistingForeignKey()}
<div className="row">
<button type="submit" className={`${styles.yellow_button} btn`}>
<button
type="submit"
className={`${styles.yellow_button} btn`}
data-test="save-button"
>
Save
</button>
{!isPrimaryKey ? (
@ -281,6 +285,7 @@ const ColumnEditor = ({
e.preventDefault();
onDelete();
}}
data-test="remove-button"
>
Remove
</button>
@ -439,6 +444,7 @@ class ModifyTable extends Component {
onClick={() => {
dispatch({ type: TOGGLE_ACTIVE_COLUMN, column: colName });
}}
data-test={`edit-${colName}`}
>
{btnText}
</button>
@ -538,6 +544,7 @@ class ModifyTable extends Component {
type="text"
className={`${styles.input} input-sm form-control`}
ref={n => (colNameInput = n)}
data-test="column-name"
/>
<select
className={`${styles.select} input-sm form-control`}
@ -576,8 +583,13 @@ class ModifyTable extends Component {
styles.defaultInput
} input-sm form-control`}
ref={n => (colDefaultInput = n)}
data-test="default-value"
/>
<button type="submit" className="btn btn-sm btn-warning">
<button
type="submit"
className="btn btn-sm btn-warning"
data-test="add-column-button"
>
+ Add column
</button>
</form>
@ -593,6 +605,7 @@ class ModifyTable extends Component {
dispatch(deleteTableSql(tableName, tableSchema));
}
}}
data-test="delete-table"
>
Delete table
</button>

View File

@ -95,6 +95,7 @@ class ModifyView extends Component {
dispatch(untrackTableSql(tableName));
}
}}
data-test="untrack-view"
>
Untrack View
</button>
@ -139,6 +140,7 @@ class ModifyView extends Component {
onClick={() => {
this.modifyViewDefinition(tableName);
}}
data-test="modify-view"
>
Modify
</button>
@ -152,6 +154,7 @@ class ModifyView extends Component {
dispatch(deleteViewSql(tableName));
}
}}
data-test="delete-view"
>
Delete view
</button>

View File

@ -639,6 +639,7 @@ class Permissions extends Component {
className={`${styles.editActionButton} button btn ${customClasses}`}
onClick={onClickFn}
disabled={disabled}
data-test={`${value.split(' ').join('-')}-button`}
>
{value}
</button>

View File

@ -77,7 +77,11 @@ const relationshipView = (
return (
<td>
<div>
<button className="btn btn-sm btn-danger" onClick={onDelete}>
<button
className="btn btn-sm btn-danger"
onClick={onDelete}
data-test="remove-button"
>
Remove
</button>
&nbsp;