Fix selenium test to change category

This commit is contained in:
Ajay Ramachandran 2021-09-06 23:51:26 -04:00
parent 041ccdaf11
commit bdedf86d63

View file

@ -15,6 +15,7 @@ test("Selenium Chrome test", async () => {
await editSegments(driver, 0, "0:04.000", "0:10.330", "5", "13.211", "0:05.000 to 0:13.211", false);
await autoskipSegment(driver, 5, 13.211);
await setSegmentCategory(driver, 0, 1, false);
await setSegmentActionType(driver, 0, 1, false);
await editSegments(driver, 0, "0:05.000", "0:13.211", "5", "7.5", "0:05.000 to 0:07.500", false);
await muteSkipSegment(driver, 5, 7.5);
@ -109,6 +110,16 @@ async function editSegments(driver: WebDriver, index: number, expectedStartTimeB
await driver.wait(until.elementTextIs(sponsorTimeDisplay, expectedDisplayedTime));
}
async function setSegmentCategory(driver: WebDriver, index: number, categoryIndex: number, openSubmitBox: boolean): Promise<void> {
if (openSubmitBox) {
const submitButton = await driver.findElement(By.id("submitButton"));
await submitButton.click();
}
const categorySelection = await driver.findElement(By.css(`#sponsorTimeCategoriesSubmissionNotice${index} > option:nth-child(${categoryIndex + 1})`));
await categorySelection.click();
}
async function setSegmentActionType(driver: WebDriver, index: number, actionTypeIndex: number, openSubmitBox: boolean): Promise<void> {
if (openSubmitBox) {
const submitButton = await driver.findElement(By.id("submitButton"));
@ -116,7 +127,7 @@ async function setSegmentActionType(driver: WebDriver, index: number, actionType
}
const actionTypeSelection = await driver.findElement(By.css(`#sponsorTimeActionTypesSubmissionNotice${index} > option:nth-child(${actionTypeIndex + 1})`));
actionTypeSelection.click();
await actionTypeSelection.click();
}
async function autoskipSegment(driver: WebDriver, startTime: number, endTime: number): Promise<void> {