<commit_before>// Function filling forms with provided inputs.
// Submits the form in the final step.
//
// Each function expects to be executed from within a `within` call selecting
// the correct form.

const submitCaseForm = (cy) => (form, { title, content, attachment }) => {
  cy.get('input[name="name"]').clear().type(title);
  cy.get('textarea[name="text"]').clear().type(content);
  if (attachment !== null) {
    cy.get('input[type="file"]')
      .filter(":visible")
      .first()
      .attachFile(attachment);
  }
  cy.contains("input", "Zgłoś").click();
};

const submitLetterForm = (cy) => (form, { title, content, attachment }) => {
  cy.get('input[name="name"]').clear().type(title);
  cy.get('textarea[name="text"]').clear().type(content);
  if (attachment !== null) {
    cy.get('input[type="file"]')
      .filter(":visible")
      .first()
      .attachFile(attachment);
  }
  cy.contains("input", "Odpowiedz wszystkim").click();
};

module.exports = { submitCaseForm, submitLetterForm };<commit_msg>Handle undefined attachments<commit_after>// Function filling forms with provided inputs.
// Submits the form in the final step.
//
// Each function expects to be executed from within a `within` call selecting
// the correct form.

const submitCaseForm = (cy) => (form, { title, content, attachment }) => {
  cy.get('input[name="name"]').clear().type(title);
  cy.get('textarea[name="text"]').clear().type(content);
  if (attachment) {
    cy.get('input[type="file"]')
      .filter(":visible")
      .first()
      .attachFile(attachment);
  }
  cy.contains("input", "Zgłoś").click();
};

const submitLetterForm = (cy) => (form, { title, content, attachment }) => {
  cy.get('input[name="name"]').clear().type(title);
  cy.get('textarea[name="text"]').clear().type(content);
  if (attachment) {
    cy.get('input[type="file"]')
      .filter(":visible")
      .first()
      .attachFile(attachment);
  }
  cy.contains("input", "Odpowiedz wszystkim").click();
};

module.exports = { submitCaseForm, submitLetterForm };
{'fraction_non_alphanumeric': 0.2030407062285434, 'fraction_numerical': 0.0, 'mean_word_length': 4.112781954887218, 'pattern_counts': {'":': 4, '<': 3, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5605269', 'n_tokens_mistral': 654, 'n_tokens_neox': 640, 'n_words': 138}