From 3ebc2fd4538bf7cd8fd8b746a5418b98c2442373 Mon Sep 17 00:00:00 2001 From: Deniz Kusefoglu Date: Mon, 6 May 2019 14:07:35 -0700 Subject: [PATCH] Add test-ids to create resource dropdown items --- ui/cypress/e2e/dashboardsIndex.test.ts | 6 +++--- ui/cypress/e2e/tasks.test.ts | 4 ++-- ui/cypress/e2e/variables.test.ts | 2 +- .../components/dashboard_index/Table.tsx | 1 + ui/src/shared/components/AddResourceDropdown.tsx | 15 +++++++++++++-- 5 files changed, 20 insertions(+), 8 deletions(-) diff --git a/ui/cypress/e2e/dashboardsIndex.test.ts b/ui/cypress/e2e/dashboardsIndex.test.ts index 92ae54b57c..711d40c121 100644 --- a/ui/cypress/e2e/dashboardsIndex.test.ts +++ b/ui/cypress/e2e/dashboardsIndex.test.ts @@ -24,7 +24,7 @@ describe('Dashboards', () => { .contains('Create') .click() - cy.getByTestID('dropdown--item New Dashboard').click() + cy.getByTestID('dropdown--item new').click() cy.fixture('routes').then(({orgs}) => { cy.get('@org').then(({id}) => { @@ -40,7 +40,7 @@ describe('Dashboards', () => { .contains('Create') .click() - cy.getByTestID('dropdown--item New Dashboard').click() + cy.getByTestID('dropdown--item new').click() cy.fixture('routes').then(({orgs}) => { cy.get('@org').then(({id}) => { @@ -61,7 +61,7 @@ describe('Dashboards', () => { .contains('Create') .click() - cy.getByTestID('dropdown--item From a Template').click() + cy.getByTestID('dropdown--item template').click() cy.getByTestID('template--Bashboard-Template').click() diff --git a/ui/cypress/e2e/tasks.test.ts b/ui/cypress/e2e/tasks.test.ts index 265996af4f..ccff812889 100644 --- a/ui/cypress/e2e/tasks.test.ts +++ b/ui/cypress/e2e/tasks.test.ts @@ -22,7 +22,7 @@ describe('Tasks', () => { cy.contains('Create').click() }) - cy.getByTestID('dropdown--item New Task').click() + cy.getByTestID('dropdown--item new').click() cy.getByInputName('name').type(taskName) cy.getByInputName('interval').type('24h') @@ -110,7 +110,7 @@ describe('Tasks', () => { cy.contains('Create').click() }) - cy.getByTestID('dropdown--item New Task').click() + cy.getByTestID('dropdown--item new').click() cy.getByInputName('name').type('🦄ask') cy.getByInputName('interval').type('24h') diff --git a/ui/cypress/e2e/variables.test.ts b/ui/cypress/e2e/variables.test.ts index ad283f4a20..61c4e35374 100644 --- a/ui/cypress/e2e/variables.test.ts +++ b/ui/cypress/e2e/variables.test.ts @@ -15,7 +15,7 @@ describe('Variables', () => { cy.contains('Create').click() }) - cy.getByTestID('dropdown--item New Variable').click() + cy.getByTestID('dropdown--item new').click() cy.getByInputName('name').type('Little Variable') cy.getByTestID('flux-editor').within(() => { diff --git a/ui/src/dashboards/components/dashboard_index/Table.tsx b/ui/src/dashboards/components/dashboard_index/Table.tsx index 888f2986ee..47de6f780a 100644 --- a/ui/src/dashboards/components/dashboard_index/Table.tsx +++ b/ui/src/dashboards/components/dashboard_index/Table.tsx @@ -133,6 +133,7 @@ class DashboardsTable extends PureComponent { onSelectImport={onImportDashboard} onSelectTemplate={this.summonImportFromTemplateOverlay} resourceName="Dashboard" + canImportFromTemplate={true} /> ) diff --git a/ui/src/shared/components/AddResourceDropdown.tsx b/ui/src/shared/components/AddResourceDropdown.tsx index ec0d7b87dd..8dae159296 100644 --- a/ui/src/shared/components/AddResourceDropdown.tsx +++ b/ui/src/shared/components/AddResourceDropdown.tsx @@ -58,10 +58,20 @@ export default class AddResourceDropdown extends PureComponent { const templateOption = this.templateOption const items = [ - + {newOption} , - + {importOption} , ] @@ -72,6 +82,7 @@ export default class AddResourceDropdown extends PureComponent { id={templateOption} key={templateOption} value={templateOption} + testID="dropdown--item template" > {templateOption}