Skip to content

Commit

Permalink
Added gui tests
Browse files Browse the repository at this point in the history
  • Loading branch information
GermanBluefox committed Dec 15, 2023
1 parent 8f925e9 commit 566304a
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 2 deletions.
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,14 @@
"@alcalzone/release-script": "^3.7.0",
"@alcalzone/release-script-plugin-iobroker": "^3.7.0",
"@alcalzone/release-script-plugin-license": "^3.7.0",
"@iobroker/legacy-testing": "^1.0.3",
"@iobroker/legacy-testing": "^1.0.4",
"chai": "^4.3.10",
"colorette": "^2.0.20",
"gulp": "^4.0.2",
"gulp-replace": "^1.1.4",
"iobroker.web": "*",
"mocha": "^10.2.0",
"chai": "^4.3.10"
"puppeteer": "^21.6.1"
},
"bugs": {
"url": "https://github.com/iobroker/iobroker.vis/issues"
Expand Down
55 changes: 55 additions & 0 deletions test/testAdapter.gui.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
const helper = require('@iobroker/vis-2-widgets-testing');

let gPage;
let gBrowser;

describe('vis', () => {
before(async function (){
this.timeout(180_000);

// install js-controller, web and vis-2
await helper.startIoBroker({
startOwnAdapter: true,
additionalAdapters: ['web'],
visUploadedId: 'vis.0.info.uploaded',
mainGuiProject: 'vis',
});
const { browser, page } = await helper.startBrowser(process.env.CI === 'true');
gBrowser = browser
gPage = page
// await helper.createProject();

// open widgets
// await helper.palette.openWidgetSet(gPage, 'basic');
await helper.screenshot(gPage, '02_widgets_opened');
});

it('Check runtime', async function (){
this.timeout(20_000);
// add widget in editor
const basicWidgets = await helper.palette.getListOfWidgets(gPage, 'basic');
// const wid = await helper.palette.addWidget(gPage, basicWidgets[0], true);
// wait for saving
// await new Promise(resolve => setTimeout(resolve, 5_000));

await helper.screenshot(gPage, '90_runtime');

const runtimePage = await gBrowser.newPage();

// open runtime
await runtimePage.goto(`http://127.0.0.1:18082/vis/index.html`, { waitUntil: 'domcontentloaded' });
await runtimePage.waitForSelector('#root', { timeout: 5_000 });
// await runtimePage.waitForSelector(`#${wid}`, { timeout: 20_000 });
await helper.screenshot(runtimePage, '91_runtime');

await runtimePage.close();
});

after(async function () {
this.timeout(5_000);
await helper.stopBrowser();
console.log('BROWSER stopped');
await helper.stopIoBroker();
console.log('ioBroker stopped');
});
});

0 comments on commit 566304a

Please sign in to comment.