drivaspreset commented on code in PR #43004:
URL: https://github.com/apache/superset/pull/43004#discussion_r3905751231


##########
superset-frontend/playwright/tests/dashboard/global-async-query.spec.ts:
##########
@@ -0,0 +1,320 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/**
+ * Global Async Queries (GAQ): the pipeline works for each of its consumers --
+ * a single chart, the cache-hit shortcut that bypasses it, many charts at
+ * once, and native filter value lookups.
+ *
+ * Failure and edge-case behavior lives in 
global-async-query-resilience.spec.ts.
+ * SQL Lab's smoke check lives in tests/sqllab/, which needs the
+ * `chromium-sqllab` project rather than this directory's default one.
+ *
+ * Requires the `GLOBAL_ASYNC_QUERIES` feature flag, Redis, and a running
+ * Celery worker -- without a worker, submissions still return 202 but no job
+ * ever executes and these tests time out. The cache-hit test is the exception:
+ * it is served synchronously and needs only the flag.
+ */
+import { testWithAssets, expect } from '../../helpers/fixtures';
+import { apiPostVirtualDataset } from '../../helpers/api/dataset';
+import { getDatabaseByName } from '../../helpers/api/database';
+import { extractIdFromResponse } from '../../helpers/api/assertions';
+import { TIMEOUT } from '../../utils/constants';
+import {
+  BIG_NUMBER_COUNT_SPEC,
+  setupDashboardWithBigNumberCharts,
+  setupDashboardWithSelectFilter,
+  trackGaqSignals,
+} from './dashboard-test-helpers';
+
+testWithAssets(
+  'forced dashboard refresh goes through the GAQ 202 -> poll -> done cycle',
+  async ({ page, testAssets }) => {
+    const { dashboard, charts, valueLocators } =
+      await setupDashboardWithBigNumberCharts(
+        page,
+        testAssets,
+        testWithAssets.info(),
+        {
+          datasetName: 'birth_names',
+          chartNamePrefix: 'gaq_tc1_cold_cache',
+          chartSpecs: [BIG_NUMBER_COUNT_SPEC],
+        },
+      );
+    const [chart] = charts;
+    const [value] = valueLocators;
+    await expect(value).toBeVisible({ timeout: TIMEOUT.CHART_RENDER });
+
+    // Track only after the initial load settles, so these signals describe the
+    // forced refresh rather than the load that preceded it.
+    const signals = trackGaqSignals(page);
+
+    // A fresh chart's query can still collide with an identical one another
+    // suite already cached, so force the refresh: forced requests take the
+    // async path regardless of cache state.
+    await dashboard.forceRefresh();
+    await expect(value).toBeVisible({ timeout: TIMEOUT.CHART_RENDER });
+    await expect(value).toHaveText(/\d/);
+
+    await expect(() => {
+      expect(
+        signals.submitStatusFor(chart.id),
+        'forced chart-data submission should be accepted (202) onto the async 
path',
+      ).toBe(202);
+      expect(
+        signals.sawAsyncEventPoll,
+        'the client should have polled /api/v1/async_event/ while the job ran',
+      ).toBe(true);
+      expect(
+        signals.sawFinalCachedFetch,
+        'once done, the client should fetch the real payload from 
/api/v1/chart/data/<cache_key>',
+      ).toBe(true);
+    }).toPass({ timeout: TIMEOUT.CHART_RENDER });

Review Comment:
   Taking your second option: the GAQ specs now stand down via the existing
   `isFeatureEnabled` helper when `GLOBAL_ASYNC_QUERIES` is off, so the 
required run
   collects and skips them instead of timing out — the same pattern the
   `recently-archived` specs use for `SOFT_DELETE`. The specs themselves are
   unchanged, so they start running for real the moment a flag-on server exists.
   
   Your first option is tracked in
   https://app.shortcut.com/preset/story/113559: the flag via
   `GLOBAL_ASYNC_QUERIES`
   
   `playwright-tests (chromium)` and `pre-commit` are both passing now



-- 
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]

Reply via email to