Skip to content

Commit

Permalink
Added GUI CI
Browse files Browse the repository at this point in the history
  • Loading branch information
GermanBluefox committed Aug 17, 2024
1 parent e52f368 commit 1e24cc5
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 122 deletions.
8 changes: 7 additions & 1 deletion .github/workflows/test-and-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ jobs:
- name: Install Dependencies
run: npm install

- name: Build
run: npm run build

# - name: Perform a type check
# run: npm run check:ts
# env:
Expand Down Expand Up @@ -112,6 +115,9 @@ jobs:
- name: Install Dependencies
run: npm install

- name: Build
run: npm run build

# - name: Create a clean build
# run: npm run build
- name: Publish package to npm
Expand Down Expand Up @@ -145,4 +151,4 @@ jobs:
sentry-cli releases finalize $SENTRY_VERSION
# Add the following line BEFORE finalize if sourcemap uploads are needed
# sentry-cli releases files $SENTRY_VERSION upload-sourcemaps build/
# sentry-cli releases files $SENTRY_VERSION upload-sourcemaps build/
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ src-admin/build
src-admin/node_modules
package-lock.json
src-admin/package-lock.json
*.tgz
6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,13 @@
"@alcalzone/release-script-plugin-license": "^3.7.0",
"@alcalzone/release-script-plugin-manual-review": "^3.7.0",
"@iobroker/adapter-dev": "^1.3.0",
"@iobroker/testing": "^4.1.3",
"@iobroker/legacy-testing": "^1.0.12",
"axios": "^1.7.4",
"mocha": "^10.7.3",
"chai": "^4.5.0"
"chai": "^4.5.0",
"colorette": "^2.0.20",
"puppeteer": "^23.1.0"
},
"bugs": {
"url": "https://github.com/ioBroker/ioBroker.ping/issues"
Expand All @@ -51,6 +54,7 @@
],
"scripts": {
"test": "node node_modules/mocha/bin/mocha --exit",
"build": "cd src-admin && npm i -f && npm run build",
"release": "release-script",
"release-patch": "release-script patch --yes",
"release-minor": "release-script minor --yes",
Expand Down
34 changes: 0 additions & 34 deletions test/testAdapter.gui.js

This file was deleted.

12 changes: 10 additions & 2 deletions test/testFunctions.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ describe('Test PING', function () {
before('Test PING: Start js-controller', function (_done) {
this.timeout(600000); // because of the first installation from npm

setup.setupController(['ping', 'admin'], async systemConfig => {
setup.setupController(['admin'], async systemConfig => {
// disable statistics and set license accepted
systemConfig.common.licenseConfirmed = true;
systemConfig.common.diag = 'none';
Expand Down Expand Up @@ -240,9 +240,17 @@ describe('Test PING', function () {

it('Test GUI', async () => {
await gPage.goto(`http://127.0.0.1:18081/#tab-instances/config/system.adapter.ping.0`, { waitUntil: 'domcontentloaded' });
await gPage.waitForSelector('button.MuiTab-root', { timeout: 20_000 });
// if slow connection dialog is opened, close it
const cancel = await gPage.$$('#ar_dialog_confirm_cancel_');
if (cancel.length) {
await cancel[0].click();
}
const buttons = await gPage.$$('button.MuiTab-root');
buttons[2].click();
await gPage.waitForSelector('.ping_custom', { timeout: 20_000 });
await screenshot(gPage, '01_instance');
}).timeout(10000)
}).timeout(60000);

after('Test PING: Stop js-controller', function (done) {
this.timeout(6000);
Expand Down
88 changes: 4 additions & 84 deletions test/testPackageFiles.js
Original file line number Diff line number Diff line change
@@ -1,85 +1,5 @@
/* jshint -W097 */
/* jshint strict:false */
/* jslint node: true */
/* jshint expr: true */
'use strict';
const path = require('node:path');
const { tests } = require('@iobroker/testing');

const expect = require('chai').expect;
const fs = require('fs');

describe('Test package.json and io-package.json', () => {
it('Test package files', done => {
console.log();

const fileContentIOPackage = fs.readFileSync(__dirname + '/../io-package.json', 'utf8');
const ioPackage = JSON.parse(fileContentIOPackage);

const fileContentNPMPackage = fs.readFileSync(__dirname + '/../package.json', 'utf8');
const npmPackage = JSON.parse(fileContentNPMPackage);

expect(ioPackage).to.be.an('object');
expect(npmPackage).to.be.an('object');

expect(ioPackage.common.version, 'ERROR: Version number in io-package.json needs to exist').to.exist;
expect(npmPackage.version, 'ERROR: Version number in package.json needs to exist').to.exist;

expect(ioPackage.common.version, 'ERROR: Version numbers in package.json and io-package.json needs to match').to.be.equal(npmPackage.version);

if (!ioPackage.common.news || !ioPackage.common.news[ioPackage.common.version]) {
console.log('WARNING: No news entry for current version exists in io-package.json, no rollback in Admin possible!');
console.log();
}

expect(npmPackage.author, 'ERROR: Author in package.json needs to exist').to.exist;
expect(ioPackage.common.authors, 'ERROR: Authors in io-package.json needs to exist').to.exist;

expect(ioPackage.common.license, 'ERROR: License missing in io-package in common.license').to.exist;

if (ioPackage.common.name.indexOf('template') !== 0) {
if (Array.isArray(ioPackage.common.authors)) {
expect(ioPackage.common.authors.length, 'ERROR: Author in io-package.json needs to be set').to.not.be.equal(0);
if (ioPackage.common.authors.length === 1) {
expect(ioPackage.common.authors[0], 'ERROR: Author in io-package.json needs to be a real name').to.not.be.equal('my Name <[email protected]>');
}
}
else {
expect(ioPackage.common.authors, 'ERROR: Author in io-package.json needs to be a real name').to.not.be.equal('my Name <[email protected]>');
}
}
else {
console.log('WARNING: Testing for set authors field in io-package skipped because template adapter');
console.log();
}
expect(fs.existsSync(__dirname + '/../README.md'), 'ERROR: README.md needs to exist! Please create one with description, detail information and changelog. English is mandatory.').to.be.true;
if (!ioPackage.common.titleLang || typeof ioPackage.common.titleLang !== 'object') {
console.log('WARNING: titleLang is not existing in io-package.json. Please add');
console.log();
}
if (!ioPackage.common.controller && !ioPackage.common.onlyWWW && !ioPackage.common.noConfig) {
if (!ioPackage.common.materialize || !fs.existsSync(__dirname + '/../admin/index_m.html') || !fs.existsSync(__dirname + '/../gulpfile.js')) {
console.log('WARNING: Admin3 support is missing! Please add it');
console.log();
}
if (ioPackage.common.materialize) {
expect(fs.existsSync(__dirname + '/../admin/index_m.html'), 'Admin3 support is enabled in io-package.json, but index_m.html is missing!').to.be.true;
}
}

const licenseFileExists = fs.existsSync(__dirname + '/../LICENSE');
const fileContentReadme = fs.readFileSync(__dirname + '/../README.md', 'utf8');
if (fileContentReadme.indexOf('## Changelog') === -1) {
console.log('Warning: The README.md should have a section ## Changelog');
console.log();
}
expect((licenseFileExists || fileContentReadme.indexOf('## License') !== -1), 'A LICENSE must exist as LICENSE file or as part of the README.md').to.be.true;
if (!licenseFileExists) {
console.log('Warning: The License should also exist as LICENSE file');
console.log();
}
if (fileContentReadme.indexOf('## License') === -1) {
console.log('Warning: The README.md should also have a section ## License to be shown in Admin3');
console.log();
}
done();
});
});
// Validate the package files
tests.packageFiles(path.join(__dirname, '..'));

0 comments on commit 1e24cc5

Please sign in to comment.