From 6f015b7689694bdbe2e90709b93b675cc66d9715 Mon Sep 17 00:00:00 2001 From: blam Date: Fri, 23 Apr 2021 19:38:51 +0200 Subject: [PATCH] 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'); }); }); });