mirror of
https://github.com/CompassConnections/Compass.git
synced 2026-06-02 05:10:44 -04:00
Coderabbit suggestions
This commit is contained in:
@@ -7,6 +7,9 @@ export class ContextManager {
|
||||
constructor(private browser: Browser) {}
|
||||
|
||||
async createContext(name: string): Promise<App> {
|
||||
const existing = this.contexts.get(name)
|
||||
if (existing) await existing.page.context().close()
|
||||
|
||||
const context = await this.browser.newContext()
|
||||
const page = await context.newPage()
|
||||
const app = new App(page)
|
||||
|
||||
@@ -53,7 +53,7 @@ export async function verifyEmail(email: string, password: string) {
|
||||
await sendVerificationEmail(loginInfo.data.idToken)
|
||||
const oobResponse = await axios.get(`${config.FIREBASE_URL.FIREBASE_EMULATOR_API}`)
|
||||
const oobCode = await getOobCode(oobResponse.data.oobCodes, email)
|
||||
console.log(oobCode)
|
||||
if (!oobCode) throw new Error(`No verification OOB code found for email: ${email}`)
|
||||
|
||||
const response = await axios.post(
|
||||
`${config.FIREBASE_URL.BASE}${config.FIREBASE_URL.CONFIRM_EMAIL_VERIFICATION}`,
|
||||
|
||||
@@ -47,11 +47,13 @@ export class MessagesPage {
|
||||
const results = await this.newMessageSearchResults
|
||||
.getByTestId('search-results-username')
|
||||
.all()
|
||||
|
||||
for (let i = 0; i < results.length; i++) {
|
||||
const usernameResults = await results[i].textContent()
|
||||
if (usernameResults?.toLowerCase() === username[i].toLowerCase()) await results[i].click()
|
||||
break
|
||||
const targetUser = username[i].toLowerCase()
|
||||
for (let j = 0; j < results.length; j++) {
|
||||
const usernameResults = (await results[j].textContent())?.toLowerCase()
|
||||
if (usernameResults === targetUser) {
|
||||
await results[j].click()
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,10 +66,12 @@ export class MessagesPage {
|
||||
await this.messageInput.fill(message)
|
||||
await expect(this.messageSubmit).toBeVisible()
|
||||
await this.messageSubmit.click()
|
||||
await this.verifyMessage(message)
|
||||
}
|
||||
|
||||
async findMessageConversation(displayName: string) {
|
||||
await expect(this.messagesTable).toBeVisible()
|
||||
await this.page.waitForTimeout(1000)
|
||||
const doMessagesExist = (await this.messagesRow.count()) > 0
|
||||
if (doMessagesExist) {
|
||||
const messages = await this.messagesRow.getByTestId('messages-username').all()
|
||||
@@ -84,6 +88,7 @@ export class MessagesPage {
|
||||
|
||||
async verifyMessage(messageContent: string) {
|
||||
await expect(this.conversation).toBeVisible()
|
||||
await this.page.waitForTimeout(1000)
|
||||
const messageCount = (await this.conversationMessage.count()) > 0
|
||||
if (messageCount) {
|
||||
const messages = await this.conversationMessage.all()
|
||||
|
||||
@@ -456,6 +456,7 @@ export class PeoplePage {
|
||||
async getProfileInfo() {
|
||||
await expect(this.profileGrid).toBeVisible()
|
||||
const totalResults = await this.profileResults.count()
|
||||
if (totalResults === 0) throw Error('No profiles found')
|
||||
const chosenProfileNumber = Math.floor(Math.random() * totalResults)
|
||||
const chosenProfile = await this.profileResults.nth(chosenProfileNumber)
|
||||
const profileName = await chosenProfile.getByTestId('people-profile-name').textContent()
|
||||
@@ -506,6 +507,7 @@ export class PeoplePage {
|
||||
await expect(this.messageInput).toBeVisible()
|
||||
await this.messageInput.fill(message)
|
||||
await this.page.getByTestId('conversation-message-submit').click()
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,8 +30,9 @@ test.describe('when given valid input', () => {
|
||||
await app.people.setDisplayFilter({cardSize: 'Large'})
|
||||
const filterdProfiles = await app.people.profileCountLocator.textContent()
|
||||
|
||||
if (!totalProfiles || !filterdProfiles) return
|
||||
await expect(parseInt(totalProfiles)).not.toEqual(parseInt(filterdProfiles))
|
||||
await expect(totalProfiles).not.toBeNull()
|
||||
await expect(filterdProfiles).not.toBeNull()
|
||||
await expect(Number(totalProfiles)).not.toEqual(Number(filterdProfiles))
|
||||
|
||||
const results = await app.people.getProfileInfo()
|
||||
if (!results) return
|
||||
@@ -66,7 +67,7 @@ test.describe('when given valid input', () => {
|
||||
await app.home.clickPeopleLink()
|
||||
|
||||
const totalProfiles = await app.people.profileCountLocator.textContent()
|
||||
await app.people.setGenderTypeFilter(['Women', 'female'])
|
||||
await app.people.setGenderTypeFilter(['Woman', 'female'])
|
||||
await app.people.setDisplayFilter({cardSize: 'Large'})
|
||||
if (!totalProfiles) return
|
||||
await app.people.verifyProfileCount(totalProfiles)
|
||||
|
||||
Reference in New Issue
Block a user