From 3ee2599744b782c18a47dc6c87ffe48d0488f56b Mon Sep 17 00:00:00 2001 From: Palak Bhojani Date: Wed, 27 Feb 2019 15:53:12 -0800 Subject: [PATCH] test(scrapers): add test for creating scrapers --- ui/cypress/e2e/scrapers.test.ts | 40 +++++++++++++++++++ .../configureStep/ScraperTarget.tsx | 2 + .../__snapshots__/ScraperTarget.test.tsx.snap | 16 ++++---- 3 files changed, 50 insertions(+), 8 deletions(-) create mode 100644 ui/cypress/e2e/scrapers.test.ts diff --git a/ui/cypress/e2e/scrapers.test.ts b/ui/cypress/e2e/scrapers.test.ts new file mode 100644 index 0000000000..c90cdd31c4 --- /dev/null +++ b/ui/cypress/e2e/scrapers.test.ts @@ -0,0 +1,40 @@ +describe('Scrapers', () => { + beforeEach(() => { + cy.flush() + + cy.signin().then(({body}) => { + const { + org: {id}, + } = body + cy.fixture('routes').then(({orgs}) => { + cy.visit(`${orgs}/${id}/scrapers_tab`) + }) + }) + }) + + describe('from the org view', () => { + it('can create a scraper', () => { + const newScraper = 'Scraper' + const newURL = 'http://google.com' + + cy.getByTestID('table-row').should('have.length', 0) + + cy.contains('Create').click() + cy.getByTestID('overlay--container').within(() => { + cy.getByInputName('name') + .clear() + .type(newScraper) + cy.getByInputName('url') + .clear() + .type(newURL) + cy.get('.button') + .contains('Finish') + .click() + }) + + cy.getByTestID('table-row') + .should('have.length', 1) + .and('contain', newScraper) + }) + }) +}) diff --git a/ui/src/dataLoaders/components/configureStep/ScraperTarget.tsx b/ui/src/dataLoaders/components/configureStep/ScraperTarget.tsx index 0c71b7bd3c..271aea8a7a 100644 --- a/ui/src/dataLoaders/components/configureStep/ScraperTarget.tsx +++ b/ui/src/dataLoaders/components/configureStep/ScraperTarget.tsx @@ -42,6 +42,7 @@ export class ScraperTarget extends PureComponent { {