Skip to content
Merged
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
8 changes: 6 additions & 2 deletions tests/e2e/cypress/support/commands/login.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,11 @@ Cypress.Commands.add("loginByForm", (username, password) => {
return;
}

cy.get("#rememberme").should("be.visible").and("not.be.checked").click();
cy.get("body").then(($body) => {
if ($body.find("#rememberme").length) {
cy.get("#rememberme").should("be.visible").and("not.be.checked").click();
}
});
Comment on lines +45 to +49

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.

⚠️ Potential issue | 🔴 Critical | ⚡ Quick win

Use tabs for indentation per coding guidelines.

The added lines use spaces for indentation, but the coding guidelines require tabs for all *.js files. As per coding guidelines, "indentation must be tabs".

🛠️ Proposed fix to convert spaces to tabs
-      cy.get("body").then(($body) => {
-        if ($body.find("`#rememberme`").length) {
-          cy.get("`#rememberme`").should("be.visible").and("not.be.checked").click();
-        }
-      });
+		cy.get("body").then(($body) => {
+			if ($body.find("`#rememberme`").length) {
+				cy.get("`#rememberme`").should("be.visible").and("not.be.checked").click();
+			}
+		});
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
cy.get("body").then(($body) => {
if ($body.find("#rememberme").length) {
cy.get("#rememberme").should("be.visible").and("not.be.checked").click();
}
});
cy.get("body").then(($body) => {
if ($body.find("`#rememberme`").length) {
cy.get("`#rememberme`").should("be.visible").and("not.be.checked").click();
}
});
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/e2e/cypress/support/commands/login.js` around lines 45 - 49, The
indentation in the added block using cy.get("body").then(...) uses spaces;
update the indentation to use tabs consistent with the project's JS coding
guidelines. Locate the block containing cy.get("body").then(($body) => { ... })
and replace the leading spaces on each line inside that function (including the
if ($body.find("`#rememberme`")...) line and the cy.get("`#rememberme`")... line)
with tabs so the file uses tabs for indentation throughout.

cy.get("#user_login").should("be.visible").setValue(username);
cy.get("#user_pass")
.should("be.visible")
Expand All @@ -52,6 +56,6 @@ Cypress.Commands.add("loginByForm", (username, password) => {
cy.location("pathname")
.should("not.contain", "/wp-login.php")
.and("not.contain", "/login")
.and("equal", "/wp-admin/");
.and("include", "/wp-admin");

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.

⚠️ Potential issue | 🔴 Critical | ⚡ Quick win

Use tabs for indentation and tighten the pathname assertion.

Two concerns:

  1. The line uses spaces for indentation, but the coding guidelines require tabs for all *.js files.
  2. Using .include("/wp-admin") is overly permissive and would match unintended paths like /some-path/wp-admin or /not-wp-admin. To ensure the pathname starts with /wp-admin, use an anchored regex instead.

As per coding guidelines, "indentation must be tabs".

🛠️ Proposed fix
-      .and("include", "/wp-admin");
+		.and("match", /^\/wp-admin/);
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
.and("include", "/wp-admin");
.and("match", /^\/wp-admin/);
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/e2e/cypress/support/commands/login.js` at line 59, Update the assertion
that currently reads `.and("include", "/wp-admin")` to use an anchored regex
match so the pathname must start with `/wp-admin` (e.g., change to a
`.and("match", /^\/wp-admin/)` style check) and convert the indentation on that
line (and its surrounding lines if affected) from spaces to a single tab to
comply with the project JS indentation rule; look for the assertion chain
involving `.and("include", "/wp-admin")` in the login command and replace it
with the anchored regex match and tab-indented line.

});
});
Loading