fixes to tag-add-btn,

fixes to tests with rating selection

Signed-off-by: Arthur Lu <learthurgo@gmail.com>
This commit is contained in:
Arthur Lu 2022-11-19 11:42:30 -08:00
parent 1379c22f6f
commit 7035fa46ee
4 changed files with 20 additions and 20 deletions

View File

@ -47,11 +47,11 @@
<fieldset class="rating"> <fieldset class="rating">
<legend> Rating: </legend> <legend> Rating: </legend>
<input type="radio" id="s5" name="rating" value="5"/> <label for="s5"> 5 stars </label> <input type="radio" id="s5" name="rating" value="5"/> <label for="s5" id="s5-select"> 5 stars </label>
<input type="radio" id="s4" name="rating" value="4"/> <label for="s4"> 4 stars </label> <input type="radio" id="s4" name="rating" value="4"/> <label for="s4" id="s4-select"> 4 stars </label>
<input type="radio" id="s3" name="rating" value="3"/> <label for="s3"> 3 stars </label> <input type="radio" id="s3" name="rating" value="3"/> <label for="s3" id="s3-select"> 3 stars </label>
<input type="radio" id="s2" name="rating" value="2"/> <label for="s2"> 2 stars </label> <input type="radio" id="s2" name="rating" value="2"/> <label for="s2" id="s2-select"> 2 stars </label>
<input type="radio" id="s1" name="rating" value="1"/> <label for="s1"> 1 star </label> <input type="radio" id="s1" name="rating" value="1"/> <label for="s1" id="s1-select"> 1 star </label>
</fieldset> </fieldset>
<fieldset> <fieldset>
@ -66,7 +66,7 @@
<div class='tag-container' id="tag-container-form"> <div class='tag-container' id="tag-container-form">
</div> </div>
<button type="button" id="tagAdd">Add Tag</button> <button type="button" id="tag-add-btn">Add Tag</button>
</label> </label>
</fieldset> </fieldset>

View File

@ -49,11 +49,11 @@
<fieldset class="rating"> <fieldset class="rating">
<legend> Rating: </legend> <legend> Rating: </legend>
<input type="radio" id="s5" name="rating" value="5"/> <label for="s5"> 5 stars </label> <input type="radio" id="s5" name="rating" value="5"/> <label for="s5" id="s5-select"> 5 stars </label>
<input type="radio" id="s4" name="rating" value="4"/> <label for="s4"> 4 stars </label> <input type="radio" id="s4" name="rating" value="4"/> <label for="s4" id="s4-select"> 4 stars </label>
<input type="radio" id="s3" name="rating" value="3"/> <label for="s3"> 3 stars </label> <input type="radio" id="s3" name="rating" value="3"/> <label for="s3" id="s3-select"> 3 stars </label>
<input type="radio" id="s2" name="rating" value="2"/> <label for="s2"> 2 stars </label> <input type="radio" id="s2" name="rating" value="2"/> <label for="s2" id="s2-select"> 2 stars </label>
<input type="radio" id="s1" name="rating" value="1"/> <label for="s1"> 1 star </label> <input type="radio" id="s1" name="rating" value="1"/> <label for="s1" id="s1-select"> 1 star </label>
</fieldset> </fieldset>
<fieldset> <fieldset>

View File

@ -46,7 +46,7 @@ function initFormHandler() {
}); });
let tagAddBtn = document.getElementById("tagAdd"); let tagAddBtn = document.getElementById("tag-add-btn");
tagAddBtn.addEventListener("click", ()=> { tagAddBtn.addEventListener("click", ()=> {
let tagField = document.getElementById("tag-form"); let tagField = document.getElementById("tag-form");
if (tagField.value.length > 0) { if (tagField.value.length > 0) {

View File

@ -55,14 +55,14 @@ describe("test App end to end", async () => {
await page.$eval("#tag-form", (el, value) => el.value = `tag ${value}`, i); await page.$eval("#tag-form", (el, value) => el.value = `tag ${value}`, i);
await tag_btn.click(); await tag_btn.click();
} }
// Select a new rating of 1 star // Select a new rating of 1 star
let rating_select = await page.$("#s1"); let rating_select = await page.$("#s1-select");
rating_select.click(); await rating_select.click({delay: 100});
// Click the save button to save updates // Click the save button to save updates
let save_btn = await page.$("#save-btn"); let save_btn = await page.$("#save-btn");
save_btn.click(); await save_btn.click();
await page.waitForNavigation(); await page.waitForNavigation();
}); });
@ -260,7 +260,7 @@ describe("test App end to end", async () => {
// Get all tag elements and click them to delete them // Get all tag elements and click them to delete them
let tag_items = await page.$$(".tag"); let tag_items = await page.$$(".tag");
for(let i = 0; i < tag_items.length; i++){ for(let i = 0; i < tag_items.length; i++){
await tag_items.click(); await tag_items[i].click();
} }
// Get the button needed to add new tags // Get the button needed to add new tags
@ -271,12 +271,12 @@ describe("test App end to end", async () => {
} }
// Select a new rating of 5 stars // Select a new rating of 5 stars
let rating_select = await page.$("#s5"); let rating_select = await page.$("#s5-select");
rating_select.click(); await rating_selects.click();
// Click the save button to save updates // Click the save button to save updates
let save_btn = await page.$("#save-btn"); let save_btn = await page.$("#save-btn");
save_btn.click(); await save_btn.click();
await page.waitForNavigation(); await page.waitForNavigation();
}); });