diff --git a/integration-tests/.gitignore b/integration-tests/.gitignore index 44e9af9..2cffbf1 100644 --- a/integration-tests/.gitignore +++ b/integration-tests/.gitignore @@ -1,2 +1,3 @@ results node_modules +.vagrant diff --git a/integration-tests/Vagrantfile b/integration-tests/Vagrantfile new file mode 100644 index 0000000..3ed6563 --- /dev/null +++ b/integration-tests/Vagrantfile @@ -0,0 +1,35 @@ +# This Vagrantfile is designed to be used with artifacts that have been built by goreleaser. +# (eg, snapshot builds on GitHub) + + +Vagrant.configure("2") do |config| + config.vm.box = "generic/centos8" + config.vm.provision "shell", inline: "mkdir /etc/OliveTin && chmod o+w /etc/OliveTin/", privileged: true + config.vm.provision "file", source: "configs/config.general.yaml/.", destination: "/etc/OliveTin/config.yaml" + + config.vm.provider :libvirt do |libvirt| + libvirt.management_network_device = 'virbr0' + end + + config.vm.define :f34 do |f34| + f34.vm.box = "generic/fedora34" + f34.vm.provision "file", source: "/opt/OliveTin-vagrant/linux_amd64_rpm/.", destination: "." + f34.vm.provision "shell", inline: "rpm -U OliveTin* && systemctl enable --now OliveTin && systemctl disable --now firewalld" + end + + config.vm.define :debian do |debian| + debian.vm.box = "generic/debian10" + debian.vm.provision "file", source: "/opt/OliveTin-vagrant/linux_amd64_deb/.", destination: "." + debian.vm.provision "shell", inline: "dpkg --force-confold -i OliveTin* && systemctl enable --now OliveTin" + end + + config.vm.define :ubuntu do |ubuntu| + ubuntu.vm.box = "generic/ubuntu2110" + ubuntu.vm.provision "file", source: "/opt/OliveTin-vagrant/linux_amd64_deb/.", destination: "." + ubuntu.vm.provision "shell", inline: "dpkg --force-confold -i OliveTin* && systemctl enable --now OliveTin && systemctl disable --now firewalld" + end + + # TODO + # + +end diff --git a/integration-tests/configs/config.general.yaml b/integration-tests/configs/config.general.yaml index a4cb64d..a3b0b0e 100644 --- a/integration-tests/configs/config.general.yaml +++ b/integration-tests/configs/config.general.yaml @@ -1,23 +1,17 @@ -# There is a built-in micro proxy that will host the webui and REST API all on -# one port (this is called the "Single HTTP Frontend") and means you just need -# one open port in the container/firewalls/etc. # -# Listen on all addresses available, port 1337 +# Integration Test Config: General +# + listenAddressSingleHTTPFrontend: 0.0.0.0:1337 -# Choose from INFO (default), WARN and DEBUG logLevel: "DEBUG" +checkForUpdates: false -# Actions (buttons) to show up on the WebUI: actions: - # This will send 1 ping (-c 1) - # Docs: https://docs.olivetin.app/action-ping.html - title: Ping Google.com shell: ping google.com -c 1 icon: ping - # Restart lightdm on host "overseer" - # Docs: https://docs.olivetin.app/action-ping.html - title: restart lightdm icon: poop shell: ssh root@overseer 'service lightdm restart' @@ -30,23 +24,11 @@ actions: shell: sleep 5 icon: "😪" - # OliveTin can run long-running jobs like Ansible playbooks. - # - # For such jobs, you will need to install ansible-playbook on the host where - # you are running OliveTin, or in the container. - # - # You probably want a much longer timeout as well (so that ansible completes). - title: "Run Ansible Playbook" icon: "🇦" shell: ansible-playbook -i /etc/hosts /root/myRepo/myPlaybook.yaml timeout: 120 - # OliveTin can control containers - docker is just a command line app. - # - # However, if you are running in a container you will need to do some setup, - # see the docs below. - # - # Docs: https://docs.olivetin.app/action-container-control.html - title: Restart Plex icon: smile shell: docker restart plex diff --git a/integration-tests/configs/config.hiddenNav.yaml b/integration-tests/configs/config.hiddenNav.yaml index 0bc7e8b..3edd298 100644 --- a/integration-tests/configs/config.hiddenNav.yaml +++ b/integration-tests/configs/config.hiddenNav.yaml @@ -1,11 +1,11 @@ -# There is a built-in micro proxy that will host the webui and REST API all on -# one port (this is called the "Single HTTP Frontend") and means you just need -# one open port in the container/firewalls/etc. # -# Listen on all addresses available, port 1337 +# Integration Test Config: General +# + listenAddressSingleHTTPFrontend: 0.0.0.0:1337 hideNavigation: true +checkForUpdates: false # Actions (buttons) to show up on the WebUI: actions: diff --git a/integration-tests/cypress/integration/general/defaultHomepageRender.spec.js b/integration-tests/cypress/integration/general/defaultHomepageRender.spec.js index 079d8a5..7e998bb 100644 --- a/integration-tests/cypress/integration/general/defaultHomepageRender.spec.js +++ b/integration-tests/cypress/integration/general/defaultHomepageRender.spec.js @@ -12,7 +12,7 @@ describe('Homepage rendering', () => { }) it('Switcher navigation is visible', () => { - cy.get('#switcher').then($el => { + cy.get('#sectionSwitcher').then($el => { expect(Cypress.dom.isHidden($el)).to.be.false }) }) diff --git a/integration-tests/cypressRunVagrant.sh b/integration-tests/cypressRunVagrant.sh new file mode 100755 index 0000000..ef0d1ab --- /dev/null +++ b/integration-tests/cypressRunVagrant.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +# args: +# $1: The Vagrant VM to test against. If blank and only one VM is provisioned, it will use that. + +IP=$(vagrant ssh-config $1 | grep HostName | awk '{print $2}') +BASE_URL="http://$IP:1337/" + +echo "IP: $IP, BaseURL: $BASE_URL" + +# Only run the general test, as we cannot easily switch out configs in VMs yet. +./node_modules/.bin/cypress run --headless -c baseUrl=$BASE_URL -s cypress/integration/general/*