@@ -33,7 +33,6 @@ export function VegaChartPageProvider({
33
33
const find = getService ( 'find' ) ;
34
34
const testSubjects = getService ( 'testSubjects' ) ;
35
35
const browser = getService ( 'browser' ) ;
36
- const { common } = getPageObjects ( [ 'common' ] ) ;
37
36
const retry = getService ( 'retry' ) ;
38
37
39
38
class VegaChartPage {
@@ -49,6 +48,15 @@ export function VegaChartPageProvider({
49
48
return find . byCssSelector ( 'div.vgaVis__controls' ) ;
50
49
}
51
50
51
+ public getYAxisContainer ( ) {
52
+ return find . byCssSelector ( '[aria-label^="Y-axis"]' ) ;
53
+ }
54
+
55
+ public async getAceGutterContainer ( ) {
56
+ const editor = await this . getEditor ( ) ;
57
+ return editor . findByClassName ( 'ace_gutter' ) ;
58
+ }
59
+
52
60
public async getRawSpec ( ) {
53
61
// Adapted from console_page.js:getVisibleTextFromAceEditor(). Is there a common utilities file?
54
62
const editor = await this . getEditor ( ) ;
@@ -83,20 +91,16 @@ export function VegaChartPageProvider({
83
91
}
84
92
85
93
public async typeInSpec ( text : string ) {
86
- await this . focusEditor ( ) ;
94
+ const aceGutter = await this . getAceGutterContainer ( ) ;
87
95
88
- let repeats = 20 ;
89
- while ( -- repeats > 0 ) {
90
- await browser . pressKeys ( Key . ARROW_UP ) ;
91
- await common . sleep ( 50 ) ;
92
- }
93
- await browser . pressKeys ( Key . ARROW_RIGHT ) ;
96
+ await aceGutter . doubleClick ( ) ;
97
+ await browser . pressKeys ( Key . LEFT ) ;
98
+ await browser . pressKeys ( Key . RIGHT ) ;
94
99
await browser . pressKeys ( text ) ;
95
100
}
96
101
97
102
public async cleanSpec ( ) {
98
- const editor = await this . getEditor ( ) ;
99
- const aceGutter = await editor . findByClassName ( 'ace_gutter' ) ;
103
+ const aceGutter = await this . getAceGutterContainer ( ) ;
100
104
101
105
await retry . try ( async ( ) => {
102
106
await aceGutter . doubleClick ( ) ;
@@ -107,11 +111,11 @@ export function VegaChartPageProvider({
107
111
}
108
112
109
113
public async getYAxisLabels ( ) {
110
- const chart = await testSubjects . find ( 'visualizationLoader' ) ;
111
- const yAxis = await chart . findByCssSelector ( '[aria-label^="Y-axis"]' ) ;
114
+ const yAxis = await this . getYAxisContainer ( ) ;
112
115
const tickGroup = await yAxis . findByClassName ( 'role-axis-label' ) ;
113
116
const labels = await tickGroup . findAllByCssSelector ( 'text' ) ;
114
117
const labelTexts : string [ ] = [ ] ;
118
+
115
119
for ( const label of labels ) {
116
120
labelTexts . push ( await label . getVisibleText ( ) ) ;
117
121
}
0 commit comments