@datagrok/api-tests
Advanced tools
Comparing version 1.4.0 to 1.4.1
{ | ||
"name": "@datagrok/api-tests", | ||
"friendlyName": "API Tests", | ||
"version": "1.4.0", | ||
"version": "1.4.1", | ||
"author": { | ||
@@ -16,3 +16,3 @@ "name": "Alexander Paramonov", | ||
"dependencies": { | ||
"@datagrok-libraries/utils": "^1.11.1", | ||
"@datagrok-libraries/utils": "^1.14.1", | ||
"cash-dom": "^8.1.1", | ||
@@ -19,0 +19,0 @@ "datagrok-api": "^1.8.1", |
@@ -31,19 +31,21 @@ import * as grok from 'datagrok-api/grok'; | ||
if ((await grok.dapi.packages.filter('PowerPack').list()).length > 0) | ||
return; | ||
let tv: DG.TableView; | ||
subs.push(grok.events.onDialogShown.subscribe((d) => { | ||
if (d.title == 'Add New Column') | ||
resolve('OK'); | ||
dialogs.push(d); | ||
})); | ||
setTimeout(() => { | ||
// eslint-disable-next-line prefer-promise-reject-errors | ||
reject('Dialog not found'); | ||
}, 1000); | ||
try { | ||
tv = grok.shell.addTableView(df); | ||
await df.dialogs.addNewColumn(); | ||
} finally { | ||
tv!.close(); | ||
grok.shell.closeTable(df); | ||
resolve('Skipped because PowerPack is installed'); | ||
else { | ||
let tv: DG.TableView; | ||
subs.push(grok.events.onDialogShown.subscribe((d) => { | ||
if (d.title == 'Add New Column') | ||
resolve('OK'); | ||
dialogs.push(d); | ||
})); | ||
setTimeout(() => { | ||
// eslint-disable-next-line prefer-promise-reject-errors | ||
reject('Dialog not found'); | ||
}, 1000); | ||
try { | ||
tv = grok.shell.addTableView(df); | ||
await df.dialogs.addNewColumn(); | ||
} finally { | ||
tv!.close(); | ||
grok.shell.closeTable(df); | ||
} | ||
} | ||
@@ -54,17 +56,19 @@ })); | ||
if ((await grok.dapi.packages.filter('PowerPack').list()).length > 0) | ||
return; | ||
subs.push(grok.events.onDialogShown.subscribe((d) => { | ||
if (d.title == 'Add New Column') | ||
resolve('OK'); | ||
dialogs.push(d); | ||
})); | ||
try { | ||
setTimeout(() => { | ||
// eslint-disable-next-line prefer-promise-reject-errors | ||
reject('Dialog not found'); | ||
}, 1000); | ||
const column = await df.columns.addNewCalculated('editable', '0'); | ||
column.dialogs.editFormula(); | ||
} finally { | ||
df.columns.remove('editable'); | ||
resolve('Skipped because PowerPack is installed'); | ||
else { | ||
subs.push(grok.events.onDialogShown.subscribe((d) => { | ||
if (d.title == 'Add New Column') | ||
resolve('OK'); | ||
dialogs.push(d); | ||
})); | ||
try { | ||
setTimeout(() => { | ||
// eslint-disable-next-line prefer-promise-reject-errors | ||
reject('Dialog not found'); | ||
}, 1000); | ||
const column = await df.columns.addNewCalculated('editable', '0'); | ||
column.dialogs.editFormula(); | ||
} finally { | ||
df.columns.remove('editable'); | ||
} | ||
} | ||
@@ -71,0 +75,0 @@ })); |
import {after, before, category, delay, expect, test} from '@datagrok-libraries/utils/src/test'; | ||
import * as grok from 'datagrok-api/grok'; | ||
import * as ui from 'datagrok-api/ui'; | ||
import * as DG from 'datagrok-api/dg'; | ||
import {getHTMLElementbyInnerText, isViewerPresent, isDialogPresent, returnDialog, setDialogInputValue, checkHTMLElementbyInnerText, isColumnPresent} from './gui-utils'; | ||
import { Viewer } from 'datagrok-api/dg'; | ||
@@ -8,0 +6,0 @@ category('Chem: ToInchi', () => { |
@@ -169,2 +169,30 @@ import * as grok from 'datagrok-api/grok'; | ||
test('testViewersLayout', async () => { | ||
let viewers = DG.Viewer.getViewerTypes().filter(vt => !vt.toLowerCase().includes('widget')); | ||
const skipViewers = ['3d scatter plot', 'Network diagram']; | ||
let layout, res, errorViewers = [], i = 0; | ||
for (let v of viewers) { | ||
if (skipViewers.includes(v)) continue; | ||
res = []; | ||
try { | ||
tv.addViewer(v); | ||
res.push(Array.from(tv.viewers).length); | ||
layout = tv.saveLayout(); | ||
tv.resetLayout(); | ||
res.push(Array.from(tv.viewers).length); | ||
tv.loadLayout(layout); | ||
res.push(Array.from(tv.viewers).length); | ||
} finally { | ||
i++; | ||
if (!(res[0] === 2 && res[1] === 1 && res[2] === 2)) errorViewers.push([v, res]); | ||
tv.resetLayout(); | ||
} | ||
} | ||
grok.shell.info(`Tested ${i} viewers of ${viewers.length}, skipped ${skipViewers.length}, error in ${errorViewers.length}`); | ||
if (errorViewers.length !== 0) throw `Error viewers: ${errorViewers}`; | ||
}); | ||
after(async () => { | ||
@@ -171,0 +199,0 @@ tv.close(); |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3236897
157
19366