fix: Address test failures caused by use of projectId

This commit is contained in:
Mike Plummer
2022-08-13 16:14:36 -05:00
parent e5e79cf3dc
commit baf868b18c
2 changed files with 11 additions and 4 deletions

View File

@@ -370,7 +370,11 @@ describe('<HeaderBarContent />', { viewportWidth: 1000, viewportHeight: 750 }, (
...(options?.state ?? {}),
}
result.currentProject.projectId = options?.projectId ?? null
const projectId = result.currentProject.config.find((item: {field: string, value: string}) => item.field = 'projectId')
if (projectId) {
projectId.value = options?.projectId
}
},
render: (gqlVal) => <div class="border-current border-1 h-700px resize overflow-auto"><HeaderBarContent gql={gqlVal} show-browsers={true} allowAutomaticPromptOpen={true} /></div>,
})

View File

@@ -157,7 +157,7 @@
v-model="isLoginOpen"
:gql="props.gql"
utm-medium="Nav"
:show-connect-button-after-login="isApp && !props.gql?.currentProject?.projectId"
:show-connect-button-after-login="isApp && !cloudProjectId"
@connect-project="handleConnectProject"
/>
</div>
@@ -234,7 +234,6 @@ fragment HeaderBar_HeaderBarContent on Query {
savedState
currentTestingType
branch
projectId
}
isGlobalMode
...TopNav
@@ -251,6 +250,10 @@ const savedState = computed(() => {
return props.gql?.currentProject?.savedState
})
const cloudProjectId = computed(() => {
return props.gql?.currentProject?.config?.find((item: { field: string }) => item.field === 'projectId')?.value
})
const currentProject = computed(() => props.gql.currentProject)
const isLoginOpen = ref(false)
@@ -336,7 +339,7 @@ function shouldShowPrompt (prompt: { slug: string, noProjectId: boolean, interva
// if prompt requires no project id,
// check if project id exists
if (prompt.noProjectId && props.gql?.currentProject?.projectId) {
if (prompt.noProjectId && cloudProjectId.value) {
return false
}