-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Set up Jest for unit tests and Cypress for e2e tests (#401)
* Add support for Jest * Set up cypress e2e tests #SkipVersionBump
- Loading branch information
1 parent
898f2b7
commit 3ad74a3
Showing
21 changed files
with
10,541 additions
and
5,864 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,7 @@ | ||
import { defineConfig } from 'cypress'; | ||
|
||
export default defineConfig({ | ||
component: { | ||
devServer: { | ||
framework: 'angular', | ||
bundler: 'webpack', | ||
options: { | ||
projectConfig: { | ||
root: './', | ||
sourceRoot: 'src', | ||
buildOptions: { | ||
outputPath: 'dist/composition' | ||
} | ||
} | ||
} | ||
}, | ||
specPattern: 'projects/cps-ui-kit/**/*.cy.ts', | ||
video: false | ||
e2e: { | ||
baseUrl: 'http://localhost:4200' | ||
} | ||
}); |
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,37 @@ | ||
describe('cps-autocomplete page', () => { | ||
describe('required single autocomplete with a tooltip', () => { | ||
beforeEach(() => { | ||
cy.visit('/autocomplete'); | ||
}); | ||
|
||
it('should select items properly', () => { | ||
cy.get("[data-cy='required-autocomplete']").click(); | ||
cy.contains('Rome').click(); | ||
cy.get("[data-cy='required-autocomplete'] .single-item-selection").should( | ||
'have.text', | ||
'Rome' | ||
); | ||
cy.get("[data-cy='required-autocomplete']").click(); | ||
cy.contains('Prague').click(); | ||
cy.get("[data-cy='required-autocomplete'] .single-item-selection").should( | ||
'have.text', | ||
'Prague' | ||
); | ||
}); | ||
|
||
it('should clear items', () => { | ||
cy.get("[data-cy='required-autocomplete'] .single-item-selection").should( | ||
'have.text', | ||
'Prague' | ||
); | ||
cy.get( | ||
"[data-cy='required-autocomplete'] .cps-autocomplete-box-clear-icon" | ||
).click(); | ||
cy.get('body').click(0, 0); | ||
cy.contains('Field is required'); | ||
cy.get("[data-cy='required-autocomplete'] .single-item-selection").should( | ||
'not.exist' | ||
); | ||
}); | ||
}); | ||
}); |
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,9 @@ | ||
{ | ||
"compilerOptions": { | ||
"target": "es5", | ||
"lib": ["es5", "dom"], | ||
"types": ["cypress", "node"], | ||
"resolveJsonModule": true | ||
}, | ||
"include": ["**/*.ts"] | ||
} |
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,7 @@ | ||
import 'jest-preset-angular/setup-jest'; | ||
|
||
window.ResizeObserver = class ResizeObserver { | ||
observe() {} | ||
unobserve() {} | ||
disconnect() {} | ||
}; |
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,7 @@ | ||
module.exports = { | ||
roots: ['<rootDir>/projects'], | ||
moduleNameMapper: { | ||
'^lodash-es$': 'lodash' | ||
}, | ||
setupFilesAfterEnv: ['<rootDir>/jest-setup.ts'] | ||
}; |
Oops, something went wrong.