-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathresize-fixed-rotate.tc.ts
39 lines (28 loc) · 1.19 KB
/
resize-fixed-rotate.tc.ts
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
import { fixture, test } from "testcafe";
import {
getWindowOrientation,
Orientation,
resizeToLandscape,
resizeToPortrait
} from "./tools";
fixture("resize strategies for fixed sized browsers")
.meta({viewPort: "fixed"})
.page("about:blank");
test("rotate()", async t => {
const isLandscape = await getWindowOrientation() === "LANDSCAPE";
const expectedOrientation: Orientation = isLandscape ? "PORTRAIT" : "LANDSCAPE";
if(isLandscape) await resizeToPortrait(t);
else await resizeToLandscape(t);
await t.expect(getWindowOrientation()).eql(expectedOrientation, "Orientation did not change!");
});
test("rotate() and back", async t => {
const initialOrientation = await getWindowOrientation();
const isLandscape = initialOrientation === "LANDSCAPE";
const expectedOrientation: Orientation = isLandscape ? "PORTRAIT" : "LANDSCAPE";
if(isLandscape) await resizeToPortrait(t);
else await resizeToLandscape(t);
await t.expect(getWindowOrientation()).eql(expectedOrientation, "Orientation did not change!");
if(isLandscape) await resizeToLandscape(t);
else await resizeToPortrait(t);
await t.expect(getWindowOrientation()).eql(initialOrientation, "Orientation did not change!");
});