From 593f085b03a17039ce05d5e2f95768287213a42e Mon Sep 17 00:00:00 2001 From: feedmeapples Date: Thu, 20 Aug 2020 16:59:48 -0700 Subject: [PATCH 1/3] Create workflows page e2e tests --- .../integration/workflow/workflows.spec.js | 78 +++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 cypress/integration/workflow/workflows.spec.js diff --git a/cypress/integration/workflow/workflows.spec.js b/cypress/integration/workflow/workflows.spec.js new file mode 100644 index 00000000..7faf9d15 --- /dev/null +++ b/cypress/integration/workflow/workflows.spec.js @@ -0,0 +1,78 @@ +/// + +context('Workflow', () => { + beforeEach(() => { + cy.visit('/namespaces/namespace-web-e2e/workflows'); + }); + + it('navigates to open workflows as default', () => { + cy.url().should('include', '&status=OPEN'); + }); + + it('filters workflows by status', () => { + cy.get('[data-cy=status-filter]') + .click() + .find('a') + .contains('Open') + .click(); + cy.get('[data-cy=workflow-list]') + .find('tr') + .should('have.length', 4); // 3 open + 1 requested to be canceled + + cy.wait(1000); + cy.get('[data-cy=status-filter]') + .click() + .find('a') + .contains('Closed') + .click(); + cy.get('[data-cy=workflow-list]') + .find('tr') + .should('have.length', 2); // 1 timed out + 1 terminated + + cy.wait(1000); + cy.get('[data-cy=status-filter]') + .click() + .find('a') + .contains('Terminated') + .click(); + cy.get('[data-cy=workflow-list]') + .find('tr') + .should('have.length', 1); + + cy.wait(1000); + cy.get('[data-cy=status-filter]') + .click() + .find('a') + .contains('Timed Out') + .click(); + cy.get('[data-cy=workflow-list]') + .find('tr') + .should('have.length', 1); + }); + + it('renders workflow execution details', () => { + cy.get('[data-cy=workflow-list]') + .find('tr') + .eq(3) + .should('contain.text', 'wf_open1') // workflow id + .should('contain.text', 'e2e_type') // workflow type name + .should('contain.text', 'running'); // status + }); + + it('navigates to workflow details', () => { + cy.wait(1000); + cy.get('[data-cy=status-filter]') + .click() + .find('a') + .contains('Closed') + .click(); + cy.get('[data-cy=workflow-list]') + .find('tr') + .eq(0) + .find('[data-cy=workflow-link]') + .click(); + + cy.url().should('include', '/namespaces/namespace-web-e2e/workflows/wf_timedout/'); + cy.url().should('include', '/summary'); + }); +}); From 02d61c828b0071e489309a6d64c751e0724144a1 Mon Sep 17 00:00:00 2001 From: feedmeapples Date: Fri, 21 Aug 2020 09:54:42 -0700 Subject: [PATCH 2/3] move e2e tests to the top of integration --- .../integration/workflow/workflows.spec.js | 78 ------------------- 1 file changed, 78 deletions(-) delete mode 100644 cypress/integration/workflow/workflows.spec.js diff --git a/cypress/integration/workflow/workflows.spec.js b/cypress/integration/workflow/workflows.spec.js deleted file mode 100644 index 7faf9d15..00000000 --- a/cypress/integration/workflow/workflows.spec.js +++ /dev/null @@ -1,78 +0,0 @@ -/// - -context('Workflow', () => { - beforeEach(() => { - cy.visit('/namespaces/namespace-web-e2e/workflows'); - }); - - it('navigates to open workflows as default', () => { - cy.url().should('include', '&status=OPEN'); - }); - - it('filters workflows by status', () => { - cy.get('[data-cy=status-filter]') - .click() - .find('a') - .contains('Open') - .click(); - cy.get('[data-cy=workflow-list]') - .find('tr') - .should('have.length', 4); // 3 open + 1 requested to be canceled - - cy.wait(1000); - cy.get('[data-cy=status-filter]') - .click() - .find('a') - .contains('Closed') - .click(); - cy.get('[data-cy=workflow-list]') - .find('tr') - .should('have.length', 2); // 1 timed out + 1 terminated - - cy.wait(1000); - cy.get('[data-cy=status-filter]') - .click() - .find('a') - .contains('Terminated') - .click(); - cy.get('[data-cy=workflow-list]') - .find('tr') - .should('have.length', 1); - - cy.wait(1000); - cy.get('[data-cy=status-filter]') - .click() - .find('a') - .contains('Timed Out') - .click(); - cy.get('[data-cy=workflow-list]') - .find('tr') - .should('have.length', 1); - }); - - it('renders workflow execution details', () => { - cy.get('[data-cy=workflow-list]') - .find('tr') - .eq(3) - .should('contain.text', 'wf_open1') // workflow id - .should('contain.text', 'e2e_type') // workflow type name - .should('contain.text', 'running'); // status - }); - - it('navigates to workflow details', () => { - cy.wait(1000); - cy.get('[data-cy=status-filter]') - .click() - .find('a') - .contains('Closed') - .click(); - cy.get('[data-cy=workflow-list]') - .find('tr') - .eq(0) - .find('[data-cy=workflow-link]') - .click(); - - cy.url().should('include', '/namespaces/namespace-web-e2e/workflows/wf_timedout/'); - cy.url().should('include', '/summary'); - }); -}); From 3499541beeef26224fd737151b0739d3e80ef88f Mon Sep 17 00:00:00 2001 From: feedmeapples Date: Mon, 24 Aug 2020 11:55:23 -0700 Subject: [PATCH 3/3] Create summary e2e coverage --- client/routes/workflow/summary.vue | 33 +++++++++----- cypress/integration/workflow-summary.spec.js | 48 ++++++++++++++++++++ 2 files changed, 69 insertions(+), 12 deletions(-) create mode 100644 cypress/integration/workflow-summary.spec.js diff --git a/client/routes/workflow/summary.vue b/client/routes/workflow/summary.vue index 705e9677..4f42b941 100644 --- a/client/routes/workflow/summary.vue +++ b/client/routes/workflow/summary.vue @@ -38,15 +38,15 @@ information may be missing.

-
+
Workflow Name
{{ workflow.workflowExecutionInfo.type.name }}
-
+
Started At
{{ workflowStartTime }}
-
+
Closed Time
{{ workflowCloseTime }}
@@ -56,6 +56,7 @@ wfStatus !== undefined && (typeof wfStatus === 'string' ? wfStatus : wfStatus.status) " + data-cy="workflow-status" >
Status
@@ -69,21 +70,25 @@
-
+
Result
-
+
Workflow Id
{{ workflowId }}
-
+
Run Id
{{ runId }}
-
+
Parent Workflow
@@ -91,7 +96,7 @@
-
+
Task Queue
-
+
History Events
{{ workflow.workflowExecutionInfo.historyLength }}
-
+
Input
-
+
Pending Activities
@@ -162,7 +171,7 @@ export default { }, created() { this.namespaceDescCache = {}; - this.getWebSettings() + this.getWebSettings(); }, computed: { workflowCloseTime() { diff --git a/cypress/integration/workflow-summary.spec.js b/cypress/integration/workflow-summary.spec.js new file mode 100644 index 00000000..41f18f81 --- /dev/null +++ b/cypress/integration/workflow-summary.spec.js @@ -0,0 +1,48 @@ +/// + +context('Workflow Summary', () => { + beforeEach(() => { + cy.visit('/namespaces/namespace-web-e2e/workflows'); + + cy.get('[data-cy=status-filter]') + .click() + .find('a') + .contains('Timed Out') + .click(); + cy.get('[data-cy=workflow-list]') + .find('tr') + .eq(0) + .find('[data-cy=workflow-link]') + .click(); + }); + + it('renders workflow summary', () => { + cy.get('[data-cy=workflow-name]').should('contain.text', 'e2e_type'); + + const dateTimeRegex = /\w+\s\w+\s[\d\w]+,\s(\d{1,2}:?){3}\s(am|pm)/; + cy.get('[data-cy=started-at]').contains(dateTimeView); + cy.get('[data-cy=closed-at]').contains(dateTimeView); + + cy.get('[data-cy=workflow-status]').should('contain.text', 'timedout'); + + cy.get('[data-cy=workflow-result]') + .should('contain.text', 'retryState') + .should('contain.text', 'Timeout'); + + cy.get('[data-cy=workflow-id]').should('contain.text', 'wf_timedout'); + + const uidRegex = /([\w\d]{4,12}-?){5}/ + cy.get('[data-cy=run-id]').contains(uidRegex); + + cy.get('[data-cy=parent-workflow]').should('contain.text', 'e2e_type'); + + cy.get('[data-cy=task-queue]').should('contain.text', 'e2eQueue'); + + cy.get('[data-cy=history-length]').should('contain.text', '3'); + + cy.get('[data-cy=workflow-input]') + .should('contain.text', '{Harley:Pumpkin!,Joker:Hahahah}') + .should('contain.text', 'to infinity and beyond') + .should('contain.text', '""'); + }); +});