From 5d8339cfee72a399a748e80b025f40009d409559 Mon Sep 17 00:00:00 2001 From: blam Date: Fri, 9 Apr 2021 14:26:37 +0200 Subject: [PATCH 1/3] some more tests Signed-off-by: blam --- cypress/cypress.json | 2 +- cypress/src/integration/integrations.ts | 45 +++++++++++++++++++++++++ 2 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 cypress/src/integration/integrations.ts diff --git a/cypress/cypress.json b/cypress/cypress.json index ebbbe59901..59f7516c47 100644 --- a/cypress/cypress.json +++ b/cypress/cypress.json @@ -1,5 +1,5 @@ { - "baseUrl": "http://localhost:7000", + "baseUrl": "http://localhost:3000", "integrationFolder": "./src/integration", "supportFile": "./src/support", "fixturesFolder": "./src/fixures", diff --git a/cypress/src/integration/integrations.ts b/cypress/src/integration/integrations.ts new file mode 100644 index 0000000000..76d0b6b28a --- /dev/null +++ b/cypress/src/integration/integrations.ts @@ -0,0 +1,45 @@ +/* + * Copyright 2021 Spotify AB + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/// +import 'os'; + +describe('Integrations', () => { + describe('ReadTree', () => { + // it('should work for azure', () => { + // cy.loginAsGuest(); + + // cy.visit('/catalog-import'); + + // cy.get('input[name=url]').type( + // 'https://dev.azure.com/backstage-verification/_git/test-repo?path=%2Fnested%2F*', + // ); + + // cy.contains('Analyze').click(); + // }); + + it('should work for github', () => { + cy.loginAsGuest(); + + cy.visit('/catalog-import'); + + cy.get('input[name=url]').type( + 'https://github.com/backstage-verification/test-repo', + ); + + cy.contains('Analyze').click(); + }); + }); +}); From 382531e50195a22cbde71b91e2107a184a40b09c Mon Sep 17 00:00:00 2001 From: blam Date: Mon, 12 Apr 2021 10:21:42 +0200 Subject: [PATCH 2/3] chore: more work towards fixing Signed-off-by: blam --- cypress/src/integration/integrations.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cypress/src/integration/integrations.ts b/cypress/src/integration/integrations.ts index 76d0b6b28a..839159d34e 100644 --- a/cypress/src/integration/integrations.ts +++ b/cypress/src/integration/integrations.ts @@ -38,6 +38,11 @@ describe('Integrations', () => { cy.get('input[name=url]').type( 'https://github.com/backstage-verification/test-repo', ); + cy.request('/api/catalog/locations', { + target: + 'https://github.com/backstage-verification/test-repo/blob/main/**/*', + type: 'url', + }); cy.contains('Analyze').click(); }); From 6f015b7689694bdbe2e90709b93b675cc66d9715 Mon Sep 17 00:00:00 2001 From: blam Date: Fri, 23 Apr 2021 19:38:51 +0200 Subject: [PATCH 3/3] e2e: added read tree tests to add github, gitlab and azure read URLs Signed-off-by: blam --- cypress/cypress.json | 2 +- cypress/src/integration/integrations.ts | 64 +++++++++++++++++-------- 2 files changed, 46 insertions(+), 20 deletions(-) diff --git a/cypress/cypress.json b/cypress/cypress.json index 59f7516c47..ebbbe59901 100644 --- a/cypress/cypress.json +++ b/cypress/cypress.json @@ -1,5 +1,5 @@ { - "baseUrl": "http://localhost:3000", + "baseUrl": "http://localhost:7000", "integrationFolder": "./src/integration", "supportFile": "./src/support", "fixturesFolder": "./src/fixures", diff --git a/cypress/src/integration/integrations.ts b/cypress/src/integration/integrations.ts index 839159d34e..5ee077502a 100644 --- a/cypress/src/integration/integrations.ts +++ b/cypress/src/integration/integrations.ts @@ -18,33 +18,59 @@ import 'os'; describe('Integrations', () => { describe('ReadTree', () => { - // it('should work for azure', () => { - // cy.loginAsGuest(); - - // cy.visit('/catalog-import'); - - // cy.get('input[name=url]').type( - // 'https://dev.azure.com/backstage-verification/_git/test-repo?path=%2Fnested%2F*', - // ); - - // cy.contains('Analyze').click(); - // }); - it('should work for github', () => { cy.loginAsGuest(); - cy.visit('/catalog-import'); - - cy.get('input[name=url]').type( - 'https://github.com/backstage-verification/test-repo', - ); - cy.request('/api/catalog/locations', { + cy.request('POST', '/api/catalog/locations', { target: 'https://github.com/backstage-verification/test-repo/blob/main/**/*', type: 'url', }); - cy.contains('Analyze').click(); + cy.visit('/catalog'); + cy.contains('All').click(); + cy.get('table').should('contain', 'github-repo'); + cy.get('table').should('contain', 'github-repo-nested'); + }); + + // it('should work for azure', () => { + // cy.loginAsGuest(); + + // cy.request('POST', '/api/catalog/locations', { + // target: + // 'https://dev.azure.com/backstage-verification/_git/test-repo?path=*', + // type: 'url', + // }); + // }); + + it('should work for gitlab', () => { + cy.loginAsGuest(); + + cy.request('POST', '/api/catalog/locations', { + target: + 'https://gitlab.com/backstage-verification/test-repo/-/tree/master/**/*', + type: 'url', + }); + + cy.visit('/catalog'); + cy.contains('All').click(); + cy.get('table').should('contain', 'gitlab-repo'); + cy.get('table').should('contain', 'gitlab-repo-nested'); + }); + + it('should work for bitbucket', () => { + cy.loginAsGuest(); + + cy.request('POST', '/api/catalog/locations', { + target: + 'https://bitbucket.org/backstage-verification/test-repo/src/master/**/*', + type: 'url', + }); + + cy.visit('/catalog'); + cy.contains('All').click(); + cy.get('table').should('contain', 'bitbucket-repo'); + cy.get('table').should('contain', 'bitbucket-repo-nested'); }); }); });