-
-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathstripe-elements.cy.ts
31 lines (27 loc) · 942 Bytes
/
stripe-elements.cy.ts
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
import "cypress-plugin-stripe-elements";
describe("Stripe Elements", () => {
it("Stripe Elements Demo works!", () => {
cy.visit("https://stripe-payments-demo.appspot.com/");
cy.get("#generate").click();
cy.get("#card-element").within(() => {
cy.fillElementsInput("cardNumber", "4242424242424242");
cy.fillElementsInput("cardCvc", "123");
cy.fillElementsInput(
"cardExpiry",
"12" + (new Date().getFullYear() + 10).toString().substr(-2)
);
});
cy.wait(1000);
cy.get(".payment-button").should(($div) => {
expect($div.text()).to.include("Pay");
});
cy.get(".payment-button").click();
cy.get(".payment-button").should(($div) => {
expect($div.text()).to.include("Processing");
});
cy.get("#confirmation > .success").should(($div) => {
expect($div).to.exist;
expect($div.text()).to.include("Thanks for your order!");
});
});
});