<commit_before>package test;

import java.net.URL;
import java.util.concurrent.TimeUnit;
import org.junit.*;
import static org.junit.Assert.*;
import org.openqa.selenium.*;
import org.openqa.selenium.htmlunit.HtmlUnitDriver;

public class SubmissionFileTest {
  private WebDriver driver;
  private String baseUrl;
  private String uploadFile;
  private boolean acceptNextAlert = true;
  private StringBuffer verificationErrors = new StringBuffer();

  @Before
  public void setUp() throws Exception {
    driver = new HtmlUnitDriver();
    baseUrl = "https://datadryad.org/";
    uploadFile = "/opt/dryad/config/workflow.xml";
    driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
  }

  @Test
  public void testSubmission() throws Exception {
    // Root page
    driver.get(baseUrl + "/");

    // Click Submit and login
    driver.findElement(By.linkText("Submit data now")).click();
    driver.findElement(By.id("aspect_eperson_PasswordLogin_field_login_email")).clear();
    driver.findElement(By.id("aspect_eperson_PasswordLogin_field_login_email")).sendKeys("<EMAIL>");
    driver.findElement(By.id("aspect_eperson_PasswordLogin_field_login_password")).clear();
    driver.findElement(By.id("aspect_eperson_PasswordLogin_field_login_password")).sendKeys("<PASSWORD>");
    driver.findElement(By.cssSelector("#aspect_eperson_PasswordLogin_item_loginsubmit-item > div.ds-form-content > #aspect_eperson_PasswordLogin_field_submit")).click();

    // 0. Select Journal
    driver.findElement(By.id("xmlui_submit_publication_article_status_accepted")).click();
    driver.findElement(By.id("aspect_submission_StepTransformer_field_prism_publicationName")).clear();
    driver.findElement(By.id("aspect_submission_StepTransformer_field_prism_publicationName")).sendKeys("Automated Test Submission Journal");
    driver.findElement(By.name("manu_accepted-cb")).click();
    driver.findElement(By.name("license_accept")).click();
    driver.findElement(By.id("aspect_submission_StepTransformer_field_submit_next")).click();
    
    // 1. Describe Publication
    driver.findElement(By.id("aspect_submission_StepTransformer_field_dc_title")).clear();
    driver.findElement(By.id("aspect_submission_StepTransformer_field_dc_title")).sendKeys("IGNORE: Automated Test Submission");
    driver.findElement(By.id("aspect_submission_StepTransformer_field_dc_contributor_author_last")).clear();
    driver.findElement(By.id("aspect_submission_StepTransformer_field_dc_contributor_author_last")).sendKeys("Test");
    driver.findElement(By.id("aspect_submission_StepTransformer_field_dc_contributor_author_first")).clear();
    driver.findElement(By.id("aspect_submission_StepTransformer_field_dc_contributor_author_first")).sendKeys("Selenium");
    driver.findElement(By.id("aspect_submission_StepTransformer_field_submit_next")).click();
    
    // 2.1 Upload Data File 1/3
    driver.findElement(By.id("aspect_submission_StepTransformer_field_dataset-file")).clear();
    driver.findElement(By.id("aspect_submission_StepTransformer_field_dataset-file")).sendKeys(uploadFile);
    driver.findElement(By.id("aspect_submission_StepTransformer_field_dc_title")).clear();
    driver.findElement(By.id("aspect_submission_StepTransformer_field_dc_title")).sendKeys("IGNORE: Automated Test Submission File");
    driver.findElement(By.id("aspect_submission_StepTransformer_field_submit_next")).click();
    // 3. Delete submission - can't get this working with selenium
    // 4. Logout
    driver.findElement(By.linkText("Logout")).click();
  }
<commit_msg>Add assertions to confirm file is uploaded<commit_after>package test;

import java.net.URL;
import java.util.concurrent.TimeUnit;
import org.junit.*;
import static org.junit.Assert.*;
import org.openqa.selenium.*;
import org.openqa.selenium.htmlunit.HtmlUnitDriver;

public class SubmissionFileTest {
  private WebDriver driver;
  private String baseUrl;
  private String uploadFile;
  private boolean acceptNextAlert = true;
  private StringBuffer verificationErrors = new StringBuffer();

  @Before
  public void setUp() throws Exception {
    driver = new HtmlUnitDriver();
    baseUrl = "https://datadryad.org/";
    uploadFile = "/opt/dryad/config/workflow.xml";
    driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
  }

  @Test
  public void testSubmission() throws Exception {
    // Root page
    driver.get(baseUrl + "/");

    // Click Submit and login
    driver.findElement(By.linkText("Submit data now")).click();
    driver.findElement(By.id("aspect_eperson_PasswordLogin_field_login_email")).clear();
    driver.findElement(By.id("aspect_eperson_PasswordLogin_field_login_email")).sendKeys("<EMAIL>");
    driver.findElement(By.id("aspect_eperson_PasswordLogin_field_login_password")).clear();
    driver.findElement(By.id("aspect_eperson_PasswordLogin_field_login_password")).sendKeys("<PASSWORD>");
    driver.findElement(By.cssSelector("#aspect_eperson_PasswordLogin_item_loginsubmit-item > div.ds-form-content > #aspect_eperson_PasswordLogin_field_submit")).click();

    // 0. Select Journal
    driver.findElement(By.id("xmlui_submit_publication_article_status_accepted")).click();
    driver.findElement(By.id("aspect_submission_StepTransformer_field_prism_publicationName")).clear();
    driver.findElement(By.id("aspect_submission_StepTransformer_field_prism_publicationName")).sendKeys("Automated Test Submission Journal");
    driver.findElement(By.name("manu_accepted-cb")).click();
    driver.findElement(By.name("license_accept")).click();
    driver.findElement(By.id("aspect_submission_StepTransformer_field_submit_next")).click();
    
    // 1. Describe Publication
    driver.findElement(By.id("aspect_submission_StepTransformer_field_dc_title")).clear();
    driver.findElement(By.id("aspect_submission_StepTransformer_field_dc_title")).sendKeys("IGNORE: Automated Test Submission");
    driver.findElement(By.id("aspect_submission_StepTransformer_field_dc_contributor_author_last")).clear();
    driver.findElement(By.id("aspect_submission_StepTransformer_field_dc_contributor_author_last")).sendKeys("Test");
    driver.findElement(By.id("aspect_submission_StepTransformer_field_dc_contributor_author_first")).clear();
    driver.findElement(By.id("aspect_submission_StepTransformer_field_dc_contributor_author_first")).sendKeys("Sel<PASSWORD>");
    driver.findElement(By.id("aspect_submission_StepTransformer_field_submit_next")).click();
    
    // 2.1 Upload Data File 1/3
    driver.findElement(By.id("aspect_submission_StepTransformer_field_dataset-file")).clear();
    driver.findElement(By.id("aspect_submission_StepTransformer_field_dataset-file")).sendKeys(uploadFile);
    driver.findElement(By.id("aspect_submission_StepTransformer_field_dc_title")).clear();
    String title = "IGNORE: Automated Test Submission File";
    driver.findElement(By.id("aspect_submission_StepTransformer_field_dc_title")).sendKeys(title);
    driver.findElement(By.id("aspect_submission_StepTransformer_field_submit_next")).click();

    // Assert that the page is reached and contains Submission overview
    assertTrue("Submission overview after file upload", driver.findElement(By.cssSelector("h1.ds-div-head")).getText().contains("Submission overview"));

    // Assert that the uploaded file is listed on the page
    assertTrue("Uploaded file appears on page", driver.findElement(By.id("aspect_submission_submit_OverviewStep_list_datasets")).getText().contains(title));

    // 3. Delete submission - can't get this working with selenium
    // 4. Logout
    driver.findElement(By.linkText("Logout")).click();
  }

{'fraction_non_alphanumeric': 0.12362349239643419, 'fraction_numerical': 0.00275301520713162, 'mean_word_length': 6.479411764705882, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 12, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, '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': '4815281', 'n_tokens_mistral': 2402, 'n_tokens_neox': 2347, 'n_words': 292}