Created
March 30, 2020 13:21
-
-
Save web-dave/6e8fd925d85d92c744d9ea4e89ea39f8 to your computer and use it in GitHub Desktop.
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
<span>{{ title }} app is running!</span> | |
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
it("loads examples", () => { | |
cy.visit("http://localhost:4200"); | |
cy.contains("Replace me with something relevant"); | |
}); |
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
describe('Cypress Test', () => { | |
beforeEach(() => { | |
cy.visit('http://localhost:4200'); | |
cy.get('span').as('spans'); | |
cy.get('div.terminal').as('terminal'); | |
}); | |
... | |
}); |
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
cy.get('@spans') | |
.contains(step) | |
.click(); | |
cy.get('@terminal').should('contain', commands[step]); |
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
it('create User', () => { | |
cy.get('button.new-user').click(); | |
cy.get('.headline').contains('Nutzer anlegen'); | |
cy.get('input[formcontrolname="name"]').type('Hannes'); | |
cy.get('button.save').should('be.enabled').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
cy.server(); |
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
cy.route(url) | |
cy.route(url, response) | |
cy.route(method, url) | |
cy.route(method, url, response) |
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
cy.route('http://my.api.com', { name: 'Hannes' }); |
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
cy.route('http://my.api.com', 'fixture:example.json'); |
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
cy.route('POST', 'http://my.api.com/users', '123456789').as( | |
'new-user' | |
); |
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
cy.get('@new-user') | |
.its('request.body') | |
.should('deep.equal', { | |
name: 'Hannes', | |
kundennummer: '1597', | |
}); |
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
describe('Next Steps', () => {...}) |
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
describe("Hooks", () => { | |
before(() => { | |
/* Wird einmalig VOR allen Tests ausgeführt */ | |
}); | |
after(() => { | |
/* Wird einmalig NACH allen Tests ausgeführt */ | |
}); | |
beforeEach(() => { | |
/* Wird VOR JEDEM Test ausgeführt */ | |
}); | |
afterEach(() => { | |
/* Wird NACH JEDEM Test ausgeführt */ | |
}); | |
}); |
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
it(`Beim besuche der Seite soll der Nutzer mit dem Namen das Projekts begrüsst werden, in form von: ProjektName app is running`, () => { | |
cy.visit('http://localhost:4200'); | |
cy.get('span').contains('cypress-test app is running!'); | |
}); |
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
it(`Beim Klick auf eine der Next Steps soll in der Anzeige eine Bestimmte Ausgabe angezeigt werden.`, () => { | |
cy.visit('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
const commands = { | |
'New Component': 'ng generate component xyz', | |
'Angular Material': 'ng add @angular/material', | |
'Add PWA support': 'ng add @angular/pwa', | |
'Add Dependency': 'ng add _____', | |
'Run and Watch Tests': 'ng test', | |
'Build for Production': 'ng build --prod' | |
}; |
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
it(`Beim Klick auf eine der Next Steps soll in der Anzeige eine Bestimmte Ausgabe angezeigt werden.`, () => { | |
cy.visit('http://localhost:4200'); | |
for (const step in commands) { | |
cy.get('span') | |
.contains(step) | |
.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
cy.get('div.terminal').should('contain', commands[step]); |
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
it(`Beim Klick auf eine der Next Steps soll in der Anzeige eine Bestimmte Ausgabe angezeigt werden.`, () => { | |
cy.visit('http://localhost:4200'); | |
// tslint:disable-next-line:forin | |
for (const step in commands) { | |
cy.get('span') | |
.contains(step) | |
.click(); | |
cy.get('div.terminal').should('contain', commands[step]); | |
} | |
}); |
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
"e2e": { | |
"builder": "@angular-devkit/build-angular:protractor", | |
"options": { | |
"protractorConfig": "e2e/protractor.conf.js", | |
"devServerTarget": "my-project:serve" | |
}, | |
"configurations": { | |
"production": { | |
"devServerTarget": "my-project:serve:production" | |
} | |
} | |
} | |
"e2e": { | |
"builder": "@briebug/cypress-schematic:cypress", | |
"options": { | |
"devServerTarget": "cypress-test:serve", | |
"watch": true, | |
"headless": false | |
}, | |
"configurations": { | |
"production": { | |
"devServerTarget": "cypress-test:serve:production" | |
} | |
} | |
}, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment