Bug 40320: (bug 40319 follow-up) Add Cypress tests
Test plan:
Make sure the display of city, state and zipcode is the same as before
the patch
Confirm that the new Cypress tests pass
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Amended-by: Jonathan Druart
Added $raw filter to [% ", " %]
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 67e04b039a)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
This commit is contained in:
parent
2cdbf324c4
commit
c1bd4858a7
|
|
@ -31,9 +31,7 @@
|
|||
<li class="patroncity">
|
||||
<span class="city">[%~ patron.city |html ~%]</span>
|
||||
[%~ IF ( patron.state ) %]
|
||||
[%~ IF ( patron.city ) ~%]
|
||||
,
|
||||
[% END ~%]
|
||||
[%~ IF ( patron.city ) ~%][% ", " | $raw %][% END ~%]
|
||||
<span class="state">[% patron.state |html ~%]</span>
|
||||
[%~ END ~%]
|
||||
[%~ IF ( patron.zipcode ) %]<span class="zipcode">[%~ " " _ patron.zipcode |html ~%]</span>[% END %]
|
||||
|
|
|
|||
|
|
@ -0,0 +1,44 @@
|
|||
describe("Display address", () => {
|
||||
beforeEach(() => {
|
||||
cy.login();
|
||||
cy.title().should("eq", "Koha staff interface");
|
||||
cy.task("buildSampleObject", {
|
||||
object: "patron",
|
||||
values: {
|
||||
street_number: 12,
|
||||
street_type: "Rd",
|
||||
address: "Awesome",
|
||||
address2: "Library",
|
||||
city: "Portland",
|
||||
state: "OR",
|
||||
postal_code: "44240",
|
||||
country: "USA",
|
||||
},
|
||||
}).then(generatedPatron => {
|
||||
cy.task("insertObject", {
|
||||
type: "patron",
|
||||
object: generatedPatron,
|
||||
}).then(objects_patron => {
|
||||
cy.wrap(objects_patron).as("objects_patron");
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
afterEach(function () {
|
||||
cy.task("deleteSampleObjects", [this.objects_patron]);
|
||||
});
|
||||
|
||||
it("should have correct spacing", function () {
|
||||
cy.visit(
|
||||
`/cgi-bin/koha/members/moremember.pl?borrowernumber=${this.objects_patron.patron_id}`
|
||||
);
|
||||
const patron = this.objects_patron;
|
||||
cy.get(".patronbriefinfo").should($el => {
|
||||
const re = new RegExp(
|
||||
`${patron.street_number} ${patron.address} ${patron.street_type}\\n\\s*${patron.address2}\\n\\s*${patron.city}, ${patron.state} ${patron.postal_code}\\n\\s*${patron.country}`
|
||||
);
|
||||
const displayedText = $el.text().replace(/ /g, " ").trim();
|
||||
expect(displayedText).to.match(re);
|
||||
});
|
||||
});
|
||||
});
|
||||
Loading…
Reference in New Issue