mirror of https://github.com/apache/superset.git
chore: cypress selectors refactor in explore module (#11309)
* cypress selectors refactor in explore module * added delay to typing to make test more stable * fixed missing click
This commit is contained in:
parent
4bebf51453
commit
a99d795eaf
|
@ -73,9 +73,10 @@ describe('AdhocFilters', () => {
|
|||
.click();
|
||||
cy.get('[data-test=adhoc_filters] input[type=text]')
|
||||
.focus()
|
||||
.type('name{enter}');
|
||||
cy.get('.adhoc-filter-option').click();
|
||||
|
||||
.type('name{enter}', { delay: 20 });
|
||||
cy.get('[data-test="adhoc_filters"]').within(() => {
|
||||
cy.contains('name = ').should('be.visible').click();
|
||||
});
|
||||
cy.wait('@filterValues');
|
||||
|
||||
cy.get('#filter-edit-popover #adhoc-filter-edit-tabs-tab-SQL').click();
|
||||
|
|
|
@ -46,18 +46,20 @@ describe('Datasource control', () => {
|
|||
cy.get('script').then(nodes => {
|
||||
expect(nodes.length).to.greaterThan(numScripts);
|
||||
});
|
||||
|
||||
// create new metric
|
||||
cy.get('.modal-content').within(() => {
|
||||
cy.get('a[role="tab"]').contains('Metrics').click();
|
||||
cy.get('[data-test="edit-dataset-tabs"]').within(() => {
|
||||
cy.contains('Metrics').click();
|
||||
});
|
||||
cy.get('button').contains('Add Item', { timeout: 10000 }).click();
|
||||
cy.get('input[value="<new metric>"]').click();
|
||||
cy.get('input[value="<new metric>"]')
|
||||
// create new metric
|
||||
cy.get('[data-test="crud-add-table-item"]', { timeout: 10000 }).click();
|
||||
cy.get('[data-test="table-content-rows"]')
|
||||
.find('input[value="<new metric>"]')
|
||||
.click();
|
||||
cy.get('[data-test="table-content-rows"]')
|
||||
.find('input[value="<new metric>"]')
|
||||
.focus()
|
||||
.clear()
|
||||
.type(`${newMetricName}{enter}`);
|
||||
cy.get('.modal-footer button').contains('Save').click();
|
||||
cy.get('[data-test="datasource-modal-save"]').click();
|
||||
cy.get('.modal-footer button').contains('OK').click();
|
||||
// select new metric
|
||||
cy.get('[data-test=metrics]')
|
||||
|
@ -74,7 +76,7 @@ describe('Datasource control', () => {
|
|||
.closest('tr')
|
||||
.find('.fa-trash')
|
||||
.click();
|
||||
cy.get('.modal-footer button').contains('Save').click();
|
||||
cy.get('[data-test="datasource-modal-save"]').click();
|
||||
cy.get('.modal-footer button').contains('OK').click();
|
||||
cy.get('.Select__multi-value__label')
|
||||
.contains(newMetricName)
|
||||
|
|
|
@ -91,21 +91,17 @@ describe('Test explore links', () => {
|
|||
cy.visitChartByParams(JSON.stringify(formData));
|
||||
cy.verifySliceSuccess({ waitAlias: '@postJson' });
|
||||
cy.url().then(() => {
|
||||
cy.get('button[data-target="#save_modal"]').click();
|
||||
cy.get('.modal-content').within(() => {
|
||||
cy.get('#saveas-radio').check();
|
||||
cy.get('input[name=new_slice_name]').type(newChartName);
|
||||
cy.get('button#btn_modal_save').click();
|
||||
});
|
||||
cy.get('[data-test="query-save-button"]').click();
|
||||
cy.get('[data-test="saveas-radio"]').check();
|
||||
cy.get('[data-test="new-chart-name"]').type(newChartName);
|
||||
cy.get('[data-test="btn-modal-save"]').click();
|
||||
cy.verifySliceSuccess({ waitAlias: '@postJson' });
|
||||
cy.visitChartByName(newChartName);
|
||||
|
||||
// Overwriting!
|
||||
cy.get('button[data-target="#save_modal"]').click();
|
||||
cy.get('.modal-content').within(() => {
|
||||
cy.get('#overwrite-radio').check();
|
||||
cy.get('button#btn_modal_save').click();
|
||||
});
|
||||
cy.get('[data-test="query-save-button"]').click();
|
||||
cy.get('[data-test="save-overwrite-radio"]').check();
|
||||
cy.get('[data-test="btn-modal-save"]').click();
|
||||
cy.verifySliceSuccess({ waitAlias: '@postJson' });
|
||||
const query = {
|
||||
filters: [
|
||||
|
@ -131,16 +127,15 @@ describe('Test explore links', () => {
|
|||
cy.visitChartByName(chartName);
|
||||
cy.verifySliceSuccess({ waitAlias: '@postJson' });
|
||||
|
||||
cy.get('button[data-target="#save_modal"]').click();
|
||||
cy.get('.modal-content').within(() => {
|
||||
cy.get('#saveas-radio').check();
|
||||
cy.get('input[name=new_slice_name]').click().clear().type(newChartName);
|
||||
// Add a new option using the "CreatableSelect" feature
|
||||
cy.get('#dashboard-creatable-select').type(
|
||||
`${dashboardTitle}{enter}{enter}`,
|
||||
);
|
||||
cy.get('button#btn_modal_save').click();
|
||||
});
|
||||
cy.get('[data-test="query-save-button"]').click();
|
||||
cy.get('[data-test="saveas-radio"]').check();
|
||||
cy.get('[data-test="new-chart-name"]').click().clear().type(newChartName);
|
||||
// Add a new option using the "CreatableSelect" feature
|
||||
cy.get('[data-test="save-chart-modal-select-dashboard-form"]')
|
||||
.find('#dashboard-creatable-select')
|
||||
.type(`${dashboardTitle}{enter}{enter}`);
|
||||
|
||||
cy.get('[data-test="btn-modal-save"]').click();
|
||||
cy.verifySliceSuccess({ waitAlias: '@postJson' });
|
||||
let query = {
|
||||
filters: [
|
||||
|
@ -158,17 +153,16 @@ describe('Test explore links', () => {
|
|||
cy.visitChartByName(newChartName);
|
||||
cy.verifySliceSuccess({ waitAlias: '@postJson' });
|
||||
|
||||
cy.get('button[data-target="#save_modal"]').click();
|
||||
cy.get('.modal-content').within(() => {
|
||||
cy.get('#overwrite-radio').check();
|
||||
cy.get('input[name=new_slice_name]').click().clear().type(newChartName);
|
||||
// This time around, typing the same dashboard name
|
||||
// will select the existing one
|
||||
cy.get('#dashboard-creatable-select').type(
|
||||
`${dashboardTitle}{enter}{enter}`,
|
||||
);
|
||||
cy.get('button#btn_modal_save').click();
|
||||
});
|
||||
cy.get('[data-test="query-save-button"]').click();
|
||||
cy.get('[data-test="save-overwrite-radio"]').check();
|
||||
cy.get('[data-test="new-chart-name"]').click().clear().type(newChartName);
|
||||
// This time around, typing the same dashboard name
|
||||
// will select the existing one
|
||||
cy.get('[data-test="save-chart-modal-select-dashboard-form"]')
|
||||
.find('#dashboard-creatable-select')
|
||||
.type(`${dashboardTitle}{enter}{enter}`);
|
||||
|
||||
cy.get('[data-test="btn-modal-save"]').click();
|
||||
cy.verifySliceSuccess({ waitAlias: '@postJson' });
|
||||
query = {
|
||||
filters: [
|
||||
|
|
|
@ -290,7 +290,8 @@ export default class CRUDCollection extends React.PureComponent<
|
|||
onClick={this.onAddItem}
|
||||
data-test="add-item-button"
|
||||
>
|
||||
<i className="fa fa-plus" /> {t('Add Item')}
|
||||
<i data-test="crud-add-table-item" className="fa fa-plus" />{' '}
|
||||
{t('Add Item')}
|
||||
</Button>
|
||||
)}
|
||||
</span>
|
||||
|
|
|
@ -887,6 +887,7 @@ class DatasourceEditor extends React.PureComponent {
|
|||
</div>
|
||||
<Tabs
|
||||
id="table-tabs"
|
||||
data-test="edit-dataset-tabs"
|
||||
onSelect={this.handleTabSelect}
|
||||
defaultActiveKey={activeTabKey}
|
||||
>
|
||||
|
|
|
@ -185,7 +185,7 @@ class SaveModal extends React.Component {
|
|||
data-test="new-chart-name"
|
||||
/>
|
||||
</FormGroup>
|
||||
<FormGroup>
|
||||
<FormGroup data-test="save-chart-modal-select-dashboard-form">
|
||||
<FormLabel required>{t('Add to dashboard')}</FormLabel>
|
||||
<CreatableSelect
|
||||
id="dashboard-creatable-select"
|
||||
|
|
Loading…
Reference in New Issue