Skip to content

Commit ed727c9

Browse files
anwesha-palit-redhatvikram-raj
authored andcommitted
feat: added step url navigation in pipeline run log tab
1 parent f3e9d4d commit ed727c9

File tree

11 files changed

+581
-8
lines changed

11 files changed

+581
-8
lines changed
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
@pipelines
2+
Feature: log-scroll-test-pipeline
3+
As a user, I want to create a pipeline and pipeline run using oc commands and then navigate to the logs tab to verify all tasks are available and if step name is present in the url then scroll to that step in the logs tab.
4+
5+
Background:
6+
Given user is at Administrator perspective
7+
And user clicks on Pipelines Tab
8+
And user has created or selected namespace "aut-pipelines"
9+
10+
@smoke
11+
Scenario:Create and start pipeline using CLI: LS-01-TC01
12+
When user creates pipeline run using YAML and CLI "testData/multistep-yaml-log-scroll/log-scroll-test-pipeline.yaml" in namespace "aut-pipelines"
13+
Then pipeline "log-scroll-test-pipeline" should be created successfully in namespace "aut-pipelines"
14+
15+
@smoke
16+
Scenario: Create pipeline run using oc commands: LS-01-TC02
17+
Given user clicks on Pipelines Tab
18+
And user has created or selected namespace "aut-pipelines"
19+
When user creates pipeline run using YAML and CLI "testData/multistep-yaml-log-scroll/log-scroll-test-pipeline-run.yaml" in namespace "aut-pipelines"
20+
Then pipeline run "log-scroll-test-pipeline-run" should be created successfully in namespace "aut-pipelines"
21+
22+
@smoke
23+
Scenario: Access logs tab and verify all tasks are available: LS-01-TC03
24+
Given user is at pipeline run details page for "log-scroll-test-pipeline-run" in namespace "aut-pipelines"
25+
When user navigates to Logs Tab for "log-scroll-test-pipeline-run" in namespace "aut-pipelines"
26+
Then user should see "frontend-build" task in task list
27+
And user should see "backend-build" task in task list
28+
29+
@smoke
30+
Scenario: Scroll to step in logs tab using URL: LS-01-TC04
31+
Given user tries to navigate to task "task-4" and step "step-9" in Logs tab using URL for "log-scroll-test-pipeline-run" in namespace "aut-pipelines"
32+
Then user should see "STEP-STEP-9" step is visible in logs tab
33+
34+
@smoke
35+
Scenario: Scroll to last step of last task using URL: LS-01-TC05
36+
Given user tries to navigate to task "task-5" and step "step-10" in Logs tab using URL for "log-scroll-test-pipeline-run" in namespace "aut-pipelines"
37+
Then user should see "STEP-STEP-10" step is visible in logs tab
38+
39+
@regression
40+
Scenario: Invalid step name in existing task using URL: LS-01-TC06
41+
Given user tries to navigate to task "task-4" and step "step-50" in Logs tab using URL for "log-scroll-test-pipeline-run" in namespace "aut-pipelines"
42+
Then user should expect default behavior of log viewer and scroll to end of log
43+
44+
@regression
45+
Scenario: Missing step parameter in URL defaults to first step: LS-01-TC10
46+
Given user tries to navigate to task "backend-build" and step "" in Logs tab using URL for "log-scroll-test-pipeline-run" in namespace "aut-pipelines"
47+
Then user should see "backend-build" task in task list
48+
And user should expect default behavior of log viewer and scroll to end of log
Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
import { Given, Then, When } from '@badeball/cypress-cucumber-preprocessor';
2+
import { switchPerspective } from '../../constants/global';
3+
import { perspective } from '../../pages/app';
4+
5+
Given('user is at Administrator perspective', () => {
6+
perspective.switchTo(switchPerspective.Administrator);
7+
});
8+
9+
When('user clicks on Pipelines Tab', () => {
10+
cy.get('[data-test="nav-pipelines"]').then(($el) => {
11+
if ($el.attr('aria-expanded') === 'false') {
12+
cy.wrap($el).click();
13+
}
14+
});
15+
cy.get('[data-test="nav"][data-quickstart-id="qs-nav-pipelines"]')
16+
.contains('Pipelines')
17+
.click();
18+
});
19+
20+
When(
21+
'user creates pipeline using YAML and CLI {string} in namespace {string}',
22+
(yamlFile: string, namespace: string) => {
23+
const fullPath = yamlFile.startsWith('cypress/')
24+
? yamlFile
25+
: `cypress/${yamlFile}`;
26+
cy.exec(`oc apply -f ${fullPath} -n ${namespace}`, {
27+
failOnNonZeroExit: false,
28+
}).then((result) => {
29+
if (result.stderr) {
30+
throw new Error(result.stderr);
31+
/* cy.log('CLI failed, falling back to UI');
32+
cy.get('[data-test="item-create"]').click();
33+
cy.get('[data-test="list-page-create-dropdown-item-pipeline"]').click();
34+
cy.get('[data-test="yaml-view-input"]').click();
35+
cy.get('button').contains('Create').click();
36+
cy.log('Pipeline created via UI'); */
37+
}
38+
});
39+
},
40+
);
41+
42+
Then(
43+
'pipeline {string} should be created successfully in namespace {string}',
44+
(pipelineName: string, namespace: string) => {
45+
cy.exec(`oc get pipeline ${pipelineName} -n ${namespace}`, {
46+
failOnNonZeroExit: false,
47+
}).then((result) => {
48+
if (result.code !== 0) {
49+
throw new Error(
50+
`Pipeline ${pipelineName} was not created successfully: ${result.stderr}`,
51+
);
52+
}
53+
cy.log(`Pipeline ${pipelineName} created successfully`);
54+
});
55+
},
56+
);
57+
58+
When(
59+
'user creates pipeline run using YAML and CLI {string} in namespace {string}',
60+
(yamlFile: string, namespace: string) => {
61+
const fullPath = yamlFile.startsWith('cypress/')
62+
? yamlFile
63+
: `cypress/${yamlFile}`;
64+
cy.exec(`oc apply -f ${fullPath} -n ${namespace}`, {
65+
failOnNonZeroExit: false,
66+
}).then((result) => {
67+
if (result.stderr) {
68+
throw new Error(result.stderr);
69+
}
70+
});
71+
},
72+
);
73+
74+
Then(
75+
'pipeline run {string} should be created successfully in namespace {string}',
76+
(pipelineRunName: string, namespace: string) => {
77+
cy.exec(`oc get pipelinerun ${pipelineRunName} -n ${namespace}`);
78+
cy.exec(
79+
`oc wait --for=condition=Succeeded pipelinerun/${pipelineRunName} -n ${namespace} --timeout=300s`,
80+
);
81+
},
82+
);
83+
84+
Given(
85+
'user is at pipeline run details page for {string} in namespace {string}',
86+
(pipelineRunName: string, namespace: string) => {
87+
cy.visit(
88+
`/k8s/ns/${namespace}/tekton.dev~v1~PipelineRun/${pipelineRunName}`,
89+
);
90+
},
91+
);
92+
93+
When(
94+
'user navigates to Logs Tab for {string} in namespace {string}',
95+
(pipelineRunName: string, namespace: string) => {
96+
cy.visit(
97+
`/k8s/ns/${namespace}/tekton.dev~v1~PipelineRun/${pipelineRunName}/logs`,
98+
);
99+
},
100+
);
101+
102+
Then('user should see {string} task in task list', (taskName: string) => {
103+
cy.get('[data-test-id="logs-tasklist"]')
104+
.contains(taskName)
105+
.should('be.visible');
106+
});
107+
108+
Given(
109+
'user tries to navigate to task {string} and step {string} in Logs tab using URL for {string} in namespace {string}',
110+
(
111+
taskName: string,
112+
stepName: string,
113+
pipelineRunName: string,
114+
namespace: string,
115+
) => {
116+
cy.visit(
117+
`/k8s/ns/${namespace}/tekton.dev~v1~PipelineRun/${pipelineRunName}/logs?taskName=${taskName}&step=${stepName}`,
118+
);
119+
},
120+
);
121+
122+
Then(
123+
'user should see {string} step is visible in logs tab',
124+
(stepName: string) => {
125+
cy.contains(stepName).should('be.visible');
126+
cy.log(`${stepName} is visible in logs tab`);
127+
cy.visit('/');
128+
},
129+
);
130+
131+
Then(
132+
'user should expect default behavior of log viewer and scroll to end of log',
133+
() => {
134+
cy.get('.pf-v5-c-log-viewer__scroll-container').then(($el) => {
135+
const el = $el[0];
136+
//eslint-disable-next-line cypress/no-unnecessary-waiting
137+
cy.wait(2000);
138+
// Verifying if the scroll is at the bottom
139+
expect(el.scrollHeight - el.scrollTop).to.be.closeTo(el.clientHeight, 1);
140+
cy.visit('/');
141+
});
142+
},
143+
);
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
apiVersion: tekton.dev/v1
2+
kind: PipelineRun
3+
metadata:
4+
name: log-scroll-test-pipeline-run
5+
namespace: aut-pipelines
6+
spec:
7+
pipelineRef:
8+
name: log-scroll-test-pipeline
Lines changed: 180 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,180 @@
1+
apiVersion: tekton.dev/v1
2+
kind: Pipeline
3+
metadata:
4+
name: log-scroll-test-pipeline
5+
namespace: aut-pipelines
6+
spec:
7+
tasks:
8+
- name: frontend-build
9+
taskSpec:
10+
steps:
11+
- name: step-1
12+
image: alpine:3.18
13+
script: "echo 'frontend-build / step-1'"
14+
- name: step-2
15+
image: alpine:3.18
16+
script: "echo 'frontend-build / step-2'"
17+
- name: step-3
18+
image: alpine:3.18
19+
script: "echo 'frontend-build / step-3'"
20+
- name: step-4
21+
image: alpine:3.18
22+
script: "echo 'frontend-build / step-4'"
23+
- name: step-5
24+
image: alpine:3.18
25+
script: "echo 'frontend-build / step-5'"
26+
- name: step-6
27+
image: alpine:3.18
28+
script: "echo 'frontend-build / step-6'"
29+
- name: step-7
30+
image: alpine:3.18
31+
script: "echo 'frontend-build / step-7'"
32+
- name: step-8
33+
image: alpine:3.18
34+
script: "echo 'frontend-build / step-8'"
35+
- name: step-9
36+
image: alpine:3.18
37+
script: "echo 'frontend-build / step-9'"
38+
- name: step-10
39+
image: alpine:3.18
40+
script: "echo 'frontend-build / step-10'"
41+
42+
- name: backend-build
43+
runAfter: [frontend-build]
44+
taskSpec:
45+
steps:
46+
- name: step-1
47+
image: alpine:3.18
48+
script: "echo 'backend-build / step-1'"
49+
- name: step-2
50+
image: alpine:3.18
51+
script: "echo 'backend-build / step-2'"
52+
- name: step-3
53+
image: alpine:3.18
54+
script: "echo 'backend-build / step-3'"
55+
- name: step-4
56+
image: alpine:3.18
57+
script: "echo 'backend-build / step-4'"
58+
- name: step-5
59+
image: alpine:3.18
60+
script: "echo 'backend-build / step-5'"
61+
- name: step-6
62+
image: alpine:3.18
63+
script: "echo 'backend-build / step-6'"
64+
- name: step-7
65+
image: alpine:3.18
66+
script: "echo 'backend-build / step-7'"
67+
- name: step-8
68+
image: alpine:3.18
69+
script: "echo 'backend-build / step-8'"
70+
- name: step-9
71+
image: alpine:3.18
72+
script: "echo 'backend-build / step-9'"
73+
- name: step-10
74+
image: alpine:3.18
75+
script: "echo 'backend-build / step-10'"
76+
77+
- name: api-tests
78+
runAfter: [backend-build]
79+
taskSpec:
80+
steps:
81+
- name: step-1
82+
image: alpine:3.18
83+
script: "echo 'api-tests / step-1'"
84+
- name: step-2
85+
image: alpine:3.18
86+
script: "echo 'api-tests / step-2'"
87+
- name: step-3
88+
image: alpine:3.18
89+
script: "echo 'api-tests / step-3'"
90+
- name: step-4
91+
image: alpine:3.18
92+
script: "echo 'api-tests / step-4'"
93+
- name: step-5
94+
image: alpine:3.18
95+
script: "echo 'api-tests / step-5'"
96+
- name: step-6
97+
image: alpine:3.18
98+
script: "echo 'api-tests / step-6'"
99+
- name: step-7
100+
image: alpine:3.18
101+
script: "echo 'api-tests / step-7'"
102+
- name: step-8
103+
image: alpine:3.18
104+
script: "echo 'api-tests / step-8'"
105+
- name: step-9
106+
image: alpine:3.18
107+
script: "echo 'api-tests / step-9'"
108+
- name: step-10
109+
image: alpine:3.18
110+
script: "echo 'api-tests / step-10'"
111+
112+
- name: task-4
113+
runAfter: [api-tests]
114+
taskSpec:
115+
steps:
116+
- name: step-1
117+
image: alpine:3.18
118+
script: "echo 'task-4 / step-1'"
119+
- name: step-2
120+
image: alpine:3.18
121+
script: "echo 'task-4 / step-2'"
122+
- name: step-3
123+
image: alpine:3.18
124+
script: "echo 'task-4 / step-3'"
125+
- name: step-4
126+
image: alpine:3.18
127+
script: "echo 'task-4 / step-4'"
128+
- name: step-5
129+
image: alpine:3.18
130+
script: "echo 'task-4 / step-5'"
131+
- name: step-6
132+
image: alpine:3.18
133+
script: "echo 'task-4 / step-6'"
134+
- name: step-7
135+
image: alpine:3.18
136+
script: "echo 'task-4 / step-7'"
137+
- name: step-8
138+
image: alpine:3.18
139+
script: "echo 'task-4 / step-8'"
140+
- name: step-9
141+
image: alpine:3.18
142+
script: "echo 'task-4 / step-9'"
143+
- name: step-10
144+
image: alpine:3.18
145+
script: "echo 'task-4 / step-10'"
146+
147+
- name: task-5
148+
runAfter: [task-4]
149+
taskSpec:
150+
steps:
151+
- name: step-1
152+
image: alpine:3.18
153+
script: "echo 'task-5 / step-1'"
154+
- name: step-2
155+
image: alpine:3.18
156+
script: "echo 'task-5 / step-2'"
157+
- name: step-3
158+
image: alpine:3.18
159+
script: "echo 'task-5 / step-3'"
160+
- name: step-4
161+
image: alpine:3.18
162+
script: "echo 'task-5 / step-4'"
163+
- name: step-5
164+
image: alpine:3.18
165+
script: "echo 'task-5 / step-5'"
166+
- name: step-6
167+
image: alpine:3.18
168+
script: "echo 'task-5 / step-6'"
169+
- name: step-7
170+
image: alpine:3.18
171+
script: "echo 'task-5 / step-7'"
172+
- name: step-8
173+
image: alpine:3.18
174+
script: "echo 'task-5 / step-8'"
175+
- name: step-9
176+
image: alpine:3.18
177+
script: "echo 'task-5 / step-9'"
178+
- name: step-10
179+
image: alpine:3.18
180+
script: "echo 'task-5 / step-10'"

0 commit comments

Comments
 (0)