View | Details | Raw Unified | Return to bug 39320
Collapse All | Expand All

(-)a/t/cypress/integration/ERM/ModuleDashboard_spec.ts (-68 / +56 lines)
Lines 43-51 describe("ERM Module Dashboard", () => { Link Here
43
            },
43
            },
44
        }).as("getDataProvidersCount");
44
        }).as("getDataProvidersCount");
45
45
46
        cy.intercept("GET", "/api/v1/erm/usage_data_providers/1", {
47
            statusCode: 200,
48
            body: cy.get_usage_data_provider(),
49
        }).as("getDataProvider");
50
46
        cy.intercept(
51
        cy.intercept(
47
            "GET",
52
            "GET",
48
            "/api/v1/erm/default_usage_reports",
53
            "/api/v1/erm/default_usage_reports*",
49
            cy.get_eusage_reports()
54
            cy.get_eusage_reports()
50
        ).as("getReports");
55
        ).as("getReports");
51
56
Lines 123-137 describe("ERM Module Dashboard", () => { Link Here
123
        }).as("get-ERM-av-cats-values");
128
        }).as("get-ERM-av-cats-values");
124
    });
129
    });
125
130
126
    it("Counts", () => {
131
    it("Run eUsage report empty", () => {
132
        cy.intercept("GET", "/api/v1/erm/default_usage_reports", []).as(
133
            "emptyReports"
134
        );
127
        cy.visit("/cgi-bin/koha/erm/erm.pl");
135
        cy.visit("/cgi-bin/koha/erm/erm.pl");
128
136
129
        //Display
137
        //Display
138
        cy.get(".widget#ERMRunUsageReport .widget-content").should(
139
            "contain",
140
            "Loading..."
141
        );
142
143
        cy.wait("@getLicenses");
144
        cy.wait("@getJobs");
145
        cy.wait("@emptyReports");
130
        cy.wait("@getAgreementsCount");
146
        cy.wait("@getAgreementsCount");
131
        cy.wait("@getLicenses");
147
        cy.wait("@getLicenses");
132
        cy.wait("@getPackagesCount");
148
        cy.wait("@getPackagesCount");
133
        cy.wait("@getTitlesCount");
149
        cy.wait("@getTitlesCount");
134
        cy.wait("@getDataProvidersCount");
150
        cy.wait("@getDataProvidersCount");
151
152
        cy.get(".widget#ERMRunUsageReport .widget-content").should(
153
            "contain",
154
            "No saved eUsage reports are available to run."
155
        );
156
        cy.get(".widget#ERMRunUsageReport .widget-content")
157
            .find("a")
158
            .should("have.attr", "href", "/cgi-bin/koha/erm/eusage/reports")
159
            .contains("Create a report");
160
    });
161
162
    it("ERM dashboard widgets", () => {
163
        cy.visit("/cgi-bin/koha/erm/erm.pl");
164
165
        //ERMLicensesNeedingAction loading
166
        cy.get(".widget#ERMLicensesNeedingAction .widget-content").should(
167
            "contain",
168
            "Loading..."
169
        );
170
        //ERMLatestSUSHIJobs loading
171
        cy.get(".widget#ERMLatestSUSHIJobs .widget-content").should(
172
            "contain",
173
            "Loading..."
174
        );
175
        cy.wait("@getLicenses");
176
        cy.wait("@getJobs");
177
        cy.wait("@getReports");
178
        cy.wait("@getAgreementsCount");
179
        cy.wait("@getLicenses");
180
        cy.wait("@getPackagesCount");
181
        cy.wait("@getTitlesCount");
182
        cy.wait("@getDataProvidersCount");
183
184
        //ERMCounts
135
        cy.get(".widget#ERMCounts .widget-content").contains("1 agreement");
185
        cy.get(".widget#ERMCounts .widget-content").contains("1 agreement");
136
        cy.get(".widget#ERMCounts .widget-content").contains("5 licenses");
186
        cy.get(".widget#ERMCounts .widget-content").contains("5 licenses");
137
        cy.get(".widget#ERMCounts .widget-content").contains(
187
        cy.get(".widget#ERMCounts .widget-content").contains(
Lines 206-239 describe("ERM Module Dashboard", () => { Link Here
206
            .children()
256
            .children()
207
            .first()
257
            .first()
208
            .should("have.id", "ERMCounts");
258
            .should("have.id", "ERMCounts");
209
    });
210
211
    it("Run eUsage report empty", () => {
212
        cy.intercept("GET", "/api/v1/erm/default_usage_reports", []).as(
213
            "emptyReports"
214
        );
215
        cy.visit("/cgi-bin/koha/erm/erm.pl");
216
217
        //Display
218
        cy.get(".widget#ERMRunUsageReport .widget-content").should(
219
            "contain",
220
            "Loading..."
221
        );
222
        cy.wait("@emptyReports");
223
        cy.get(".widget#ERMRunUsageReport .widget-content").should(
224
            "contain",
225
            "No saved eUsage reports are available to run."
226
        );
227
        cy.get(".widget#ERMRunUsageReport .widget-content")
228
            .find("a")
229
            .should("have.attr", "href", "/cgi-bin/koha/erm/eusage/reports")
230
            .contains("Create a report");
231
    });
232
233
    it("Run eUsage report: exists", () => {
234
        cy.visit("/cgi-bin/koha/erm/erm.pl");
235
        cy.wait("@getReports");
236
259
260
        //ERMRunUsageReport
237
        cy.get(".widget#ERMRunUsageReport .widget-content")
261
        cy.get(".widget#ERMRunUsageReport .widget-content")
238
            .find(".v-select")
262
            .find(".v-select")
239
            .should("exist");
263
            .should("exist");
Lines 252-268 describe("ERM Module Dashboard", () => { Link Here
252
            .find("button")
276
            .find("button")
253
            .contains("Run")
277
            .contains("Run")
254
            .should("not.be.disabled");
278
            .should("not.be.disabled");
255
        cy.get(
256
            ".widget#ERMRunUsageReport .widget-content button.btn-primary"
257
        ).click();
258
        cy.url().should("match", /erm\/eusage\/reports\/viewer/);
259
260
        cy.intercept(
261
            "GET",
262
            "/api/v1/erm/default_usage_reports",
263
            cy.get_eusage_reports()
264
        );
265
        cy.visit("/cgi-bin/koha/erm/erm.pl");
266
279
267
        //Move
280
        //Move
268
        cy.get(
281
        cy.get(
Lines 298-314 describe("ERM Module Dashboard", () => { Link Here
298
            .children()
311
            .children()
299
            .first()
312
            .first()
300
            .should("have.id", "ERMRunUsageReport");
313
            .should("have.id", "ERMRunUsageReport");
301
    });
302
314
303
    it("Licenses needing action", () => {
315
        // ERMLicensesNeedingAction
304
        cy.visit("/cgi-bin/koha/erm/erm.pl");
305
306
        //Display
307
        cy.get(".widget#ERMLicensesNeedingAction .widget-content").should(
308
            "contain",
309
            "Loading..."
310
        );
311
        cy.wait("@getLicenses");
312
        cy.get(
316
        cy.get(
313
            ".widget#ERMLicensesNeedingAction .widget-content table tbody tr:first"
317
            ".widget#ERMLicensesNeedingAction .widget-content table tbody tr:first"
314
        ).contains("license 1");
318
        ).contains("license 1");
Lines 367-396 describe("ERM Module Dashboard", () => { Link Here
367
            .children()
371
            .children()
368
            .first()
372
            .first()
369
            .should("have.id", "ERMLicensesNeedingAction");
373
            .should("have.id", "ERMLicensesNeedingAction");
370
    });
371
374
372
    it("Latest SUSHI Counter jobs", () => {
375
        //ERMLatestSUSHIJobs
373
        cy.visit("/cgi-bin/koha/erm/erm.pl");
374
375
        //Display
376
        cy.get(".widget#ERMLatestSUSHIJobs .widget-content").should(
377
            "contain",
378
            "Loading..."
379
        );
380
        cy.wait("@getJobs");
381
        cy.get(
376
        cy.get(
382
            ".widget#ERMLatestSUSHIJobs .widget-content table tbody tr td:first"
377
            ".widget#ERMLatestSUSHIJobs .widget-content table tbody tr td:first"
383
        ).contains("Finished");
378
        ).contains("Finished");
384
379
385
        cy.get(
380
        cy.get(
386
            ".widget#ERMLatestSUSHIJobs .widget-content table tbody tr td:nth-child(2)"
381
            ".widget#ERMLatestSUSHIJobs .widget-content table tbody tr td:nth-child(2)"
387
        )
382
        ).contains("Wiley Online Library");
388
            .contains("Wiley Online Library")
389
            .click();
390
391
        cy.url().should("match", /erm\/eusage\/usage_data_providers/);
392
393
        cy.visit("/cgi-bin/koha/erm/erm.pl");
394
383
395
        cy.get(
384
        cy.get(
396
            ".widget#ERMLatestSUSHIJobs .widget-content table tbody tr td:nth-child(5)"
385
            ".widget#ERMLatestSUSHIJobs .widget-content table tbody tr td:nth-child(5)"
397
- 

Return to bug 39320