File tree Expand file tree Collapse file tree 1 file changed +38
-0
lines changed
examples/panel-basic/tests/translations Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Original file line number Diff line number Diff line change 1+ import * as semver from 'semver' ;
2+
3+ import { expect , test } from '@grafana/plugin-e2e' ;
4+
5+ test . use ( {
6+ featureToggles : {
7+ localizationForPlugins : true ,
8+ } ,
9+ userPreferences : {
10+ language : 'sv-SE' ,
11+ } ,
12+ } ) ;
13+
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+ } ) => {
20+ const dashboard = await readProvisionedDashboard ( { fileName : 'dashboard.json' } ) ;
21+ const panelEditPage = await gotoPanelEditPage ( { dashboard, id : '1' } ) ;
22+
23+ const isVersion11OrHigher = semver . gte ( grafanaVersion , '11.0.0' ) ;
24+
25+ if ( isVersion11OrHigher ) {
26+ // For Grafana v11+, expect Swedish translations
27+ await expect ( panelEditPage . panel . locator . getByText ( 'Textalternativ värde:' ) ) . toBeVisible ( ) ;
28+ const options = panelEditPage . getCustomOptions ( 'Basic' ) ;
29+ const showSeriesCounter = options . getSwitch ( 'Visa serieräknare' ) ;
30+ await expect ( showSeriesCounter . locator ( ) ) . toBeVisible ( ) ;
31+ } else {
32+ // For Grafana <v11, expect English fallback
33+ await expect ( panelEditPage . panel . locator . getByText ( 'Text option value:' ) ) . toBeVisible ( ) ;
34+ const options = panelEditPage . getCustomOptions ( 'Basic' ) ;
35+ const showSeriesCounter = options . getSwitch ( 'Show series counter' ) ;
36+ await expect ( showSeriesCounter . locator ( ) ) . toBeVisible ( ) ;
37+ }
38+ } ) ;
You can’t perform that action at this time.
0 commit comments