File tree Expand file tree Collapse file tree 2 files changed +60
-0
lines changed
examples/panel-basic/tests/translations Expand file tree Collapse file tree 2 files changed +60
-0
lines changed Original file line number Diff line number Diff line change 1+ import { expect , test } from '@grafana/plugin-e2e' ;
2+
3+ test . use ( {
4+ featureToggles : {
5+ localizationForPlugins : true ,
6+ } ,
7+ userPreferences : {
8+ language : 'es-ES' ,
9+ } ,
10+ } ) ;
11+
12+ test ( 'should display Spanish plugin translations for all supported versions (>=11.0.0)' , async ( {
13+ gotoPanelEditPage,
14+ readProvisionedDashboard,
15+ page,
16+ } ) => {
17+ const dashboard = await readProvisionedDashboard ( { fileName : 'dashboard.json' } ) ;
18+ const panelEditPage = await gotoPanelEditPage ( { dashboard, id : '1' } ) ;
19+
20+ await expect ( panelEditPage . panel . locator . getByText ( 'Valor de la opción de texto:' ) ) . toBeVisible ( ) ;
21+ const options = panelEditPage . getCustomOptions ( 'Basic' ) ;
22+ const showSeriesCounter = options . getSwitch ( 'Mostrar contador de series' ) ;
23+ await expect ( showSeriesCounter . locator ( ) ) . toBeVisible ( ) ;
24+ } ) ;
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 v12.1+, English fallback for v11-12.0)' , 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 isVersion12Point1OrHigher = semver . gte ( grafanaVersion , '12.1.0' ) ;
24+
25+ if ( isVersion12Point1OrHigher ) {
26+ await expect ( panelEditPage . panel . locator . getByText ( 'Textalternativ värde:' ) ) . toBeVisible ( ) ;
27+ const options = panelEditPage . getCustomOptions ( 'Basic' ) ;
28+ const showSeriesCounter = options . getSwitch ( 'Visa serieräknare' ) ;
29+ await expect ( showSeriesCounter . locator ( ) ) . toBeVisible ( ) ;
30+ } else {
31+ await expect ( panelEditPage . panel . locator . getByText ( 'Text option value:' ) ) . toBeVisible ( ) ;
32+ const options = panelEditPage . getCustomOptions ( 'Basic' ) ;
33+ const showSeriesCounter = options . getSwitch ( 'Show series counter' ) ;
34+ await expect ( showSeriesCounter . locator ( ) ) . toBeVisible ( ) ;
35+ }
36+ } ) ;
You can’t perform that action at this time.
0 commit comments