From 37821ee0082a84e3baeaf9f2c812cc20d806484a Mon Sep 17 00:00:00 2001 From: Gabriel Dutra Date: Mon, 28 Jan 2019 06:21:42 -0200 Subject: [PATCH] Add Percy Page Screenshots (#3338) * Add Percy Page Screenshots * Add missing space --- .../data-source/create_data_source_spec.js | 3 --- cypress/integration/percy/page_screenshots.js | 21 +++++++++++++++++++ .../integration/query/create_query_spec.js | 2 +- cypress/integration/user/login_spec.js | 2 +- 4 files changed, 23 insertions(+), 5 deletions(-) create mode 100644 cypress/integration/percy/page_screenshots.js diff --git a/cypress/integration/data-source/create_data_source_spec.js b/cypress/integration/data-source/create_data_source_spec.js index e286a334e6..52adef85fc 100644 --- a/cypress/integration/data-source/create_data_source_spec.js +++ b/cypress/integration/data-source/create_data_source_spec.js @@ -14,8 +14,5 @@ describe('Create Data Source', () => { cy.getByTestId('Database Name').type('postgres{enter}'); cy.contains('Saved.'); - - cy.wait(1000); - cy.percySnapshot('Create Data Source page'); }); }); diff --git a/cypress/integration/percy/page_screenshots.js b/cypress/integration/percy/page_screenshots.js new file mode 100644 index 0000000000..8170944007 --- /dev/null +++ b/cypress/integration/percy/page_screenshots.js @@ -0,0 +1,21 @@ +const pages = [ + { name: 'Create Data Source - Types', url: '/data_sources/new' }, + { name: 'Edit Data Source - PostgreSQL', url: '/data_sources/1' }, + { name: 'Users', url: '/users' }, + { name: 'Groups', url: '/groups' }, + { name: 'Group', url: '/groups/1' }, + { name: 'Create Destination - Types', url: '/destinations/new' }, + { name: 'Organization Settings', url: '/settings/organization' }, + { name: 'User Profile', url: '/users/me' }, +]; + +describe('Percy Page Screenshots', () => { + pages.forEach((page) => { + it(`takes a screenshot of ${page.name}`, () => { + cy.login(); + cy.visit(page.url); + cy.wait(1000); + cy.percySnapshot(page.name); + }); + }); +}); diff --git a/cypress/integration/query/create_query_spec.js b/cypress/integration/query/create_query_spec.js index 844a0501a6..7ec734feed 100644 --- a/cypress/integration/query/create_query_spec.js +++ b/cypress/integration/query/create_query_spec.js @@ -16,6 +16,6 @@ describe('Create Query', () => { cy.getByTestId('ExecuteButton').click(); cy.getByTestId('DynamicTable').should('exist'); - cy.percySnapshot('Edit Query page'); + cy.percySnapshot('Edit Query'); }); }); diff --git a/cypress/integration/user/login_spec.js b/cypress/integration/user/login_spec.js index bc759567a3..46cb45f67e 100644 --- a/cypress/integration/user/login_spec.js +++ b/cypress/integration/user/login_spec.js @@ -7,7 +7,7 @@ describe('Login', () => { cy.contains('h3', 'Login to Redash'); cy.wait(1000); - cy.percySnapshot('Login page'); + cy.percySnapshot('Login'); }); it('shows message on failed login', () => {