You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2022/08/16 23:30:04 UTC

[GitHub] [superset] justinpark opened a new pull request, #21105: fix(sqllab): Enable cypress specs for sqllab query

justinpark opened a new pull request, #21105:
URL: https://github.com/apache/superset/pull/21105

   ### SUMMARY
   This commit fixes the cypress specs for sqllab query by updating selectors and network interceptors.
   This commit also includes all api mock response in fixtures folder.
   The spec will interactive with the fake interceptors rather than real network interaction.
   It will inspect the request payload/formdata for network request.
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   
   https://user-images.githubusercontent.com/1392866/185002049-34afed2b-bf57-4f2a-b626-30073ac7a2c1.mov
   
   ### TESTING INSTRUCTIONS
   cypress
   
   ```
   cd superset-frontend/cypress-base
   yarn cypress
   ```
   
   ### ADDITIONAL INFORMATION
   - [ ] Has associated issue:
   - [ ] Required feature flags:
   - [ ] Changes UI
   - [ ] Includes DB Migration (follow approval process in [SIP-59](https://github.com/apache/superset/issues/13351))
     - [ ] Migration is atomic, supports rollback & is backwards-compatible
     - [ ] Confirm DB migration upgrade and downgrade tested
     - [ ] Runtime estimates and downtime expectations provided
   - [ ] Introduces new feature or API
   - [ ] Removes existing feature or API
   


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] codecov[bot] commented on pull request #21105: fix(sqllab): Enable cypress specs for sqllab query

Posted by GitBox <gi...@apache.org>.
codecov[bot] commented on PR #21105:
URL: https://github.com/apache/superset/pull/21105#issuecomment-1217299458

   # [Codecov](https://codecov.io/gh/apache/superset/pull/21105?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#21105](https://codecov.io/gh/apache/superset/pull/21105?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (12d5a85) into [master](https://codecov.io/gh/apache/superset/commit/8005b7f8c77fa96e0ff32958830ba307db74abff?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (8005b7f) will **not change** coverage.
   > The diff coverage is `n/a`.
   
   ```diff
   @@           Coverage Diff           @@
   ##           master   #21105   +/-   ##
   =======================================
     Coverage   66.27%   66.27%           
   =======================================
     Files        1770     1770           
     Lines       67543    67543           
     Branches     7185     7185           
   =======================================
     Hits        44764    44764           
     Misses      20940    20940           
     Partials     1839     1839           
   ```
   
   | Flag | Coverage Δ | |
   |---|---|---|
   | javascript | `52.00% <ø> (ø)` | |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#carryforward-flags-in-the-pull-request-comment) to find out more.
   
   
   :mega: We’re building smart automated test selection to slash your CI/CD build times. [Learn more](https://about.codecov.io/iterative-testing/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] ktmud commented on a diff in pull request #21105: fix(sqllab): Enable cypress specs for sqllab query

Posted by GitBox <gi...@apache.org>.
ktmud commented on code in PR #21105:
URL: https://github.com/apache/superset/pull/21105#discussion_r947350589


##########
superset-frontend/cypress-base/cypress/integration/sqllab/query.test.ts:
##########
@@ -17,144 +17,343 @@
  * under the License.
  */
 import * as shortid from 'shortid';
-import { selectResultsTab, assertSQLLabResultsAreEqual } from './sqllab.helper';
-
-function parseClockStr(node: JQuery) {
-  return Number.parseFloat(node.text().replace(/:/g, ''));
-}
+import { selectResultsTab } from './sqllab.helper';
 
 describe('SqlLab query panel', () => {
+  const mockTabId = '88889999';
+  const mockQueryId = 'mock_qid_28dvde';
+
   beforeEach(() => {
+    cy.intercept('/tableschemaview/', {
+      id: 1,
+    }).as('mockTableSchemaView');
+    cy.intercept('/tabstate/', {
+      id: 1,
+    }).as('mockTabStateView');
+    cy.intercept('GET', '/api/v1/database/?q=**', req => {
+      req.continue(res => {
+        res.send({ fixture: 'sqllab_databases.json' });
+      });
+    }).as('mockDatabaseList');
+    cy.intercept('GET', '/api/v1/database/*/function_names/', {
+      function_names: [],
+    }).as('mockFunctionNameList');
+    cy.intercept(
+      {
+        method: 'GET',
+        url: '/api/v1/database/*/schemas/?q=*',
+      },
+      {
+        result: ['mock'],
+      },
+    ).as('mockSchemaList');
+    cy.intercept(
+      {
+        method: 'POST',
+        url: '/superset/sql_json/',
+      },
+      req => {
+        req.reply({
+          delay: 800,
+          fixture: 'sqllab_sql_json.json',
+        });
+      },
+    ).as('mockSQLResponse');
+    cy.intercept('GET', '/superset/tables/1/**', {
+      fixture: 'sqllab_tables.json',
+    }).as('mockTableList');
+    cy.intercept('GET', '/api/v1/database/1/table/mock_table_1/*/', req => {
+      req.reply({
+        fixture: 'sqllab_table_1.json',
+        delay: 500,
+      });
+    }).as('mockTable1Schema');
+    cy.intercept('GET', '/api/v1/database/1/table_extra/mock_table_1/*/', {
+      body: {},
+    }).as('mockTable1SchemaExtra');
+    cy.intercept('GET', '/superset/queries/*', {
+      fixture: 'sqllab_queries_progress1.json',
+    });
+    cy.intercept('POST', 'tabstateview', {
+      id: mockTabId,
+    }).as('mockTabCreate');
+    cy.intercept('PUT', `tabstateview/*`, req => {
+      req.reply({
+        id: req.url.match(/\d+$/)?.[0],
+      });
+    }).as('mockTabUpdate');
+    cy.intercept('DELETE', `tabstateview/*`, req => {
+      req.reply({
+        id: req.url.match(/\d+$/)?.[0],
+      });
+    }).as('mockTabDelete');

Review Comment:
   Can these fixture setup be put in some kind of utils function so it can be shared with other tests in SQL Lab (suppose we will have more)?



##########
superset-frontend/cypress-base/cypress/fixtures/sqllab_tables.json:
##########
@@ -0,0 +1,29 @@
+{

Review Comment:
   Can these JSON files be typed JavaScript objects instead?



-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(sqllab): Enable cypress specs for sqllab query [superset]

Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas commented on PR #21105:
URL: https://github.com/apache/superset/pull/21105#issuecomment-1920524819

   @justinpark should we follow through on this? Looks like it just needs codeowner approval (which I can give) after a rebase and consideration of the suggestions on the thread.


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org