Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test(frontend): use absolute path for src imports #9761

Merged
merged 2 commits into from
May 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion superset-frontend/.prettierrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"singleQuote": true,
"trailingComma": "all"
"trailingComma": "all",
"arrowParens": "avoid"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

prettier changed the default behavior for arrowParent. We revert it back to the old behavior.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There seems to be another change to space between function and parentheses.

function() {} vs function () {}

I do not have strong preference in terms of styling but perhaps we can use the original to reduce amount of changes.

This is the settings from @superset-ui

{
  "arrowParens": "avoid",
  "bracketSpacing": true,
  "jsxBracketSameLine": false,
  "printWidth": 100,
  "proseWrap": "always",
  "requirePragma": false,
  "semi": true,
  "singleQuote": true,
  "tabWidth": 2,
  "trailingComma": "all",
  "useTabs": false
};

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

@kristw kristw May 7, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ic. If no strong objection from others I am good with this. I'll approve but wait for others to have a chance to see the PR.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer without the space, but if there's no way to turn it off, it won't break my heart.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just read through some of the threads on that feature, and now I'm glad I don't work on that project. Yeesh!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we merge this then? 😄

}
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@ export default () =>
cy.server();
cy.login();
cy.visit(WORLD_HEALTH_DASHBOARD);
cy.get('.dashboard-header')
.contains('Edit dashboard')
.click();
cy.get('.dashboard-header').contains('Edit dashboard').click();
});

it('remove, and add chart flow', () => {
Expand All @@ -36,17 +34,13 @@ export default () =>
cy.get('.fa.fa-trash')
.last()
.then($el => {
cy.wrap($el)
.invoke('show')
.click();
cy.wrap($el).invoke('show').click();
// box plot should be gone
cy.get('.grid-container .box_plot').should('not.exist');
});

// open charts list
cy.get('.component-layer')
.contains('Your charts & filters')
.click();
cy.get('.component-layer').contains('Your charts & filters').click();

// find box plot is available from list
cy.get('.slices-layer')
Expand Down Expand Up @@ -74,9 +68,7 @@ export default () =>
cy.get('.dashboard-header .button-container').contains('Save changes');

// undo 2 steps
cy.get('.dashboard-header .undo-action')
.click()
.click();
cy.get('.dashboard-header .undo-action').click().click();

// no changes, can switch to view mode
cy.get('.dashboard-header .button-container')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,7 @@ export default () =>

it('should allow favor/unfavor', () => {
if (!isFavoriteDashboard) {
cy.get('.favstar')
.find('i')
.should('have.class', 'fa-star-o');
cy.get('.favstar').find('i').should('have.class', 'fa-star-o');
cy.get('.favstar').trigger('click');
cy.get('.favstar')
.find('i')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,7 @@ export default () =>
cy.get('.dashboard-header')
.contains('Edit dashboard')
.trigger('click', { force: true });
cy.get('.fa.fa-trash')
.last()
.trigger('click', { force: true });
cy.get('.fa.fa-trash').last().trigger('click', { force: true });
cy.get('.grid-container .box_plot').should('not.exist');

cy.route('POST', '/superset/save_dash/**/').as('saveRequest');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,7 @@ export default () =>
});

// click row level tab, send 1 more query
cy.get('.tab-content ul.nav.nav-tabs li')
.last()
.click();
cy.get('.tab-content ul.nav.nav-tabs li').last().click();
cy.wait('@linechartRequest').then(xhr => {
const requestFormData = xhr.request.body;
const requestParams = JSON.parse(requestFormData.get('form_data'));
Expand Down Expand Up @@ -184,9 +182,7 @@ export default () =>
.find('ul.nav.nav-tabs li')
.first()
.click();
cy.get('.tab-content ul.nav.nav-tabs li')
.first()
.click();
cy.get('.tab-content ul.nav.nav-tabs li').first().click();
cy.get('span.Select-clear').click();

// trigger 1 new query
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,19 +59,15 @@ describe('AdhocMetrics', () => {
cy.get('.select-clear').click();
cy.get('.Select-control').click({ force: true });
cy.get('input').type('sum_girls', { force: true });
cy.get('.VirtualizedSelectFocusedOption')
.trigger('mousedown')
.click();
cy.get('.VirtualizedSelectFocusedOption').trigger('mousedown').click();
});

cy.get('#metrics-edit-popover').within(() => {
cy.get('.popover-title').within(() => {
cy.get('span').click();
cy.get('input').type(metricName);
});
cy.get('button')
.contains('Save')
.click();
cy.get('button').contains('Save').click();
});

cy.get('button.query').click();
Expand Down Expand Up @@ -101,9 +97,7 @@ describe('AdhocMetrics', () => {
cy.get('#adhoc-metric-edit-tabs-tab-SQL').click();
cy.get('.ace_content').click();
cy.get('.ace_text-input').type('/COUNT(DISTINCT name)', { force: true });
cy.get('button')
.contains('Save')
.click();
cy.get('button').contains('Save').click();
});

cy.get('button.query').click();
Expand All @@ -122,9 +116,7 @@ describe('AdhocMetrics', () => {
cy.get('.select-clear').click();
cy.get('.Select-control').click({ force: true });
cy.get('input').type('sum_girls', { force: true });
cy.get('.VirtualizedSelectFocusedOption')
.trigger('mousedown')
.click();
cy.get('.VirtualizedSelectFocusedOption').trigger('mousedown').click();
});

cy.get('#metrics-edit-popover').within(() => {
Expand All @@ -136,9 +128,7 @@ describe('AdhocMetrics', () => {
});
cy.get('#adhoc-metric-edit-tabs-tab-SIMPLE').click();
cy.get('.select-value-label').contains('num');
cy.get('button')
.contains('Save')
.click();
cy.get('button').contains('Save').click();
});

cy.get('button.query').click();
Expand All @@ -164,22 +154,16 @@ describe('AdhocFilters', () => {
cy.get('[data-test=adhoc_filters]').within(() => {
cy.get('.Select-control').click({ force: true });
cy.get('input').type('name', { force: true });
cy.get('.VirtualizedSelectFocusedOption')
.trigger('mousedown')
.click();
cy.get('.VirtualizedSelectFocusedOption').trigger('mousedown').click();
});
cy.get('.adhoc-filter-option').click({ force: true });
cy.get('#filter-edit-popover').within(() => {
cy.get('[data-test=adhoc-filter-simple-value]').within(() => {
cy.get('div.select-input').click({ force: true });
cy.get('input.select-input').type('Amy', { force: true });
cy.get('.VirtualizedSelectFocusedOption')
.trigger('mousedown')
.click();
cy.get('.VirtualizedSelectFocusedOption').trigger('mousedown').click();
});
cy.get('button')
.contains('Save')
.click();
cy.get('button').contains('Save').click();
});

cy.get('button.query').click();
Expand All @@ -196,19 +180,15 @@ describe('AdhocFilters', () => {
cy.get('[data-test=adhoc_filters]').within(() => {
cy.get('.Select-control').click({ force: true });
cy.get('input').type('name', { force: true });
cy.get('.VirtualizedSelectFocusedOption')
.trigger('mousedown')
.click();
cy.get('.VirtualizedSelectFocusedOption').trigger('mousedown').click();
});

cy.get('.adhoc-filter-option').click({ force: true });
cy.get('#filter-edit-popover').within(() => {
cy.get('#adhoc-filter-edit-tabs-tab-SQL').click();
cy.get('.ace_content').click();
cy.get('.ace_text-input').type("'Amy' OR name = 'Bob'", { force: true });
cy.get('button')
.contains('Save')
.click();
cy.get('button').contains('Save').click();
});

cy.get('button.query').click();
Expand Down Expand Up @@ -241,9 +221,7 @@ describe('Advanced analytics', () => {
cy.get('[data-test=time_compare]').within(() => {
cy.get('.Select-control').click({ force: true });
cy.get('input').type('364 days', { force: true });
cy.get('.VirtualizedSelectOption')
.trigger('mousedown')
.click();
cy.get('.VirtualizedSelectOption').trigger('mousedown').click();
});

cy.get('button.query').click();
Expand Down Expand Up @@ -289,9 +267,7 @@ describe('Annotations', () => {
.within(() => {
cy.get('input').type('y=1400000');
});
cy.get('button')
.contains('OK')
.click();
cy.get('button').contains('OK').click();
});

cy.get('button.query').click();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,12 @@ describe('Test explore links', () => {
cy.verifySliceSuccess({ waitAlias: '@postJson' });

cy.get('button#query').click();
cy.get('span')
.contains('View query')
.parent()
.click();
cy.get('span').contains('View query').parent().click();
cy.wait('@postJson').then(() => {
cy.get('code');
});
cy.get('.modal-header').within(() => {
cy.get('button.close')
.first()
.click({ force: true });
cy.get('button.close').first().click({ force: true });
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,7 @@ export default () => {
`{selectall}{backspace}SELECT ds, gender, name, num FROM main.birth_names LIMIT ${rowLimit}`,
{ force: true },
);
cy.get('#js-sql-toolbar button')
.eq(0)
.click();
cy.get('#js-sql-toolbar button').eq(0).click();

cy.wait('@sqlLabQuery');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@ export default () => {
const initialTabCount = tabList.length;

// add tab
cy.get('#a11y-query-editor-tabs > ul > li')
.last()
.click();
cy.get('#a11y-query-editor-tabs > ul > li').last().click();

cy.get('#a11y-query-editor-tabs > ul > li').should(
'have.length',
Expand All @@ -50,9 +48,7 @@ export default () => {
).click();

// first item is close
cy.get('#a11y-query-editor-tabs > ul > li:first ul li a')
.eq(0)
.click();
cy.get('#a11y-query-editor-tabs > ul > li:first ul li a').eq(0).click();

cy.get('#a11y-query-editor-tabs > ul > li').should(
'have.length',
Expand Down