Closed Bug 491952 Opened 16 years ago Closed 15 years ago

Mozmill test for verifying Set Home Page to Current Page

Categories

(Mozilla QA Graveyard :: Mozmill Tests, defect)

defect
Not set
normal

Tracking

(Not tracked)

VERIFIED FIXED

People

(Reporter: aakashd, Assigned: aakashd)

References

Details

(Whiteboard: [mozmill-smoketest][mozmill-prefs])

Attachments

(1 file, 5 obsolete files)

The following test sets the profile's homepage to the Gmail login page and then verifies the home page is set using the home button located on the navbar. This test case won't work on Windows until the Bug listed in the "Depends On" section is fixed. It references litmus testcases: * Testcase ID #5921 - Set Home Page to current page * Testcase ID #5989 - Home button
Attachment #376321 - Flags: review?(hskupin)
Attachment #376321 - Flags: review?(hskupin) → review-
Comment on attachment 376321 [details] [diff] [review] AakashDesai_Options_testSetHomePage.js That looks good for the first iteration. >var setupModule = function(module) { > controller = mozmill.getBrowserController(); > prefController = mozmill.getPreferencesController(); >} Please add the module as prefix for the assignment. That's the one we rely on in our tests and get as parameter by this function. > // Go to the Google Mail website > controller.open('http://www.gmail.com/'); That's not a good option because you will be redirected here too. Please use http://www.mozilla.org. After that you can compare the urlbar value and don't have to rely on any element in the page. > // Select the Main Pane in the Preferences Dialog > prefController.click(new elementslib.Lookup(prefController.window.document, '/id("BrowserPreferences")/anon({"orient":"vertical"})/anon({"anonid":"selector"})/{"pane":"paneMain"}')); > new elementslib.Lookup(controller.window.document, '/id("BrowserPreferences")/anon({"orient":"vertical"})/anon({"anonid":"selector"})/{"pane":"paneMain"}') You have pasted the elementslib line twice in this test. For those long lines it would be nice to create a new variable first and use it in the click function. Before leaving the preferences dialog you can safe the new homepage in a variable like that way: > var element = new elementslib.ID(prefController.window.document, "browserHomePage"); > var homepage = element.getNode().value; It can be used for the comparison later. > // Set Home Page to the Current page(s) and Exit out of Options Dialog using Esc key nit: current page and use small letters. > prefController.sleep(1000); Make it a global const (gDelay) and place it in-front of setupModule. For the final test it should be 0. > prefController.keypress(new elementslib.Lookup(prefController.window.document, '/id("BrowserPreferences")/anon({"orient":"vertical"})/anon({"anonid":"selector"})'),27,false,false,false,false); Can you execute the esc keyevent directly on the window? > // Go to another page before going to the home page > controller.open('http://www.yahoo.com/'); > controller.waitForPageLoad(controller.tabs.activeTab); > controller.waitForElement(new elementslib.ID(controller.tabs.activeTab, "ylogo")); Don't wait for the element. That's not necessary. > controller.waitForPageLoad(controller.tabs.activeTab); > controller.waitForElement(new elementslib.ID(controller.tabs.activeTab, "Email"));; Just compare the value of the urlbar with the save home page url.
Added changes to the new testscript in-line with your review. The only thing I didn't change is the Esc keypress. I dont know what you meant by changing it via the window.
Attachment #376321 - Attachment is obsolete: true
Attachment #376790 - Flags: review?(hskupin)
Comment on attachment 376790 [details] [diff] [review] AakashDesai_Options_testSetHomePage.js >const gDelay = 750; For patches this should be set to 0. >/** > * Testcase ID #5921 - Set Home Page to current page > * Testcase ID #5989 - Home button > */ Can you probably split this test into two test functions inside this module? >var testSetHomePage = function() { > controller.assertNode(new elementslib.Link(controller.tabs.activeTab, "Mozilla")); > controller.assertNode(new elementslib.Link(controller.tabs.activeTab, "About")); > controller.assertNode(new elementslib.Link(controller.tabs.activeTab, "Foundation")); > controller.assertNode(new elementslib.Link(controller.tabs.activeTab, "Contribute")); > controller.assertNode(new elementslib.Link(controller.tabs.activeTab, "Community")); > controller.assertNode(new elementslib.Link(controller.tabs.activeTab, "Developers")); > controller.assertNode(new elementslib.Link(controller.tabs.activeTab, "Projects")); Please only use one check here. It's not necessary to check all of those menu entries. > //Verify urlbar with the saved homepage > controller.assertValue(new elementslib.Lookup(controller.window.document, '/id("main-window")/id("navigator-toolbox")/id("nav-bar")/id("urlbar-container")/id("urlbar")/anon({"class":"autocomplete-textbox-container"})/anon({"anonid":"textbox-input-box"})/anon({"anonid":"input"})'), homepage); >} Please use "new elementslib.ID(this.window.document, 'urlbar')" here. Two more important things: * Make sure you close all tabs before you start the test. There is a helper function in the utilsAPI. * Clean-up everything you have changed after the tests have been finished. Use the teardown function. In this case please reset the homepage to the default page. You can read the browser.startup.homepage pref directly in-front of your test and set it back afterward.
Attachment #376790 - Flags: review?(hskupin) → review-
Attached file testSetHomePage.js (obsolete) —
Update includes all comments needed, closeAllTabs() from the utilsAPI and a change in the name that is in-line with the current test framework
Attachment #376790 - Attachment is obsolete: true
Attachment #378400 - Flags: review?
Attachment #378400 - Flags: review? → review?(hskupin)
Comment on attachment 378400 [details] testSetHomePage.js I'll not recognize reviews when you don't explicitely add my name. Putting on my list...
Comment on attachment 378400 [details] testSetHomePage.js We have to wait for the preference dialog api.
Attachment #378400 - Flags: review?(hskupin)
The preferences dialog API has been implemented. See bug 486407 for an example how to implement it.
Attached patch testSetHomePage.js (obsolete) — Splinter Review
This is working when running this via the graphical UI, but is failing via command line. The issue is that "controller.open(homepage);" is not opening when run via command line, but works just fine via the graphical UI. Otherwise, it's finished. See if it works for you :).
Attachment #378400 - Attachment is obsolete: true
Attachment #383808 - Flags: review?(hskupin)
Assignee: nobody → adesai
Status: NEW → ASSIGNED
Comment on attachment 383808 [details] [diff] [review] testSetHomePage.js >const homepage = ''; This is a left over and can be removed. > // Go to the Mozilla.org website and verify the correct page has loaded > var homepage = 'http://www.mozilla.org/'; Can you move the declaration to the beginning of the function? That makes it easier to spot the assignment and eventually later corrections. > //Verify urlbar with the saved homepage > var addressBar = new elementslib.Lookup(controller.window.document, '/id("main-window")/id("navigator-toolbox")/id("nav-bar")/id("urlbar-container")/id("urlbar")/anon({"class":"autocomplete-textbox-container"})/anon({"anonid":"textbox-input-box"})/anon({"anonid":"input"})'); > if (addressBar.getNode().value != homepage) { > throw "Error: URL in address bar does not match expected " + homepage; > } You can remove the manual comparator. Since assertValue has been fixed a while back you can use this function now. Can you also please rename addressBar to locationBar. Would be nice to be consistent between all the tests. >var prefDialogHomePageCallback = function(controller) { > > // Select the Main Pane in the Preferences Dialog > controller.click(new elementslib.Lookup(controller.window.document, '/id("BrowserPreferences")/anon({"orient":"vertical"})/anon({"anonid":"selector"})/{"pane":"paneMain"}')); Before you click onto the main pane button you should use delayedAssertNode. For me the test fails each time iin this line without it. And finally I still miss the teardown function. You have to reset the homepage to the default value. Therefor you can use the PrefsAPI and simply call "PrefsAPI.preferences.branch.clearUserPref("browser.startup.homepage");" Otherwise it will be ready for checkin.
Attachment #383808 - Flags: review?(hskupin) → review-
Attached patch testSetHomePage.js (obsolete) — Splinter Review
This should be the final review.
Attachment #383808 - Attachment is obsolete: true
Attachment #384642 - Flags: review?(hskupin)
Never mind, this is the last patch. I removed the manual check at the end and replaced it with assertValue.
Attachment #384642 - Attachment is obsolete: true
Attachment #384649 - Flags: review?(hskupin)
Attachment #384642 - Flags: review?(hskupin)
I had to make some changes because the test wasn't working on Windows. Pressing ESC will discard the changes and that's why the default home page was still loaded. Aakash, can you please update your tests to use this way? Thanks. Checked in as http://hg.mozilla.org/qa/mozmill-tests/rev/e60b6dec8314
Status: ASSIGNED → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
Attachment #384649 - Flags: review?(hskupin) → review-
Mass move of Mozmill Test related project bugs to newly created components. You can filter out those emails by using "Mozmill-Tests-to-MozillaQA" as criteria.
Component: Preferences → Mozmill Tests
Product: Firefox → Mozilla QA
QA Contact: preferences → mozmill-tests
Status: RESOLVED → VERIFIED
Summary: [mozmill] - Set Home Page to current page → Mozmill test for verifying Set Home Page to Current Page
Whiteboard: [mozmill-smoketest][mozmill-prefs]
Product: Mozilla QA → Mozilla QA Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: