Mandatory Assignment 2

Automated testing

We have provided you with a list of automated end-to-end test using the Cypress testing framework. If you have implemented the app according to the specifications written here, these automated tests will pass and you can be confident about your solution. The tests do not require a network connection, nor a running DHIS2 instance.

User interface specifications

Automated testing requires that the app you make have elements with names or attributes we've agreed on here so that we can find the correct elements to click and check.

We are going to use the data-test attribute to tag specific elements in the UI. Almost all @dhis2/ui components take a dataTest attribute property and include this property under the data-test property in the HTML document.

Menu

The menu should have two menu items:

  • Programs with the data-test: menu-programs
  • Data sets with the data-test: menu-dataSets

List

Every item in the list of programs or data sets must have a unique data-test attribute value.

  • Programs with the data-test: list-program-ID where ID is replaced by the program id
  • Data sets with the data-test: list-dataSet-ID where ID is replaced by the data set id

Details

When we click on one of the programs or data sets, more details about the particular resource should be shown.

  • id with the data-test: details-id and should contain (in text format) the id of the particular resource
  • name with the data-test: details-name and should contain (in text format) the name of the particular resource
  • created with the data-test: details-created and should contain (in text format) the created at date of the particular resource

Running tests

You can run the automated tests by executing (in the terminal):

yarn cypress:open

and then click the Run all specs button. If everything is properly implemented, you should be met with a window similar to the one in the screenshot below.

The cypress test runner after the tests have run and is showing that all tests have passed.
The cypress test runner after the tests have run and is showing that all tests have passed.