williaster commented on a change in pull request #5693: Adding simple Cypress 
tests
URL: 
https://github.com/apache/incubator-superset/pull/5693#discussion_r214185228
 
 

 ##########
 File path: superset/assets/cypress/support/commands.js
 ##########
 @@ -0,0 +1,58 @@
+// ***********************************************
+// This example commands.js shows you how to
+// create various custom commands and overwrite
+// existing commands.
+//
+// For more comprehensive examples of custom
+// commands please read more here:
+// https://on.cypress.io/custom-commands
+// ***********************************************
+//
+//
+// -- This is a parent command --
+// Cypress.Commands.add("login", (email, password) => { ... })
+//
+//
+// -- This is a child command --
+// Cypress.Commands.add("drag", { prevSubject: 'element'}, (subject, options) 
=> { ... })
+//
+//
+// -- This is a dual command --
+// Cypress.Commands.add("dismiss", { prevSubject: 'optional'}, (subject, 
options) => { ... })
+//
+//
+// -- This is will overwrite an existing command --
+// Cypress.Commands.overwrite("visit", (originalFn, url, options) => { ... })
+
+const BASE_URL = '/superset/explore/?form_data=';
+
+Cypress.Commands.add('login', () => {
+  cy.request({
+    method: 'POST',
+    url: 'http://localhost:8081/login/',
+    body: { username: 'admin', password: 'general' },
+  }).then((response) => {
+    expect(response.status).to.eq(200);
+  });
+});
+
+Cypress.Commands.add('visitChart', ({ name, sliceId, formData }) => {
 
 Review comment:
   when I first read this it wasn't clear to me what `visitChart` meant. While 
it seems possibly useful to have a method that could handle 3 different types 
of input, since they are all mutually exclusive could we instead create 3 
methods with more descriptive names which each expect one type of input?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to