Web

We use the term Web to refer to frontend assignments in raw HTML, CSS & JavaScript (i.e. without the use of a framework such as React or Angular. To create a new assignment in Web, click into one of your courses, and then click Add assignment. Choose Web from the drop-down list of available frontend frameworks and set the the rest of your assignment's parameters (deadline, etc.). Once the assignment is created, a new folder will be created in the private GitHub/GitLab template repository for the course in which you are added this assignment. This folder will contain a standard npm project structure.

Automated test-suite setup

If you would like to add tests that are automatically run by AssignmentOS against each student's solution to your assignment, you can add these as unit tests or end-to-end tests.

All unit tests files must use the Jest test framework, and all end-to-end tests must use the Cypress E2E test framework.

All unit test filenames must end with .test.js, .test.ts or .test.tsx, and unit test files with filenames that end with .hidden.test.js, .hidden.test.ts or .hidden.test.tsx will not be visible to the student.

All end-to-end test filenames must end with .spec.js or .spec.ts, and end-to-end test files with filenames that end with .hidden.spec.js or .hidden.spec.ts will not be visible to the student.

If you want to add files that your hidden unit tests use and hence are also not visible to the student, the names of these files must begin with hidden (case-insensitive), e.g., hiddenFoo.json, hiddenFoo.csv, HiddenFoo.js, etc.

GitHub Action & GitLab CI/CD

AssignmentOS uses either GitHub Actions or GitLab CI/CD (depending on whether you use with GitHub or GitLab) to run automated unit tests. We provide the following GitHub Action & GitLab CI/CD file for Web assignments. Note that this file is added dynamically to the repo of each student taking your assignment, so please do not include it in your template repo. This file also cannot be changed.

GitHub Action .yml fileGitLab CI/CD .yml file
name: Web CI

on: push

jobs:

  unit:
    runs-on: ubuntu-latest
    steps:
    - name: Checkout
      uses: actions/checkout@v3

    - name: Install dependencies
      run: npm install

    - name: Run Jest tests
      run: npm test -- --passWithNoTests
      env:
        CI: false

  e2e:
    runs-on: ubuntu-latest
    steps:
    - name: Checkout
      uses: actions/checkout@v3

    - name: Install dependencies
      run: npm install

    - name: Check Cypress tests exist
      id: check_cypress_tests
      uses: andstor/file-existence-action@v1
      with:
        files: "cypress/e2e/"

    - name: Install and run Cypress tests
      uses: cypress-io/github-action@v4
      if: steps.check_cypress_tests.outputs.files_exists == 'true'
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
      with:
        build: npm run build --if-present
        start: npm start
        wait-on: 'http://localhost:3000'

Coming soon!

Last updated