Skip to content

Commit

Permalink
fix: Fix from for promise failure (#39295)
Browse files Browse the repository at this point in the history
## Description
> [!TIP]  
> _Add a TL;DR when the description is longer than 500 words or
extremely technical (helps the content, marketing, and DevRel team)._
>
> _Please also include relevant motivation and context. List any
dependencies that are required for this change. Add links to Notion,
Figma or any other documents that might be relevant to the PR._


Fixes #`Issue Number`  
_or_  
Fixes `Issue URL`
> [!WARNING]  
> _If no issue exists, please create an issue first, and check with the
maintainers if the issue is valid._

## Automation

/ok-to-test tags="@tag.AppUrl"

### 🔍 Cypress test results
<!-- This is an auto-generated comment: Cypress test results  -->
> [!TIP]
> 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
> Workflow run:
<https://github.com/appsmithorg/appsmith/actions/runs/13363538162>
> Commit: 0701248
> <a
href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=13363538162&attempt=1"
target="_blank">Cypress dashboard</a>.
> Tags: `@tag.AppUrl`
> Spec:
> <hr>Mon, 17 Feb 2025 05:49:10 UTC
<!-- end of auto-generated comment: Cypress test results  -->


## Communication
Should the DevRel and Marketing teams inform users about this change?
- [ ] Yes
- [x] No


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

## Summary by CodeRabbit

- **Tests**
- Streamlined redirection tests by removing an unnecessary sign out
step.
- Enhanced URL validation with improved logging to ensure correct
encoding.
- Refined the testing process to robustly verify that redirection
parameters are accurately passed.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
  • Loading branch information
sagar-qa007 authored Feb 17, 2025
1 parent 8543816 commit cd519bb
Showing 1 changed file with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,19 @@ describe("Slug URLs", { tags: ["@tag.AppUrl"] }, () => {

it("4. Checks redirect url", () => {
cy.url().then((url) => {
homePage.Signout(true);
const redirectUrl = `${url}?embed=true&a=b`;
cy.stub(agHelper, "VisitNAssert").as("visitStub");

// Call your function that handles redirection
agHelper.VisitNAssert(redirectUrl);
agHelper.AssertURL(`?redirectUrl=${encodeURIComponent(redirectUrl)}`);

// Assert that the stubbed function was called with the correct redirectUrl
cy.get("@visitStub").should("have.been.calledWith", redirectUrl);
cy.wrap(redirectUrl).then((redirectUrl) => {
const encodedRedirectUrl = `?redirectUrl=${encodeURIComponent(redirectUrl)}`;
cy.log(encodedRedirectUrl);
agHelper.AssertURL(encodedRedirectUrl);
});
});
});
});

0 comments on commit cd519bb

Please sign in to comment.