Skip to content

Commit 12a4f01

Browse files
experiment: add console logs with DOM info
1 parent c0e4475 commit 12a4f01

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

packages/devextreme-cli/testing/app-template.test.shared.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,13 +217,38 @@ module.exports = (env, { port = 8080, urls = {} } = {}) => {
217217
compareSnapshot(image, 'toggle');
218218
});
219219

220+
function getPopulatedProperties(elementStyles) {
221+
for(const prop in elementStyles) {
222+
if(
223+
// Check the property belongs to the CSSStyleProperties instance
224+
// Check property has a numeric index (indicates inline/dash-named style)
225+
Object.hasOwn(elementStyles, prop) &&
226+
!Number.isNaN(Number.parseInt(prop, 10))
227+
) {
228+
console.log(
229+
`${elementStyles[prop]} = '${elementStyles.getPropertyValue(
230+
elementStyles[prop],
231+
)}'`,
232+
);
233+
}
234+
}
235+
}
236+
220237
it('User panel', async() => {
221238
await openPage(getPageURL('profile'));
222239
const isCompact = await page.$('.dx-toolbar-item-invisible .user-button');
223240
await page.click(isCompact ? '.dx-dropdownmenu-button' : '.user-button');
224241
// NOTE: Wait for animation complete
225242
await new Promise(r => setTimeout(r, 2000));
226243
await page.waitForSelector('.dx-toolbar-item div::-p-text(My App)');
244+
if(env.engine.startsWith('nextjs')) {
245+
const html = await page.$eval('.header-component .dx-toolbar-before', el => el.innerHTML);
246+
console.log('********** Toolbar Inner HTML', html);
247+
// eslint-disable-next-line
248+
const styles = await page.$eval('.header-component .dx-toolbar .dx-item div::-p-text(My App)', el => window.getComputedStyle(el));
249+
console.log('********** Title Styles');
250+
getPopulatedProperties(styles);
251+
}
227252
const image = await takeScreenshot({
228253
clip: {
229254
x: viewport.width - 300,

0 commit comments

Comments
 (0)