I'm trying to stub the Omniture page tracking function s.t()
. It is called on every page load after some processing is done to set appropriate variables that should be sent with the request. I'm trying to test that the correct variables/tracking parameters are being set on a given page.
Here is what I have tried:
cy.visit();
cy.stub(s, "t");
This just generates an error saying s
is not defined. (s is the global object that the Omniture s_code creates).
So after some google searching I found that you have to initialize the object first, so my code turned into this:
var s = {
t: cy.stub()
};
cy.visit();
That doesn't generate any errors, and shows the stub in the command log but it says the function was never called. I know it was called, because I see the Omniture request in the network tab of the developer console.
Can anyone tell me what I'm doing wrong? It would be much appreciated.
Aucun commentaire:
Enregistrer un commentaire