-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: added cypress tests and ci (#14)
* test: cypress setup and dropdown test * test: cypress testing branch * fix: update cypress version remove error: ``` TSError: ⨯ Unable to compile TypeScript: error TS5095: Option 'bundler' can only be used when 'module' is set to 'es2015' or later. ``` * fix: rebuild pnpm.lock * chore: updated dependencies * ci: updated ci to include cypress tests * ci: fix for prettier step in lint job --------- Co-authored-by: Pratik Borole <[email protected]>
- Loading branch information
1 parent
0aac508
commit 7738b1d
Showing
16 changed files
with
1,210 additions
and
717 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 was deleted.
Oops, something went wrong.
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,10 @@ | ||
import { defineConfig } from 'cypress'; | ||
|
||
export default defineConfig({ | ||
component: { | ||
devServer: { | ||
framework: 'next', | ||
bundler: 'webpack', | ||
}, | ||
}, | ||
}); |
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,38 @@ | ||
// /* eslint-disable simple-import-sort/imports */ | ||
|
||
import '@/app/globals.css'; | ||
|
||
import { Dropdown } from '@/app/ui/Dropdown'; | ||
|
||
describe('Dropdown.cy.tsx', () => { | ||
const initialVal = 'Initial Val'; | ||
const options = ['Option 1', 'Options2']; | ||
|
||
it('dropdown selects first option', () => { | ||
const action = cy.spy().as('onDropdownChange'); | ||
cy.mount(<Dropdown value={initialVal} items={options} action={action} />); | ||
cy.get('[data-cy="dropdown"]').click(); | ||
cy.get('[data-cy="dropdown-item"]').first().click(); | ||
cy.get('@onDropdownChange').should('have.been.calledWith', options[0]); | ||
}); | ||
|
||
it('dropdown selects second option', () => { | ||
const action = cy.spy().as('onDropdownChange'); | ||
cy.mount(<Dropdown value={initialVal} items={options} action={action} />); | ||
cy.get('[data-cy="dropdown"]').click(); | ||
cy.get('[data-cy="dropdown-item"]').first().next().click(); | ||
cy.get('@onDropdownChange').should('have.been.calledWith', options[1]); | ||
}); | ||
|
||
it('dropdown with no items and close dropdown', () => { | ||
const action = cy.spy().as('onDropdownChange'); | ||
cy.mount(<Dropdown value={initialVal} items={[]} action={action} />); | ||
cy.get('[data-cy="dropdown"]').click(); | ||
cy.get('[data-cy="dropdown-item"]').should('not.exist'); | ||
cy.get('@onDropdownChange').should('not.have.been.calledWith', options[0]); | ||
cy.get('@onDropdownChange').should('not.have.been.calledWith', options[1]); | ||
|
||
// Outside click | ||
cy.get('body').click(); | ||
}); | ||
}); |
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,5 @@ | ||
{ | ||
"name": "Using fixtures to represent data", | ||
"email": "[email protected]", | ||
"body": "Fixtures are a great way to mock data for responses to routes" | ||
} |
Oops, something went wrong.