-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* attributes critical test migrated to playwright * changeset added * TC: SALEOR_35 User should be able to invite staff member with full access permissions * deactivate staff member test * Admin User should be able to activate other user * reset password test * user should be able to change password test * Trigger Build * Trigger Build * removed reset password and change password tests * fix dashboard path * removed should be able to invite staff user * removed duplacated e2-poll.yaml
- Loading branch information
1 parent
b5d5740
commit 698e2cd
Showing
26 changed files
with
488 additions
and
84 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"saleor-dashboard": minor | ||
--- | ||
|
||
Attributes critical test migrated to playwright |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,66 @@ | ||
import { URL_LIST } from "@data/url"; | ||
import { APIRequestContext, expect } from "@playwright/test"; | ||
|
||
const MAILPIT_URI = process.env.CYPRESS_MAILPITURL || "no mailpit url provided"; | ||
const mailpitUrl = "https://" + MAILPIT_URI; | ||
export class MailpitService { | ||
readonly request: APIRequestContext; | ||
|
||
constructor(request: APIRequestContext) { | ||
this.request = request; | ||
} | ||
|
||
async getLastEmails(getEmailsLimit = 100) { | ||
let latestEmails: any; | ||
await expect(async () => { | ||
latestEmails = await this.request.get( | ||
`${mailpitUrl}/api/v1/messages?limit=${getEmailsLimit}`, | ||
); | ||
expect(latestEmails.body()).not.toBeUndefined(); | ||
}).toPass({ | ||
intervals: [3_000, 3_000, 3_000], | ||
timeout: 10_000, | ||
}); | ||
const latestEmailsJson = await latestEmails!.json(); | ||
return latestEmailsJson; | ||
} | ||
|
||
async getEmailDetails(mailId: string) { | ||
const emailDetails = await this.request.get( | ||
`${mailpitUrl}/api/v1/message/${mailId}`, | ||
); | ||
const emailDetailsJson = await emailDetails.json(); | ||
|
||
return emailDetailsJson; | ||
} | ||
|
||
async getEmailsForUser(userEmail: string) { | ||
let userEmails: any[] = []; | ||
await expect(async () => { | ||
const emails = await this.getLastEmails(); | ||
userEmails = emails.messages.filter((mails: { To: any[] }) => | ||
mails.To.map( | ||
(recipientObj: { Address: any }) => `${recipientObj.Address}`, | ||
).includes(userEmail), | ||
); | ||
expect(userEmails.length).toBeGreaterThanOrEqual(1); | ||
}).toPass({ | ||
intervals: [3_000, 3_000, 3_000], | ||
timeout: 10_000, | ||
}); | ||
await expect(userEmails).not.toEqual([]); | ||
|
||
return userEmails; | ||
} | ||
|
||
async generateResetPasswordUrl(userEmail: string) { | ||
const tokenRegex = /token=([A-Za-z0-9]+(-[A-Za-z0-9]+)+)/; | ||
|
||
const userEmails = await this.getEmailsForUser(userEmail); | ||
const emailDetails = await this.getEmailDetails(userEmails[0].ID); | ||
const emailHtmlFormat = tokenRegex.exec(emailDetails.HTML.toString()); | ||
const token = "&" + emailHtmlFormat![0]; | ||
const resetPasswordUrl = URL_LIST.resetPassword + userEmail + token; | ||
return resetPasswordUrl; | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,47 @@ | ||
export const PRODUCTS = { | ||
singleProductType: { | ||
id: "UHJvZHVjdFR5cGU6Njcy", | ||
info: "Single product type", | ||
}, | ||
productToAddVariants: { | ||
id: "UHJvZHVjdDo3Mjk%3D", | ||
info: "Product that does not contain any variant yet", | ||
}, | ||
productWithOneVariant: { | ||
id: "UHJvZHVjdDo3MzM%3D", | ||
info: "Product that contains single variant", | ||
}, | ||
}; | ||
|
||
export const SHIPPING_METHODS = { | ||
shippingMethodWithoutRates: { | ||
id: "U2hpcHBpbmdab25lOjIzNzg%3D", | ||
info: "Shipping method that is used to add rates", | ||
}, | ||
}; | ||
export const USERS = { | ||
userToBeDeactivated: { | ||
id: "VXNlcjoxMzQ3", | ||
email: "user-to-be-deactivated@gmai.com", | ||
info: "Active user used in deactivation user test", | ||
}, | ||
userToBeActivated: { | ||
id: "VXNlcjoxMzQ5", | ||
email: "user-to-be-activated@gmai.com", | ||
info: "Inactive user used in activation user test", | ||
}, | ||
userForPasswordReset: { | ||
email: "user-for-password-reset@gmail.com", | ||
newPassword: "4321test", | ||
info: "User used in reset password test", | ||
name: "e2e", | ||
lastName: "user", | ||
}, | ||
userForPasswordChange: { | ||
email: "change-password-user@gmail.com", | ||
newPassword: "4321test", | ||
info: "User used in change password test", | ||
name: "change password", | ||
lastName: "user", | ||
}, | ||
}; |
This file was deleted.
Oops, something went wrong.
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.