usc-isi-i2 / t2wml

Table to Wikidata Mapping Language
MIT License
22 stars 11 forks source link

Add frontend tests for Electron #398

Open zmbq opened 3 years ago

zmbq commented 3 years ago

Use Spectron for it.

https://www.electronjs.org/spectron

devowit commented 3 years ago

all the new projects need to be created in a clean, temporary directory.

new project:

  1. from new project button in projects list window
  2. from new project menu item while in projects list window
  3. from new project menu, while within a project window

open existing project: (fortunately, we will have 3 at this point)

  1. from open existing project button in projects list window
  2. from open existing project menu item
  3. from open recent menu item
  4. from projects list (which also displays recent projects)
  5. from the menu items, but in the project window

populate a project:

project 1: (basic pipeline we've had forever--- based on homicide data)

  1. add data file (homicide_data_file.xlsx) from upload data file button
  2. add a wikifier file (wikifier_homicide.csv) from the import wikifier button
  3. add an entities file (homicide_entities.tsv) from the import entities button
  4. switch between annotate, wikify, and output buttons to check that they're working
  5. switch to a different sheet (table-1b) using the buttons at the bottom of the sheet
  6. upload a yaml file (table-1b.yaml) with the import button
  7. press apply
  8. press on a green cell-- see output in output window
  9. press on a different green cell (click or arrow, whichever is easier) and see output change
  10. press on a cell with blue text (wikified) -- see toast

project 2: (annotations and file menu)

  1. add a wikifier file from entities menu (rick-click + load existing)
  2. add an entities file from the entities menu (right click + load existing)
  3. add a data file from upload data file button (one day this will be replaced with drag and drop?)
  4. add an empty annotation file from the file tree right click
  5. in annotation mode:
    1. annotate the dependent variable.
    2. annotate the main subject
    3. annotate a property
    4. annotate a qualifier. search for a property
  6. switch to wikify mode.
    1. change a wikification based on cell
    2. change a wikification base don block
    3. change a property wikification
  7. check output mode.

project 3:

  1. add a data file from upload data file button
  2. NO WIKIFIER FILE, NO ENTITIES FILE
  3. run annotation steps like above...
  4. check entities window
  5. check project settings window
  6. check global settings window
devowit commented 3 years ago

tests, assuming we cannot open files:

we will need to pre-create projects, and then open those projects to run the tests on.

attached is one to start with.

some tests we can hopefully do with the loaded project:

frontend-test-project.zip

ChanaChelem commented 3 years ago

I wrote the tests:

  1. switch between data files
  2. switch between sheets (from file sidebar, and from sheet switcher below spreadsheet)
  3. switch between mapping files (homicide has a yaml and an annotation file, others have some annotation files...)

branch: spectron-test commits: fb8dcd9f4bff171d9bd7fd0a00779fec605ead75 - 72f19df52929a8aa478209c3c471135e97625981

Unzip the file t2wml\electron\test\files\frontend-test-project.zip in same folder is located, before you run the tests.

devowit commented 3 years ago

i switched my comment to have a checklist, so you can check stuff off in it (I think)