2

How can I use global variables in ptor ? The "window" prefix doesn't work.

element(by.id("priceNet")).getText().then(function (getNet) {
        net = getNet;
    });
element(by.id("priceVat")).getText().then(function (getVat) {
        vat = getVat;
    });
console.log(vat + " " + net);
expect(element(by.id("priceTotal")).getText()).toContain(net + vat);

When I want use window.net ptor doesn't know the window I want to use net and vat in expect.

Kex
  • 93
  • 1
  • 9

1 Answers1

1

Problem solved. This solution working. (ofc have to parse to Int or Float)

        element(by.id("priceNet")).getText().then( function (getNet) {
            element(by.id("priceVat")).getText().then( function (getVat) {
            expect(element(by.id("priceTotal")).getText()).toContain(getNet + getVat);   
        })
    });
Kex
  • 93
  • 1
  • 9