Skip to content

Remove flakiness from ssh-keys integration tests #7427

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 14 commits into
base: main
Choose a base branch
from

Conversation

KhizerRehan
Copy link
Contributor

@KhizerRehan KhizerRehan commented Jun 13, 2025

What this PR does / why we need it:

This PR fixes flakiness in ssh-keys integration tests

image

Which issue(s) this PR fixes:

Fixes #6940

What type of PR is this?

/kind bug
/find failing-test

Special notes for your reviewer:

Does this PR introduce a user-facing change? Then add your Release Note here:

NONE

Documentation:

NONE

@kubermatic-bot kubermatic-bot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. do-not-merge/docs-needed Indicates that a PR should not merge because it's missing one of the documentation labels. dco-signoff: yes Denotes that all commits in the pull request have the valid DCO signoff message. do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. labels Jun 13, 2025
@kubermatic-bot
Copy link
Contributor

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@kubermatic-bot kubermatic-bot added do-not-merge/code-freeze Indicates that a PR should not merge because it has not been approved for code freeze yet. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jun 13, 2025
@KhizerRehan
Copy link
Contributor Author

/test all

@KhizerRehan
Copy link
Contributor Author

/test pre-dashboard-web-check

@KhizerRehan
Copy link
Contributor Author

/test all

@KhizerRehan
Copy link
Contributor Author

/test pre-dashboard-web-check

@KhizerRehan KhizerRehan marked this pull request as ready for review June 16, 2025 13:27
@kubermatic-bot kubermatic-bot added release-note-none Denotes a PR that doesn't merit a release note. docs/none Denotes a PR that doesn't need documentation (changes). and removed do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. do-not-merge/docs-needed Indicates that a PR should not merge because it's missing one of the documentation labels. labels Jun 16, 2025
Copy link
Contributor

@ahmadhamzh ahmadhamzh left a comment

Choose a reason for hiding this comment

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

small comments

@@ -26,6 +26,7 @@ export enum Condition {
NotBe = 'not.be',
NotBeChecked = 'not.be.checked',
NotBeVisible = 'not.be.visible',
NotBeDisabled = 'not.be.disabled',
Copy link
Contributor

Choose a reason for hiding this comment

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

isn't NotBeDisabled is the same of BeEnabled

Copy link
Contributor Author

Choose a reason for hiding this comment

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

“not disabled” == “enabled” Another way of testing assertions using negative expression but if that make harder form understanding POV let me know wdyt?

Copy link
Contributor

Choose a reason for hiding this comment

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

personally, I think it might be a bit redundant, but I’m okay if you feel it makes more sense to keep it.

this.Buttons.openDialog.click();
this.Elements.addDialogInput.type(name).then(_ => this._strategy?.onCreate());
this.Buttons.openDialog.click({force: true});
this.Elements.addDialogInput.should(Condition.BeVisible).should(Condition.NotBeDisabled);
Copy link
Contributor

Choose a reason for hiding this comment

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

shouldn't we use Condition.BeEnabled instead

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Makes no difference IMO, if we use Not.Be.Disabled or Be.Enabled which technically means input should ready for input keystrokes

Reasoning same as above “not disabled” == “enabled” but if "Be.Enabled" makes more sense let me know.

Happy to Change!

thx

{
"/api/v1/*": "/$1",
"/api/v2/*": "/$1"
}
Copy link
Contributor

Choose a reason for hiding this comment

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

we need to add an empty line at the end of the file here

Copy link
Contributor

Choose a reason for hiding this comment

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

also why do we need this file ?
we have one inside fixtures/routes.json ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

IMO, there is only routes.json / db.json (checking in main branch)

Under this path
image

  • Currently, there’s only routes.json and db.json in main.
  • In this PR, I have moved them into cypress/fixtures for better organization — they’re related to e2e tests.
  • From my understanding, they’re mainly used to make sure json-server runs and aren’t used for test mocks.
  • We already have datacenter(s).json files and Endpoints.ts for API endpoints.

FYI: Instead of deleting i have moved these files into cypress/fixtures folder + updated package.json script to PICK those files from cypress/fixtures path

let me know if something problematic in the following change or my understanding

Thx

Copy link
Contributor

Choose a reason for hiding this comment

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

sounds good 👍
but i think we need to add an empty line at the end of the file here

if ($warning.length > 0) {
cy.reload();
}
});
Copy link
Contributor

Choose a reason for hiding this comment

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

should we add this to settings/defaults.spec.ts ?

Copy link
Contributor Author

@KhizerRehan KhizerRehan Jun 17, 2025

Choose a reason for hiding this comment

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

We can but TBH, i didn't found an issue while running default.spec however we can add it but I think there is not need to add extra check for default.spec unless it was problematic same as of ssh-keys.spec

thoughts?

Copy link
Contributor

Choose a reason for hiding this comment

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

one other thing is that if '.no-data-warning' is not found then it will fail right ? so i think that is not right

Copy link
Contributor Author

@KhizerRehan KhizerRehan Jun 17, 2025

Choose a reason for hiding this comment

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

@ahmadhamzh did you mean .no-data-warning if class is removed or changed to something else it shouldn't fail or did you mean to keep trying multiple times and fail then?

Ah! I see what you mean in case warning doesn't exists cypress will try to fetch warning and if it fails test will fail too. Which shouldn't be the case. Hmmm I see.

@@ -59,8 +59,16 @@ describe('SSH Key Management Story', () => {
Pages.expect(View.Clusters.Default);
});

it('should create the cluster with ssh key', {retries: 3}, () => {
it('should create the cluster with ssh key', () => {
Pages.Clusters.List.visit();
Copy link
Contributor

Choose a reason for hiding this comment

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

isn't this already been done in the previous step ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Each it block runs independently if it was handled in beforeEach block then we might not need this line but to be explicit we need to navigate to list page once this test runs.

thoughts?

Copy link
Contributor

Choose a reason for hiding this comment

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

IMO there's no point in visiting the clusters list page if we're not going to perform any action there.

Copy link
Contributor

Choose a reason for hiding this comment

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

Nevermind, I thought the Pages.Wizard.visit() is navigating directly to wizard. But in other case, @ahmadhamzh is correct, we're already navigating to clusters list page in previous test. I agree that all tests should run independently but in this case every test is dependent on previous one.

Copy link
Contributor Author

@KhizerRehan KhizerRehan left a comment

Choose a reason for hiding this comment

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

Feedback Response

@@ -59,8 +59,16 @@ describe('SSH Key Management Story', () => {
Pages.expect(View.Clusters.Default);
});

it('should create the cluster with ssh key', {retries: 3}, () => {
it('should create the cluster with ssh key', () => {
Pages.Clusters.List.visit();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Each it block runs independently if it was handled in beforeEach block then we might not need this line but to be explicit we need to navigate to list page once this test runs.

thoughts?

if ($warning.length > 0) {
cy.reload();
}
});
Copy link
Contributor Author

@KhizerRehan KhizerRehan Jun 17, 2025

Choose a reason for hiding this comment

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

We can but TBH, i didn't found an issue while running default.spec however we can add it but I think there is not need to add extra check for default.spec unless it was problematic same as of ssh-keys.spec

thoughts?

this.Buttons.openDialog.click();
this.Elements.addDialogInput.type(name).then(_ => this._strategy?.onCreate());
this.Buttons.openDialog.click({force: true});
this.Elements.addDialogInput.should(Condition.BeVisible).should(Condition.NotBeDisabled);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Makes no difference IMO, if we use Not.Be.Disabled or Be.Enabled which technically means input should ready for input keystrokes

Reasoning same as above “not disabled” == “enabled” but if "Be.Enabled" makes more sense let me know.

Happy to Change!

thx

@@ -26,6 +26,7 @@ export enum Condition {
NotBe = 'not.be',
NotBeChecked = 'not.be.checked',
NotBeVisible = 'not.be.visible',
NotBeDisabled = 'not.be.disabled',
Copy link
Contributor Author

Choose a reason for hiding this comment

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

“not disabled” == “enabled” Another way of testing assertions using negative expression but if that make harder form understanding POV let me know wdyt?

{
"/api/v1/*": "/$1",
"/api/v2/*": "/$1"
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

IMO, there is only routes.json / db.json (checking in main branch)

Under this path
image

  • Currently, there’s only routes.json and db.json in main.
  • In this PR, I have moved them into cypress/fixtures for better organization — they’re related to e2e tests.
  • From my understanding, they’re mainly used to make sure json-server runs and aren’t used for test mocks.
  • We already have datacenter(s).json files and Endpoints.ts for API endpoints.

FYI: Instead of deleting i have moved these files into cypress/fixtures folder + updated package.json script to PICK those files from cypress/fixtures path

let me know if something problematic in the following change or my understanding

Thx

Comment on lines -1 to -13
# See the OWNERS docs: https://git.k8s.io/community/contributors/guide/owners.md

approvers:
- sig-ui

reviewers:
- sig-ui

labels:
- sig-ui

options:
no_parent_owners: true
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Delete this files due to moving files under cypress/fixtures folder?

Any thoughts on this?

if ($warning.length > 0) {
cy.reload();
}
});
Copy link
Contributor

Choose a reason for hiding this comment

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

one other thing is that if '.no-data-warning' is not found then it will fail right ? so i think that is not right

Copy link
Contributor

Choose a reason for hiding this comment

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

are you sure we don't need this file anymore ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes —
db.json and routes.json have been moved to modules/web/cypress/fixtures and related scripts updated in package.json.
Therefore, there’s no need for an OWNER file there anymore, as the directory no longer contains any files.

@@ -26,6 +26,7 @@ export enum Condition {
NotBe = 'not.be',
NotBeChecked = 'not.be.checked',
NotBeVisible = 'not.be.visible',
NotBeDisabled = 'not.be.disabled',
Copy link
Contributor

Choose a reason for hiding this comment

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

personally, I think it might be a bit redundant, but I’m okay if you feel it makes more sense to keep it.

{
"/api/v1/*": "/$1",
"/api/v2/*": "/$1"
}
Copy link
Contributor

Choose a reason for hiding this comment

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

sounds good 👍
but i think we need to add an empty line at the end of the file here

Comment on lines +98 to 99
Pages.Members.accessSideNavItem();
Pages.SSHKeys.visit();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Test was failing as DDN menu was not opened and DOM node is not visible therefore fails.

Where as Pages.SSHKeys.visit() only clicks the button if DDN is opened.

reference test: should create the ssh key

@kubermatic-bot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign ahmadhamzh for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kubermatic-bot kubermatic-bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jun 17, 2025
@KhizerRehan
Copy link
Contributor Author

/test pre-dashboard-web-integration-tests

@kubermatic kubermatic deleted a comment from kubermatic-bot Jun 17, 2025
@KhizerRehan
Copy link
Contributor Author

/test pre-dashboard-web-integration-tests

@KhizerRehan
Copy link
Contributor Author

/test pre-dashboard-web-integration-tests-ce

@Waseem826
Copy link
Contributor

/test pre-dashboard-web-integration-tests-ce

There was a failure (on different scenario) for ssh keys spec: https://minio.worker.ci.k8c.io/dashboard-cypress-artifacts/pr-7427-pre-dashboard-web-integration-tests-1934999113099644928/videos/ssh-keys.spec.ts.mp4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dco-signoff: yes Denotes that all commits in the pull request have the valid DCO signoff message. do-not-merge/code-freeze Indicates that a PR should not merge because it has not been approved for code freeze yet. docs/none Denotes a PR that doesn't need documentation (changes). release-note-none Denotes a PR that doesn't merit a release note. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove flakiness from ssh-keys integration tests
4 participants