Giter VIP home page Giter VIP logo

librecat-frontend-tests's Introduction

LibreCat-Frontend-Tests

Cypress frontend tests for LibreCat

Installation

In order to run the tests locally:

Translations

The tests need translation files from LibreCat. By default the test framework expects 2 files: en.json and de.json.

You can export these from LibreCat as follows (these will include any translations added via layers):

$ cd {LibreCat root}
$ bin/librecat config locale.en > {LibreCat-Frontend-Tests root}/l10n/en.json
$ bin/librecat config locale.de > {LibreCat-Frontend-Tests root}/l10n/de.json

Please note that files in the l10n folder should never be committed and that you may need to export them again on a regular basis.

If for some reason you want to test any additional locales or use custom translations, you can add files to the l10n folder, and add a cypress.env.json file (see cypress.env.json.example) which overwrites the default environment variable locales defined in cypress.json, like so:

{
    "locales": {
        "en": ["en.json", "en.custom.json"],
        "de": ["de.json", "de.custom.json"]
    }
}

Please note that this file should never be committed to git. Also note that the order of files is important here, as later files may overwrite translations in earlier files.

Usage

Headless test excecution (CLI)

$ yarn test

or

$ yarn cypress run

Test execution in Cypress GUI

$ yarn cypress open

librecat-frontend-tests's People

Contributors

dependabot[bot] avatar phochste avatar verheyenkoen avatar vpeil avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

librecat-frontend-tests's Issues

Testing author activation

  • login in librecat as test user
  • add a new book publication
  • fill out the lastname 'monroe'
  • click on 'activate author'

The author field should be automatically completed to 'Marilyn Monroe'.

alternative test using the previous name of Marylin: Norma Jeane Mortenson

  • login in librecat as test user
  • add a new book publication
  • fill out the lastname 'Mortenson'
  • click on 'activate author'

The author field should be automatically completed to 'Marilyn Monroe'.

Error in current version

There seems to be a bug in the current version. I just pulled the latest changes and now I'm getting the following error when I run $(npm bin)/cypress open

Error: Cannot find module 'he' from '[...]/cypress/support/commands'

Test marking records

  • No login is required.
  • Click 'publications' tab
  • Click first publication title
    • Click mark publication checkbox
    • The marked records counter (under Export) should say 1 Marked Publications
  • Click second publication title
    • Click mark publication checkbox
    • The marked records counter (under Export) should say 2 Marked Publications
  • Click 2 Marked Publications
    • The display should show 2 publications
  • With a drag and drop the second publication can be moved above the first one
  • Export as 'BibText'
    • An export with 2 publications should be found
  • Click on 'unmark all'
    • No publications should be marked

Testing BibText import

  • Login as test user
  • Click 'Add Publications'
  • In Paste Your BibTex records add this text:
@article{small,
author = {Freely, I.P.},
title = {A small paper},
journal = {The journal of small papers},
year = 1997,
volume = {-1},
note = {to appear},
}

@article{big,
author = {Jass, Hugh},
title = {A big paper},
journal = {The journal of big papers},
year = 7991,
volume = {MCMXCVII},
}
  • Click on import
  • The title should say:
Imported 2 record(s) from bibtex
 A small paper
 A big paper
  • Clicking on the 'edit' link should open the form to edit the metadata [this fails currently !]

Testing Quick and Easy uploads

  • Login as 'test'
  • Go to 'Add publications'
  • In the 'Drop your Open Access fulltext here' upload a file
  • Click to checkbox to accept the policy
  • Click submit
  • A new title should appear in the windows
Imported 1 record(s) from dropzone
New Quick And Easy Publication - Will be edited by LibreCat team
  • Click the edit button under it
  • And edit form should appear

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.