-
Notifications
You must be signed in to change notification settings - Fork 3.5k
/
Image_spec.js
89 lines (82 loc) · 2.98 KB
/
Image_spec.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
const commonlocators = require("../../../../../locators/commonlocators.json");
const viewWidgetsPage = require("../../../../../locators/ViewWidgets.json");
const publish = require("../../../../../locators/publishWidgetspage.json");
const widgetsPage = require("../../../../../locators/Widgets.json");
import {
agHelper,
dataManager,
deployMode,
} from "../../../../../support/Objects/ObjectsCore";
describe(
"Image Widget Functionality",
{ tags: ["@tag.Widget", "@tag.Image"] },
function () {
before(() => {
agHelper.AddDsl("displayWidgetDsl");
});
it("1. Image Widget Functionality", function () {
cy.openPropertyPane("imagewidget");
/**
* @param{Text} Random Text
* @param{ImageWidget}Mouseover
* @param{ImagePre Css} Assertion
*/
cy.widgetText(
"img",
viewWidgetsPage.imageWidget,
widgetsPage.widgetNameSpan,
);
cy.testJsontext("defaultimage", this.dataSet.defaultimage);
cy.wait(1000);
cy.focused().blur();
/**
* @param{URL} ImageUrl
*/
cy.testCodeMirror(this.dataSet.NewImage);
cy.get(viewWidgetsPage.imageinner)
.invoke("attr", "src")
.should("contain", this.dataSet.validateImage);
cy.closePropertyPane();
});
it("2. No Zoom functionality check", function () {
cy.openPropertyPane("imagewidget");
//Zoom validation
cy.changeZoomLevel("1x (No Zoom)");
cy.get(commonlocators.imgWidget)
.invoke("attr", "style")
.should("not.contain", "zoom-in");
deployMode.DeployApp(publish.imageWidget);
// Image Widget Functionality To Validate Image
cy.get(publish.imageWidget + " " + "img")
.invoke("attr", "src")
.should("contain", this.dataSet.NewImage);
});
it("3. Image Widget Functionality To Check/Uncheck Visible Widget", function () {
deployMode.NavigateBacktoEditor();
cy.openPropertyPane("imagewidget");
agHelper.CheckUncheck(commonlocators.visibleCheckbox, false);
deployMode.DeployApp();
cy.get(publish.imageWidget).should("not.exist");
deployMode.NavigateBacktoEditor();
//Image Widget Functionality To Check Visible Widget", function () {
cy.openPropertyPane("imagewidget");
agHelper.CheckUncheck(commonlocators.visibleCheckbox);
deployMode.DeployApp(publish.imageWidget);
deployMode.NavigateBacktoEditor();
});
it("4. In case of an image loading error, show off the error message", () => {
cy.openPropertyPane("imagewidget");
// Invalid image url
const invalidImageUrl =
"http:https://host.docker.internal:4200/photo-not-exists.jpeg";
cy.testCodeMirror(invalidImageUrl);
// Show off error message
cy.get(
`${viewWidgetsPage.imageWidget} div[data-testid=styledImage]`,
).should("not.exist");
cy.get(
`${viewWidgetsPage.imageWidget} [data-testid="error-container"]`,
).contains("Unable to display the image");
});
},
);