Skip to content

Commit

Permalink
Fix lint error
Browse files Browse the repository at this point in the history
  • Loading branch information
ivanblinov2k17 committed Jan 27, 2025
1 parent 6ef1a27 commit 7976970
Showing 1 changed file with 30 additions and 32 deletions.
62 changes: 30 additions & 32 deletions apps/demos/testing/common.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ const SKIPPED_TESTS = {
return;
}
runTestAtPage(
test,
test,
pageURL,
skipJsErrorsComponents.includes(widgetName),
)
Expand All @@ -398,58 +398,56 @@ const SKIPPED_TESTS = {
if (approach === 'Angular') {
await waitForAngularLoading();
}

if (testCodeSource) {
await execCode(testCodeSource);
}

if (testCafeCodeSource) {
await execTestCafeCode(t, testCafeCodeSource);
}

if (process.env.STRATEGY === 'accessibility') {
const specificSkipRules = getTestSpecificSkipRules(testName);
const options = { rules: { } };
const options = { rules: {} };

[...COMMON_SKIP_RULES, ...specificSkipRules].forEach((ruleName) => {
options.rules[ruleName] = { enabled: false };
});

const axeResult = await axeCheck(t, '.demo-container', options);
const { error, results } = axeResult;

if (results.violations.length > 0) {
createMdReport({ testName, results });
await t.report(createTestCafeReport(results.violations));
}
}

await t.expect(error).notOk();
await t.expect(results.violations.length === 0).ok(createReport(results.violations));
} else {
const testTheme = process.env.THEME;
await t.expect(error).notOk();
await t.expect(results.violations.length === 0).ok(createReport(results.violations));
} else {
const testTheme = process.env.THEME;

if (shouldSkipDemo(approach, widgetName, demoName, SKIPPED_TESTS)) {
return;
}
if (shouldSkipDemo(approach, widgetName, demoName, SKIPPED_TESTS)) {
return;
}

let comparisonResult;
if (isGitHubDemos) {
comparisonResult = await compareScreenshot(t, `${testName}${getThemePostfix(testTheme)}.png`, undefined, (comparisonOptions && {
...comparisonOptions,
...{ looksSameComparisonOptions: { antialiasingTolerance: 10 } },
}));
} else {
comparisonResult = await compareScreenshot(t, `${testName}${getThemePostfix(testTheme)}.png`, undefined, comparisonOptions);
}
let comparisonResult;
if (isGitHubDemos) {
comparisonResult = await compareScreenshot(t, `${testName}${getThemePostfix(testTheme)}.png`, undefined, (comparisonOptions && {
...comparisonOptions,
...{ looksSameComparisonOptions: { antialiasingTolerance: 10 } },
}));
} else {
comparisonResult = await compareScreenshot(t, `${testName}${getThemePostfix(testTheme)}.png`, undefined, comparisonOptions);
}

const consoleMessages = await t.getBrowserConsoleMessages();
const consoleMessages = await t.getBrowserConsoleMessages();

const errors = [...consoleMessages.error, ...consoleMessages.warn]
.filter((e) => !knownWarnings.some((kw) => e.startsWith(kw)));
const errors = [...consoleMessages.error, ...consoleMessages.warn]
.filter((e) => !knownWarnings.some((kw) => e.startsWith(kw)));

await t.expect(errors).eql([]);
await t.expect(comparisonResult).ok('INVALID_SCREENSHOT');
}
});
await t.expect(errors).eql([]);
await t.expect(comparisonResult).ok('INVALID_SCREENSHOT');
}
});
});
});

0 comments on commit 7976970

Please sign in to comment.