-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into releases/august
- Loading branch information
Showing
286 changed files
with
2,289 additions
and
677 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,13 +2,11 @@ | |
/// <reference types="../../cypress/support" /> | ||
|
||
describe("auth-antd", () => { | ||
const BASE_URL = "http://localhost:5173"; | ||
|
||
beforeEach(() => { | ||
cy.clearAllCookies(); | ||
cy.clearAllLocalStorage(); | ||
cy.clearAllSessionStorage(); | ||
cy.visit(BASE_URL); | ||
cy.visit("/"); | ||
}); | ||
|
||
const submitAuthForm = () => { | ||
|
@@ -32,7 +30,7 @@ describe("auth-antd", () => { | |
|
||
cy.location("pathname").should("eq", "/"); | ||
cy.getAllLocalStorage().then((ls) => { | ||
expect(ls[BASE_URL]).to.have.property("email"); | ||
expect(ls[Cypress.config("baseUrl")!]).to.have.property("email"); | ||
}); | ||
}); | ||
|
||
|
@@ -48,7 +46,7 @@ describe("auth-antd", () => { | |
login(); | ||
cy.location("pathname").should("eq", "/"); | ||
|
||
cy.visit(`${BASE_URL}/test`); | ||
cy.visit("/test"); | ||
cy.location("pathname").should("eq", "/test"); | ||
cy.clearAllLocalStorage(); | ||
cy.reload(); | ||
|
@@ -60,7 +58,7 @@ describe("auth-antd", () => { | |
}); | ||
|
||
it("should redirect to /login?to= if user not authenticated", () => { | ||
cy.visit(`${BASE_URL}/test-route`); | ||
cy.visit("/test-route"); | ||
cy.get(".ant-card-head-title > .ant-typography").contains( | ||
/sign in to your account/i, | ||
); | ||
|
@@ -78,7 +76,7 @@ describe("auth-antd", () => { | |
login(); | ||
cy.location("pathname").should("eq", "/"); | ||
cy.getAllLocalStorage().then((ls) => { | ||
expect(ls[BASE_URL]).to.have.property("email"); | ||
expect(ls[Cypress.config("baseUrl")!]).to.have.property("email"); | ||
}); | ||
}); | ||
|
||
|
@@ -97,7 +95,7 @@ describe("auth-antd", () => { | |
|
||
describe("forgot password", () => { | ||
it("should throw error if forgot password email is wrong", () => { | ||
cy.visit(`${BASE_URL}/forgot-password`); | ||
cy.visit("/forgot-password"); | ||
cy.get("#email").clear().type("[email protected]"); | ||
submitAuthForm(); | ||
cy.getAntdNotification().contains(/invalid email/i); | ||
|
@@ -107,7 +105,7 @@ describe("auth-antd", () => { | |
|
||
describe("update password", () => { | ||
it("should throw error if update password is wrong", () => { | ||
cy.visit(`${BASE_URL}/update-password`); | ||
cy.visit("/update-password"); | ||
cy.get("#password").clear().type("123456"); | ||
cy.get("#confirmPassword").clear().type("123456"); | ||
submitAuthForm(); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,8 +2,6 @@ | |
/// <reference types="../../cypress/support" /> | ||
|
||
describe("auth-chakra-ui", () => { | ||
const BASE_URL = "http://localhost:5173"; | ||
|
||
const submitAuthForm = () => { | ||
return cy.get("button[type=submit]").click(); | ||
}; | ||
|
@@ -22,15 +20,15 @@ describe("auth-chakra-ui", () => { | |
cy.clearAllCookies(); | ||
cy.clearAllLocalStorage(); | ||
cy.clearAllSessionStorage(); | ||
cy.visit(BASE_URL); | ||
cy.visit("/"); | ||
}); | ||
|
||
describe("login", () => { | ||
it("should login", () => { | ||
login(); | ||
cy.location("pathname").should("eq", "/posts"); | ||
cy.getAllLocalStorage().then((ls) => { | ||
expect(ls[BASE_URL]).to.have.property("email"); | ||
expect(ls[Cypress.config("baseUrl")!]).to.have.property("email"); | ||
}); | ||
}); | ||
|
||
|
@@ -46,7 +44,7 @@ describe("auth-chakra-ui", () => { | |
login(); | ||
cy.location("pathname").should("eq", "/posts"); | ||
|
||
cy.visit(`${BASE_URL}/test`); | ||
cy.visit("/test"); | ||
cy.location("pathname").should("eq", "/test"); | ||
cy.clearAllLocalStorage(); | ||
cy.reload(); | ||
|
@@ -58,7 +56,7 @@ describe("auth-chakra-ui", () => { | |
}); | ||
|
||
it("should redirect to /login?to= if user not authenticated", () => { | ||
cy.visit(`${BASE_URL}/test-route`); | ||
cy.visit("/test-route"); | ||
cy.get(".chakra-heading").contains(/sign in to your account/i); | ||
cy.location("search").should("contains", "to=%2Ftest"); | ||
cy.location("pathname").should("eq", "/login"); | ||
|
@@ -74,7 +72,7 @@ describe("auth-chakra-ui", () => { | |
login(); | ||
cy.location("pathname").should("eq", "/posts"); | ||
cy.getAllLocalStorage().then((ls) => { | ||
expect(ls[BASE_URL]).to.have.property("email"); | ||
expect(ls[Cypress.config("baseUrl")!]).to.have.property("email"); | ||
}); | ||
}); | ||
|
||
|
@@ -93,7 +91,7 @@ describe("auth-chakra-ui", () => { | |
|
||
describe("forgot password", () => { | ||
it("should throw error if forgot password email is wrong", () => { | ||
cy.visit(`${BASE_URL}/forgot-password`); | ||
cy.visit("/forgot-password"); | ||
cy.get("#email").clear().type("[email protected]"); | ||
submitAuthForm(); | ||
cy.getChakraUINotification().contains(/invalid email/i); | ||
|
@@ -103,7 +101,7 @@ describe("auth-chakra-ui", () => { | |
|
||
describe("update password", () => { | ||
it("should throw error if update password is wrong", () => { | ||
cy.visit(`${BASE_URL}/update-password`); | ||
cy.visit("/update-password"); | ||
cy.get("#password").clear().type("123456"); | ||
cy.get("#confirmPassword").clear().type("123456"); | ||
submitAuthForm(); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.