Skip to content

Closes #925 [Smoke test] Test should be able to delete plugin successfully#231

Merged
Khadreal merged 7 commits into
developfrom
feat/925-should-delete
Jun 26, 2025
Merged

Closes #925 [Smoke test] Test should be able to delete plugin successfully#231
Khadreal merged 7 commits into
developfrom
feat/925-should-delete

Conversation

@sandyfzu
Copy link
Copy Markdown
Member

Description

Fixes 925

Type of change

Detailed scenario

Check the issue.

What was tested

Tested plugin deletion in different scenarios.

How to test

Run the node ./node_modules/@cucumber/cucumber/bin/cucumber-js -p default --tags @bwpplugindeletion to for this specific test

Technical description

Documentation

Added some scenarios to test plugin deletion

Mandatory Checklist

Code validation

  • I validated all the Acceptance Criteria. If possible, provide screenshots or videos.
  • I triggered all changed lines of code at least once without new errors/warnings/notices.
  • I implemented built-in tests to cover the new/changed code.

Code style

  • I wrote a self-explanatory code about what it does.
  • I protected entry points against unexpected inputs.
  • I did not introduce unnecessary complexity.
  • Output messages (errors, notices, logs) are explicit enough for users to understand the issue and are actionnable.

Unticked items justification

n/a

Copilot AI review requested due to automatic review settings June 23, 2025 16:57
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Adds smoke tests for verifying BackWPup plugin deletion by introducing step definitions and feature scenarios, and extends onboarding steps with backup frequency controls and job card assertions.

  • Introduced new Cucumber steps to delete and assert deletion of BackWPup plugin.
  • Added new feature file delete-plugin.feature outlining scenarios for plugin deletion.
  • Enhanced onboarding.ts with backup frequency configuration and job card visibility steps.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
src/backwpup/steps/onboarding.ts Added steps for setting backup frequencies and asserting job card visibility
src/backwpup/steps/delete.ts Added step to assert plugin deletion success
src/backwpup/delete-plugin.feature New feature file with plugin deletion test scenarios
Comments suppressed due to low confidence (2)

src/backwpup/steps/onboarding.ts:75

  • This doc comment is incomplete; consider updating it to clearly describe the purpose of the 'I should see {string} job cards' step, e.g., 'Verifies visibility of job cards for the given data type'.
 * See data type in

src/backwpup/steps/delete.ts:18

  • [nitpick] To make this step reusable for other plugins, consider parameterizing the plugin slug, e.g., When('I delete {string} plugin', ...), so you don't need separate definitions for each plugin.
When('I delete backwpup plugin', async function (this: ICustomWorld) {

Comment on lines +78 to +93
if(dataType === 'files') {
await expect(this.page.locator('div.backwpup-job-files')).toBeVisible();
}

if(dataType === 'database') {
await expect(this.page.locator('div.backwpup-job-database')).toBeVisible();
}

if(dataType === 'both') {
await expect(this.page.locator('div.backwpup-job-database')).toBeVisible();
await expect(this.page.locator('div.backwpup-job-files')).toBeVisible();
}

if(dataType === 'mixed') {
await expect(this.page.locator('div.backwpup-job-mixed')).toBeVisible();
}
Copy link

Copilot AI Jun 23, 2025

Choose a reason for hiding this comment

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

[nitpick] The series of if statements for different data types can be refactored into a mapping between dataType values and selectors to reduce duplication and improve maintainability.

Suggested change
if(dataType === 'files') {
await expect(this.page.locator('div.backwpup-job-files')).toBeVisible();
}
if(dataType === 'database') {
await expect(this.page.locator('div.backwpup-job-database')).toBeVisible();
}
if(dataType === 'both') {
await expect(this.page.locator('div.backwpup-job-database')).toBeVisible();
await expect(this.page.locator('div.backwpup-job-files')).toBeVisible();
}
if(dataType === 'mixed') {
await expect(this.page.locator('div.backwpup-job-mixed')).toBeVisible();
}
const jobCardSelectors = {
files: ['div.backwpup-job-files'],
database: ['div.backwpup-job-database'],
both: ['div.backwpup-job-database', 'div.backwpup-job-files'],
mixed: ['div.backwpup-job-mixed'],
};
const selectors = jobCardSelectors[dataType];
if (selectors) {
for (const selector of selectors) {
await expect(this.page.locator(selector)).toBeVisible();
}
} else {
throw new Error(`Unsupported dataType: ${dataType}`);
}

Copilot uses AI. Check for mistakes.
Comment on lines +61 to +66
await this.page.locator('button[data-content="frequency"][data-job-id="2"]').click();
await this.page.selectOption('select[name="frequency"]#backwpup_frequency', period);
}

if(dataType === 'database') {
await this.page.locator('button[data-content="frequency"][data-job-id="3"]').click();
Copy link

Copilot AI Jun 23, 2025

Choose a reason for hiding this comment

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

After clicking to open the advanced frequency dropdown, consider waiting for the <select> element to be visible (e.g., await this.page.waitForSelector('select#backwpup_frequency')) before calling selectOption to avoid potential flakiness.

Suggested change
await this.page.locator('button[data-content="frequency"][data-job-id="2"]').click();
await this.page.selectOption('select[name="frequency"]#backwpup_frequency', period);
}
if(dataType === 'database') {
await this.page.locator('button[data-content="frequency"][data-job-id="3"]').click();
await this.page.locator('button[data-content="frequency"][data-job-id="2"]').click();
await this.page.waitForSelector('select[name="frequency"]#backwpup_frequency', { state: 'visible', timeout: 10000 });
await this.page.selectOption('select[name="frequency"]#backwpup_frequency', period);
}
if(dataType === 'database') {
await this.page.locator('button[data-content="frequency"][data-job-id="3"]').click();
await this.page.waitForSelector('select[name="frequency"]#backwpup_frequency', { state: 'visible', timeout: 10000 });

Copilot uses AI. Check for mistakes.
Comment thread src/backwpup/steps/onboarding.ts Outdated
@sandyfzu sandyfzu requested a review from jeawhanlee June 24, 2025 15:04
Comment thread utils/page-utils.ts
@Khadreal Khadreal merged commit 1c59948 into develop Jun 26, 2025
2 checks passed
@Khadreal Khadreal deleted the feat/925-should-delete branch June 26, 2025 10:26
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.

4 participants