metadata:
  name: grilo
  format: "Apertis Test Definition 1.0"
  image-type: any
  image-arch: any
  type: functional
  exec-type: automated
  priority: medium
  description: "Check grilo metadata notifications, and filesystem browsing."
  maintainer: "Apertis Project"

  pre-conditions:
    - "Ensure Rootfs is remounted as read/write."
    - "$ sudo mount -o remount,rw /"
    - "Install dependencies"
    - "$ sudo apt install apertis-tests gir1.2-grilo-0.2 grilo-plugins-0.2 python3 python3-gi"
    - "Restart the system to restore the filesystem state to read-only before
       running the test."
    - "$ sudo reboot"

  expected:
    - "The output should be similar to this one:"
    - |
        >GriloTest: filesystem notifications
        GriloTest: received 'content-changed' signal: file:///tmp/test-grilo-Y7UF7X added
        GriloTest: received 'content-changed' signal: file:///tmp/test-grilo-Y7UF7X added
        GriloTest: received 'content-changed' signal: file:///tmp/test-grilo-Y7UF7X/subdir added
        GriloTest: received 'content-changed' signal: file:///tmp/test-grilo-Y7UF7X/subdir added
        GriloTest: received 'content-changed' signal: file:///tmp/test-grilo-Y7UF7X changed
        GriloTest: received 'content-changed' signal: file:///tmp/test-grilo-Y7UF7X/subdir removed
        GriloTest: received 'content-changed' signal: file:///tmp/test-grilo-Y7UF7X/subdir removed
        GriloTest: received 'content-changed' signal: file:///tmp/test-grilo-Y7UF7X removed
        GriloTest: received 'content-changed' signal: file:///tmp/test-grilo-Y7UF7X removed

        (python3:1426): Grilo-WARNING **: [filesystem] grl-filesystem.c:711: Got error: No such file or directory
        ApertisTest: copying medias to /tmp/test-grilo-Y7UF7X
        GriloTest: filesystem browse
        GriloBrowserMixin: add media Videos/big_buck_bunny_smaller.ogv
        GriloBrowserMixin: add media Pictures/320px-European_Common_Frog_Rana_temporaria.jpg
        GriloBrowserMixin: add media Pictures/collabora-logo-big.png
        GriloBrowserMixin: add media Music/Ghosts.pls
        GriloBrowserMixin: add media Music/Generic_Sounds.pls
        GriloBrowserMixin: add media Music/Ghosts.m3u
        GriloBrowserMixin: add media Music/generic.oga
        GriloBrowserMixin: add media Music/generic.wav
        GriloBrowserMixin: add media Music/generic.mp3
        GriloBrowserMixin: add media Music/generic.flac
        GriloBrowserMixin: add media Music/generic-no-artwork.mp3
        GriloTest: playlist
        GriloBrowserMixin: add media Music/audio/generic.mp3
        GriloBrowserMixin: add media Music/audio/generic.flac
        GriloBrowserMixin: add media Music/audio/generic.oga
        .
        ----------------------------------------------------------------------
        Ran 1 test in 0.076s
        OK
    - "If any test failed, they will be listed instead of the success message:"
    - |
        >[python backtrace]
        FAILED (errors=1)

install:
  deps:
  - apertis-tests
  - gir1.2-grilo-0.2
  - grilo-plugins-0.2
  - python3
  - python3-gi

run:
  steps:
  - "# Execute the following command:"
  - common/run-test-in-systemd --timeout=900 --basename grilo/automated/test-grilo.py

parse:
  pattern: ^(?P<test_case_id>[a-zA-Z0-9_\-\./]+):\s*(?P<result>pass|fail|skip|unknown)$
