From 6244324dc3f1ebb53461d052f1358776a8d39719 Mon Sep 17 00:00:00 2001 From: astone123 Date: Mon, 6 Feb 2023 17:25:10 -0700 Subject: [PATCH 1/4] fix: prompt user to create new project when switching to an org with no projects --- .../modals/SelectCloudProjectModal.cy.tsx | 14 ++++++++++++++ .../modals/SelectCloudProjectModal.vue | 2 ++ 2 files changed, 16 insertions(+) diff --git a/packages/frontend-shared/src/gql-components/modals/SelectCloudProjectModal.cy.tsx b/packages/frontend-shared/src/gql-components/modals/SelectCloudProjectModal.cy.tsx index 41ed65f58165..84fba37b9d25 100644 --- a/packages/frontend-shared/src/gql-components/modals/SelectCloudProjectModal.cy.tsx +++ b/packages/frontend-shared/src/gql-components/modals/SelectCloudProjectModal.cy.tsx @@ -134,6 +134,20 @@ describe('', () => { mountDialog() }) + it('can switch between organizations with and without projects', () => { + cy.get('[data-cy="selectOrganization"]').click() + cy.findByRole('listbox').within(() => cy.findAllByText('Test Org 2').click()) + + cy.contains('button', defaultMessages.runs.connect.modal.selectProject.connectProject).should('not.exist') + cy.contains('button', defaultMessages.runs.connect.modal.selectProject.createProject).should('be.visible') + + cy.get('[data-cy="selectOrganization"]').click() + cy.findByRole('listbox').within(() => cy.findAllByText('Test Org 1').click()) + + cy.contains('button', defaultMessages.runs.connect.modal.selectProject.createProject).should('not.exist') + cy.contains('button', defaultMessages.runs.connect.modal.selectProject.connectProject).should('be.visible') + }) + context('create new project', () => { beforeEach(() => { cy.contains('a', defaultMessages.runs.connect.modal.selectProject.createNewProject).click() diff --git a/packages/frontend-shared/src/gql-components/modals/SelectCloudProjectModal.vue b/packages/frontend-shared/src/gql-components/modals/SelectCloudProjectModal.vue index 68cf5779c0aa..7660197f5968 100644 --- a/packages/frontend-shared/src/gql-components/modals/SelectCloudProjectModal.vue +++ b/packages/frontend-shared/src/gql-components/modals/SelectCloudProjectModal.vue @@ -348,6 +348,8 @@ watch(projectOptions, (newVal, oldVal) => { } else { pickedProject.value = projectOptions.value.find((p) => p.name === projectName.value) } + + newProject.value = projectOptions.value.length === 0 }, { immediate: true, }) From 8de675f8fe6d13f3d392253f321e4bf606263f84 Mon Sep 17 00:00:00 2001 From: astone123 Date: Mon, 6 Feb 2023 17:59:21 -0700 Subject: [PATCH 2/4] changelog --- cli/CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cli/CHANGELOG.md b/cli/CHANGELOG.md index 2b20a859d206..f9b976885104 100644 --- a/cli/CHANGELOG.md +++ b/cli/CHANGELOG.md @@ -3,6 +3,9 @@ _Released 02/14/2023 (PENDING)_ +**Bugfixes:** + - Fixed an issue with the Cloud project selection modal not showing the correct prompts. Fixes [#25520](https://github.com/cypress-io/cypress/issues/25520). + **Features:** - 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). From b5cbf584675704ff595cf9b677aa9e272695c2a5 Mon Sep 17 00:00:00 2001 From: astone123 Date: Tue, 7 Feb 2023 08:43:09 -0700 Subject: [PATCH 3/4] fix changelog --- cli/CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/cli/CHANGELOG.md b/cli/CHANGELOG.md index f9b976885104..525bd3526a4b 100644 --- a/cli/CHANGELOG.md +++ b/cli/CHANGELOG.md @@ -4,6 +4,7 @@ _Released 02/14/2023 (PENDING)_ **Bugfixes:** + - Fixed an issue with the Cloud project selection modal not showing the correct prompts. Fixes [#25520](https://github.com/cypress-io/cypress/issues/25520). **Features:** From e449c942c44b4ce4eb58d1c4e5d4fc78c051e879 Mon Sep 17 00:00:00 2001 From: astone123 Date: Tue, 7 Feb 2023 11:10:19 -0700 Subject: [PATCH 4/4] use newVal rather than ref --- .../src/gql-components/modals/SelectCloudProjectModal.vue | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/frontend-shared/src/gql-components/modals/SelectCloudProjectModal.vue b/packages/frontend-shared/src/gql-components/modals/SelectCloudProjectModal.vue index 7660197f5968..1ae2486aaeb3 100644 --- a/packages/frontend-shared/src/gql-components/modals/SelectCloudProjectModal.vue +++ b/packages/frontend-shared/src/gql-components/modals/SelectCloudProjectModal.vue @@ -344,12 +344,12 @@ watch(projectOptions, (newVal, oldVal) => { } if (newVal.length === 1) { - pickedProject.value = projectOptions.value[0] + pickedProject.value = newVal[0] } else { - pickedProject.value = projectOptions.value.find((p) => p.name === projectName.value) + pickedProject.value = newVal.find((p) => p.name === projectName.value) } - newProject.value = projectOptions.value.length === 0 + newProject.value = newVal.length === 0 }, { immediate: true, })