diff --git a/Dockerfile b/Dockerfile index d3a07b5..8723f5e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,9 +5,10 @@ RUN apt-get update && apt-get install --no-install-recommends -y libapache2-mod- RUN mkdir -p /app/code WORKDIR /app/code -ARG VERSION=1.24.3 +# renovate: datasource=github-releases depName=FreshRSS/FreshRSS versioning=semver +ARG FRESHRSS_VERSION=1.24.3 -RUN curl -L https://github.com/FreshRSS/FreshRSS/archive/${VERSION}.tar.gz | tar -zxvf - --strip-components=1 && \ +RUN curl -L https://github.com/FreshRSS/FreshRSS/archive/${FRESHRSS_VERSION}.tar.gz | tar -zxvf - --strip-components=1 && \ mv data data-orig && ln -s /app/data data # official extensions (https://github.com/FreshRSS/Extensions/commits/master) diff --git a/test/test.js b/test/test.js index 28cf521..48f47fa 100644 --- a/test/test.js +++ b/test/test.js @@ -1,11 +1,6 @@ #!/usr/bin/env node -/* jshint esversion: 8 */ -/* global describe */ -/* global before */ -/* global after */ -/* global it */ -/* global xit */ +/* global it, xit, describe, before, after, afterEach */ 'use strict'; @@ -13,6 +8,7 @@ require('chromedriver'); const execSync = require('child_process').execSync, expect = require('expect.js'), + fs = require('fs'), path = require('path'), superagent = require('superagent'), { Builder, By, Key, until } = require('selenium-webdriver'), @@ -28,7 +24,7 @@ if (!process.env.USERNAME || !process.env.PASSWORD) { describe('Application life cycle test', function () { this.timeout(0); - const LOCATION = 'test'; + const LOCATION = process.env.LOCATION || 'test'; const TEST_TIMEOUT = parseInt(process.env.TIMEOUT, 10) || 10000; const EXEC_ARGS = { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' }; @@ -39,16 +35,27 @@ describe('Application life cycle test', function () { let athenticated_by_oidc = false; before(function () { - const options = new Options().windowSize({ width: 1280, height: 1024 }); - if (process.env.HEADLESS) options.addArguments('headless'); - - browser = new Builder().forBrowser('chrome').setChromeOptions(options).build(); + const chromeOptions = new Options().windowSize({ width: 1280, height: 1024 }); + if (process.env.CI) chromeOptions.addArguments('no-sandbox', 'disable-dev-shm-usage', 'headless'); + browser = new Builder().forBrowser('chrome').setChromeOptions(chromeOptions).build(); + if (!fs.existsSync('./screenshots')) fs.mkdirSync('./screenshots'); }); after(function () { browser.quit(); }); + afterEach(async function () { + if (!process.env.CI || !app) return; + + const currentUrl = await browser.getCurrentUrl(); + if (!currentUrl.includes(app.domain)) return; + expect(this.currentTest.title).to.be.a('string'); + + const screenshotData = await browser.takeScreenshot(); + fs.writeFileSync(`./screenshots/${new Date().getTime()}-${this.currentTest.title.replaceAll(' ', '_')}.png`, screenshotData, 'base64'); + }); + function getAppInfo() { var inspect = JSON.parse(execSync('cloudron inspect')); app = inspect.apps.filter(function (a) { return a.location.indexOf(LOCATION) === 0; })[0];