Skip to content

Commit

Permalink
fix: Address windows test failures introduced by gql query changes (#…
Browse files Browse the repository at this point in the history
…23332)

* fix: Address test failures caused by use of projectId

* Revert "fix: Address test failures caused by use of projectId"

This reverts commit baf868b.

* Delay cloud modals gql query until needed

* Pluck projectId from config rather than directly query
  • Loading branch information
mike-plummer authored Aug 15, 2022
1 parent 2899b21 commit 9a6b72d
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 12 deletions.
25 changes: 19 additions & 6 deletions packages/app/src/layouts/default.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
:page-name="currentRoute.name?.toString()"
data-cy="app-header-bar"
:allow-automatic-prompt-open="true"
@connect-project="showConnectDialog = true"
@connect-project="handleConnectProject"
/>
<div
v-if="query.data.value?.baseError || query.data.value?.currentProject?.isLoadingConfigFile || query.data.value?.currentProject?.isLoadingNodeEvents"
Expand Down Expand Up @@ -50,9 +50,9 @@
</transition>
</router-view>
<CloudConnectModals
v-if="showConnectDialog && query.data.value"
v-if="showConnectDialog && cloudModalQuery.data.value"
:show="showConnectDialog"
:gql="query.data.value"
:gql="cloudModalQuery.data.value"
@cancel="showConnectDialog = false"
@success="showConnectDialog = false"
/>
Expand All @@ -71,7 +71,7 @@ import CloudConnectModals from '../runs/modals/CloudConnectModals.vue'
import { useRoute } from 'vue-router'
import { computed, ref } from 'vue'
import { MainAppQueryDocument, MainApp_ResetErrorsAndLoadConfigDocument } from '../generated/graphql'
import { MainApp_CloudConnectModalsQueryDocument, MainAppQueryDocument, MainApp_ResetErrorsAndLoadConfigDocument } from '../generated/graphql'
gql`
fragment MainAppQueryData on Query {
Expand All @@ -84,7 +84,6 @@ fragment MainAppQueryData on Query {
isLoadingConfigFile
isLoadingNodeEvents
}
...CloudConnectModals
}
`
Expand All @@ -94,6 +93,12 @@ query MainAppQuery {
}
`
gql`
query MainApp_CloudConnectModalsQuery {
...CloudConnectModals
}
`
gql`
mutation MainApp_ResetErrorsAndLoadConfig($id: ID!) {
resetErrorAndLoadConfig(id: $id) {
Expand All @@ -102,6 +107,10 @@ mutation MainApp_ResetErrorsAndLoadConfig($id: ID!) {
}
`
const showConnectDialog = ref(false)
const cloudModalQuery = useQuery({ query: MainApp_CloudConnectModalsQueryDocument, pause: true })
const currentRoute = useRoute()
const showHeader = computed(() => {
Expand All @@ -121,6 +130,10 @@ const resetErrorAndLoadConfig = (id: string) => {
}
const renderSidebar = window.__CYPRESS_MODE__ !== 'run'
const showConnectDialog = ref(false)
async function handleConnectProject () {
await cloudModalQuery.executeQuery()
showConnectDialog.value = true
}
</script>
8 changes: 6 additions & 2 deletions packages/app/src/runs/CloudConnectButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
v-model="isLoginOpen"
:gql="props.gql"
utm-medium="Runs Tab"
:show-connect-button-after-login="!props.gql?.currentProject?.projectId"
:show-connect-button-after-login="!cloudProjectId"
@connect-project="isProjectConnectOpen = true"
/>
<CloudConnectModals
Expand Down Expand Up @@ -40,7 +40,7 @@ gql`
fragment CloudConnectButton on Query {
currentProject {
id
projectId
config
}
...CloudConnectModals
...LoginModal
Expand Down Expand Up @@ -70,4 +70,8 @@ function openConnection () {
}
}
const cloudProjectId = computed(() => {
return props.gql?.currentProject?.config?.find((item: { field: string }) => item.field === 'projectId')?.value
})
</script>
Original file line number Diff line number Diff line change
Expand Up @@ -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>,
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -234,7 +234,6 @@ fragment HeaderBar_HeaderBarContent on Query {
savedState
currentTestingType
branch
projectId
}
isGlobalMode
...TopNav
Expand All @@ -253,6 +252,10 @@ const savedState = computed(() => {
const currentProject = computed(() => props.gql.currentProject)
const cloudProjectId = computed(() => {
return props.gql?.currentProject?.config?.find((item: { field: string }) => item.field === 'projectId')?.value
})
const isLoginOpen = ref(false)
const clearCurrentProjectMutation = useMutation(GlobalPageHeader_ClearCurrentProjectDocument)
Expand Down Expand Up @@ -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
}
Expand Down

5 comments on commit 9a6b72d

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 9a6b72d Aug 15, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the linux x64 version of the Test Runner.

Learn more about this pre-release platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/10.5.0/linux-x64/develop-9a6b72dd8b760f7d53afa05b92aa382462f72cd9/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 9a6b72d Aug 15, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the linux arm64 version of the Test Runner.

Learn more about this pre-release platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/10.5.0/linux-arm64/develop-9a6b72dd8b760f7d53afa05b92aa382462f72cd9/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 9a6b72d Aug 15, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the darwin arm64 version of the Test Runner.

Learn more about this pre-release platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/10.5.0/darwin-arm64/develop-9a6b72dd8b760f7d53afa05b92aa382462f72cd9/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 9a6b72d Aug 15, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the darwin x64 version of the Test Runner.

Learn more about this pre-release platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/10.5.0/darwin-x64/develop-9a6b72dd8b760f7d53afa05b92aa382462f72cd9/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 9a6b72d Aug 15, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the win32 x64 version of the Test Runner.

Learn more about this pre-release platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/10.5.0/win32-x64/develop-9a6b72dd8b760f7d53afa05b92aa382462f72cd9/cypress.tgz

Please sign in to comment.