Skip to content

MTV-3643 | E2E customization scripts - downstream spec & page objects (part 2)#2341

Merged
avivtur merged 8 commits intokubev2v:mainfrom
Pedro-S-Abreu:e2e-customization-scripts
Apr 15, 2026
Merged

MTV-3643 | E2E customization scripts - downstream spec & page objects (part 2)#2341
avivtur merged 8 commits intokubev2v:mainfrom
Pedro-S-Abreu:e2e-customization-scripts

Conversation

@Pedro-S-Abreu
Copy link
Copy Markdown
Collaborator

@Pedro-S-Abreu Pedro-S-Abreu commented Apr 7, 2026

📝 Links

📝 Description

Adds downstream Playwright E2E tests for the customization scripts feature, complementing the page objects introduced in part 1.

New files:

  • plan-customization-scripts.spec.ts — 3 downstream tests (create with scripts, empty state, back-navigation edit)
  • AutomationTab.ts — Plan Details Automation tab page object
  • ScriptEditModal.ts — Script edit modal page object

Modified:

  • PlanDetailsPage.ts — wired AutomationTab
  • CustomizationScriptsStep.ts — fixed heading text to match actual wizard step title

🎥 Demo

@Pedro-S-Abreu Pedro-S-Abreu force-pushed the e2e-customization-scripts branch from 6ff0e76 to 6207805 Compare April 7, 2026 16:50
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Apr 7, 2026

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 16.27%. Comparing base (13484d0) to head (4113e4d).
⚠️ Report is 1033 commits behind head on main.
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@             Coverage Diff             @@
##             main    #2341       +/-   ##
===========================================
- Coverage   36.81%   16.27%   -20.55%     
===========================================
  Files         158     1192     +1034     
  Lines        2548    21664    +19116     
  Branches      599     4284     +3685     
===========================================
+ Hits          938     3525     +2587     
- Misses       1428    18129    +16701     
+ Partials      182       10      -172     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown
Member

@avivtur avivtur left a comment

Choose a reason for hiding this comment

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

nice work, left some comments

Comment on lines +23 to +32
for (let i = existingCount - 1; i > 0; i -= 1) {
await this.scriptEditModal.removeScript(i);
}

for (let i = 0; i < scripts.length; i += 1) {
if (i > 0) {
await this.scriptEditModal.addScript();
}
await this.scriptEditModal.configureScript(i, scripts[i]);
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

why you remove and than add, and something looks weird in 2nd for loop, why using that if? why not configure and than add?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

added comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I meant the logic here is a bit off, why we need the remove and add operations, can't you just configure directly?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

fixed it

Comment thread testing/playwright/e2e/downstream/plans/plan-customization-scripts.spec.ts Outdated
Comment thread testing/playwright/e2e/downstream/plans/plan-customization-scripts.spec.ts Outdated
Comment on lines +9 to +28
const LINUX_FIRSTBOOT_SCRIPT: ScriptConfig = {
content: '#!/bin/bash\necho "firstboot setup"\nsystemctl enable my-service',
guestType: 'linux',
name: 'linux-setup',
scriptType: 'firstboot',
};

const WINDOWS_FIRSTBOOT_SCRIPT: ScriptConfig = {
content: 'REM Windows firstboot\nnet user admin P@ssw0rd /add',
guestType: 'windows',
name: 'win-setup',
scriptType: 'firstboot',
};

const UPDATED_SCRIPT: ScriptConfig = {
content: '#!/bin/bash\necho "updated script"\nexit 0',
guestType: 'linux',
name: 'updated-script',
scriptType: 'run',
};
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

can we use SCRIPT_TYPE_LABELS and GUEST_TYPE_LABELS here with toLowerCase?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

GUEST_TYPE_LABELS maps from 'linux' to 'Linux', so doing GUEST_TYPE_LABELS['linux'].toLowerCase() to get 'linux' back is circular.

@Pedro-S-Abreu Pedro-S-Abreu requested a review from avivtur April 13, 2026 18:00
this.scriptEditModal = new ScriptEditModal(page);
}

async editScripts(scripts: ScriptConfig[]): Promise<void> {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think the name of the function is what got me confused about the logic here in the first place, is this function essentially replacing the existing scripts with the scripts coming as parameter?
if so I think you'd want some function like setScripts(scripts: ScriptConfig[]): Promise in ScriptEditModal page object that would look like your original implementation before the latest change, then here you'd have replaceScripts that could like this:
async replaceScripts(scripts: ScriptConfig[]): Promise {
await this.openScriptEditModal();
await this.scriptEditModal.setScripts(scripts);
await this.scriptEditModal.save();
}
this would clarify intent of open-> set new scripts-> save

@Pedro-S-Abreu Pedro-S-Abreu requested a review from avivtur April 14, 2026 14:46
… (part 2)

Add downstream Playwright E2E tests for the customization scripts
feature, using the page objects introduced in part 1.

Resolves: MTV-3643
Signed-off-by: Pedro Abreu <pabreu@redhat.com>
Move GUEST_TYPE_LABELS and SCRIPT_TYPE_LABELS to test-data.ts
and import from both page objects that used local copies.

Resolves: MTV-3643
Signed-off-by: Pedro Abreu <pabreu@redhat.com>
Resolves: MTV-3643
Signed-off-by: Pedro Abreu <pabreu@redhat.com>
- Remove unused verifyScriptName and verifyEditButtonDisabled
- Replace waitForLoadState('networkidle') with click-only
- Fix misleading step name

Resolves: MTV-3643
Signed-off-by: Pedro Abreu <pabreu@redhat.com>
- Replace hardcoded 'Linux', 'Windows', 'Firstboot', 'Run' strings
  with GUEST_TYPE_LABELS and SCRIPT_TYPE_LABELS lookups in spec assertions
- Add clarifying comment on editScripts explaining the row-reuse pattern

Resolves: MTV-3643
Signed-off-by: Pedro Abreu <pabreu@redhat.com>
Move configureScript logic (field filling, dropdown selection,
Monaco editor content) into a shared fillScriptFields utility.
Both ScriptEditModal and CustomizationScriptsStep now delegate
to it, parameterized by their different test IDs.

Resolves: MTV-3643
Signed-off-by: Pedro Abreu <pabreu@redhat.com>
Instead of removing all rows then adding back, reuse existing rows,
only add when more are needed, and remove only the excess.

Resolves: MTV-3643
Signed-off-by: Pedro Abreu <pabreu@redhat.com>
Move row management (configure/add/remove) into
ScriptEditModal.setScripts() and rename the AutomationTab
orchestrator to replaceScripts() for clearer intent:
open modal -> set scripts -> save.

Resolves: MTV-3643
Signed-off-by: Pedro Abreu <pabreu@redhat.com>
@avivtur avivtur force-pushed the e2e-customization-scripts branch from 9c2118b to 4113e4d Compare April 15, 2026 06:41
@sonarqubecloud
Copy link
Copy Markdown

@avivtur avivtur added this pull request to the merge queue Apr 15, 2026
Merged via the queue into kubev2v:main with commit 5b5b5dd Apr 15, 2026
15 checks passed
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.

3 participants