-
Notifications
You must be signed in to change notification settings - Fork 1
/
test.e2e.js
105 lines (85 loc) · 3 KB
/
test.e2e.js
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
const path = require("path");
const { expect } = intern.getPlugin("chai");
const { registerSuite } = intern.getInterface("object");
registerSuite("is-webp-extended", {
async "it should handle non-webp image"() {
await this.remote
.get("test.html")
.findById("input")
.type(path.join(__dirname, "fixtures/non-webp.png"))
.end()
.sleep(1000);
const isWebPText = await this.remote
.findById("isWebP")
.getVisibleText();
const isAnimatedWebPText = await this.remote
.findById("isAnimatedWebP")
.getVisibleText();
expect(isWebPText).to.be.eq("false", "isWebPText should be false");
expect(isAnimatedWebPText).to.be.eq("false", "isAnimatedWebPText should be false");
},
async "it should handle lossy webp image"() {
await this.remote
.get("test.html")
.findById("input")
.type(path.join(__dirname, "fixtures/lossy.webp"))
.end()
.sleep(1000);
const isWebPText = await this.remote
.findById("isWebP")
.getVisibleText();
const isAnimatedWebPText = await this.remote
.findById("isAnimatedWebP")
.getVisibleText();
expect(isWebPText).to.be.eq("true", "isWebPText should be true");
expect(isAnimatedWebPText).to.be.eq("false", "isAnimatedWebPText should be false");
},
async "it should handle lossless webp image"() {
await this.remote
.get("test.html")
.findById("input")
.type(path.join(__dirname, "fixtures/lossless.webp"))
.end()
.sleep(1000);
const isWebPText = await this.remote
.findById("isWebP")
.getVisibleText();
const isAnimatedWebPText = await this.remote
.findById("isAnimatedWebP")
.getVisibleText();
expect(isWebPText).to.be.eq("true", "isWebPText should be true");
expect(isAnimatedWebPText).to.be.eq("false", "isAnimatedWebPText should be false");
},
async "it should handle animated webp image"() {
await this.remote
.get("test.html")
.findById("input")
.type(path.join(__dirname, "fixtures/animated.webp"))
.end()
.sleep(1000);
const isWebPText = await this.remote
.findById("isWebP")
.getVisibleText();
const isAnimatedWebPText = await this.remote
.findById("isAnimatedWebP")
.getVisibleText();
expect(isWebPText).to.be.eq("true", "isWebPText should be true");
expect(isAnimatedWebPText).to.be.eq("true", "isAnimatedWebPText should be true");
},
async "it should handle extended webp image"() {
await this.remote
.get("test.html")
.findById("input")
.type(path.join(__dirname, "fixtures/exif-jeju.webp"))
.end()
.sleep(1000);
const isWebPText = await this.remote
.findById("isWebP")
.getVisibleText();
const isAnimatedWebPText = await this.remote
.findById("isAnimatedWebP")
.getVisibleText();
expect(isWebPText).to.be.eq("true", "isWebPText should be true");
expect(isAnimatedWebPText).to.be.eq("false", "isAnimatedWebPText should be false");
},
});