Execute tests within browser page context

This commit is contained in:
hensm
2019-01-11 13:47:19 +00:00
parent ab82229228
commit 242142313b
18 changed files with 7945 additions and 272 deletions

View File

@@ -1,34 +1,11 @@
"use strict";
const { create } = require("../../../driver");
describe("chrome.cast.Receiver", () => {
let driver;
beforeAll(async () => {
driver = await create();
});
afterAll(() => {
driver.quit();
})
it("should have all properties", async () => {
const [ typeof_friendlyName
, typeof_label
, receiver ] = await driver.executeScript(() => {
const receiver = new chrome.cast.Receiver();
const receiver = new chrome.cast.Receiver();
return [
typeof receiver.friendlyName
, typeof receiver.label
, receiver
];
});
expect(typeof_friendlyName).toBe("undefined");
expect(typeof_label).toBe("undefined");
expect(typeof receiver.friendlyName).toBe("undefined");
expect(typeof receiver.label).toBe("undefined");
expect(receiver.capabilities).toEqual([]);
expect(receiver.displayStatus).toBe(null);
expect(receiver.isActiveInput).toBe(null);
@@ -37,18 +14,16 @@ describe("chrome.cast.Receiver", () => {
});
it("should have expected assigned properties", async () => {
const error = await driver.executeScript(() => {
return new chrome.cast.Receiver(
"testLabel"
, "testFriendlyName"
, [ chrome.cast.Capability.VIDEO_OUT
, chrome.cast.Capability.AUDIO_OUT ]
, new chrome.cast.Volume(1, false));
});
const receiver = new chrome.cast.Receiver(
"testLabel"
, "testFriendlyName"
, [ chrome.cast.Capability.VIDEO_OUT
, chrome.cast.Capability.AUDIO_OUT ]
, new chrome.cast.Volume(1, false));
expect(error.capabilities).toEqual([ "video_out", "audio_out" ]);
expect(error.friendlyName).toBe("testFriendlyName");
expect(error.label).toBe("testLabel");
expect(error.volume).toEqual({ level: 1, muted: false });
expect(receiver.capabilities).toEqual([ "video_out", "audio_out" ]);
expect(receiver.friendlyName).toBe("testFriendlyName");
expect(receiver.label).toBe("testLabel");
expect(receiver.volume).toEqual(jasmine.objectContaining({ level: 1, muted: false }));
});
});