Member alalytics basic tc
unknown
plain_text
a year ago
4.8 kB
8
Indexable
MembershipData.multiDomain.forEach((data: any) => {
test.describe(`Location: ${data.location[0]}`, () => {
test.beforeAll(async () => {
currLocId = data.location[0]
await commonPage.navigateToLocationDashboardURL(currLocId)
})
test.beforeEach(async () => {
contactData = await contactAPI.createNewContact(
fakers.firstName(),
fakers.lastName(),
fakers.email(),
fakers.phone(),
undefined,
undefined,
currLocId,
)
product = await membershipAPI.createProduct(
currLocId,
MembershipData.productName,
)
offer = await membershipAPI.createOffer(
MembershipData.offerName,
product.productId,
currLocId,
)
await membershipAPI.publishDraftOffer(currLocId, offer.offerId)
await membershipAPI.tagOffertoContact(contactData.id, offer.offerId)
category = await membershipAPI.createCategory(
product.productId,
MembershipData.categoryName,
currLocId,
`published`,
)
lesson = await membershipAPI.createLessons(
product.productId,
category.categoryId,
currLocId,
MembershipData.lessonNames,
`published`,
)
await membershipAPI.getPreviewUserIdAndSetPassword(
contactData.email,
currLocId,
data.location[1],
)
})
test(`@Products @REVEX_ProdSanity @REVEX_Membership_Prod @REVEX_CP_ChildApps Login into ${data.location[2]} preview side and check user datails and login count is increased or not`, async () => {
const loginCnt = 3
for (let i = 1; i <= loginCnt; i++) {
console.log(`iteration ${i} : `)
const response = await membershipAPI.loginIntoPreviewWithEmail(
contactData.email,
MembershipData.AgencyPassword,
data.location[2],
data.location[1],
data.location[0],
)
expect([200, 201], {
message: `Logged into account successfully`,
}).toContain(response.code)
}
await ms.navigateToMemberships()
await ms.navigateToAnalytics()
const name = contactData.firstName + ' ' + contactData.lastName
await ms.validateLoginCountAfterLogin(contactData.email, loginCnt, name)
})
test(`@Products @REVEX_ProdSanity @REVEX_Membership_Prod @REVEX_CP_ChildApps Login into ${data.location[2]} preview side and verify user name and email`, async () => {
console.log('-------contactData : ', contactData)
await ms.navigateToMemberships()
await ms.navigateToAnalytics()
const name = contactData.firstName + ' ' + contactData.lastName
})
test.afterEach(async () => {
await contactAPI.deleteContactDetails(contactData.id)
await membershipAPI.deleteOffer(offer.offerId, currLocId)
await membershipAPI.deleteProduct(product.productId, currLocId)
})
})
})
async validateLoginCountAfterLogin(
email: string,
count: number,
name: string,
) {
await this.analyticsUserSearch(email)
const verifyNmae = await uiActions.isVisible(
membershipObjects.memberAnalyticsList.replace('REPLACE', name),
20000,
)
expect(verifyNmae, 'Verify the user name on analytics page').toBeTruthy()
const verifyEmail = await uiActions.isVisible(
membershipObjects.memberAnalyticsList.replace('REPLACE', email),
20000,
)
expect(verifyEmail, 'Verify the user email on analytics page').toBeTruthy()
const loginCount = await uiActions.getText(
membershipObjects.loginCount.replace('REPLACE', email),
20000,
)
const lastAccess = await uiActions.getText(
membershipObjects.userLastAccessedTime.replace('REPLACE', email),
20000,
)
const memberSince = await uiActions.getText(
membershipObjects.userMemberSince.replace('REPLACE', email),
20000,
)
const timeData = await this.getDateBasedOnLocation()
const memberSinceDate = `${timeData.details.day} ${timeData.details.month} ${timeData.details.year}`
const currentDate = `${timeData.details.month} ${timeData.details.day}, ${timeData.details.year} ${timeData.details.hours}`
console.log('current date: ' + currentDate)
expect(memberSince, 'date should contain member since date').toContain(
memberSinceDate,
)
expect(Number(loginCount)).toEqual(count)
expect(lastAccess, 'date should contain current date').toContain(
currentDate,
)
}
userMemberSince: `//div[text()='REPLACE']//ancestor::tr//td[@data-col-key='memberSince']`,Editor is loading...
Leave a Comment