Skip to content

Commit a21de6b

Browse files
authored
fix: update newProject ref when switching between organizations in SelectCloudProjectModal (#25730)
1 parent f941005 commit a21de6b

File tree

3 files changed

+22
-2
lines changed

3 files changed

+22
-2
lines changed

cli/CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33

44
_Released 02/14/2023 (PENDING)_
55

6+
**Bugfixes:**
7+
8+
- Fixed an issue with the Cloud project selection modal not showing the correct prompts. Fixes [#25520](https://github.com/cypress-io/cypress/issues/25520).
9+
610
**Features:**
711

812
- Added the "Open in IDE" feature for failed tests reported from the Debug page. Addressed in [#25691](https://github.com/cypress-io/cypress/pull/25691).

packages/frontend-shared/src/gql-components/modals/SelectCloudProjectModal.cy.tsx

+14
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,20 @@ describe('<SelectCloudProjectModal />', () => {
134134
mountDialog()
135135
})
136136

137+
it('can switch between organizations with and without projects', () => {
138+
cy.get('[data-cy="selectOrganization"]').click()
139+
cy.findByRole('listbox').within(() => cy.findAllByText('Test Org 2').click())
140+
141+
cy.contains('button', defaultMessages.runs.connect.modal.selectProject.connectProject).should('not.exist')
142+
cy.contains('button', defaultMessages.runs.connect.modal.selectProject.createProject).should('be.visible')
143+
144+
cy.get('[data-cy="selectOrganization"]').click()
145+
cy.findByRole('listbox').within(() => cy.findAllByText('Test Org 1').click())
146+
147+
cy.contains('button', defaultMessages.runs.connect.modal.selectProject.createProject).should('not.exist')
148+
cy.contains('button', defaultMessages.runs.connect.modal.selectProject.connectProject).should('be.visible')
149+
})
150+
137151
context('create new project', () => {
138152
beforeEach(() => {
139153
cy.contains('a', defaultMessages.runs.connect.modal.selectProject.createNewProject).click()

packages/frontend-shared/src/gql-components/modals/SelectCloudProjectModal.vue

+4-2
Original file line numberDiff line numberDiff line change
@@ -344,10 +344,12 @@ watch(projectOptions, (newVal, oldVal) => {
344344
}
345345
346346
if (newVal.length === 1) {
347-
pickedProject.value = projectOptions.value[0]
347+
pickedProject.value = newVal[0]
348348
} else {
349-
pickedProject.value = projectOptions.value.find((p) => p.name === projectName.value)
349+
pickedProject.value = newVal.find((p) => p.name === projectName.value)
350350
}
351+
352+
newProject.value = newVal.length === 0
351353
}, {
352354
immediate: true,
353355
})

0 commit comments

Comments
 (0)