1- import * as semver from 'semver' ;
2-
31import { expect , test } from '@grafana/plugin-e2e' ;
42
53test . use ( {
@@ -11,32 +9,17 @@ test.use({
119 } ,
1210} ) ;
1311
14- test ( 'should display correct translation based on Grafana version (Swedish for v11+, English fallback for <v11)' , async ( {
15- gotoPanelEditPage,
16- readProvisionedDashboard,
17- grafanaVersion,
18- page,
19- } ) => {
12+ test ( 'should display Swedish plugin translations' , async ( { gotoPanelEditPage, readProvisionedDashboard, page } ) => {
2013 const dashboard = await readProvisionedDashboard ( { fileName : 'dashboard.json' } ) ;
2114 const panelEditPage = await gotoPanelEditPage ( { dashboard, id : '1' } ) ;
2215 await page . evaluate ( ( ) => {
2316 console . log ( 'lang' , ( window as any ) . grafanaBootData ?. user ?. language ) ;
2417 console . log ( 'toggles' , ( window as any ) . grafanaBootData ?. settings . featureToggles ) ;
2518 } ) ;
2619
27- const isVersion11OrHigher = semver . gte ( grafanaVersion , '11.0.0' ) ;
28-
29- if ( isVersion11OrHigher ) {
30- // For Grafana v11+, expect Swedish translations
31- await expect ( panelEditPage . panel . locator . getByText ( 'Textalternativ värde:' ) ) . toBeVisible ( ) ;
32- const options = panelEditPage . getCustomOptions ( 'Basic' ) ;
33- const showSeriesCounter = options . getSwitch ( 'Visa serieräknare' ) ;
34- await expect ( showSeriesCounter . locator ( ) ) . toBeVisible ( ) ;
35- } else {
36- // For Grafana <v11, expect English fallback
37- await expect ( panelEditPage . panel . locator . getByText ( 'Text option value:' ) ) . toBeVisible ( ) ;
38- const options = panelEditPage . getCustomOptions ( 'Basic' ) ;
39- const showSeriesCounter = options . getSwitch ( 'Show series counter' ) ;
40- await expect ( showSeriesCounter . locator ( ) ) . toBeVisible ( ) ;
41- }
20+ // For Grafana v11+, expect Swedish translations
21+ await expect ( panelEditPage . panel . locator . getByText ( 'Textalternativ värde:' ) ) . toBeVisible ( ) ;
22+ const options = panelEditPage . getCustomOptions ( 'Basic' ) ;
23+ const showSeriesCounter = options . getSwitch ( 'Visa serieräknare' ) ;
24+ await expect ( showSeriesCounter . locator ( ) ) . toBeVisible ( ) ;
4225} ) ;
0 commit comments