;
+ name?: string;
+ };
+
+ const makeEvent = (button: Button, method: string) => {
+ return {
+ event: {
+ event: 'unstruct',
+ app_id: 'button-click-tracking-' + testIdentifier,
+ page_url: `http://snowplow-js-tracker.local:8080/button-click-tracking.html?eventMethod=${method}`,
+ unstruct_event: {
+ data: {
+ schema: 'iglu:com.snowplowanalytics.snowplow/button_click/jsonschema/1-0-0',
+ data: button,
+ },
+ },
+ },
+ };
+ };
+
+ const logContainsButtonClick = (event: any) => {
+ expect(logContains(event)).toBe(true);
+ };
+
+ const nButtons = 7;
+ beforeAll(async () => {
+ testIdentifier = await pageSetup();
+
+ const runClicks = async (method: string) => {
+ await loadUrlAndWait('/button-click-tracking.html?eventMethod=' + method);
+ for (let i = 1; i < nButtons; i++) {
+ await (await $(`#button${i}`)).click();
+ await browser.pause(50);
+ }
+ // Dynamic button
+ await (await $('#addDynamic')).click();
+ await browser.pause(500);
+ await (await $('#button7')).click();
+ await browser.pause(500);
+
+ // Disable/enable
+
+ await (await $('#disable')).click();
+ await browser.pause(500);
+ await (await $('#disabled-click')).click();
+ await browser.pause(500);
+
+ await (await $('#enable')).click();
+ await browser.pause(500);
+ await (await $('#enabled-click')).click();
+ await browser.pause(500);
+
+ await (await $('#set-multiple-configs')).click();
+ await browser.pause(500);
+
+ await (await $('#final-config')).click();
+ await browser.pause(500);
+ };
+
+ for (let method of eventMethods) {
+ await runClicks(method);
+ await browser.pause(6000);
+ }
+
+ log = await browser.call(async () => await fetchResults());
+ });
+
+ eventMethods.forEach((method) => {
+ it('should get button1', () => {
+ const ev = makeEvent({ id: 'button1', label: 'TestButton' }, method);
+ logContainsButtonClick(ev);
+ });
+
+ it('should get button2', () => {
+ const ev = makeEvent({ id: 'button2', label: 'TestButtonWithClass', classes: ['test-class'] }, method);
+ logContainsButtonClick(ev);
+ });
+
+ it('should get button3', () => {
+ const ev = makeEvent(
+ { id: 'button3', label: 'TestButtonWithClasses', classes: ['test-class', 'test-class2'] },
+ method
+ );
+ logContainsButtonClick(ev);
+ });
+
+ it('should get button4', () => {
+ const ev = makeEvent({ id: 'button4', label: 'TestWithName', name: 'testName' }, method);
+ logContainsButtonClick(ev);
+ });
+
+ it('should get button5', () => {
+ const ev = makeEvent({ id: 'button5', label: 'DataLabel' }, method);
+ logContainsButtonClick(ev);
+ });
+
+ it('should get button6', () => {
+ const ev = makeEvent({ id: 'button6', label: 'TestInputButton' }, method);
+ logContainsButtonClick(ev);
+ });
+
+ it('should get button7 after it is added dynamically', async () => {
+ const ev = makeEvent({ id: 'button7', label: 'TestDynamicButton-' + method }, method);
+ logContainsButtonClick(ev);
+ });
+
+ it('should not get disabled-click', () => {
+ const ev = makeEvent({ id: 'disabled-click', label: 'DisabledClick' }, method);
+ expect(logContains(ev)).toBe(false);
+ });
+
+ it('should get enabled-click', () => {
+ const ev = makeEvent({ id: 'enabled-click', label: 'EnabledClick' }, method);
+ logContainsButtonClick(ev);
+ });
+
+ it('should get `final-config` as it is the last config set', () => {
+ const ev = makeEvent({ id: 'final-config', classes: ['final-config'], label: 'Final Config' }, method);
+ logContainsButtonClick(ev);
+ });
+ });
+});
diff --git a/trackers/javascript-tracker/test/integration/integration.test.ts b/trackers/javascript-tracker/test/integration/integration.test.ts
index 1218068ff..28ba0966c 100755
--- a/trackers/javascript-tracker/test/integration/integration.test.ts
+++ b/trackers/javascript-tracker/test/integration/integration.test.ts
@@ -50,12 +50,15 @@ describe('Snowplow Micro integration', () => {
beforeAll(async () => {
testIdentifier = await pageSetup();
await loadUrlAndWait('/integration.html?eventMethod=get');
+ await browser.pause(2000); // Time for pings
await $('#bottomRight').click();
await browser.pause(5000); // Time for requests to get written
await loadUrlAndWait('/integration.html?eventMethod=post');
+ await browser.pause(2000); // Time for pings
await $('#bottomRight').click();
await browser.pause(6000); // Time for requests to get written
await loadUrlAndWait('/integration.html?eventMethod=beacon');
+ await browser.pause(2000); // Time for pings
await $('#bottomRight').click();
await browser.pause(6000); // Time for requests to get written
log = await browser.call(async () => await fetchResults());
diff --git a/trackers/javascript-tracker/test/pages/button-click-tracking.html b/trackers/javascript-tracker/test/pages/button-click-tracking.html
new file mode 100644
index 000000000..a543dc315
--- /dev/null
+++ b/trackers/javascript-tracker/test/pages/button-click-tracking.html
@@ -0,0 +1,100 @@
+
+
+
+ Page for Link Click testing with Snowplow Micro
+
+
+
+
+ Page for Button Click testing with Snowplow Micro
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/trackers/javascript-tracker/tracker.config.ts b/trackers/javascript-tracker/tracker.config.ts
index 3ee40fc1e..8ede57633 100644
--- a/trackers/javascript-tracker/tracker.config.ts
+++ b/trackers/javascript-tracker/tracker.config.ts
@@ -51,3 +51,4 @@ export const enhancedConsent = false;
export const snowplowMedia = false;
export const vimeoTracking = false;
export const privacySandbox = false;
+export const buttonClickTracking = false;
diff --git a/trackers/javascript-tracker/tracker.lite.config.ts b/trackers/javascript-tracker/tracker.lite.config.ts
index 4ad8c4046..c5cdf2eea 100644
--- a/trackers/javascript-tracker/tracker.lite.config.ts
+++ b/trackers/javascript-tracker/tracker.lite.config.ts
@@ -51,3 +51,4 @@ export const enhancedConsent = false;
export const snowplowMedia = false;
export const vimeoTracking = false;
export const privacySandbox = false;
+export const buttonClickTracking = false;
diff --git a/trackers/javascript-tracker/tracker.test.config.ts b/trackers/javascript-tracker/tracker.test.config.ts
index 4f3c136a2..5d5d70725 100644
--- a/trackers/javascript-tracker/tracker.test.config.ts
+++ b/trackers/javascript-tracker/tracker.test.config.ts
@@ -51,3 +51,4 @@ export const enhancedConsent = false;
export const snowplowMedia = true;
export const vimeoTracking = true;
export const privacySandbox = false;
+export const buttonClickTracking = true;
diff --git a/trackers/node-tracker/api-extractor.json b/trackers/node-tracker/api-extractor.json
index d8abf13ef..d44afd2c0 100644
--- a/trackers/node-tracker/api-extractor.json
+++ b/trackers/node-tracker/api-extractor.json
@@ -135,7 +135,7 @@
* SUPPORTED TOKENS: , ,
* DEFAULT VALUE: "/etc/"
*/
- "reportFolder": "/docs/"
+ "reportFolder": "../../api-docs/docs/node-tracker/"
/**
* Specifies the folder where the temporary report file is written. The file name portion is determined by