Files
halo-dark-mode-plugin/third-party/darkreader/tests/browser/e2e/devtools.tests.ts
T

83 lines
2.4 KiB
TypeScript

import {multiline} from '../../support/test-utils';
import type {StyleExpectations} from '../globals';
async function loadBasicPage() {
await loadTestPage({
'/': multiline(
'<!DOCTYPE html>',
'<html>',
'<head>',
' <style>',
' h1 { color: red; }',
' </style>',
'</head>',
'<body>',
' <h1>E2E test page</h1>',
' <p>Text</p>',
' <a href="#">Link</a>',
'</body>',
'</html>',
),
});
}
async function expectStyles(styles: StyleExpectations) {
await expectPageStyles(expect, styles);
}
describe('Modifying config via Developer tools', () => {
it('Modifying config', async () => {
await loadBasicPage();
await expectStyles([
['document', 'background-color', 'rgb(24, 26, 27)'],
['document', 'color', 'rgb(232, 230, 227)'],
['body', 'background-color', 'rgb(24, 26, 27)'],
['body', 'color', 'rgb(232, 230, 227)'],
['h1', 'color', 'rgb(255, 26, 26)'],
['a', 'color', 'rgb(51, 145, 255)'],
]);
await devtoolsUtils.paste([
'*',
'',
'CSS',
'h1 {',
' background: black;',
' color: white;',
'}',
'',
'============================',
'',
'nonexistent.com',
'',
'CSS',
'h1 {',
' color: red;',
'}',
'',
].join('\n'));
await expectStyles([
['document', 'background-color', 'rgb(24, 26, 27)'],
['document', 'color', 'rgb(232, 230, 227)'],
['body', 'background-color', 'rgb(24, 26, 27)'],
['body', 'color', 'rgb(232, 230, 227)'],
['h1', 'background-color', 'rgb(0, 0, 0)'],
['h1', 'color', 'rgb(255, 255, 255)'],
['a', 'color', 'rgb(51, 145, 255)'],
]);
await devtoolsUtils.reset();
await expectStyles([
['document', 'background-color', 'rgb(24, 26, 27)'],
['document', 'color', 'rgb(232, 230, 227)'],
['body', 'background-color', 'rgb(24, 26, 27)'],
['body', 'color', 'rgb(232, 230, 227)'],
['h1', 'color', 'rgb(255, 26, 26)'],
['a', 'color', 'rgb(51, 145, 255)'],
]);
});
});