-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore(npm/angular): migrate angular adapter to monorepo #16434
Conversation
Thanks for taking the time to open a PR!
|
Test summaryRun details
View run in Cypress Dashboard ➡️ This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. You can manage this integration in this project's settings in the Cypress Dashboard |
Nice. Ideally we split up incremental changes such as added tests and code changes into PRs into this branch. The acceptance criteria for this PR is that:
|
Trying to test but cannot create a new angular app using the angular-cli. Weird. Edit: freak accident, I already had a Vue app called |
npm/angular/package.json
Outdated
"angular2-template-loader": "0.6.2", | ||
"codelyzer": "6.0.2", | ||
"core-js": "3.12.1", | ||
"cypress": "7.1.0", |
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.
Shouldn't this be local Cypress?
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.
Yes. Well spotted.
The test script uses local, but I will remove this unused and useless dependency.
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.
Done.
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.
Great PR! I still have a couple of comments.
- I believe the snapshot images taken by cypress should not be version controlled.
- npm/angular/src/assets/.gitkeep is unnecessary since we have a logo for cypress besides it
@elevatebart fixed most of those things. Why don't we add snapshots? I think we need them, so we can diff the new ones with the old ones. This repo uses 'cypress-image-snapshot`, which does the diff between existing ones and new ones - like visual regression. |
The design-system test are failing because of a classic cypress flake (the element is detached from the DOM) The tests are fixed in this PR that still needs to be approved/merged. I believe you will have to do so before this one can pass. |
import { NetworkService } from '../network.service' | ||
import { NetworkComponent } from './network.component' | ||
|
||
describe('Network', () => { |
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.
I just added an example with cy.intercept
:
import { HttpClientModule } from '@angular/common/http';
import { initEnv, mount } from 'cypress-angular-unit-test';
import { NetworkService } from '../network.service';
import { NetworkComponent } from './network.component';
describe('Network', () => {
describe('No mock', () => {
beforeEach(() => {
initEnv(NetworkComponent, {
providers: [NetworkService],
imports: [HttpClientModule],
});
});
it('fetches 3 users from remote API', () => {
mount(NetworkComponent);
cy.get('li').should('have.length', 3);
});
});
describe('With mock', () => {
beforeEach(() => {
cy.intercept('/users?_limit=3', { body: [{ id: 1, name: 'foo' }] });
initEnv(NetworkComponent, {
providers: [NetworkService],
imports: [HttpClientModule],
});
});
it('fetch 1 user stubed', () => {
mount(NetworkComponent);
cy.get('li').should('have.length', 1).first().contains('foo');
});
});
});
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.
I'll add this, thanks.
Feel free to make PRs against this repo if you like 👍 or just ping me and I can make changes (still learning Angular...)
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.
Done
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.
GOood stuff
User facing changelog
Migrate Angular adapter into monorepo from https://www.npmjs.com/package/cypress-angular-unit-test.
Still WIP. It's marked
private: true
so it won't go to npm yet.Additional details
Consolidate all major adapters (Vue, React, Angular) in a single place This supports better code sharing, and the ability to run their test suite against the latest Cypress commits.
How has the user experience changed?
PR Tasks
cypress-documentation
?type definitions
?cypress.schema.json
?