Bugzilla – Attachment 175289 Details for
Bug 38461
Table features needs to be covered by e2e tests using Cypress
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 38461: Fix random failures
Bug-38461-Fix-random-failures.patch (text/plain), 2.89 KB, created by
Jonathan Druart
on 2024-12-09 09:54:26 UTC
(
hide
)
Description:
Bug 38461: Fix random failures
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2024-12-09 09:54:26 UTC
Size:
2.89 KB
patch
obsolete
>From 079c87348c0e95da858c128acfc89d08d4e47aed Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Thu, 28 Nov 2024 11:25:03 +0100 >Subject: [PATCH] Bug 38461: Fix random failures > >All this is weird. >I found this and implemented it: >https://stackoverflow.com/questions/69425289/javascript-prompt-cause-document-is-not-focused >It was still not enough to reduce the failures. >The wait and adding the focus to the window seems ok. >If I remove one of those 3 hacks, I still get failures... > >Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net> >--- > koha-tmpl/intranet-tmpl/prog/js/datatables.js | 8 ++++++-- > t/cypress/integration/KohaTable_spec.ts | 2 ++ > 2 files changed, 8 insertions(+), 2 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/js/datatables.js b/koha-tmpl/intranet-tmpl/prog/js/datatables.js >index 8b342d7cb03..7e490300c42 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/datatables.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/datatables.js >@@ -711,6 +711,10 @@ function _dt_buttons(params){ > ); > > if ( table_settings ) { >+ const writeToClipboard= async (text, node) => { >+ await navigator.clipboard.writeText(text); >+ $(node).tooltip({trigger: 'manual', title: __("Copied!")}).tooltip('show'); >+ }; > buttons.push( > { > autoClose: true, >@@ -728,10 +732,10 @@ function _dt_buttons(params){ > delete state.time; > let searchParams = new URLSearchParams(window.location.search); > searchParams.set(table_key + '_state', btoa(state)); >+ > let url = window.location.origin + window.location.pathname + '?' + searchParams.toString() + window.location.hash; > if( navigator.clipboard && navigator.clipboard.writeText){ >- navigator.clipboard.writeText( url ); >- $(node).tooltip({trigger: 'manual', title: __("Copied!")}).tooltip('show'); >+ writeToClipboard(url, node); > } > }, > } >diff --git a/t/cypress/integration/KohaTable_spec.ts b/t/cypress/integration/KohaTable_spec.ts >index 48364401d86..a9b973be66a 100644 >--- a/t/cypress/integration/KohaTable_spec.ts >+++ b/t/cypress/integration/KohaTable_spec.ts >@@ -268,8 +268,10 @@ describe("kohaTable (using REST API)", () => { > // Close the 'Columns' list > cy.get(".dt-button-background").click(); > cy.get(".dt-button-background").should("not.exist"); >+ cy.wait(500); // ensure the animation completes, random failures? > > // Copy the shareable link (Name and Code shown) >+ cy.window().focus(); > cy.get( > `#${table_id}_wrapper .copyConditions_controls` > ).click({ force: true }); >-- >2.34.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 38461
:
174877
|
174878
|
175004
|
175005
|
175006
|
175007
|
175008
|
175009
|
175010
|
175011
|
175015
|
175016
|
175179
|
175223
|
175224
|
175225
|
175226
|
175227
|
175228
|
175229
|
175230
|
175231
|
175232
|
175233
|
175234
|
175235
|
175289
|
175290
|
175291
|
175292
|
176082
|
176083
|
176084
|
176085
|
176086
|
176087
|
176088
|
176089
|
176090
|
176091
|
176092
|
176093
|
176793
|
176846
|
176902