From 1940f9c0e8f3056a42e2ed0ce5618732158b806d Mon Sep 17 00:00:00 2001
From: Patrizio Bekerle <patrizio@bekerle.com>
Date: Thu, 16 Feb 2023 13:04:50 +0100
Subject: [PATCH] Inject a data-testid attribute for Playwright

---
 packages/auth/src/auth-keycloak.js | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/packages/auth/src/auth-keycloak.js b/packages/auth/src/auth-keycloak.js
index f77d510f..60da2375 100644
--- a/packages/auth/src/auth-keycloak.js
+++ b/packages/auth/src/auth-keycloak.js
@@ -42,6 +42,11 @@ export class AuthKeycloak extends AdapterLitElement {
         this.idpHint = '';
 
         this._onKCChanged = this._onKCChanged.bind(this);
+
+        // inject a data-testid attribute for Playwright
+        if (window.playwright) {
+            this.setAttribute("data-testid", "dbp-auth-keycloak");
+        }
     }
 
     update(changedProperties) {
-- 
GitLab