1717 * under the License.
1818 */
1919
20- export function SharePageProvider ( { getService, getPageObjects } ) {
20+ import { FtrProviderContext } from '../ftr_provider_context' ;
21+
22+ export function SharePageProvider ( { getService, getPageObjects } : FtrProviderContext ) {
2123 const testSubjects = getService ( 'testSubjects' ) ;
2224 const find = getService ( 'find' ) ;
2325 const PageObjects = getPageObjects ( [ 'visualize' , 'common' ] ) ;
@@ -32,7 +34,7 @@ export function SharePageProvider({ getService, getPageObjects }) {
3234 return testSubjects . click ( 'shareTopNavButton' ) ;
3335 }
3436
35- async openShareMenuItem ( itemTitle ) {
37+ async openShareMenuItem ( itemTitle : string ) {
3638 log . debug ( `openShareMenuItem title:${ itemTitle } ` ) ;
3739 const isShareMenuOpen = await this . isShareMenuOpen ( ) ;
3840 if ( ! isShareMenuOpen ) {
@@ -45,11 +47,24 @@ export function SharePageProvider({ getService, getPageObjects }) {
4547 await this . clickShareTopNavButton ( ) ;
4648 }
4749 const menuPanel = await find . byCssSelector ( 'div.euiContextMenuPanel' ) ;
48- testSubjects . click ( `sharePanel-${ itemTitle . replace ( ' ' , '' ) } ` ) ;
50+ await testSubjects . click ( `sharePanel-${ itemTitle . replace ( ' ' , '' ) } ` ) ;
4951 await testSubjects . waitForDeleted ( menuPanel ) ;
5052 }
5153
54+ /**
55+ * if there are more entries in the share menu, the permalinks entry has to be clicked first
56+ * else the selection isn't displayed. this happens if you're testing against an instance
57+ * with xpack features enabled, where there's also a csv sharing option
58+ * in a pure OSS environment, the permalinks sharing panel is displayed initially
59+ */
60+ async openPermaLinks ( ) {
61+ if ( await testSubjects . exists ( 'sharePanel-Permalinks' ) ) {
62+ await testSubjects . click ( `sharePanel-Permalinks` ) ;
63+ }
64+ }
65+
5266 async getSharedUrl ( ) {
67+ await this . openPermaLinks ( ) ;
5368 return await testSubjects . getAttribute ( 'copyShareUrlButton' , 'data-share-url' ) ;
5469 }
5570
@@ -68,9 +83,9 @@ export function SharePageProvider({ getService, getPageObjects }) {
6883 }
6984
7085 async exportAsSavedObject ( ) {
86+ await this . openPermaLinks ( ) ;
7187 return await testSubjects . click ( 'exportAsSavedObject' ) ;
7288 }
73-
7489 }
7590
7691 return new SharePage ( ) ;
0 commit comments