Prepare for ci
This commit is contained in:
parent
6b58760334
commit
81ac195aa3
|
@ -5,9 +5,10 @@ RUN apt-get update && apt-get install --no-install-recommends -y libapache2-mod-
|
||||||
RUN mkdir -p /app/code
|
RUN mkdir -p /app/code
|
||||||
WORKDIR /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
|
mv data data-orig && ln -s /app/data data
|
||||||
|
|
||||||
# official extensions (https://github.com/FreshRSS/Extensions/commits/master)
|
# official extensions (https://github.com/FreshRSS/Extensions/commits/master)
|
||||||
|
|
29
test/test.js
29
test/test.js
|
@ -1,11 +1,6 @@
|
||||||
#!/usr/bin/env node
|
#!/usr/bin/env node
|
||||||
|
|
||||||
/* jshint esversion: 8 */
|
/* global it, xit, describe, before, after, afterEach */
|
||||||
/* global describe */
|
|
||||||
/* global before */
|
|
||||||
/* global after */
|
|
||||||
/* global it */
|
|
||||||
/* global xit */
|
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
@ -13,6 +8,7 @@ require('chromedriver');
|
||||||
|
|
||||||
const execSync = require('child_process').execSync,
|
const execSync = require('child_process').execSync,
|
||||||
expect = require('expect.js'),
|
expect = require('expect.js'),
|
||||||
|
fs = require('fs'),
|
||||||
path = require('path'),
|
path = require('path'),
|
||||||
superagent = require('superagent'),
|
superagent = require('superagent'),
|
||||||
{ Builder, By, Key, until } = require('selenium-webdriver'),
|
{ Builder, By, Key, until } = require('selenium-webdriver'),
|
||||||
|
@ -28,7 +24,7 @@ if (!process.env.USERNAME || !process.env.PASSWORD) {
|
||||||
describe('Application life cycle test', function () {
|
describe('Application life cycle test', function () {
|
||||||
this.timeout(0);
|
this.timeout(0);
|
||||||
|
|
||||||
const LOCATION = 'test';
|
const LOCATION = process.env.LOCATION || 'test';
|
||||||
const TEST_TIMEOUT = parseInt(process.env.TIMEOUT, 10) || 10000;
|
const TEST_TIMEOUT = parseInt(process.env.TIMEOUT, 10) || 10000;
|
||||||
const EXEC_ARGS = { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' };
|
const EXEC_ARGS = { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' };
|
||||||
|
|
||||||
|
@ -39,16 +35,27 @@ describe('Application life cycle test', function () {
|
||||||
let athenticated_by_oidc = false;
|
let athenticated_by_oidc = false;
|
||||||
|
|
||||||
before(function () {
|
before(function () {
|
||||||
const options = new Options().windowSize({ width: 1280, height: 1024 });
|
const chromeOptions = new Options().windowSize({ width: 1280, height: 1024 });
|
||||||
if (process.env.HEADLESS) options.addArguments('headless');
|
if (process.env.CI) chromeOptions.addArguments('no-sandbox', 'disable-dev-shm-usage', 'headless');
|
||||||
|
browser = new Builder().forBrowser('chrome').setChromeOptions(chromeOptions).build();
|
||||||
browser = new Builder().forBrowser('chrome').setChromeOptions(options).build();
|
if (!fs.existsSync('./screenshots')) fs.mkdirSync('./screenshots');
|
||||||
});
|
});
|
||||||
|
|
||||||
after(function () {
|
after(function () {
|
||||||
browser.quit();
|
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() {
|
function getAppInfo() {
|
||||||
var inspect = JSON.parse(execSync('cloudron inspect'));
|
var inspect = JSON.parse(execSync('cloudron inspect'));
|
||||||
app = inspect.apps.filter(function (a) { return a.location.indexOf(LOCATION) === 0; })[0];
|
app = inspect.apps.filter(function (a) { return a.location.indexOf(LOCATION) === 0; })[0];
|
||||||
|
|
Loading…
Reference in New Issue