Skip to content

Commit 9e70f1d

Browse files
Barthélémy Ledouxlmiller1990
andauthored
feat: add footer to the settings (#18867)
* feat: add footer to the settings * update i18n Co-authored-by: Lachlan Miller <[email protected]>
1 parent f967908 commit 9e70f1d

File tree

4 files changed

+48
-4
lines changed

4 files changed

+48
-4
lines changed

packages/app/cypress/e2e/integration/settings.spec.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,12 @@ describe('Settings', { viewportWidth: 1200 }, () => {
3030
cy.findByText('Testing Preferences').should('be.visible')
3131
cy.findByText('Proxy Settings').should('be.visible')
3232
})
33+
34+
it('calls a reconfigure mutation when click on the footer button', () => {
35+
cy.visitApp()
36+
cy.get('[href="#/settings"]').click()
37+
cy.intercept('mutation-SettingsContainer_ReconfigureProject', { 'data': { 'reconfigureProject': true } }).as('ReconfigureProject')
38+
cy.findByText('Reconfigure Project').click()
39+
cy.wait('@ReconfigureProject')
40+
})
3341
})

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

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,19 @@ import { SettingsContainerFragmentDoc } from '../generated/graphql-test'
22
import { defaultMessages } from '@cy/i18n'
33
import SettingsContainer from './SettingsContainer.vue'
44

5-
describe('<SettingsContainer />', () => {
5+
describe('<SettingsContainer />', { viewportHeight: 800, viewportWidth: 900 }, () => {
66
it('renders', () => {
7-
cy.viewport(900, 800)
87
cy.mountFragment(SettingsContainerFragmentDoc, { render: (gql) => <SettingsContainer gql={gql} /> })
98

109
cy.contains('Project Settings').click()
1110

1211
cy.findByText(defaultMessages.settingsPage.projectId.title).should('be.visible')
1312
cy.findByText(defaultMessages.settingsPage.config.title).should('be.visible').click()
1413
})
14+
15+
it('renders a footer', () => {
16+
cy.mountFragment(SettingsContainerFragmentDoc, { render: (gql) => <SettingsContainer gql={gql} /> })
17+
cy.findByText(defaultMessages.settingsPage.footer.text)
18+
cy.findByText(defaultMessages.settingsPage.footer.button)
19+
})
1520
})

packages/app/src/settings/SettingsContainer.vue

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,21 +22,42 @@
2222
:gql="props.gql.currentProject"
2323
/>
2424
</SettingsCard>
25+
<hr class="border-gray-100 my-32px">
26+
<p class="leading-24px text-16px text-light max-w-500px text-gray-500 mx-auto text-center">
27+
{{ t('settingsPage.footer.text') }}
28+
</p>
29+
<Button
30+
class="my-16px mx-auto"
31+
variant="outline"
32+
:prefix-icon="SettingsIcon"
33+
prefix-icon-class="icon-dark-gray-500 icon-light-gray-50"
34+
@click="reconfigure"
35+
>
36+
{{ t('settingsPage.footer.button') }}
37+
</Button>
2538
</div>
2639
</template>
2740

2841
<script lang="ts" setup>
2942
import { useI18n } from '@cy/i18n'
30-
import { gql } from '@urql/vue'
43+
import { gql, useMutation } from '@urql/vue'
44+
import Button from '@cy/components/Button.vue'
3145
import SettingsCard from './SettingsCard.vue'
3246
import ProjectSettings from './project/ProjectSettings.vue'
3347
import DeviceSettings from './device/DeviceSettings.vue'
34-
import type { SettingsContainerFragment } from '../generated/graphql'
48+
import { SettingsContainer_ReconfigureProjectDocument, SettingsContainerFragment } from '../generated/graphql'
3549
import IconLaptop from '~icons/cy/laptop_x24.svg'
3650
import IconFolder from '~icons/cy/folder-outline_x24.svg'
51+
import SettingsIcon from '~icons/cy/settings_x16.svg'
3752
3853
const { t } = useI18n()
3954
55+
gql`
56+
mutation SettingsContainer_ReconfigureProject {
57+
reconfigureProject
58+
}
59+
`
60+
4061
gql`
4162
fragment SettingsContainer on Query {
4263
currentProject {
@@ -48,4 +69,10 @@ fragment SettingsContainer on Query {
4869
const props = defineProps<{
4970
gql: SettingsContainerFragment
5071
}>()
72+
73+
const openElectron = useMutation(SettingsContainer_ReconfigureProjectDocument)
74+
75+
function reconfigure () {
76+
openElectron.executeMutation({})
77+
}
5178
</script>

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,10 @@
310310
"testingPreferences": {
311311
"title": "Testing Preferences",
312312
"description": "Configure your testing environment with these flags"
313+
},
314+
"footer": {
315+
"text": "You can reconfigure the settings for this project if you’re experiencing issues with your Cypress configuration.",
316+
"button": "Reconfigure Project"
313317
}
314318
},
315319
"runs": {

0 commit comments

Comments
 (0)