Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Check Topsites add
- test_newtab(
- // it should be able to click the topsites edit button to reveal the edit topsites modal and overlay.
- function topsites_edit() {
- //Find the edit topsites button
- const topsitesEditBtn = content.document.querySelector(".edit-topsites-button button");
- topsitesEditBtn.click();
- let found = content.document.querySelector(".edit-topsites");
- ok(found && !found.hidden, "Should find a visible topsites edit menu");
- found = content.document.querySelector(".modal-overlay");
- ok(found && !found.hidden, "Should find a visible overlay");
- //Find the "Add" button
- const topsitesAddBtn = content.document.querySelector(".add");
- topsitesAddBtn.click();
- // Write field title
- let fieldTitle = content.document.querySelector(".field.title input");
- ok(fieldTitle && !fieldTitle.hidden, "Should find field title input");
- fieldTitle.value = "Youtube";
- is(fieldTitle.value, "Youtube", "The field title should match");
- // Write field url
- let fieldURL = content.document.querySelector(".field.url input");
- ok(fieldURL && !fieldURL.hidden, "Should find field url input");
- fieldURL.value = "https://www.youtube.com/";
- is(fieldURL.value, "https://www.youtube.com/", "The field title should match");
- //Click the "Add" button
- const addBtn = content.document.querySelector(".done.add");
- addBtn.click();
- //Check if the URL matches
- let topSite = content.document.querySelector(".top-site-outer:nth-child(1) a");
- is("https://www.youtube.com/", topSite.getAttribute("href"), "URL should match");
- }
- );
Add Comment
Please, Sign In to add comment