Skip to content

Commit

Permalink
Merge branch 'alejandro/fix/component-spec-creation' of github.com:cy…
Browse files Browse the repository at this point in the history
…press-io/cypress into alejandro/fix/component-spec-creation
  • Loading branch information
estrada9166 committed Jan 28, 2022
2 parents cf6f7a9 + 749c1a3 commit 68f336d
Show file tree
Hide file tree
Showing 25 changed files with 516 additions and 234 deletions.
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/1-bug-report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ body:
id: reproduction
attributes:
label: Test code to reproduce
description: Provide a failing test or repo we can run. You can fork [this repo](https://github.com/cypress-io/cypress-test-tiny), set up a failing test, then link to your fork.
description: Provide a failing test or repo we can run. You can fork [this repo](https://github.com/cypress-io/cypress-test-tiny), set up a failing test, then link to your fork. If you have never done this before, watch [this video](https://youtu.be/NnriKHmj5T8) for example.
placeholder: Here is my failing test code and the app code to run the tests on...
validations:
required: true
Expand All @@ -39,4 +39,4 @@ body:
id: other
attributes:
label: Other
placeholder: Any other details?
placeholder: Any other details?
4 changes: 4 additions & 0 deletions circle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2127,15 +2127,19 @@ linux-workflow: &linux-workflow
requires:
- build
- system-tests-chrome:
context: test-runner:performance-tracking
requires:
- system-tests-node-modules-install
- system-tests-electron:
context: test-runner:performance-tracking
requires:
- system-tests-node-modules-install
- system-tests-firefox:
context: test-runner:performance-tracking
requires:
- system-tests-node-modules-install
- system-tests-non-root:
context: test-runner:performance-tracking
executor: non-root-docker-user
requires:
- system-tests-node-modules-install
Expand Down
11 changes: 10 additions & 1 deletion guides/release-process.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,13 @@ of Cypress. You can see the progress of the test projects by opening the status
![Screenshot of status checks](https://i.imgur.com/AsQwzgO.png)
Once the `develop` branch for all test projects are reliably passing with the new changes, publishing can proceed.
#### :bangbang: Important :bangbang:
The `linux x64`, `win32 x64`, and `darwin x64` artifacts produced by CI are all placed in the same directory on the CDN. The version that was built last will overwrite the other versions in the directory. Until work is done to complete [#19771](https://github.com/cypress-io/cypress/issues/19771), you must ensure that the `linux` workflow publishes its artifacts **after** the `windows`/`mac` workflows. To guarantee this, you can re-run the `create-build-artifacts` job for the `linux` workflow within CircleCI after the initial builds have completed.
<img src="https://user-images.githubusercontent.com/1711637/150612076-ac1d233b-519a-443b-9fd4-950a8f0439ef.png" width="250" height="auto">
Once the `develop` branch for all test projects are reliably passing with the new changes and the `linux` binary is present at `https://cdn.cypress.io/beta/npm/X.Y.Z/<sha>/cypress.tgz`, publishing can proceed.
### Steps to Publish a New Version
Expand All @@ -89,6 +95,7 @@ In the following instructions, "X.Y.Z" is used to denote the [next version of Cy
![commit-link](https://user-images.githubusercontent.com/1157043/80608728-33fe6100-8a05-11ea-8b53-375303757b67.png)
2. Scroll down past the changes to the comments. The first comment should be a `cypress-bot` comment that includes a line beginning `npm install ...`. Grab the `https://cdn.../npm/X.Y.Z/<long sha>/cypress.tgz` link.
![cdn-tgz-link](https://user-images.githubusercontent.com/1157043/80608736-3791e800-8a05-11ea-8d75-e4f80128e857.png)
- Make sure the linux binaries are present at that location. See [Before Publishing a New Version](#before-publishing-a-new-version).
- Publish to the npm registry straight from the URL:
```shell
Expand All @@ -107,6 +114,8 @@ In the following instructions, "X.Y.Z" is used to denote the [next version of Cy
- Run a quick, manual smoke test:
- `cypress open`
- Go into a project, run a quick test, make sure things look right
- Install the new version into an established project and run the tests there
- [cypress-realworld-app](https://github.com/cypress-io/cypress-realworld-app) uses yarn and represents a typical consumer implementation.
- Optionally, do more thorough tests:
- Trigger test projects from the command line (if you have the appropriate permissions)
Expand Down
78 changes: 41 additions & 37 deletions packages/app/cypress/e2e/sidebar_navigation.cy.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import type { Interception } from '@packages/net-stubbing/lib/external-types'

describe('Sidebar Navigation', () => {
context('as e2e testing type', () => {
beforeEach(() => {
Expand Down Expand Up @@ -75,10 +73,6 @@ describe('Sidebar Navigation', () => {
cy.percySnapshot()
cy.get('[data-cy="sidebar-header"]').trigger('mouseout')

cy.get('[data-cy="switch-testing-type"]').realHover()
cy.contains('#tooltip-target > div', 'E2E Testing')
cy.get('[data-cy="switch-testing-type"]').trigger('mouseout')

cy.get('[data-e2e-href="/runs"]').realHover()
cy.contains('#tooltip-target > div', 'Runs')
cy.get('[data-e2e-href="/runs"]').trigger('mouseout')
Expand Down Expand Up @@ -107,26 +101,42 @@ describe('Sidebar Navigation', () => {
cy.findAllByText('todos').eq(1).should('be.visible')
})

it('displays the project name (expanded state)', () => {
it('displays the project name and opens a modal to switch testing type', () => {
cy.findByLabelText('Sidebar').closest('[aria-expanded]').should('have.attr', 'aria-expanded', 'true')

cy.findAllByText('todos').eq(1).should('be.visible')
})

it('has menu item labeled by current active testing type that opens a modal to switch testing type (expanded state)', () => {
cy.findByLabelText('Sidebar').closest('[aria-expanded]').should('have.attr', 'aria-expanded', 'true')
cy.get('[data-cy="sidebar-header"]').within(() => {
cy.get('[data-cy="testing-type-e2e"]').should('be.visible')
cy.findByText('todos').should('be.visible')
}).click()

cy.findByText('E2E Testing').should('be.visible')
cy.get('[data-cy="switch-testing-type"]').click()
cy.findByText('Choose a testing type').should('be.visible')

cy.get('[data-cy-testingtype=e2e]').within(() => {
cy.contains('Configured')
})

cy.intercept('mutation-SwitchTestingType_ReconfigureProject').as('SwitchTestingType')
cy.get('[data-cy-testingtype="component"]').click()
cy.wait('@SwitchTestingType').then((interception: Interception) => {
expect(interception.request.url).to.include('graphql/mutation-SwitchTestingType_ReconfigureProject')
cy.withCtx((ctx) => {
ctx.actions.project.reconfigureProject = sinon.stub()
})

cy.get('[data-cy-testingtype="component"]').within(() => {
cy.contains('Not Configured')
}).click()

cy.wait('@SwitchTestingType').then((interception) => {
expect(interception.request.body.variables.testingType).eq('component')
})

cy.get('[aria-label="Close"]').click()
cy.findByText('Choose a testing type').should('not.exist')

cy.findByLabelText('toggle navigation', {
selector: 'button',
}).click()

cy.get('[data-cy="sidebar-header"]').click()
cy.findByText('Choose a testing type').should('be.visible')
})

it('has unlabeled menu item that shows the keyboard shortcuts modal (expanded state)', () => {
Expand Down Expand Up @@ -175,20 +185,6 @@ describe('Sidebar Navigation', () => {
cy.get('[data-cy="app-header-bar"]').findByText('Settings').should('be.visible')
cy.get('.router-link-active').findByText('Settings').should('be.visible')
})

it('shows if testing type is configured when clicking switch testing type', () => {
cy.openProject('pristine-with-e2e-testing')

cy.findByText('E2E Testing').should('be.visible')
cy.get('[data-cy="switch-testing-type"]').click()
cy.get('[data-cy-testingtype=e2e]').within(() => {
cy.contains('Configured')
})

cy.get('[data-cy-testingtype=component]').within(() => {
cy.contains('Not Configured')
})
})
})

context('as component testing type', () => {
Expand All @@ -198,15 +194,23 @@ describe('Sidebar Navigation', () => {
cy.startAppServer('component')
cy.visitApp()

cy.findByText('Component Testing').should('be.visible')
cy.get('[data-cy="switch-testing-type"]').click()
cy.get('[data-cy-testingtype=e2e]').within(() => {
cy.contains('Not Configured')
})

cy.get('[data-cy="sidebar-header"]').within(() => cy.get('[data-cy="testing-type-component"]')).click()
cy.get('[data-cy-testingtype=component]').within(() => {
cy.contains('Configured')
})

cy.intercept('mutation-SwitchTestingType_ReconfigureProject').as('SwitchTestingType')
cy.withCtx((ctx) => {
ctx.actions.project.reconfigureProject = sinon.stub()
})

cy.get('[data-cy-testingtype="e2e"]').within(() => {
cy.contains('Not Configured')
}).click()

cy.wait('@SwitchTestingType').then((interception) => {
expect(interception.request.body.variables.testingType).eq('e2e')
})
})
})
})
6 changes: 1 addition & 5 deletions packages/app/src/navigation/SidebarNavigation.cy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,13 @@ describe('SidebarNavigation', () => {
cy.contains('#tooltip-target > div', 'test-project').should('be.visible')
cy.get('[data-cy="sidebar-header"]').trigger('mouseout')

cy.get('[data-cy="switch-testing-type"]').realHover()
cy.contains('#tooltip-target > div', 'E2E Testing').should('be.visible')
cy.get('[data-cy="switch-testing-type"]').trigger('mouseout')

cy.get('[data-e2e-href="/runs"]').realHover()
cy.contains('#tooltip-target > div', 'Runs').should('be.visible')
cy.get('[data-e2e-href="/runs"]').trigger('mouseout')
})

it('opens a modal to switch testing type', { viewportWidth: 1280 }, () => {
mountComponent()
cy.get('[data-cy="switch-testing-type"]').click()
cy.get('[data-cy="sidebar-header"]').click()
})
})
50 changes: 6 additions & 44 deletions packages/app/src/navigation/SidebarNavigation.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,45 +20,14 @@
</div>
</button>
<div class="flex flex-col flex-1 overflow-y-auto ">
<SidebarTooltip
class="border-b flex border-gray-900 flex-shrink-0 h-64px items-center"
:disabled="mainStore.navBarExpanded"
:popper-top-offset="4"
popper-class="h-56px"
data-cy="sidebar-header"
>
<i-cy-bookmark_x24
class="flex-shrink-0
h-24px
mx-20px
w-24px
icon-dark-gray-200 icon-light-gray-900"
/>
<div class="text-gray-50 text-size-16px leading-24px truncate">
{{ currentProject?.title ?? 'Cypress' }}
<p class="text-gray-600 text-size-14px leading-20px truncate">
{{ currentProject?.branch }}
</p>
</div>

<template #popper>
<div class="text-left text-gray-50 text-size-16px leading-16px truncate">
{{ currentProject?.title ?? 'Cypress' }}
<p class="text-gray-600 text-size-14px leading-20px truncate">
{{ currentProject?.branch }}
</p>
</div>
</template>
</SidebarTooltip>

<SidebarNavigationHeader
v-if="query.data.value"
:gql="query.data.value"
/>
<nav
class="space-y-1 bg-gray-1000 flex-1"
aria-label="Sidebar"
>
<SwitchTestingTypeButton
v-if="query.data.value"
:gql="query.data.value"
/>
<RouterLink
v-for="item in navigation"
v-slot="{ isActive }"
Expand Down Expand Up @@ -108,7 +77,6 @@
import { computed, ref } from 'vue'
import { gql, useQuery } from '@urql/vue'
import SidebarNavigationRow from './SidebarNavigationRow.vue'
import SwitchTestingTypeButton from './SwitchTestingTypeButton.vue'
import KeyboardBindingsModal from './KeyboardBindingsModal.vue'
import CodeIcon from '~icons/cy/code-editor_x24'
import RunsIcon from '~icons/cy/runs_x24'
Expand All @@ -120,6 +88,7 @@ import { SideBarNavigationDocument } from '../generated/graphql'
import CypressLogo from '@packages/frontend-shared/src/assets/logos/cypress_s.png'
import { useI18n } from '@cy/i18n'
import { useRoute } from 'vue-router'
import SidebarNavigationHeader from './SidebarNavigationHeader.vue'
const { t } = useI18n()
Expand All @@ -131,19 +100,12 @@ const navigation = [
gql`
query SideBarNavigation {
...SwitchTestingTypeButton
currentProject {
id
title
branch
}
...SidebarNavigationHeader
}
`
const query = useQuery({ query: SideBarNavigationDocument, requestPolicy: 'network-only' })
const currentProject = computed(() => query.data.value?.currentProject)
const bindingsOpen = ref(false)
const mainStore = useMainStore()
Expand Down
93 changes: 93 additions & 0 deletions packages/app/src/navigation/SidebarNavigationHeader.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
<template>
<SidebarTooltip
v-if="testingType"
class="border-b cursor-pointer flex border-gray-900 flex-shrink-0 h-64px pl-20px transition-all duration-300 items-center hover:bg-gray-900"
:disabled="mainStore.navBarExpanded"
:popper-top-offset="4"
popper-class="h-56px"
data-cy="sidebar-header"
tabindex="0"
@click="showModal = true"
@keydown.enter="showModal = true"
>
<SwitchTestingTypeModal
:show="showModal"
:gql="props.gql"
@close="showModal = false"
/>
<component
:is="testingType.icon"
class="
flex-shrink-0 h-24px
mr-20px w-24px
icon-dark-jade-600 icon-light-jade-300
children:transition
children:duration-300"
/>
<div class="text-gray-50 text-size-16px leading-24px truncate">
{{ props.gql.currentProject?.title ?? 'Cypress' }}
<p class="text-gray-600 text-size-14px leading-20px truncate">
{{ props.gql.currentProject?.branch }}
</p>
</div>

<template #popper>
<div class="text-left text-gray-50 text-size-16px leading-16px truncate">
{{ props.gql.currentProject?.title ?? 'Cypress' }}
<p class="text-gray-600 text-size-14px leading-20px truncate">
{{ props.gql.currentProject?.branch }}
</p>
</div>
</template>
</SidebarTooltip>
</template>

<script lang="ts" setup>
import { computed, ref } from 'vue'
import { gql } from '@urql/vue'
import type { SidebarNavigationHeaderFragment } from '../generated/graphql'
import { useMainStore } from '../store'
import SidebarTooltip from './SidebarTooltip.vue'
import SwitchTestingTypeModal from './SwitchTestingTypeModal.vue'
import IconE2E from '~icons/cy/testing-type-e2e-solid-simple'
import IconComponent from '~icons/cy/testing-type-component-solid_x64'
import { useI18n } from '@cy/i18n'
const { t } = useI18n()
gql`
fragment SidebarNavigationHeader on Query {
...SwitchTestingTypeModal
currentProject {
id
currentTestingType
title
branch
}
}
`
const showModal = ref(false)
const props = defineProps<{
gql: SidebarNavigationHeaderFragment
}>()
const TESTING_TYPE_MAP = {
e2e: {
name: t(`testingType.e2e.name`),
icon: IconE2E,
},
component: {
name: t(`testingType.component.name`),
icon: IconComponent,
},
} as const
const testingType = computed(() => {
return props.gql.currentProject?.currentTestingType ? TESTING_TYPE_MAP[props.gql.currentProject.currentTestingType] : null
})
const mainStore = useMainStore()
</script>
Loading

0 comments on commit 68f336d

Please sign in to comment.