Line 0
Link Here
|
0 |
- |
1 |
describe("Display address", () => { |
|
|
2 |
beforeEach(() => { |
3 |
cy.login(); |
4 |
cy.title().should("eq", "Koha staff interface"); |
5 |
cy.task("buildSampleObject", { |
6 |
object: "patron", |
7 |
values: { |
8 |
street_number: 12, |
9 |
street_type: "Rd", |
10 |
address: "Awesome", |
11 |
address2: "Library", |
12 |
city: "Portland", |
13 |
state: "OR", |
14 |
postal_code: "44240", |
15 |
country: "USA", |
16 |
}, |
17 |
}).then(generatedPatron => { |
18 |
cy.task("insertObject", { |
19 |
type: "patron", |
20 |
object: generatedPatron, |
21 |
}).then(objects_patron => { |
22 |
cy.wrap(objects_patron).as("objects_patron"); |
23 |
}); |
24 |
}); |
25 |
}); |
26 |
|
27 |
afterEach(function () { |
28 |
cy.task("deleteSampleObjects", [this.objects_patron]); |
29 |
}); |
30 |
|
31 |
it("should have correct spacing", function () { |
32 |
cy.visit( |
33 |
`/cgi-bin/koha/members/moremember.pl?borrowernumber=${this.objects_patron.patron_id}` |
34 |
); |
35 |
const patron = this.objects_patron; |
36 |
cy.get(".patronbriefinfo").should($el => { |
37 |
const re = new RegExp( |
38 |
`${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}` |
39 |
); |
40 |
const displayedText = $el.text().replace(/ /g, " ").trim(); |
41 |
expect(displayedText).to.match(re); |
42 |
}); |
43 |
}); |
44 |
}); |