EandrewJones commented on code in PR #466:
URL: https://github.com/apache/flagon-useralejs/pull/466#discussion_r1638635580


##########
test/e2e/spec/package.spec.ts:
##########
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import { test, expect } from "@playwright/test";
+
+test.beforeEach(async ({ page }) => {
+  const requestPromise = page.waitForRequest(
+    (request) => request.method() === "POST",
+  );
+  await page.goto("/");
+  await requestPromise;
+});
+
+test.describe("Userale custom logging", () => {
+  test("executes added callbacks", async ({ page }) => {
+    const requestPromise = page.waitForRequest(
+      (request) => request.method() === "POST",
+    );
+    await page.getByText("Click Me!", { exact: true }).click();
+    const request = await requestPromise;
+    const body = await request.postDataJSON();
+
+    const buttonClickLog = body.find(
+      (log: { target: string; logType: string }) =>
+        log.target === "button#test_button" && log.logType === "custom",
+    );
+    expect(buttonClickLog).toHaveProperty("customLabel");
+
+    const actualValue = buttonClickLog.customLabel;
+    const expectedValue = "map & packageLog Example";
+    expect(actualValue).toBe(expectedValue);
+  });
+});

Review Comment:
   Can we also add some tests for plugin-specific behavior like tabIds, tab 
events, etc? I would recommend listing out all the plugin specific 
behaviors/characteristics and adding tests to cover them.
   
   We want to have a validation suite we can use to safely migrate to MV3.



##########
test/e2e/package.config.ts:
##########
@@ -0,0 +1,71 @@
+import { defineConfig, devices } from "@playwright/test";

Review Comment:
   BTW, there is command to run skywalking  eyes, `npm run license:fix`, to 
auto fix this stuff for you.



##########
jest.config.ts:
##########
@@ -176,10 +176,9 @@ const config: Config = {
   // testLocationInResults: false,
 
   // The glob patterns Jest uses to detect test files
-  // testMatch: [
-  //   "**/__tests__/**/*.[jt]s?(x)",
-  //   "**/?(*.)+(spec|test).[tj]s?(x)"
-  // ],
+  testMatch: [
+    "**/test/?(*.)+(spec|test).[tj]s?(x)"

Review Comment:
   My hunch is this is the problem. Unfortunately, I'm not handy enough with 
glob/regex mixing for these matching. Also, once you're using regex, i.e. 
`?(...`, won't the `*` take on the regex behavior, not the global behavior. In 
other words, is `?(*.)` valid?
   
   Regardless, I could easily see this matching the `**/test/e2e/` spec files.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@flagon.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscr...@flagon.apache.org
For additional commands, e-mail: notifications-h...@flagon.apache.org

Reply via email to