Browse Source

Tests(DPxAI): update test for class-it

CON-3221-Fix-the-class-it-test-so-it-accepts-reverted-order-of-classes
Toussaint Louis 2 weeks ago committed by GitHub
parent
commit
050a618215
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 25
      dom/class-it_test.js

25
dom/class-it_test.js

@ -26,11 +26,20 @@ tests.push(async ({ page, eq }) => {
}) })
tests.push(async ({ page, eq }) => { tests.push(async ({ page, eq }) => {
// check that the targetted elements have the correct class names // Helper function to check if an element has the expected classes
await eq.$('p#eye-left', { className: 'eye' }) async function hasClasses(selector, expectedClasses) {
await eq.$('p#eye-right', { className: 'eye' }) const element = await page.$(selector);
await eq.$('div#arm-left', { className: 'arm body-member' }) const className = await element.evaluate(el => el.className);
await eq.$('div#arm-right', { className: 'arm body-member' }) const classList = className.split(' ').sort();
await eq.$('div#leg-left', { className: 'leg body-member' }) const expectedClassList = expectedClasses.split(' ').sort();
await eq.$('div#leg-right', { className: 'leg body-member' }) return JSON.stringify(classList) === JSON.stringify(expectedClassList);
}) }
// Check that the target elements have the correct classes
eq(await hasClasses('p#eye-left', 'eye'), true);
eq(await hasClasses('p#eye-right', 'eye'), true);
eq(await hasClasses('div#arm-left', 'arm body-member'), true);
eq(await hasClasses('div#arm-right', 'arm body-member'), true);
eq(await hasClasses('div#leg-left', 'leg body-member'), true);
eq(await hasClasses('div#leg-right', 'leg body-member'), true);
});

Loading…
Cancel
Save