Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
@pipelines
Feature: log-scroll-test-pipeline
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.

Background:
Given user is at Administrator perspective
And user clicks on Pipelines Tab
And user has created or selected namespace "aut-pipelines"

@smoke
Scenario:Create and start pipeline using CLI: LS-01-TC01
When user creates pipeline run using YAML and CLI "testData/multistep-yaml-log-scroll/log-scroll-test-pipeline.yaml" in namespace "aut-pipelines"
Then pipeline "log-scroll-test-pipeline" should be created successfully in namespace "aut-pipelines"

@smoke
Scenario: Create pipeline run using oc commands: LS-01-TC02
Given user clicks on Pipelines Tab
And user has created or selected namespace "aut-pipelines"
When user creates pipeline run using YAML and CLI "testData/multistep-yaml-log-scroll/log-scroll-test-pipeline-run.yaml" in namespace "aut-pipelines"
Then pipeline run "log-scroll-test-pipeline-run" should be created successfully in namespace "aut-pipelines"

@smoke
Scenario: Access logs tab and verify all tasks are available: LS-01-TC03
Given user is at pipeline run details page for "log-scroll-test-pipeline-run" in namespace "aut-pipelines"
When user navigates to Logs Tab for "log-scroll-test-pipeline-run" in namespace "aut-pipelines"
Then user should see "frontend-build" task in task list
And user should see "backend-build" task in task list

@smoke
Scenario: Scroll to step in logs tab using URL: LS-01-TC04
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"
Then user should see "STEP-STEP-9" step is visible in logs tab

@smoke
Scenario: Scroll to last step of last task using URL: LS-01-TC05
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"
Then user should see "STEP-STEP-10" step is visible in logs tab

@regression
Scenario: Invalid step name in existing task using URL: LS-01-TC06
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"
Then user should expect default behavior of log viewer and scroll to end of log

@regression
Scenario: Missing step parameter in URL defaults to first step: LS-01-TC10
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"
Then user should see "backend-build" task in task list
And user should expect default behavior of log viewer and scroll to end of log
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
import { Given, Then, When } from '@badeball/cypress-cucumber-preprocessor';
import { switchPerspective } from '../../constants/global';
import { perspective } from '../../pages/app';

Given('user is at Administrator perspective', () => {
perspective.switchTo(switchPerspective.Administrator);
});

When('user clicks on Pipelines Tab', () => {
cy.get('[data-test="nav-pipelines"]').then(($el) => {
if ($el.attr('aria-expanded') === 'false') {
cy.wrap($el).click();
}
});
cy.get('[data-test="nav"][data-quickstart-id="qs-nav-pipelines"]')
.contains('Pipelines')
.click();
});

When(
'user creates pipeline using YAML and CLI {string} in namespace {string}',
(yamlFile: string, namespace: string) => {
const fullPath = yamlFile.startsWith('cypress/')
? yamlFile
: `cypress/${yamlFile}`;
cy.exec(`oc apply -f ${fullPath} -n ${namespace}`, {
failOnNonZeroExit: false,
}).then((result) => {
if (result.stderr) {
throw new Error(result.stderr);
/* cy.log('CLI failed, falling back to UI');
cy.get('[data-test="item-create"]').click();
cy.get('[data-test="list-page-create-dropdown-item-pipeline"]').click();
cy.get('[data-test="yaml-view-input"]').click();
cy.get('button').contains('Create').click();
cy.log('Pipeline created via UI'); */
}
});
},
);

Then(
'pipeline {string} should be created successfully in namespace {string}',
(pipelineName: string, namespace: string) => {
cy.exec(`oc get pipeline ${pipelineName} -n ${namespace}`, {
failOnNonZeroExit: false,
}).then((result) => {
if (result.code !== 0) {
throw new Error(
`Pipeline ${pipelineName} was not created successfully: ${result.stderr}`,
);
}
cy.log(`Pipeline ${pipelineName} created successfully`);
});
},
);

When(
'user creates pipeline run using YAML and CLI {string} in namespace {string}',
(yamlFile: string, namespace: string) => {
const fullPath = yamlFile.startsWith('cypress/')
? yamlFile
: `cypress/${yamlFile}`;
cy.exec(`oc apply -f ${fullPath} -n ${namespace}`, {
failOnNonZeroExit: false,
}).then((result) => {
if (result.stderr) {
throw new Error(result.stderr);
}
});
},
);

Then(
'pipeline run {string} should be created successfully in namespace {string}',
(pipelineRunName: string, namespace: string) => {
cy.exec(`oc get pipelinerun ${pipelineRunName} -n ${namespace}`);
cy.exec(
`oc wait --for=condition=Succeeded pipelinerun/${pipelineRunName} -n ${namespace} --timeout=300s`,
);
},
);

Given(
'user is at pipeline run details page for {string} in namespace {string}',
(pipelineRunName: string, namespace: string) => {
cy.visit(
`/k8s/ns/${namespace}/tekton.dev~v1~PipelineRun/${pipelineRunName}`,
);
},
);

When(
'user navigates to Logs Tab for {string} in namespace {string}',
(pipelineRunName: string, namespace: string) => {
cy.visit(
`/k8s/ns/${namespace}/tekton.dev~v1~PipelineRun/${pipelineRunName}/logs`,
);
},
);

Then('user should see {string} task in task list', (taskName: string) => {
cy.get('[data-test-id="logs-tasklist"]')
.contains(taskName)
.should('be.visible');
});

Given(
'user tries to navigate to task {string} and step {string} in Logs tab using URL for {string} in namespace {string}',
(
taskName: string,
stepName: string,
pipelineRunName: string,
namespace: string,
) => {
cy.visit(
`/k8s/ns/${namespace}/tekton.dev~v1~PipelineRun/${pipelineRunName}/logs?taskName=${taskName}&step=${stepName}`,
);
},
);

Then(
'user should see {string} step is visible in logs tab',
(stepName: string) => {
cy.contains(stepName).should('be.visible');
cy.log(`${stepName} is visible in logs tab`);
cy.visit('/');
},
);

Then(
'user should expect default behavior of log viewer and scroll to end of log',
() => {
cy.get('.pf-v5-c-log-viewer__scroll-container').then(($el) => {
const el = $el[0];
//eslint-disable-next-line cypress/no-unnecessary-waiting
cy.wait(2000);
// Verifying if the scroll is at the bottom
expect(el.scrollHeight - el.scrollTop).to.be.closeTo(el.clientHeight, 1);
cy.visit('/');
});
},
);
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: tekton.dev/v1
kind: PipelineRun
metadata:
name: log-scroll-test-pipeline-run
namespace: aut-pipelines
spec:
pipelineRef:
name: log-scroll-test-pipeline
Original file line number Diff line number Diff line change
@@ -0,0 +1,180 @@
apiVersion: tekton.dev/v1
kind: Pipeline
metadata:
name: log-scroll-test-pipeline
namespace: aut-pipelines
spec:
tasks:
- name: frontend-build
taskSpec:
steps:
- name: step-1
image: alpine:3.18
script: "echo 'frontend-build / step-1'"
- name: step-2
image: alpine:3.18
script: "echo 'frontend-build / step-2'"
- name: step-3
image: alpine:3.18
script: "echo 'frontend-build / step-3'"
- name: step-4
image: alpine:3.18
script: "echo 'frontend-build / step-4'"
- name: step-5
image: alpine:3.18
script: "echo 'frontend-build / step-5'"
- name: step-6
image: alpine:3.18
script: "echo 'frontend-build / step-6'"
- name: step-7
image: alpine:3.18
script: "echo 'frontend-build / step-7'"
- name: step-8
image: alpine:3.18
script: "echo 'frontend-build / step-8'"
- name: step-9
image: alpine:3.18
script: "echo 'frontend-build / step-9'"
- name: step-10
image: alpine:3.18
script: "echo 'frontend-build / step-10'"

- name: backend-build
runAfter: [frontend-build]
taskSpec:
steps:
- name: step-1
image: alpine:3.18
script: "echo 'backend-build / step-1'"
- name: step-2
image: alpine:3.18
script: "echo 'backend-build / step-2'"
- name: step-3
image: alpine:3.18
script: "echo 'backend-build / step-3'"
- name: step-4
image: alpine:3.18
script: "echo 'backend-build / step-4'"
- name: step-5
image: alpine:3.18
script: "echo 'backend-build / step-5'"
- name: step-6
image: alpine:3.18
script: "echo 'backend-build / step-6'"
- name: step-7
image: alpine:3.18
script: "echo 'backend-build / step-7'"
- name: step-8
image: alpine:3.18
script: "echo 'backend-build / step-8'"
- name: step-9
image: alpine:3.18
script: "echo 'backend-build / step-9'"
- name: step-10
image: alpine:3.18
script: "echo 'backend-build / step-10'"

- name: api-tests
runAfter: [backend-build]
taskSpec:
steps:
- name: step-1
image: alpine:3.18
script: "echo 'api-tests / step-1'"
- name: step-2
image: alpine:3.18
script: "echo 'api-tests / step-2'"
- name: step-3
image: alpine:3.18
script: "echo 'api-tests / step-3'"
- name: step-4
image: alpine:3.18
script: "echo 'api-tests / step-4'"
- name: step-5
image: alpine:3.18
script: "echo 'api-tests / step-5'"
- name: step-6
image: alpine:3.18
script: "echo 'api-tests / step-6'"
- name: step-7
image: alpine:3.18
script: "echo 'api-tests / step-7'"
- name: step-8
image: alpine:3.18
script: "echo 'api-tests / step-8'"
- name: step-9
image: alpine:3.18
script: "echo 'api-tests / step-9'"
- name: step-10
image: alpine:3.18
script: "echo 'api-tests / step-10'"

- name: task-4
runAfter: [api-tests]
taskSpec:
steps:
- name: step-1
image: alpine:3.18
script: "echo 'task-4 / step-1'"
- name: step-2
image: alpine:3.18
script: "echo 'task-4 / step-2'"
- name: step-3
image: alpine:3.18
script: "echo 'task-4 / step-3'"
- name: step-4
image: alpine:3.18
script: "echo 'task-4 / step-4'"
- name: step-5
image: alpine:3.18
script: "echo 'task-4 / step-5'"
- name: step-6
image: alpine:3.18
script: "echo 'task-4 / step-6'"
- name: step-7
image: alpine:3.18
script: "echo 'task-4 / step-7'"
- name: step-8
image: alpine:3.18
script: "echo 'task-4 / step-8'"
- name: step-9
image: alpine:3.18
script: "echo 'task-4 / step-9'"
- name: step-10
image: alpine:3.18
script: "echo 'task-4 / step-10'"

- name: task-5
runAfter: [task-4]
taskSpec:
steps:
- name: step-1
image: alpine:3.18
script: "echo 'task-5 / step-1'"
- name: step-2
image: alpine:3.18
script: "echo 'task-5 / step-2'"
- name: step-3
image: alpine:3.18
script: "echo 'task-5 / step-3'"
- name: step-4
image: alpine:3.18
script: "echo 'task-5 / step-4'"
- name: step-5
image: alpine:3.18
script: "echo 'task-5 / step-5'"
- name: step-6
image: alpine:3.18
script: "echo 'task-5 / step-6'"
- name: step-7
image: alpine:3.18
script: "echo 'task-5 / step-7'"
- name: step-8
image: alpine:3.18
script: "echo 'task-5 / step-8'"
- name: step-9
image: alpine:3.18
script: "echo 'task-5 / step-9'"
- name: step-10
image: alpine:3.18
script: "echo 'task-5 / step-10'"
Loading
Loading