Skip to content
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { agHelper, homePage } from "../../../../support/Objects/ObjectsCore";
import SignupPageLocators from "../../../../locators/SignupPage.json";
import loginPage from "../../../../locators/LoginPage.json";
import welcomePage from "../../../../locators/welcomePage.json";

const emailOne = `sagarspecSignIn1.${Math.random().toString(36).substring(2, 25)}@appsmith.com`;
const tempPassword = "testPassword";

describe("Sign in and Sign up verification", { tags: ["@tag.SignIn"] }, () => {
it("1. User can sign up to application with form.", () => {
homePage.LogOutviaAPI();
agHelper.VisitNAssert("/");
agHelper.WaitUntilEleAppear(SignupPageLocators.forgetPasswordLink);
agHelper.AssertElementExist(SignupPageLocators.signupLink);
agHelper.GetNClick(SignupPageLocators.signupLink);
agHelper.AssertURL("/user/signup");
cy.get(loginPage.username).type(emailOne);
cy.get(loginPage.password).type(tempPassword, { log: false });
cy.get(loginPage.submitBtn).click();
cy.wait("@getConsolidatedData");
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Remove cy.wait and use proper assertions

Replace cy.wait("@getConsolidatedData") with proper assertions to validate the response.

-    cy.wait("@getConsolidatedData");
+    cy.intercept("GET", "/api/v1/users/consolidated-data").as("getConsolidatedData");
+    cy.wait("@getConsolidatedData").then((interception) => {
+      expect(interception.response.statusCode).to.eq(200);
+    });
📝 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.wait("@getConsolidatedData");
cy.intercept("GET", "/api/v1/users/consolidated-data").as("getConsolidatedData");
cy.wait("@getConsolidatedData").then((interception) => {
expect(interception.response.statusCode).to.eq(200);
});

agHelper.AssertURL("/signup-success?");
agHelper.AssertContains("Brand New");
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Avoid using string assertions

Replace direct string assertion with data-testid or constants.

-    agHelper.AssertContains("Brand New");
+    agHelper.AssertElementVisible(welcomePage.welcomeMessage);
📝 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
agHelper.AssertContains("Brand New");
agHelper.AssertElementVisible(welcomePage.welcomeMessage);

agHelper.GetNClick(welcomePage.proficiencyGroupButton, 0);
agHelper.GetNClick(welcomePage.useCaseGroupButton, 0);
agHelper.ClickButton("Get started");
});
Comment on lines +10 to +26
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Use SignupFromAPI instead of form-based signup

According to the coding guidelines, signup should be performed via API using SignupFromAPI.

-  it("1. User can sign up to application with form.", () => {
-    homePage.LogOutviaAPI();
-    agHelper.VisitNAssert("/");
-    agHelper.WaitUntilEleAppear(SignupPageLocators.forgetPasswordLink);
-    agHelper.AssertElementExist(SignupPageLocators.signupLink);
-    agHelper.GetNClick(SignupPageLocators.signupLink);
-    agHelper.AssertURL("/user/signup");
-    cy.get(loginPage.username).type(emailOne);
-    cy.get(loginPage.password).type(tempPassword, { log: false });
-    cy.get(loginPage.submitBtn).click();
-    cy.wait("@getConsolidatedData");
-    agHelper.AssertURL("/signup-success?");
-    agHelper.AssertContains("Brand New");
-    agHelper.GetNClick(welcomePage.proficiencyGroupButton, 0);
-    agHelper.GetNClick(welcomePage.useCaseGroupButton, 0);
-    agHelper.ClickButton("Get started");
+  it("1. User can sign up to application via API.", () => {
+    homePage.SignupFromAPI(emailOne, tempPassword);
+    // Verify post-signup flow
+    agHelper.AssertURL("/signup-success?");
+    agHelper.GetNClick(welcomePage.proficiencyGroupButton, 0);
+    agHelper.GetNClick(welcomePage.useCaseGroupButton, 0);
+    agHelper.ClickButton("Get started");
   });
📝 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
it("1. User can sign up to application with form.", () => {
homePage.LogOutviaAPI();
agHelper.VisitNAssert("/");
agHelper.WaitUntilEleAppear(SignupPageLocators.forgetPasswordLink);
agHelper.AssertElementExist(SignupPageLocators.signupLink);
agHelper.GetNClick(SignupPageLocators.signupLink);
agHelper.AssertURL("/user/signup");
cy.get(loginPage.username).type(emailOne);
cy.get(loginPage.password).type(tempPassword, { log: false });
cy.get(loginPage.submitBtn).click();
cy.wait("@getConsolidatedData");
agHelper.AssertURL("/signup-success?");
agHelper.AssertContains("Brand New");
agHelper.GetNClick(welcomePage.proficiencyGroupButton, 0);
agHelper.GetNClick(welcomePage.useCaseGroupButton, 0);
agHelper.ClickButton("Get started");
});
it("1. User can sign up to application via API.", () => {
homePage.SignupFromAPI(emailOne, tempPassword);
// Verify post-signup flow
agHelper.AssertURL("/signup-success?");
agHelper.GetNClick(welcomePage.proficiencyGroupButton, 0);
agHelper.GetNClick(welcomePage.useCaseGroupButton, 0);
agHelper.ClickButton("Get started");
});


it("2. User can sign in to application with form.", () => {
homePage.LogOutviaAPI();
cy.LoginFromAPI(emailOne, tempPassword);
});
});
8 changes: 4 additions & 4 deletions app/client/cypress/locators/LoginPage.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"username":"input[name='username']",
"password":"input[name='password']",
"submitBtn":"button[type='submit']",
"signupLink":".t--sign-up"
"username": "input[name='username'], input[name='email']",
"password": "input[name='password']",
"submitBtn": "button[type='submit']",
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Use data-testid for button selector

Replace type attribute selector with data-testid.

-    "submitBtn": "button[type='submit']",
+    "submitBtn": "[data-testid='t--submit-button']",
📝 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
"submitBtn": "button[type='submit']",
"submitBtn": "[data-testid='t--submit-button']",

"signupLink": ".t--sign-up"
}
3 changes: 2 additions & 1 deletion app/client/cypress/locators/SignupPage.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@
"useCaseGroupButton": "[data-testid='t--user-use-case'] button",
"dropdownOption": ".rc-select-item-option:first",
"getStartedSubmit": ".t--get-started-button",
"forgetPasswordLink": "[href='/user/forgotPassword']"
"forgetPasswordLink": "[href='/user/forgotPassword']",
"signupLink": ".t--signup-link"
}
1 change: 1 addition & 0 deletions app/client/cypress/tags.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ module.exports = {
"@tag.Scanner",
"@tag.Select",
"@tag.Settings",
"@tag.SignIn",
"@tag.Slider",
"@tag.Statbox",
"@tag.Switch",
Expand Down
Loading