Skip to content

Created RestartFromLocalDevfile test - #23931

Open
olkornii wants to merge 3 commits into
eclipse-che:mainfrom
olkornii:CRW-11918
Open

Created RestartFromLocalDevfile test#23931
olkornii wants to merge 3 commits into
eclipse-che:mainfrom
olkornii:CRW-11918

Conversation

@olkornii

Copy link
Copy Markdown
Contributor

What does this PR do?

Automation for RestartFromLocalDevfile manual test case

Screenshot/screencast of this PR

What issues does this PR fix or reference?

https://redhat.atlassian.net/browse/CRW-11918

How to test this PR?

There is a related bug: https://redhat.atlassian.net/browse/CRW-9559
Once this bug is fixed it will be possible to run jenkins job.

PR Checklist

As the author of this Pull Request I made sure that:

Reviewers

Reviewers, please comment how you tested the PR when approving it.

Assisted-by: Claude Code
Signed-off-by: Oleksii Korniienko <olkornii@redhat.com>
Signed-off-by: Oleksii Korniienko <olkornii@redhat.com>
Assisted-by: Claude Code
Signed-off-by: Oleksii Korniienko <olkornii@redhat.com>
@olkornii
olkornii marked this pull request as ready for review August 25, 2026 13:56
await driverHelper.wait(1000);
}

// go to line 9999 to jump to the end of the file

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code could be simplified by changing the file content using the terminal:

// Append invalid env declaration directly to devfile.yaml
const appendOutput: ShellString = containerTerminal.execInContainerCommand(
    `printf '    env:\\n      - name: test-env\\n        value: true\\n' >> /projects/${projectName}/devfile.yaml`
);

@dmytro-ndp

Copy link
Copy Markdown
Contributor

@olkornii : Thank you for the test automation. It looks good overall and covers the test scenarios as expected.

There are a few cosmetic issues that violate CODE_STYLE.md and are worth improving:

  1. Hard-coded timeout values — should use TIMEOUT_CONSTANTS

CODE_STYLE.md says: "Use test ./constants to make test flexible."

The PR uses raw numbers throughout:
await driverHelper.waitAndClick(..., 30000);
await driverHelper.waitAndClick(..., 120000);
await driverHelper.waitVisibility(..., 180000);
await driverHelper.waitVisibility(..., 40000);
await driverHelper.wait(1000);
await driverHelper.wait(500);
await driverHelper.wait(300);
These should use TIMEOUT_CONSTANTS (e.g. TIMEOUT_CONSTANTS.TS_SELENIUM_START_WORKSPACE_TIMEOUT, TS_IDE_START_TIMEOUT, etc.) — and TIMEOUT_CONSTANTS is not imported at all.

  1. registerRunningWorkspace not called

Other specs (e.g. WorkspaceBackupRestore.spec.ts) call registerRunningWorkspace(WorkspaceHandlingTests.getWorkspaceName()) after creating a workspace so the global MochaHook afterAll can delete it on unexpected failures. The PR never calls this, relying solely on suiteTeardown. If the suite crashes before teardown, the workspace is leaked.

  1. Locators declared as local const inside test functions

CODE_STYLE.md rule (for page-object classes): "✗ Avoid to declare locators as constant in methods."
The spec itself is not a class, but looking at the pattern in existing specs, By locators that are used in tests tend to be defined as private static readonly in extracted page-object classes. The PR inlines them in test functions:
const devfileTab: By = By.xpath('...');
const errorDialog: By = By.xpath('...');
const errorDetailDialog: By = By.xpath('...');
const storageTypeLocator: By = By.xpath('...');
These interactions should ideally be encapsulated in a page-object method. At minimum, the locators for the restart dialog/error popup should live in an appropriate page-object class.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants