Skip to content

Commit b21ecfb

Browse files
RachelZachJW34
andauthored
feat: replace reconfigure button on settings page with link to config doc (#21077)
Co-authored-by: Zachary Williams <ZachJW34@gmail.com>
1 parent f8621da commit b21ecfb

File tree

4 files changed

+21
-29
lines changed

4 files changed

+21
-29
lines changed

packages/app/cypress/e2e/settings.cy.ts

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -27,19 +27,6 @@ describe('App: Settings', () => {
2727
cy.get('button').contains('Log In')
2828
})
2929

30-
it('can reconfigure a project', () => {
31-
cy.startAppServer('e2e')
32-
cy.visitApp('settings')
33-
cy.withCtx((ctx, o) => {
34-
o.sinon.stub(ctx.actions.project, 'reconfigureProject')
35-
})
36-
37-
cy.findByText('Reconfigure Project').click()
38-
cy.withRetryableCtx((ctx) => {
39-
expect(ctx.actions.project.reconfigureProject).to.have.been.called
40-
})
41-
})
42-
4330
describe('Cloud Settings', () => {
4431
it('shows the projectId section when there is a projectId', () => {
4532
cy.withCtx(async (ctx, o) => {

packages/app/src/settings/SettingsContainer.cy.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,4 +50,11 @@ describe('<SettingsContainer />', { viewportHeight: 800, viewportWidth: 900 }, (
5050

5151
cy.findByText(defaultMessages.settingsPage.projectId.title).should('not.exist')
5252
})
53+
54+
it('renders footer with CTA button', () => {
55+
mountSettingsContainer()
56+
cy.contains('p', defaultMessages.settingsPage.footer.text.replace('{testingType}', 'E2E'))
57+
cy.contains('a', defaultMessages.settingsPage.footer.button)
58+
.should('have.attr', 'href', defaultMessages.settingsPage.footer.buttonLink)
59+
})
5360
})

packages/app/src/settings/SettingsContainer.vue

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -36,23 +36,25 @@
3636
</div>
3737
<hr class="border-gray-100">
3838
<p class="mx-auto font-light text-center text-gray-500 max-w-500px text-16px leading-24px">
39-
{{ t('settingsPage.footer.text') }}
39+
{{ footerText }}
4040
</p>
4141
<Button
4242
class="mx-auto group"
4343
variant="outline"
4444
:prefix-icon="SettingsIcon"
4545
prefix-icon-class="icon-dark-gray-500 icon-light-gray-50 group-hocus:icon-dark-indigo-400 group-hocus:icon-light-indigo-50"
46-
@click="reconfigure"
46+
:href="t('settingsPage.footer.buttonLink')"
4747
>
4848
{{ t('settingsPage.footer.button') }}
4949
</Button>
5050
</div>
5151
</template>
5252

5353
<script lang="ts" setup>
54+
55+
import { computed } from 'vue'
5456
import { useI18n } from '@cy/i18n'
55-
import { gql, useMutation } from '@urql/vue'
57+
import { gql } from '@urql/vue'
5658
import Button from '@cy/components/Button.vue'
5759
import ExternalEditorSettings from './device/ExternalEditorSettings.vue'
5860
import ProxySettings from './device/ProxySettings.vue'
@@ -61,19 +63,19 @@ import ProjectSettings from './project/ProjectSettings.vue'
6163
import CloudSettings from '../settings/project/CloudSettings.vue'
6264
import TestingPreferences from './device/TestingPreferences.vue'
6365
import type { SettingsContainerFragment } from '../generated/graphql'
64-
import { SettingsContainer_ReconfigureProjectDocument } from '../generated/graphql'
6566
import IconLaptop from '~icons/cy/laptop_x24.svg'
6667
import IconOdometer from '~icons/cy/object-odometer_x24.svg'
6768
import IconFolder from '~icons/cy/folder-outline_x24.svg'
6869
import SettingsIcon from '~icons/cy/settings_x16.svg'
6970
7071
const { t } = useI18n()
7172
72-
gql`
73-
mutation SettingsContainer_ReconfigureProject {
74-
reconfigureProject
75-
}
76-
`
73+
const footerText = computed(() => {
74+
return t('settingsPage.footer.text',
75+
{ testingType: props.gql.currentProject?.currentTestingType === 'component'
76+
? 'component'
77+
: 'E2E' })
78+
})
7779
7880
gql`
7981
fragment SettingsContainer on Query {
@@ -91,9 +93,4 @@ const props = defineProps<{
9193
gql: SettingsContainerFragment
9294
}>()
9395
94-
const openElectron = useMutation(SettingsContainer_ReconfigureProjectDocument)
95-
96-
function reconfigure () {
97-
openElectron.executeMutation({})
98-
}
9996
</script>

packages/frontend-shared/src/locales/en-US.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -410,8 +410,9 @@
410410
}
411411
},
412412
"footer": {
413-
"text": "You can reconfigure the settings for this project if you're experiencing issues with your Cypress configuration.",
414-
"button": "Reconfigure Project"
413+
"text": "You can reconfigure the {testingType} testing settings for this project if you're experiencing issues with your Cypress configuration.",
414+
"button": "Configuration Guide",
415+
"buttonLink": "https://docs.cypress.io/guides/references/configuration"
415416
}
416417
},
417418
"runs": {

0 commit comments

Comments
 (0)