Skip to content
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

Added more e2e tests #96 #101

Merged
merged 9 commits into from
Nov 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
[![Maintainability Rating](https://sonarcloud.io/api/project_badges/measure?project=microcatalog&metric=sqale_rating)](https://sonarcloud.io/dashboard?id=microcatalog)
[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=microcatalog&metric=coverage)](https://sonarcloud.io/dashboard?id=microcatalog)
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=microcatalog&metric=alert_status)](https://sonarcloud.io/dashboard?id=microcatalog)
[![microservice-catalog](https://img.shields.io/endpoint?url=https://dashboard.cypress.io/badge/simple/ge12oz&style=flat&logo=cypress)](https://dashboard.cypress.io/projects/ge12oz/runs)
[![Docker Image Version (latest by date)](https://img.shields.io/docker/v/tillias/microcatalog)](https://hub.docker.com/r/tillias/microcatalog)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![Lines of Code](https://sonarcloud.io/api/project_badges/measure?project=microcatalog&metric=ncloc)](https://sonarcloud.io/dashboard?id=microcatalog)
Expand Down
3 changes: 2 additions & 1 deletion cypress.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"chromeWebSecurity": false
"chromeWebSecurity": false,
"projectId": "ge12oz"
}
220 changes: 220 additions & 0 deletions cypress/integration/catalog.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,220 @@
describe.only('catalog and search', () => {

before(function login() {
cy.logout();
cy.loginUser();
})


it('autocomplete search works', function () {
cy.visit('/');

cy.get('[autocapitalize="off"]').type('Service 1');
cy.get('#ngb-typeahead-0-0').click();

cy.get('.card-body').should('have.length', 1);
})

it('advanced filter case insensitive search by name', function () {
cy.visit('/');

cy.get('.btn-secondary').click();
cy.get('.row:nth-child(2) > .form-control').click();
cy.get(':nth-child(2) > .form-control').type('old service');
cy.get('.btn-primary:nth-child(1)').click();

cy.get('.card-body').should('have.length', 1);
cy.get('.h3').should('have.text', 'Some old service');
})

it('advanced filter case insensitive search by name not found', function () {
cy.visit('/');

cy.get('.btn-secondary').click();
cy.get('.row:nth-child(2) > .form-control').click();
cy.get(':nth-child(2) > .form-control').type('Something to be not found');
cy.get('.btn-primary:nth-child(1)').click();

cy.get('.card-body').should('have.length', 0);
})

it('advanced filter case insensitive search by name', function () {
cy.visit('/');

cy.get('.btn-secondary').click();
cy.get('.row:nth-child(2) > .form-control').click();
cy.get(':nth-child(2) > .form-control').type('Some old');
cy.get('.btn-primary:nth-child(1)').click();

cy.get('.card-body').should('have.length', 1);
cy.get('.h3').should('have.text', 'Some old service');
})

it('advanced filter case sensitive search by name not found', function () {
cy.visit('/');

cy.get('.btn-secondary').click();

cy.get('#customSwitch1').click({force: true});

cy.get('.row:nth-child(2) > .form-control').click();
cy.get(':nth-child(2) > .form-control').type('Old service');
cy.get('.btn-primary:nth-child(1)').click();

cy.get('.card-body').should('have.length', 0);
})

it('advanced filter case insensitive search by description', function () {
cy.visit('/');

cy.get('.btn-secondary').click();
cy.get('.row:nth-child(3) > .form-control').click();
cy.get(':nth-child(3) > .form-control').type('custom old service description');
cy.get('.btn-primary:nth-child(1)').click();

cy.get('.card-body').should('have.length', 1);
cy.get('h6').should('have.text', 'This is custom old service description\n');

})

it('advanced filter case insensitive search by description not found', function () {
cy.visit('/');

cy.get('.btn-secondary').click();
cy.get('.row:nth-child(3) > .form-control').click();
cy.get(':nth-child(3) > .form-control').type('Something not to be found');
cy.get('.btn-primary:nth-child(1)').click();

cy.get('.card-body').should('have.length', 0);

})

it('advanced filter case sensitive search by description not found', function () {
cy.visit('/');

cy.get('.btn-secondary').click();

cy.get('#customSwitch1').click({force: true});

cy.get('.row:nth-child(3) > .form-control').click();
cy.get(':nth-child(3) > .form-control').type('Custom old service description');
cy.get('.btn-primary:nth-child(1)').click();

cy.get('.card-body').should('have.length', 0);
})

it('advanced filter case sensitive search by description', function () {
cy.visit('/');

cy.get('.btn-secondary').click();

cy.get('#customSwitch1').click({force: true});

cy.get('.row:nth-child(3) > .form-control').click();
cy.get(':nth-child(3) > .form-control').type('This is custom');
cy.get('.btn-primary:nth-child(1)').click();

cy.get('.card-body').should('have.length', 1);
cy.get('h6').should('have.text', 'This is custom old service description\n');
})

it('advanced filter case insensitive search by swagger url', function () {
cy.visit('/');

cy.get('.btn-secondary').click();
cy.get('.row:nth-child(4) > .form-control').click();
cy.get(':nth-child(4) > .form-control').type('some-old-service');
cy.get('.btn-primary:nth-child(1)').click();

cy.get('.card-body').should('have.length', 1);
cy.get('.h3').should('have.text', 'Some old service');
cy.get('div > :nth-child(5) > a').should('have.attr', 'href');
cy.get('div > :nth-child(5) > a').attribute('href').should('eq', 'some-old-service/swagger');
})

it('advanced filter case insensitive search by git url', function () {
cy.visit('/');

cy.get('.btn-secondary').click();
cy.get('.row:nth-child(5) > .form-control').click();
cy.get(':nth-child(5) > .form-control').type('some-old-service');
cy.get('.btn-primary:nth-child(1)').click();

cy.get('.card-body').should('have.length', 1);
cy.get('.h3').should('have.text', 'Some old service');
cy.get('div > :nth-child(1) > a').should('have.attr', 'href');
cy.get('div > :nth-child(1) > a').attribute('href').should('eq', 'some-old-service/repo.git');
})

it('advanced filter search by team', function () {
cy.visit('/');

cy.get('.btn-secondary').click();
cy.get('.row:nth-child(6) > .custom-select').select('3: Object');
cy.get('.btn-primary:nth-child(1)').click();

cy.get('.card-body').should('have.length', 1);
cy.get('.h3').should('have.text', 'Some old service');
cy.get('.font-weight-bold').should('have.text', 'Team: Team Three');
})

it('advanced filter search by status', function () {
cy.visit('/');

cy.get('.btn-secondary').click();
cy.get('.row:nth-child(7) > .custom-select').select('4: Object');
cy.get('.btn-primary:nth-child(1)').click();

cy.get('.card-body').should('have.length', 1);
cy.get('.h3').should('have.text', 'Some old service');
cy.get('.badge').should('have.text', 'Draft');
})

it('advanced filter search by all attributes', function () {
cy.visit('/');

cy.get('.btn-secondary').click();
cy.get('.row:nth-child(6) > .custom-select').select('1: Object');
cy.get('.row:nth-child(7) > .custom-select').select('1: Object');

cy.get('.row:nth-child(5) > .form-control').click();
cy.get(':nth-child(5) > .form-control').type('lime'); // git
cy.get('.btn-primary:nth-child(1)').click();

cy.get('.card-body')

cy.get('.card-body').should('have.length', 1);
cy.get('.h3').should('have.text', 'Service 1');
cy.get('.badge').should('have.text', 'Released');
cy.get('div > :nth-child(1) > a').should('have.attr', 'href');
cy.get('div > :nth-child(1) > a').attribute('href').should('eq', 'lime Denmark');
})

it('clear filters', function () {
cy.visit('/');

cy.get('.btn-secondary').click();
cy.get('.row:nth-child(7) > .custom-select').select('4: Object');
cy.get('.btn-primary:nth-child(1)').click();

cy.get('.card-body').should('have.length', 1);

cy.get('[jhitranslate="microcatalogApp.microservice.search.group.clear"]').click();
cy.get('.card-body').should('have.length', 13);
})

it('details screen is accessible', function () {
cy.visit('/');

cy.get('.btn-secondary').click();
cy.get('.row:nth-child(7) > .custom-select').select('4: Object');
cy.get('.btn-primary:nth-child(1)').click();

cy.get('.card-body').should('have.length', 1);

cy.get('.text-primary > a').click();

cy.get('h2').should('have.text', 'Microservice 11');
})
})

75 changes: 67 additions & 8 deletions cypress/integration/dependencies-dashboard.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,79 @@
describe('microservice-catalog e2e', () => {
it('check dependency dashboard selection', function () {
describe('dependency dashboard', () => {

before(function login() {
cy.logout();
cy.loginUser();
})


it('dependency graph is built', function () {

cy.visit('/');
cy.get('.alert:nth-child(1) > .alert-link').click();
cy.get('#username').type('user');
cy.get('#password').type('user');
cy.get('.btn').click();
cy.get('.form').submit();

cy.get('#dashboard > span > span').click();

// wait till dependency-dashboard will load it's data
cy.get('ngx-spinner').should('not.be.visible');

cy.get('canvas').click();
cy.get('canvas').click(249, 320, {force: true});

cy.get('canvas').click(244, 327, {force: true});
cy.get('jhi-vertex-legend a').should('have.text', 'Service 1');
cy.get('jhi-edge-legend.ng-star-inserted > :nth-child(2) > :nth-child(1) > a').should('have.text', '1->2');
cy.get('jhi-edge-legend.ng-star-inserted > :nth-child(2) > :nth-child(2) > a').should('have.text', '1->8');
cy.get('jhi-edge-legend.ng-star-inserted > :nth-child(2) > :nth-child(3) > a').should('have.text', '9->1');
cy.get('jhi-edge-legend.ng-star-inserted > :nth-child(2) > :nth-child(4) > a').should('have.text', 'Some old service->1');

cy.get('canvas').click(203, 237, {force: true});
cy.get('jhi-vertex-legend a').should('have.text', 'Service 2');
cy.get('jhi-edge-legend.ng-star-inserted > :nth-child(2) > :nth-child(1) > a').should('have.text', '1->2');
cy.get('jhi-edge-legend.ng-star-inserted > :nth-child(2) > :nth-child(2) > a').should('have.text', '2->4');

cy.get('canvas').click(41, 196, {force: true});
cy.get('jhi-vertex-legend a').should('have.text', 'Service 3');
cy.get('jhi-edge-legend.ng-star-inserted > :nth-child(2) > .text-primary > a').should('have.text', '3->5');

cy.get('canvas').click(209, 135, {force: true});
cy.get('jhi-vertex-legend a').should('have.text', 'Service 4');
cy.get('jhi-edge-legend.ng-star-inserted > :nth-child(2) > :nth-child(1) > a').should('have.text', '2->4');
cy.get('jhi-edge-legend.ng-star-inserted > :nth-child(2) > :nth-child(2) > a').should('have.text', '4->8');
cy.get('jhi-edge-legend.ng-star-inserted > :nth-child(2) > :nth-child(3) > a').should('have.text', '6->4');
cy.get('jhi-edge-legend.ng-star-inserted > :nth-child(2) > :nth-child(4) > a').should('have.text', '4->5');
cy.get(':nth-child(2) > :nth-child(5) > a').should('have.text', '4->7');
cy.get(':nth-child(6) > a').should('have.text', '4->10');

cy.get('canvas').click(144, 204, {force: true});
cy.get('jhi-vertex-legend a').should('have.text', 'Service 5');
cy.get('jhi-edge-legend.ng-star-inserted > :nth-child(2) > :nth-child(1) > a').should('have.text', '4->5');
cy.get('jhi-edge-legend.ng-star-inserted > :nth-child(2) > :nth-child(2) > a').should('have.text', '10->5');
cy.get('jhi-edge-legend.ng-star-inserted > :nth-child(2) > :nth-child(3) > a').should('have.text', '3->5');

cy.get('canvas').click(301, 81, {force: true});
cy.get('jhi-vertex-legend a').should('have.text', 'Service 6');
cy.get('jhi-edge-legend.ng-star-inserted > :nth-child(2) > .text-primary > a').should('have.text', '6->4');

cy.get('canvas').click(191, 34, {force: true});
cy.get('jhi-vertex-legend a').should('have.text', 'Service 7');
cy.get('jhi-edge-legend.ng-star-inserted > :nth-child(2) > :nth-child(1) > a').should('have.text', '4->7');
cy.get('jhi-edge-legend.ng-star-inserted > :nth-child(2) > :nth-child(2) > a').should('have.text', '7->10');

cy.get('canvas').click(260, 219, {force: true});
cy.get('jhi-vertex-legend a').should('have.text', 'Service 8');
cy.get('jhi-edge-legend.ng-star-inserted > :nth-child(2) > :nth-child(1) > a').should('have.text', '1->8');
cy.get('jhi-edge-legend.ng-star-inserted > :nth-child(2) > :nth-child(2) > a').should('have.text', '4->8');

cy.get('canvas').click(107, 100, {force: true});
cy.get('jhi-vertex-legend a').should('have.text', 'Service 10');
cy.get('jhi-edge-legend.ng-star-inserted > :nth-child(2) > :nth-child(1) > a').should('have.text', '4->10');
cy.get('jhi-edge-legend.ng-star-inserted > :nth-child(2) > :nth-child(2) > a').should('have.text', '7->10');
cy.get('jhi-edge-legend.ng-star-inserted > :nth-child(2) > :nth-child(3) > a').should('have.text', '10->5');

cy.get('canvas').click(340, 205, {force: true});
cy.get('jhi-vertex-legend a').should('have.text', 'Service 20');
cy.get('jhi-edge-legend.ng-star-inserted > :nth-child(2) > .text-primary > a').should('have.text', '20->21');

cy.get('canvas').click(412, 122, {force: true});
cy.get('jhi-vertex-legend a').should('have.text', 'Service 21');
cy.get('jhi-edge-legend.ng-star-inserted > :nth-child(2) > .text-primary > a').should('have.text', '20->21');
})
})
Loading