11import SpecRunnerHeader from './SpecRunnerHeader.vue'
22import { useAutStore } from '../store'
3- import { SpecRunnerHeaderFragmentDoc } from '../generated/graphql-test'
3+ import { SpecRunnerHeaderFragment , SpecRunnerHeaderFragmentDoc } from '../generated/graphql-test'
4+ import { createEventManager , createTestAutIframe } from '../../cypress/e2e/support/ctSupport'
5+
6+ function renderWithGql ( gqlVal : SpecRunnerHeaderFragment ) {
7+ const eventManager = createEventManager ( )
8+ const autIframe = createTestAutIframe ( )
9+
10+ return ( < SpecRunnerHeader gql = { gqlVal }
11+ eventManager = { eventManager }
12+ getAutIframe = { ( ) => autIframe } /> )
13+ }
414
515describe ( 'SpecRunnerHeader' , ( ) => {
616 it ( 'renders' , ( ) => {
@@ -9,49 +19,46 @@ describe('SpecRunnerHeader', () => {
919 autStore . updateUrl ( 'http://localhost:4000' )
1020 cy . mountFragment ( SpecRunnerHeaderFragmentDoc , {
1121 render : ( gqlVal ) => {
12- return < SpecRunnerHeader gql = { gqlVal } />
22+ return renderWithGql ( gqlVal )
1323 } ,
1424 } )
1525 } )
1626
17- it ( 'disabled selector playground and studio buttons when isRunning is true' , ( ) => {
27+ it ( 'disabled selector playground button when isRunning is true' , ( ) => {
1828 const autStore = useAutStore ( )
1929
2030 autStore . setIsRunning ( true )
2131
2232 cy . mountFragment ( SpecRunnerHeaderFragmentDoc , {
2333 render : ( gqlVal ) => {
24- return < SpecRunnerHeader gql = { gqlVal } />
34+ return renderWithGql ( gqlVal )
2535 } ,
2636 } )
2737
28- cy . get ( '[data-cy="header-studio"]' ) . should ( 'be.disabled' )
2938 cy . get ( '[data-cy="header-selector"]' ) . should ( 'be.disabled' )
3039 } )
3140
32- it ( 'disabled selector playground and studio buttons when isLoading is true' , ( ) => {
41+ it ( 'disabled selector playground button when isLoading is true' , ( ) => {
3342 const autStore = useAutStore ( )
3443
3544 autStore . setIsLoading ( true )
3645
3746 cy . mountFragment ( SpecRunnerHeaderFragmentDoc , {
3847 render : ( gqlVal ) => {
39- return < SpecRunnerHeader gql = { gqlVal } />
48+ return renderWithGql ( gqlVal )
4049 } ,
4150 } )
4251
43- cy . get ( '[data-cy="header-studio"]' ) . should ( 'be.disabled' )
4452 cy . get ( '[data-cy="header-selector"]' ) . should ( 'be.disabled' )
4553 } )
4654
47- it ( 'enables selector playground and studio buttons by default' , ( ) => {
55+ it ( 'enables selector playground button by default' , ( ) => {
4856 cy . mountFragment ( SpecRunnerHeaderFragmentDoc , {
4957 render : ( gqlVal ) => {
50- return < SpecRunnerHeader gql = { gqlVal } />
58+ return renderWithGql ( gqlVal )
5159 } ,
5260 } )
5361
54- cy . get ( '[data-cy="header-studio"]' ) . should ( 'not.be.disabled' )
5562 cy . get ( '[data-cy="header-selector"]' ) . should ( 'not.be.disabled' )
5663 } )
5764
@@ -65,7 +72,7 @@ describe('SpecRunnerHeader', () => {
6572 gql . currentTestingType = 'e2e'
6673 } ,
6774 render : ( gqlVal ) => {
68- return < SpecRunnerHeader gql = { gqlVal } />
75+ return renderWithGql ( gqlVal )
6976 } ,
7077 } )
7178
@@ -82,7 +89,7 @@ describe('SpecRunnerHeader', () => {
8289 gql . currentTestingType = 'component'
8390 } ,
8491 render : ( gqlVal ) => {
85- return < SpecRunnerHeader gql = { gqlVal } />
92+ return renderWithGql ( gqlVal )
8693 } ,
8794 } )
8895
@@ -98,7 +105,7 @@ describe('SpecRunnerHeader', () => {
98105 ctx . currentBrowser = ctx . browsers ?. find ( ( x ) => x . displayName === 'Chrome' ) ?? null
99106 } ,
100107 render : ( gqlVal ) => {
101- return < SpecRunnerHeader gql = { gqlVal } />
108+ return renderWithGql ( gqlVal )
102109 } ,
103110 } )
104111
0 commit comments