Skip to content
This repository was archived by the owner on May 14, 2025. It is now read-only.

Commit 4cef3d0

Browse files
authored
feat: Consolidate E2E testing stack
Change e2e stack to Cypress Initial e2e tests See #1615
1 parent b641ed9 commit 4cef3d0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+1786
-2111
lines changed

ui/angular.json

Lines changed: 62 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,8 @@
2727
"inlineCritical": false
2828
}
2929
},
30-
"assets": [
31-
"src/favicon.ico",
32-
"src/assets",
33-
"src/logout-success-oauth.html"
34-
],
35-
"styles": [
36-
"node_modules/@clr/icons/clr-icons.css",
37-
"node_modules/@clr/ui/clr-ui.css",
38-
"src/styles.scss"
39-
],
30+
"assets": ["src/favicon.ico", "src/assets", "src/logout-success-oauth.html"],
31+
"styles": ["node_modules/@clr/icons/clr-icons.css", "node_modules/@clr/ui/clr-ui.css", "src/styles.scss"],
4032
"scripts": [
4133
"node_modules/@webcomponents/webcomponentsjs/custom-elements-es5-adapter.js",
4234
"node_modules/@webcomponents/webcomponentsjs/webcomponents-bundle.js",
@@ -126,51 +118,90 @@
126118
"polyfills": "src/polyfills.ts",
127119
"tsConfig": "src/tsconfig.spec.json",
128120
"karmaConfig": "src/karma.conf.js",
129-
"styles": [
130-
"src/styles.scss"
131-
],
121+
"styles": ["src/styles.scss"],
132122
"scripts": [],
133-
"assets": [
134-
"src/favicon.ico",
135-
"src/assets",
136-
"src/logout-success-oauth.html"
137-
]
123+
"assets": ["src/favicon.ico", "src/assets", "src/logout-success-oauth.html"]
138124
}
139125
},
140126
"lint": {
141127
"builder": "@angular-eslint/builder:lint",
142128
"options": {
143-
"lintFilePatterns": [
144-
"src/app/**/*.ts",
145-
"src/app/**/*.html"
146-
]
129+
"lintFilePatterns": ["src/app/**/*.ts", "src/app/**/*.html"]
130+
}
131+
},
132+
"cypress-run": {
133+
"builder": "@cypress/schematic:cypress",
134+
"options": {
135+
"devServerTarget": "dataflow:serve"
136+
},
137+
"configurations": {
138+
"production": {
139+
"devServerTarget": "dataflow:serve:production"
140+
}
141+
}
142+
},
143+
"cypress-open": {
144+
"builder": "@cypress/schematic:cypress",
145+
"options": {
146+
"watch": true,
147+
"headless": false
148+
}
149+
},
150+
"e2e": {
151+
"builder": "@cypress/schematic:cypress",
152+
"options": {
153+
"devServerTarget": "dataflow:serve",
154+
"watch": true,
155+
"headless": false
156+
},
157+
"configurations": {
158+
"production": {
159+
"devServerTarget": "dataflow:serve:production"
160+
}
147161
}
148162
}
149163
}
150164
},
151165
"dataflow-e2e": {
152-
"root": "e2e/",
166+
"root": "cypress/",
153167
"projectType": "application",
154168
"architect": {
155169
"e2e": {
156-
"builder": "@angular-devkit/build-angular:protractor",
170+
"builder": "@cypress/schematic:cypress",
157171
"options": {
158-
"protractorConfig": "e2e/protractor.conf.js",
159-
"devServerTarget": "dataflow:serve:production"
172+
"devServerTarget": "dataflow-e2e:serve",
173+
"configFile": "cypress.json"
160174
},
161175
"configurations": {
162176
"production": {
163-
"devServerTarget": "dataflow:serve:production"
177+
"devServerTarget": "dataflow-e2e:serve:production"
164178
}
165179
}
166180
},
167181
"lint": {
168182
"builder": "@angular-eslint/builder:lint",
169183
"options": {
170-
"lintFilePatterns": [
171-
"e2e/src/**/*.ts",
172-
"e2e/src/**/*.html"
173-
]
184+
"lintFilePatterns": ["cypress/**/*.ts"]
185+
}
186+
},
187+
"cypress-run": {
188+
"builder": "@cypress/schematic:cypress",
189+
"options": {
190+
"devServerTarget": "dataflow-e2e:serve",
191+
"configFile": "cypress.json"
192+
},
193+
"configurations": {
194+
"production": {
195+
"devServerTarget": "dataflow-e2e:serve:production"
196+
}
197+
}
198+
},
199+
"cypress-open": {
200+
"builder": "@cypress/schematic:cypress",
201+
"options": {
202+
"watch": true,
203+
"headless": false,
204+
"configFile": "cypress.json"
174205
}
175206
}
176207
}

ui/cypress.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"integrationFolder": "cypress/integration",
3+
"supportFile": "cypress/support/index.ts",
4+
"videosFolder": "cypress/videos",
5+
"screenshotsFolder": "cypress/screenshots",
6+
"pluginsFile": "cypress/plugins/index.ts",
7+
"fixturesFolder": "cypress/fixtures",
8+
"baseUrl": "http://localhost:4200",
9+
"defaultCommandTimeout": 10000,
10+
"viewportWidth": 1400,
11+
"viewportHeight": 800
12+
}

ui/cypress/fixtures/example.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"name": "Using fixtures to represent data",
3+
"email": "[email protected]",
4+
"body": "Fixtures are a great way to mock data for responses to routes"
5+
}
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
describe('Applications', () => {
2+
/**
3+
* Before hook
4+
* Setup the context, import stream applications
5+
*/
6+
before(() => {
7+
cy.apps();
8+
cy.importAppsStream();
9+
});
10+
11+
/**
12+
* After hook
13+
* Clean the context, unregister all the application
14+
*/
15+
after(() => {
16+
cy.unregisterApplications();
17+
});
18+
19+
/**
20+
* Before Each hook
21+
* Navigate to the applications list
22+
*/
23+
beforeEach(() => {
24+
cy.apps();
25+
});
26+
27+
it('should navigate to the application details', () => {
28+
cy.get('.datagrid-row-scrollable clr-dg-cell').should('be.visible');
29+
cy.get('.datagrid-row-scrollable clr-dg-cell a').first().click();
30+
cy.get('app-view-card').should('have.id', 'info');
31+
});
32+
33+
it('should register 2 versions of an application', () => {
34+
cy.apps();
35+
cy.get('button[data-cy=addApps]').click();
36+
cy.get('clr-accordion-title[data-cy=register]').click();
37+
cy.get('input[name = "name0"]').type('aaaa');
38+
cy.get('select[name = "type0"]').select('source');
39+
cy.get('input[name = "uri0"]').type('maven://org.springframework.cloud.task.app:timestamp-task:2.1.1.RELEASE');
40+
cy.get('button[name = "register"]').click();
41+
cy.shouldShowToast('Register application(s).', '1 App(s) registered');
42+
cy.get('app-apps-list').should('be.exist');
43+
44+
cy.apps();
45+
cy.get('button[data-cy=addApps]').click();
46+
cy.get('clr-accordion-title[data-cy=register]').click();
47+
cy.get('input[name = "name0"]').type('aaaa');
48+
cy.get('select[name = "type0"]').select('source');
49+
cy.get('input[name = "uri0"]').type('maven://org.springframework.cloud.task.app:timestamp-task:2.0.0.RELEASE');
50+
cy.get('button[name = "register"]').click();
51+
cy.shouldShowToast('Register application(s).', '1 App(s) registered');
52+
cy.get('app-apps-list').should('be.exist');
53+
});
54+
55+
it('should change the default version', () => {
56+
cy.get('clr-dg-cell a')
57+
.contains('aaaa')
58+
.parentsUntil('clr-dg-row')
59+
.children('.datagrid-row-sticky')
60+
.first()
61+
.click();
62+
cy.get('div[role = "menu"]').should('be.exist');
63+
cy.get('div[role = "menu"] button:nth-child(2)').click();
64+
cy.get('.modal-title').contains('Manage versions');
65+
cy.get('button[data-cy="setDefault"]').first().click();
66+
cy.get('button[data-cy="confirmYes"]').click();
67+
cy.shouldShowToast(
68+
'Default version',
69+
'The version "2.0.0.RELEASE" is now the default version of the application "aaaa" (source).'
70+
);
71+
});
72+
73+
it('should unregister one version', () => {
74+
cy.get('clr-dg-cell a')
75+
.contains('aaaa')
76+
.parentsUntil('clr-dg-row')
77+
.children('.datagrid-row-sticky')
78+
.first()
79+
.click();
80+
cy.get('div[role = "menu"]').should('be.exist');
81+
cy.get('div[role = "menu"] button:nth-child(2)').click();
82+
cy.get('.modal-title').contains('Manage versions');
83+
cy.get('button[data-cy="unregister"]').last().click();
84+
cy.get('button[data-cy="confirmYes"]').click();
85+
cy.shouldShowToast('Unregister version', 'Successfully removed version "2.1.1.RELEASE".');
86+
});
87+
});
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
describe('Streams', () => {
2+
/**
3+
* Before hook
4+
* Setup the context, import stream apps, create streams
5+
*/
6+
before(() => {
7+
cy.apps();
8+
cy.importAppsStream();
9+
});
10+
11+
/**
12+
* After hook
13+
* Clean the context, remove streams and apps
14+
*/
15+
after(() => {
16+
cy.destroyStreams();
17+
cy.unregisterApplications();
18+
});
19+
20+
/**
21+
* Before Each hook
22+
*/
23+
beforeEach(() => {
24+
cy.streams();
25+
});
26+
27+
it('should create 2 streams', () => {
28+
cy.createStream('bar');
29+
cy.createStream('foo');
30+
cy.get('span.pagination-total').should(elem => {
31+
expect(Number(elem.text())).to.equal(2);
32+
});
33+
});
34+
35+
it('should navigate to the View details', () => {
36+
cy.get('.datagrid-action-toggle').first().click();
37+
cy.get('.datagrid-action-overflow button').first().click();
38+
cy.get('app-view-card').should('have.id', 'info');
39+
});
40+
41+
it('should deploy a stream', () => {
42+
cy.get('.datagrid-action-toggle').first().click();
43+
cy.get('.datagrid-action-overflow button:nth-child(2)').first().click();
44+
cy.get('button[data-cy=deploy]').click();
45+
// Waiting 10s for deploying
46+
cy.wait(10 * 1000).then(() => {
47+
cy.get('span.pagination-total').should(elem => {
48+
expect(Number(elem.text())).to.equal(2);
49+
});
50+
});
51+
});
52+
53+
it('should undeploy a stream', () => {
54+
cy.get('.datagrid-action-toggle').first().click();
55+
cy.get('.datagrid-action-overflow button:nth-child(3)').first().click();
56+
cy.get('button[data-cy="undeploy"]').should('be.exist');
57+
cy.get('button[data-cy="undeploy"]').click();
58+
cy.shouldShowToast('Undeploy stream', 'Successfully undeploy stream "bar".');
59+
cy.get('span.pagination-total').should(elem => {
60+
expect(Number(elem.text())).to.equal(2);
61+
});
62+
});
63+
64+
it('should clone a stream', () => {
65+
cy.get('.datagrid-action-toggle').first().click();
66+
cy.get('.datagrid-action-overflow button:nth-child(4)').first().click();
67+
cy.get('button[data-cy="clone"]').should('be.exist');
68+
cy.get('button[data-cy="clone"]').click();
69+
cy.shouldShowToast('Stream(s) clone', 'Stream(s) have been cloned successfully');
70+
cy.get('span.pagination-total').should(elem => {
71+
expect(Number(elem.text())).to.equal(3);
72+
});
73+
});
74+
75+
// it('Group action for deploy streams', () => {
76+
// cy.checkExistence('span[data-cy=streams-total]');
77+
// cy.get('.apps-total').should(elem => {
78+
// expect(Number(elem.text())).to.gt(0);
79+
// });
80+
// cy.get('.apps-total').then($appTotal => {
81+
// const initialAddedApps = $appTotal.text();
82+
// cy.get('button#btnGroupActions').click();
83+
// cy.get('input[type="checkbox"] + label').first().click();
84+
// cy.get('button#btnUnregisterApplications').click();
85+
// cy.checkExistence('.modal button');
86+
// cy.get('.modal button').last().click();
87+
// cy.get('clr-spinner').should('not.exist');
88+
// cy.get('.content-area').scrollTo('bottom');
89+
// cy.checkExistence('.apps-total');
90+
// cy.get('.apps-total').then($appUpdatedTotal => {
91+
// expect(Number($appUpdatedTotal.text())).to.lt(Number(initialAddedApps));
92+
// });
93+
// });
94+
// });
95+
});

0 commit comments

Comments
 (0)