bito-code-review[bot] commented on code in PR #44531:
URL: https://github.com/apache/superset/pull/44531#discussion_r4135604600
##########
superset-frontend/playwright/tests/dashboard/clear-all-filters.spec.ts:
##########
@@ -160,3 +160,115 @@ testWithAssets(
await applyAfterClearPromise;
},
);
+
+testWithAssets(
+ 'Re-selecting the value Clear All removed re-enables Apply (#44530)',
+ async ({ page, testAssets }) => {
+ testWithAssets.setTimeout(TIMEOUT.SLOW_TEST);
+
+ const dataset = await getDatasetByName(page, DATASET_NAME);
+ if (!dataset) {
+ throw new Error(`Dataset ${DATASET_NAME} not found`);
+ }
+ const datasetId = dataset.id;
+
+ // Same fixture as the test above: one chart targeted by a gender
+ // native filter rendered in the vertical filter bar.
+ const chartParams = {
+ datasource: `${datasetId}__table`,
+ viz_type: 'big_number_total',
+ metric: 'count',
+ adhoc_filters: [],
+ header_font_size: 0.4,
+ subheader_font_size: 0.15,
+ };
+ const chartResp = await apiPost(page, 'api/v1/chart/', {
+ slice_name: `clear_all_reselect_${Date.now()}`,
+ viz_type: 'big_number_total',
+ datasource_id: datasetId,
+ datasource_type: 'table',
+ params: JSON.stringify(chartParams),
+ });
+ expect(chartResp.ok()).toBe(true);
+ const chartId = await extractIdFromResponse(chartResp);
+ testAssets.trackChart(chartId);
+
+ const positionJson = buildSingleRowDashboardLayout([
+ {
+ id: chartId,
+ sliceName: 'clear_all_reselect',
+ width: 6,
+ height: 50,
+ },
+ ]);
+
+ const jsonMetadata = buildFilterJsonMetadata({
+ chartsInScope: [chartId],
+ nativeFilters: [
+ buildSelectFilter({
+ datasetId,
+ column: FILTER_COLUMN,
+ chartsInScope: [chartId],
+ name: 'Gender',
+ }),
+ ],
+ });
+
+ const dashResp = await apiPostDashboard(page, {
+ dashboard_title: `clear_all_reselect_${Date.now()}`,
+ published: true,
+ position_json: JSON.stringify(positionJson),
+ json_metadata: JSON.stringify(jsonMetadata),
+ });
+ expect(dashResp.ok()).toBe(true);
+ const dashboardId = await extractIdFromResponse(dashResp);
+ testAssets.trackDashboard(dashboardId);
+
+ const linkResp = await apiPut(page, `api/v1/chart/${chartId}`, {
+ dashboards: [dashboardId],
+ });
+ expect(linkResp.ok()).toBe(true);
+
+ const dashboardPage = new DashboardPage(page);
+ await dashboardPage.gotoById(dashboardId);
+ await dashboardPage.waitForLoad({ timeout: TIMEOUT.SLOW_TEST });
+ await dashboardPage.waitForChartsToLoad();
+ const filterBar = await dashboardPage.waitForFilterBar();
Review Comment:
<div>
<div id="suggestion">
<div id="issue"><b>Duplicated dashboard fixture setup</b></div>
<div id="fix">
This new test re-implements the whole dashboard fixture inline (dataset
lookup, chart POST, `buildSingleRowDashboardLayout`, `buildFilterJsonMetadata`,
dashboard POST, chart link) — the same sequence already exported as
`createDashboardWithCharts` in `./dashboard-test-helpers` and duplicated in the
sibling test above. Reusing the helper removes ~70 duplicated lines and keeps
the fixture in one place.
</div>
</div>
<small><i>Code Review Run #d6c4df</i></small>
</div>
---
Should Bito avoid suggestions like this for future reviews? (<a
href=https://alpha.bito.ai/home/ai-agents/review-rules>Manage Rules</a>)
- [ ] Yes, avoid them
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]