Skip to content

Commit

Permalink
add back more dnt
Browse files Browse the repository at this point in the history
  • Loading branch information
alexprudhomme committed Sep 12, 2024
1 parent 1e9dffe commit d1aade3
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion packages/atomic/cypress/fixtures/test-fixture.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ export class TestFixture {
private language?: string;
private localizationCompatibilityVersion: i18nCompatibilityVersion = 'v4';
private disabledAnalytics = false;
private doNotTrack = false;
private fieldCaptions: {field: string; captions: Record<string, string>}[] =
[];
private translations: Record<string, string> = {};
Expand Down Expand Up @@ -135,6 +136,11 @@ export class TestFixture {
return this;
}

public withDoNotTrack() {
this.doNotTrack = true;
return this;
}

public withRedirection() {
this.redirected = true;
return this;
Expand Down Expand Up @@ -204,6 +210,13 @@ export class TestFixture {
setupIntercept();
spyConsole();

cy.window().then((win) => {
Object.defineProperty(win.navigator, 'doNotTrack', {
get: () => (this.doNotTrack ? '1' : '0'),
configurable: true,
});
});

cy.document().then((doc) => {
doc.head.appendChild(this.style);
doc.body.appendChild(this.searchInterface);
Expand Down Expand Up @@ -260,7 +273,7 @@ export class TestFixture {

if (this.execFirstSearch && this.firstIntercept) {
cy.wait(TestFixture.interceptAliases.Search);
if (!this.disabledAnalytics) {
if (!this.disabledAnalytics || this.doNotTrack) {
cy.wait(TestFixture.interceptAliases.UA);
}
}
Expand Down

0 comments on commit d1aade3

Please sign in to comment.