Skip to content

Commit

Permalink
feat: wire up the manage record keys button (#19829)
Browse files Browse the repository at this point in the history
  • Loading branch information
Barthélémy Ledoux authored Jan 24, 2022
1 parent 5cac74c commit d307abe
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 11 deletions.
21 changes: 21 additions & 0 deletions packages/app/cypress/e2e/settings.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,27 @@ describe('App: Settings', () => {
cy.findByText('Project ID').should('be.visible')
})

it('shows the recordKeys section', () => {
cy.loginUser()

cy.visitApp()
cy.findByText('Settings').click()
cy.findByText('Project Settings').click()
cy.findByText('Record Key').should('be.visible')
})

it('opens cloud settings when clicking on "Manage Keys"', () => {
cy.loginUser()
cy.intercept('mutation-ExternalLink_OpenExternal', { 'data': { 'openExternal': true } }).as('OpenExternal')
cy.visitApp()
cy.findByText('Settings').click()
cy.findByText('Project Settings').click()
cy.findByText('Manage Keys').click()
cy.wait('@OpenExternal')
.its('request.body.variables.url')
.should('equal', 'http:/test.cloud/cloud-project/settings')
})

it('can reconfigure a project', () => {
cy.visitApp('settings')

Expand Down
2 changes: 2 additions & 0 deletions packages/app/src/settings/project/ProjectSettings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
v-for="key of props.gql.currentProject.cloudProject.recordKeys"
:key="key.id"
:gql="key"
:manage-keys-url="props.gql.currentProject.cloudProject.cloudProjectSettingsUrl"
/>
</template>
<SpecPatterns :gql="props.gql.currentProject" />
Expand All @@ -34,6 +35,7 @@ fragment ProjectSettings on Query {
__typename
... on CloudProject {
id
cloudProjectSettingsUrl
recordKeys {
id
...RecordKey
Expand Down
2 changes: 1 addition & 1 deletion packages/app/src/settings/project/RecordKey.cy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ describe('<RecordKey />', () => {
},
render: (gql) => (
<div class="py-4 px-8">
<RecordKey gql={gql} />
<RecordKey gql={gql} manageKeysUrl="http://project.cypress.io/settings" />
</div>
),
})
Expand Down
22 changes: 12 additions & 10 deletions packages/app/src/settings/project/RecordKey.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
</template>
<div
v-if="recordKey"
class="inline-flex justify-start gap-10px"
class="gap-10px inline-flex justify-start"
>
<CodeBox
:code="recordKey"
Expand All @@ -45,16 +45,19 @@

<script lang="ts" setup>
import { computed, ref } from 'vue'
import { useI18n } from '@cy/i18n'
import type { RecordKeyFragment } from '../../generated/graphql'
import SettingsSection from '../SettingsSection.vue'
import { gql } from '@urql/core'
import Button from '@cy/components/Button.vue'
import CopyButton from '@cy/components/CopyButton.vue'
import ExternalLink from '@cy/gql-components/ExternalLink.vue'
import { useExternalLink } from '@cy/gql-components/useExternalLink'
import IconKey from '~icons/cy/placeholder_x16.svg'
import IconExport from '~icons/cy/export_x16.svg'
import { gql } from '@urql/core'
import CopyButton from '@cy/components/CopyButton.vue'
import type { RecordKeyFragment } from '../../generated/graphql'
import SettingsSection from '../SettingsSection.vue'
import CodeBox from './CodeBox.vue'
import ExternalLink from '@packages/frontend-shared/src/gql-components/ExternalLink.vue'
import { useI18n } from '@cy/i18n'
const { t } = useI18n()
gql`
fragment RecordKey on CloudRecordKey {
Expand All @@ -65,11 +68,10 @@ fragment RecordKey on CloudRecordKey {
const props = defineProps<{
gql: RecordKeyFragment
manageKeysUrl: string
}>()
const openManageKeys = () => { }
const showRecordKey = ref(false)
const { t } = useI18n()
const openManageKeys = useExternalLink(props.manageKeysUrl)
const recordKey = computed(() => props.gql.key)
</script>

3 comments on commit d307abe

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on d307abe Jan 24, 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.0.0/circle-10.0-release-d307abe1f152601a0c17abc64cd0d96bccb0522b/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on d307abe Jan 24, 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.0.0/circle-10.0-release-d307abe1f152601a0c17abc64cd0d96bccb0522b/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on d307abe Jan 24, 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.0.0/circle-10.0-release-d307abe1f152601a0c17abc64cd0d96bccb0522b/cypress.tgz

Please sign in to comment.