-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Update build workflow * Update release workflow * Fix typo in caching * Rewrite Protractor test to Cypress tests * Ude default cypress directory * Use GitHub action to run Cypress tests * Use correct indentation * Update indentation of settings file * Use different way to execute Cypress tests * No need to build lib as it is already built * Fix bug * Use separately installed wait-on * Combine starting app and wait-on * Cleanup the scripts in package.json * Remove e2e testing from angular.json * Also cache path to Cypress binary
- Loading branch information
1 parent
3fcb4dd
commit 0ad50c1
Showing
19 changed files
with
2,591 additions
and
241 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,9 +1,10 @@ | ||
{ | ||
"editor.formatOnSave": true, | ||
"editor.codeActionsOnSave": { | ||
"source.fixAll": true, | ||
"source.fixAll": "explicit" | ||
}, | ||
"html.format.wrapAttributes": "aligned-multiple", | ||
"html.format.wrapLineLength": 150, | ||
"typescript.tsdk": "node_modules/typescript/lib" | ||
} | ||
"typescript.tsdk": "node_modules/typescript/lib", | ||
"npm.exclude": "**/dist/**" | ||
} |
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,8 @@ | ||
import { defineConfig } from 'cypress' | ||
|
||
export default defineConfig({ | ||
e2e: { | ||
baseUrl: 'http://localhost:4200', | ||
supportFile: false | ||
}, | ||
}) |
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,51 @@ | ||
// Disable Cypress retry mechanism as it will retry a couple of times, each with a pause of a second. | ||
// For the tests we want to check that after one second the value has changed so it is better not to | ||
// rely on the framework to do the waiting, instead we use cy.wait(1100). | ||
const noRetries = { | ||
runMode: 0, | ||
openMode: 0, | ||
}; | ||
|
||
describe('workspace-project App', () => { | ||
it('Visits the initial project page', () => { | ||
cy.visit('/'); | ||
cy.get('app-root h1').contains('Welcome to the demo of @politie/ngx-sherlock'); | ||
}); | ||
|
||
it('should update the auto changedetection every second', { retries: noRetries }, done => { | ||
cy.visit('/'); | ||
checkTime(getAutoCDClock, done); | ||
}); | ||
|
||
it('should update the value pipe every second', { retries: noRetries }, done => { | ||
cy.visit('/'); | ||
checkTime(getPipeClock, done); | ||
}); | ||
|
||
it('should update the value proxy pipe every second', { retries: noRetries }, done => { | ||
cy.visit('/'); | ||
checkTime(getProxyPipeClock, done); | ||
}); | ||
}); | ||
|
||
const checkTime = (func: () => Cypress.Chainable<JQuery<HTMLElement>>, done: Mocha.Done) => { | ||
func().invoke('text').then((timeFirst) => { | ||
cy.wait(1100); | ||
func().invoke('text').then((timeSecond) => { | ||
expect(timeSecond).not.to.equal(timeFirst); | ||
done(); | ||
}); | ||
}); | ||
}; | ||
|
||
const getAutoCDClock = () => { | ||
return cy.get('app-auto-change-detection-service time').first(); | ||
}; | ||
|
||
const getPipeClock = () => { | ||
return cy.get('app-value-pipe time.base-clock').first(); | ||
}; | ||
|
||
const getProxyPipeClock = () => { | ||
return cy.get('app-value-pipe time.base-clock').last(); | ||
}; |
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]" | ||
} | ||
|
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 @@ | ||
// *********************************************** | ||
// This example namespace declaration will help | ||
// with Intellisense and code completion in your | ||
// IDE or Text Editor. | ||
// *********************************************** | ||
// declare namespace Cypress { | ||
// interface Chainable<Subject = any> { | ||
// customCommand(param: any): typeof customCommand; | ||
// } | ||
// } | ||
// | ||
// function customCommand(param: any): void { | ||
// console.warn(param); | ||
// } | ||
// | ||
// NOTE: You can use it like so: | ||
// Cypress.Commands.add('customCommand', customCommand); | ||
// | ||
// *********************************************** | ||
// This example commands.js shows you how to | ||
// create various custom commands and overwrite | ||
// existing commands. | ||
// | ||
// For more comprehensive examples of custom | ||
// commands please read more here: | ||
// https://on.cypress.io/custom-commands | ||
// *********************************************** | ||
// | ||
// | ||
// -- This is a parent command -- | ||
// Cypress.Commands.add("login", (email, password) => { ... }) | ||
// | ||
// | ||
// -- This is a child command -- | ||
// Cypress.Commands.add("drag", { prevSubject: 'element'}, (subject, options) => { ... }) | ||
// | ||
// | ||
// -- This is a dual command -- | ||
// Cypress.Commands.add("dismiss", { prevSubject: 'optional'}, (subject, options) => { ... }) | ||
// | ||
// | ||
// -- This will overwrite an existing command -- | ||
// Cypress.Commands.overwrite("visit", (originalFn, url, options) => { ... }) |
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,17 @@ | ||
// *********************************************************** | ||
// This example support/e2e.ts is processed and | ||
// loaded automatically before your test files. | ||
// | ||
// This is a great place to put global configuration and | ||
// behavior that modifies Cypress. | ||
// | ||
// You can change the location of this file or turn off | ||
// automatically serving support files with the | ||
// 'supportFile' configuration option. | ||
// | ||
// You can read more here: | ||
// https://on.cypress.io/configuration | ||
// *********************************************************** | ||
|
||
// When a command from ./commands is ready to use, import with `import './commands'` syntax | ||
// import './commands'; |
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,8 @@ | ||
{ | ||
"extends": "../tsconfig.json", | ||
"include": ["**/*.ts"], | ||
"compilerOptions": { | ||
"sourceMap": false, | ||
"types": ["cypress"] | ||
} | ||
} |
Oops, something went wrong.