-
-
Notifications
You must be signed in to change notification settings - Fork 79
fix(e2e): stabilize Cypress login on custom login pages #1282
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -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(); | ||||||
| } | ||||||
| }); | ||||||
| cy.get("#user_login").should("be.visible").setValue(username); | ||||||
| cy.get("#user_pass") | ||||||
| .should("be.visible") | ||||||
|
|
@@ -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"); | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use tabs for indentation and tighten the pathname assertion. Two concerns:
As per coding guidelines, "indentation must be tabs". 🛠️ Proposed fix- .and("include", "/wp-admin");
+ .and("match", /^\/wp-admin/);📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||
| }); | ||||||
| }); | ||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use tabs for indentation per coding guidelines.
The added lines use spaces for indentation, but the coding guidelines require tabs for all
*.jsfiles. As per coding guidelines, "indentation must be tabs".🛠️ Proposed fix to convert spaces to tabs
📝 Committable suggestion
🤖 Prompt for AI Agents