-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: fix spec list header, "Create specs" prompt, add workspace recom…
…mended apollo extension (#18993) * chore: add apollographql.vscode-apollo to extensions.json * fix: show "Create spec" when there are no specs * fix: display correct specslist header
- Loading branch information
Showing
5 changed files
with
94 additions
and
29 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
describe('Index', () => { | ||
beforeEach(() => { | ||
cy.setupE2E('component-tests') | ||
cy.initializeApp() | ||
}) | ||
|
||
context('with no specs', () => { | ||
beforeEach(() => { | ||
cy.visitApp() | ||
cy.withCtx((ctx, o) => { | ||
ctx.actions.file.removeFileInProject('cypress/integration/integration-spec.js') | ||
}) | ||
}) | ||
|
||
it('shows "Create your first spec"', () => { | ||
// after removing the default scaffolded spec, we should be prompted to create a first spec | ||
cy.visitApp() | ||
cy.contains('Create your first spec') | ||
}) | ||
}) | ||
}) |
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,44 +1,80 @@ | ||
import SpecsList from './SpecsList.vue' | ||
import { Specs_SpecsListFragmentDoc, SpecNode_SpecsListFragment } from '../generated/graphql-test' | ||
import { Specs_SpecsListFragmentDoc, SpecNode_SpecsListFragment, TestingTypeEnum } from '../generated/graphql-test' | ||
|
||
const rowSelector = '[data-testid=specs-list-row]' | ||
const inputSelector = 'input' | ||
|
||
function mountWithTestingType (testingType: TestingTypeEnum) { | ||
cy.mountFragment(Specs_SpecsListFragmentDoc, { | ||
onResult: (ctx) => { | ||
if (!ctx.currentProject) throw new Error('need current project') | ||
|
||
ctx.currentProject.currentTestingType = testingType | ||
|
||
return ctx | ||
}, | ||
render: (gqlVal) => { | ||
return <SpecsList gql={gqlVal} /> | ||
}, | ||
}) | ||
} | ||
|
||
let specs: Array<SpecNode_SpecsListFragment> = [] | ||
|
||
describe('<SpecsList />', { keystrokeDelay: 0 }, () => { | ||
beforeEach(() => { | ||
cy.mountFragment(Specs_SpecsListFragmentDoc, { | ||
onResult: (ctx) => { | ||
specs = ctx.currentProject?.specs?.edges || [] | ||
|
||
return ctx | ||
}, | ||
render: (gqlVal) => { | ||
return <SpecsList gql={gqlVal} /> | ||
}, | ||
context('when testingType is unset', () => { | ||
beforeEach(() => { | ||
cy.mountFragment(Specs_SpecsListFragmentDoc, { | ||
onResult: (ctx) => { | ||
specs = ctx.currentProject?.specs?.edges || [] | ||
|
||
return ctx | ||
}, | ||
render: (gqlVal) => { | ||
return <SpecsList gql={gqlVal} /> | ||
}, | ||
}) | ||
}) | ||
}) | ||
|
||
it('should filter specs', () => { | ||
const spec = specs[0].node | ||
it('should filter specs', () => { | ||
const spec = specs[0].node | ||
|
||
cy.get(inputSelector).type('garbage 🗑', { delay: 0 }) | ||
.get(rowSelector) | ||
.should('not.exist') | ||
|
||
cy.get(inputSelector).clear().type(spec.relative) | ||
cy.get(rowSelector).first().should('contain', spec.relative.replace(`/${spec.fileName}${spec.specFileExtension}`, '')) | ||
cy.get(rowSelector).last().should('contain', `${spec.fileName}${spec.specFileExtension}`) | ||
}) | ||
|
||
it('should close directories', () => { | ||
// close all directories | ||
['src', 'packages', 'frontend', '__test__', 'lib', 'tests'].forEach((dir) => { | ||
cy.get('[data-cy="row-directory-depth-0"]').contains(dir).click() | ||
}) | ||
|
||
cy.get('[data-cy="spec-item"]').should('not.exist') | ||
}) | ||
}) | ||
|
||
cy.get(inputSelector).type('garbage 🗑', { delay: 0 }) | ||
.get(rowSelector) | ||
.should('not.exist') | ||
context('when testingType is e2e', () => { | ||
beforeEach(() => { | ||
mountWithTestingType('e2e') | ||
}) | ||
|
||
cy.get(inputSelector).clear().type(spec.relative) | ||
cy.get(rowSelector).first().should('contain', spec.relative.replace(`/${spec.fileName}${spec.specFileExtension}`, '')) | ||
cy.get(rowSelector).last().should('contain', `${spec.fileName}${spec.specFileExtension}`) | ||
it('should display the e2e testing header', () => { | ||
cy.get('[data-cy="specs-testing-type-header"]').should('have.text', 'E2E Specs') | ||
}) | ||
}) | ||
|
||
it('should close directories', () => { | ||
// close all directories | ||
['src', 'packages', 'frontend', '__test__', 'lib', 'tests'].forEach((dir) => { | ||
cy.get('[data-cy="row-directory-depth-0"]').contains(dir).click() | ||
context('when testingType is component', () => { | ||
beforeEach(() => { | ||
mountWithTestingType('component') | ||
}) | ||
|
||
// all directories closed; no specs should be showing. | ||
cy.get('[data-cy="spec-item"]').should('not.exist') | ||
it('should display the component testing header', () => { | ||
cy.get('[data-cy="specs-testing-type-header"]').should('have.text', 'Component Specs') | ||
}) | ||
}) | ||
}) |
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
d65e570
There was a problem hiding this comment.
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:
d65e570
There was a problem hiding this comment.
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: