Comparing two different URLs (I.e: Prod URL and Pre-prod URL) can be done automatically using Applitools. To do so, you would need to create a test that will run twice with the same baseline parameters (same parameters in eyes.open), but open a different URL in each run.
As a result, the first test run will generate a baseline from the first URL and the second test run will be compared against it. Setting eyes.setSaveDiffs(true) in the first tests is done to ensure that when you run it in the future, the first test will always override the baseline and will ignore previous results.
Please find below a code example that will enable you to save the first URL as baseline and the second URL as a comparison version (a helper class in Java, as well as an example on how to use it, is attached below):
[…]
Eyes eyes = new Eyes();
// This is your api key, make sure you use it in all your tests:
eyes.setApiKey(“API_KEY”);
// Makes sure that the 1st URL is saved as the baseline
eyes.setSaveDiffs(true);
driver = eyes.open(driver, “App Name”, “Test Name”, new RectangleSize(1024, 768));
driver.get(“First URL”);
// Visual validation point #1
eyes.checkWindow(“PageName”);
// End visual testing. Validate visual correctness.
eyes.close(false);
// Consecutive test run with the 2nd URL:
The following command will make sure that the 2nd URL does not override the baseline.
eyes.setSaveDiffs(false);
driver = eyes.open(driver, “App Name”, “Test Name”, new RectangleSize(1024, 768));
driver.get(“Second URL”);
// Visual validation point #1
eyes.checkWindow(“PageName”);
// End visual testing. Validate visual correctness.
eyes.close();