From 38b4e3b5a7775c7fc0ac675a89ad7593e7101a06 Mon Sep 17 00:00:00 2001 From: David Taylor Date: Tue, 7 Jan 2020 12:54:01 +0000 Subject: [PATCH] DEV: Add smoke test to github actions (#8580) --- .github/workflows/ci.yml | 1 - .github/workflows/smoke.yml | 63 +++++++++++++++++++++++++++++++++++++ test/smoke_test.js | 6 ++-- 3 files changed, 67 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/smoke.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 51fd199db1c..d3ad7394285 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -156,4 +156,3 @@ jobs: if: env.BUILD_TYPE == 'FRONTEND' run: bundle exec rake plugin:qunit timeout-minutes: 30 - diff --git a/.github/workflows/smoke.yml b/.github/workflows/smoke.yml new file mode 100644 index 00000000000..6bc22c771dc --- /dev/null +++ b/.github/workflows/smoke.yml @@ -0,0 +1,63 @@ +name: SMOKE TEST + +on: + push: + branches: + - master + pull_request: + branches-ignore: + - 'tests-passed' + +jobs: + smoke_test: + name: "CORE" + runs-on: ubuntu-latest + timeout-minutes: 60 + + steps: + - uses: actions/checkout@master + with: + fetch-depth: 1 + + - name: Install unbuffer + run: sudo apt-get install -yqq expect + + - name: Boot dev image + run: unbuffer d/boot_dev + + - name: Create script + run: | + mkdir tmp + touch tmp/script.rb + echo "u = User.new(username:'smoke_user', password:'P4ssw0rd', email:'smoke@example.com', admin:true)" >> tmp/script.rb + echo "u.save!(validate: false)" >> tmp/script.rb + echo "u.activate" >> tmp/script.rb + echo "SiteSetting.wizard_enabled = false" >> tmp/script.rb + + - name: tmp + run: sudo chown -R 1000:1000 . + + - name: Bundle + run: unbuffer d/bundle install + + - name: Migrate + run: unbuffer d/rake db:migrate + + - name: Run script + run: unbuffer d/rails runner tmp/script.rb + + - name: Start Server + run: unbuffer d/rails s & + + - name: Warm Up Server + run: curl -I -A "Chrome" --retry 10 --retry-delay 1 --max-time 60 http://localhost:3000 + + - name: Run smoke test + run: unbuffer d/rake smoke:test + + - uses: actions/upload-artifact@v1 + if: failure() + with: + name: smoke-test-screenshots + path: tmp/smoke-test-screenshots + diff --git a/test/smoke_test.js b/test/smoke_test.js index 833e99fbfab..487e3a4c2e8 100644 --- a/test/smoke_test.js +++ b/test/smoke_test.js @@ -126,7 +126,7 @@ const path = require("path"); }); await exec("expect a log in button in the header", () => { - return page.waitForSelector("header .login-button", { visible: true }); + return page.waitForSelector("header .login-button"); }); if (process.env.LOGIN_AT_BEGINNING) { @@ -171,7 +171,9 @@ const path = require("path"); } await exec("go home", () => { - let promise = page.waitForSelector("#site-logo, #site-text-logo", { visible: true }); + let promise = page.waitForSelector("#site-logo, #site-text-logo", { + visible: true + }); promise = promise.then(() => { return page.click("#site-logo, #site-text-logo");