{"size": 1176, "ext": "js", "max_stars_repo_path": "cypress/support/commands.js", "max_stars_repo_name": "grconnor/client_user_el_gaucho_nyheter", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "cypress/support/commands.js", "max_issues_repo_name": "grconnor/client_user_el_gaucho_nyheter", "max_issues_repo_issues_event_min_datetime": "2020-11-24T05:01:09.000Z", "max_issues_repo_issues_event_max_datetime": "2021-07-30T05:21:49.000Z", "max_forks_repo_path": "cypress/support/commands.js", "max_forks_repo_name": "grconnor/client_user_el_gaucho_nyheter", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": 128, "max_forks_count": null, "avg_line_length": 28.0, "max_line_length": 82, "alphanum_fraction": 0.5578231293}
Cypress.Commands.add("typeInStripeElement", (id, field, value) => {
  cy.get(`[data-cy=${id}]`).within(() => {
    cy.get('iframe[name^="__privateStripeFrame"]').then(($iframe) => {
      const $body = $iframe.contents().find("body");
      cy.wrap($body).find(`input[name=${field}]`).type(`${value}`, { delay: 10 });
    });
  })
})

Cypress.Commands.add("login", (role) => {
  cy.server();
  cy.route({
    method: "POST",
    url: "http://localhost:3000/api/v1/auth/*",
    response: `fixture:successful_login_${role}.json`,
    headers: {
      uid: `user@mail.com`,
    },
  });

  cy.route({
    method: "GET",
    url: "http://localhost:3000/api/v1/articles",
    response: "fixture:articles_index.json",
  });
  
  cy.route({
    method: "GET",
    url: "http://localhost:3000/api/v1/auth/*",
    response: `fixture:successful_login_${role}.json`,
    headers: {
      uid: `user@mail.com`,
    },
  });
  cy.visit("/");
  cy.get("[data-cy='login']").click()
  cy.get("[data-cy='login-form']").within(() => {
    cy.get("[data-cy='email']").type("user@mail.com");
    cy.get("[data-cy='password']").type("password");
    cy.get("[data-cy='submit']").click();
  });
});