Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding clarification to error messages #46

Merged
merged 1 commit into from
Oct 7, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions upload.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ async function changeLoginPageLangIfNeeded(localPage) {
try {
await localPage.waitForSelector(selectedLangSelector)
} catch(e) {
throw new Error('Failed to find selected lang : ' + e.name)
throw new Error('Failed to find selected language : ' + e.name)
}


Expand All @@ -147,7 +147,7 @@ async function changeLoginPageLangIfNeeded(localPage) {
)

if (! selectedLang) {
throw new Error('Failed to find selected lang : Empty text')
throw new Error('Failed to find selected language : Empty text')
}

if (selectedLang.includes('English')) {
Expand All @@ -163,7 +163,7 @@ async function changeLoginPageLangIfNeeded(localPage) {
try {
await localPage.waitForSelector(englishLangItemSelector)
} catch(e) {
throw new Error('Failed to find english lang item : ' + e.name)
throw new Error('Failed to find english language item : ' + e.name)
}

await localPage.click(englishLangItemSelector)
Expand All @@ -184,7 +184,7 @@ async function changeHomePageLangIfNeeded(localPage) {
try {
await localPage.waitForSelector(avatarButtonSelector)
} catch (e) {
throw new Error('Avatar button not found : ' + e.name)
throw new Error('Avatar/Profile picture button not found : ' + e.name)
}

await localPage.click(avatarButtonSelector)
Expand All @@ -193,7 +193,7 @@ async function changeHomePageLangIfNeeded(localPage) {
try {
await localPage.waitForSelector(langMenuItemSelector)
} catch (e) {
throw new Error('Lang menu item selector not found : ' + e.name)
throw new Error('Language menu item selector/button(">") not found : ' + e.name)
}

/** @type {?string} */
Expand All @@ -203,7 +203,7 @@ async function changeHomePageLangIfNeeded(localPage) {
)

if (! selectedLang) {
throw new Error('Failed to find selected lang : Empty text')
throw new Error('Failed to find selected language : Empty text')
}

if (selectedLang.includes('English')) {
Expand All @@ -219,7 +219,7 @@ async function changeHomePageLangIfNeeded(localPage) {
try {
await localPage.waitForXPath(englishItemXPath)
} catch (e) {
throw new Error('English item selector not found : ' + e.name)
throw new Error('English(UK) item selector not found : ' + e.name)
}

await localPage.waitForTimeout(3000)
Expand Down Expand Up @@ -336,7 +336,7 @@ async function uploadVideo (videoJSON) {
break
} catch (error) {
const nextText = i === 0 ? ' trying again' : ' failed again'
console.log('failed to find the select files button for chapter ', chapter, nextText)
console.log('Failed to find the select files button for chapter ', chapter, nextText)
console.error(error)
await page.evaluate(() => { window.onbeforeunload = null })
await page.goto(uploadURL)
Expand All @@ -353,7 +353,7 @@ async function uploadVideo (videoJSON) {
])
await fileChooser.accept([pathToFile])
// Wait for upload to complete
await page.waitForXPath('//*[contains(text(),"Upload complete")]', { timeout: 0 })
await page.waitForXPath('//*[contains(text(),"Upload complete")]', { hidden: true, timeout: 0 })
// Wait for upload to go away and processing to start
await page.waitForXPath('//*[contains(text(),"Upload complete")]', { hidden: true, timeout: 0 })
// Wait until title & description box pops up
Expand Down