Skip to content

Run OpenQA smoketest locally

Saray Cabrera Padrón edited this page May 24, 2022 · 11 revisions

Introduction

Here are described the steps to run the smoketest of the webui locally. These tests are used in the openQA Setup for OBS.

We will replicate the steps done by the following scripts:

Run appliance

Download the appliance you want to test and run it in a Virtual Machine. You can find some guidance in OBS Appliance documentation.

Prepare the environment to run the tests inside the appliance

Depending on the image you have downloaded, you will need to clone a different git branch:

  • For Unstable: export GIT_BRANCH=master
  • For 2.10: export GIT_BRANCH=2.10

Then you can do the following steps:

git clone --single-branch --branch $GIT_BRANCH --depth 1 https://github.com/openSUSE/open-build-service.git /tmp/open-build-service
cd /tmp/open-build-service/dist/t/                                                                                                                    
zypper -vv -n --gpg-auto-import-keys install --force-resolution --no-recommends chromedriver xorg-x11-fonts libxml2-devel libxslt-devel ruby2.7-devel 
bundle.ruby2.7 install                                                                                                                                

Run the tests

cd /tmp/open-build-service/dist/t/
bundle.ruby2.7 exec rspec

Re-run the tests

In case you found an error running the tests, most probably you will need to restore the database to the initial setup:

cd /srv/www/obs/api/
rake db:drop db:create db:setup RAILS_ENV=production DISABLE_DATABASE_ENVIRONMENT_CHECK=1 SAFETY_ASSURED=1

Then you can rerun the tests, as described in the previous section.

Capybara Screenshots

When a feature test fails, we generate an html and png file into the directory

/tmp/rspec_screens

To check these files, you can copy the file to your local machine with:

scp root@IP_VIRTUAL_MACHINE:/tmp/rspec_screens/screenshot-0040_package_spec.rb-24.png .
Clone this wiki locally