Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into issue-7306-addSelector-redux
- Loading branch information
Showing
15 changed files
with
468 additions
and
181 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,26 @@ | ||
import RunsEmpty from './RunsEmpty.vue' | ||
import { RunsEmptyFragmentDoc } from '../generated/graphql-test' | ||
import { defaultMessages } from '@cy/i18n' | ||
|
||
describe('<RunsEmpty />', () => { | ||
it('playground', () => { | ||
cy.mountFragment(RunsEmptyFragmentDoc, { | ||
render (gqlVal) { | ||
return (<div class="h-screen"> | ||
<RunsEmpty gql={gqlVal} /> | ||
</div>) | ||
}, | ||
}) | ||
describe('RunsEmpty', () => { | ||
it('renders expected content', () => { | ||
cy.mount(<RunsEmpty />) | ||
|
||
cy.gqlStub.Query.currentProject = { | ||
id: 'test_id', | ||
title: 'project_title', | ||
currentTestingType: 'component', | ||
cloudProject: { | ||
__typename: 'CloudProject', | ||
id: 'cloud_id', | ||
recordKeys: [{ | ||
__typename: 'CloudRecordKey', | ||
id: 'recordKey1', | ||
key: 'abcd-efg-1234', | ||
}], | ||
} as any, | ||
} as any | ||
|
||
cy.contains(defaultMessages.specPage.banners.record.title).should('be.visible') | ||
cy.contains('npx cypress run --component --record --key abcd-efg-1234').should('be.visible') | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
packages/frontend-shared/src/gql-components/RecordPrompt.cy.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import RecordPromptVue from './RecordPrompt.vue' | ||
|
||
describe('RecordPrompt', () => { | ||
it('renders with no props', () => { | ||
cy.mount(<RecordPromptVue />) | ||
|
||
cy.findByText('npx cypress run --record --key <record-key>').should('be.visible') | ||
}) | ||
|
||
it('renders with component testing type', () => { | ||
cy.mount(<RecordPromptVue currentTestingType="component" />) | ||
|
||
cy.findByText('npx cypress run --component --record --key <record-key>').should('be.visible') | ||
}) | ||
|
||
it('renders with record key', () => { | ||
cy.mount(<RecordPromptVue recordKey="abc-123" />) | ||
|
||
cy.findByText('npx cypress run --record --key abc-123').should('be.visible') | ||
}) | ||
|
||
it('renders with record key for component testing', () => { | ||
cy.mount(<RecordPromptVue currentTestingType="component" recordKey="abc-123" />) | ||
|
||
cy.findByText('npx cypress run --component --record --key abc-123').should('be.visible') | ||
}) | ||
}) |
27 changes: 27 additions & 0 deletions
27
packages/frontend-shared/src/gql-components/RecordPrompt.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<template> | ||
<TerminalPrompt | ||
:command="recordCommand" | ||
class="bg-white max-w-900px" | ||
/> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import TerminalPrompt from '@cy/components/TerminalPrompt.vue' | ||
import { computed } from 'vue' | ||
const props = defineProps<{ | ||
recordKey?: string | null | ||
currentTestingType?: string | null | ||
}>() | ||
const firstRecordKey = computed(() => { | ||
return props.recordKey ?? '<record-key>' | ||
}) | ||
const recordCommand = computed(() => { | ||
const componentFlagOrSpace = props.currentTestingType === 'component' ? ' --component ' : ' ' | ||
return `npx cypress run${componentFlagOrSpace}--record --key ${firstRecordKey.value}` | ||
}) | ||
</script> |
35 changes: 35 additions & 0 deletions
35
packages/frontend-shared/src/gql-components/RecordPromptAdapter.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<template> | ||
<RecordPrompt | ||
:record-key="query.data.value?.currentProject?.cloudProject?.__typename === 'CloudProject' ? query.data.value?.currentProject.cloudProject.recordKeys?.[0]?.key : ''" | ||
:current-testing-type="query.data.value?.currentProject?.currentTestingType" | ||
/> | ||
</template> | ||
<script setup lang="ts"> | ||
import { gql, useQuery } from '@urql/vue' | ||
import { RecordPromptAdapterDocument } from '../generated/graphql' | ||
import RecordPrompt from './RecordPrompt.vue' | ||
gql` | ||
query RecordPromptAdapter { | ||
currentProject { | ||
id | ||
title | ||
currentTestingType | ||
cloudProject { | ||
__typename | ||
... on CloudProject { | ||
id | ||
recordKeys { | ||
id | ||
key | ||
} | ||
} | ||
} | ||
} | ||
} | ||
` | ||
const query = useQuery({ query: RecordPromptAdapterDocument }) | ||
</script> |
43 changes: 43 additions & 0 deletions
43
packages/frontend-shared/src/gql-components/RecordRunModal.cy.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import RecordRunModalVue from './RecordRunModal.vue' | ||
import { defaultMessages } from '@cy/i18n' | ||
|
||
describe('RecordRunModal', () => { | ||
it('is not open by default', () => { | ||
cy.mount(<RecordRunModalVue isModalOpen={false} close={cy.stub()} utmMedium="Nav" />) | ||
|
||
cy.findByTestId('record-run-modal').should('not.exist') | ||
}) | ||
|
||
it('renders open', () => { | ||
cy.mount(<RecordRunModalVue isModalOpen={true} close={cy.stub()} utmMedium="Nav" />) | ||
|
||
cy.contains(defaultMessages.specPage.banners.record.title).should('be.visible') | ||
cy.findByTestId('copy-button').should('be.visible') | ||
|
||
cy.contains('npx cypress run --record --key 2aaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa').should('be.visible') | ||
|
||
cy.percySnapshot() | ||
}) | ||
|
||
it('calls close when X is clicked', () => { | ||
const closeStub = cy.stub() | ||
|
||
cy.mount(<RecordRunModalVue isModalOpen={true} close={closeStub} utmMedium="Nav" />) | ||
|
||
cy.findByRole('button', { name: defaultMessages.actions.close }).click().then(() => { | ||
expect(closeStub).to.have.been.called | ||
}) | ||
}) | ||
|
||
it('sends UTM parameters with help link', () => { | ||
cy.mount(<RecordRunModalVue isModalOpen={true} close={cy.stub()} utmMedium="Nav" utmContent="content" />) | ||
|
||
cy.contains(defaultMessages.links.needHelp).should('have.attr', 'href', 'https://on.cypress.io/cypress-run-record-key?utm_medium=Nav&utm_source=Binary%3A+Launchpad&utm_content=content') | ||
}) | ||
|
||
it('sends UTM parameters with help link without UTM content prop', () => { | ||
cy.mount(<RecordRunModalVue isModalOpen={true} close={cy.stub()} utmMedium="Nav" />) | ||
|
||
cy.contains(defaultMessages.links.needHelp).should('have.attr', 'href', 'https://on.cypress.io/cypress-run-record-key?utm_medium=Nav&utm_source=Binary%3A+Launchpad&utm_content=') | ||
}) | ||
}) |
Oops, something went wrong.