blob: 9f771315fe9c848fea478d0079df737477c0c3a9 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
import * as path from "path";
import * as assert from "assert";
import TestServer from "./lib/TestServer";
import { Builder, Lanthan } from "lanthan";
import { WebDriver } from "selenium-webdriver";
import { Options as FirefoxOptions } from "selenium-webdriver/firefox";
import Page from "./lib/Page";
describe("colorscheme test", () => {
const server = new TestServer();
let lanthan: Lanthan;
let webdriver: WebDriver;
let page: Page;
beforeAll(async () => {
const opts = (new FirefoxOptions() as any).setPreference(
"ui.systemUsesDarkTheme",
1
);
lanthan = await Builder.forBrowser("firefox")
.setOptions(opts)
.spyAddon(path.join(__dirname, ".."))
.build();
webdriver = lanthan.getWebDriver();
await server.start();
});
afterAll(async () => {
await server.stop();
if (lanthan) {
await lanthan.quit();
}
});
beforeEach(async () => {
page = await Page.navigateTo(webdriver, server.url());
});
it("changes color scheme by set command", async () => {
let console = await page.showConsole();
await console.execCommand("set colorscheme=dark");
await (webdriver.switchTo() as any).parentFrame();
console = await page.showConsole();
assert.strictEqual(await console.getTheme(), "dark");
await console.execCommand("set colorscheme=light");
await (webdriver.switchTo() as any).parentFrame();
console = await page.showConsole();
assert.strictEqual(await console.getTheme(), "light");
await console.execCommand("set colorscheme=system");
await (webdriver.switchTo() as any).parentFrame();
console = await page.showConsole();
assert.strictEqual(await console.getTheme(), "dark");
});
});
|