gemini icon indicating copy to clipboard operation
gemini copied to clipboard

Split the core out of library

Open SevInf opened this issue 8 years ago • 8 comments

gemini, in its current state performs much more functions beyond its initial purpose "capture screenshot from a webpage and compare it with image on disk". It is now a single monolith that performs a functions of:

  • WebDriver session manager
  • WebDriver client
  • Testing library & test runner
  • Test assertion library (with a single assertion, but a lot of logic to implement it).
  • Config file reader & overriding using complicated rules
  • Plugin system

Due to a monolythic design it is hard now to make a large-scale changes to it (remember when we've changed config format in 0.13?) and its hard to integrate it into other systems (You already have a bunch of selenium tests and just want gemini to take screenshot after them? Sorry, you either use our runner & selenium client or go away).

My proposition is to split it up into two projects:

  1. Lightweight library, which does the following things:

    • Given a CSS selector, returns the image of the area that matches the selector.

    • Compares it with pre-existing image and reports the results.

    • Provides a hook to integrate any test runner and WebDriver client. Integration should implement the following interfaces:

      interface WebDriver {
         Promise<Buffer> takeFullscreenImage();
         Promise<any> executeJS(string code);
      }
      
      interface TestRunner {
        void startSuite(string name);
        void endSuite();
        void startTest(string name);
        void endTest();
      }
      

      And exposes two functions calibrate, take([selectors], [ignoreSelectors]),

    It does not cares about the way you are performing the actions, which test runner are you using and which WD client do you prefer and can be integrated into existing test suites or used as a part of bigger tool, such as gemini. Parts of the gemini that will go here: CaptureSession (without runHook), Image, Coverage, all client scripts and probably, Calibrator. The single focus of this library is to do one thing: capture screenshot from a webpage and compare it with image on disk.

  2. Gemini stays as it is today and integrates the said library. Nothing changes for the end users.

This way we can also separate the team responsibilities. I will focus on a core library and make sure it does its limited scope tasks right and others can work on a broader set of features in gemini itself without me constantly bragging about broadening the feature set.

/сс @arikon @SwinX @j0tunn

SevInf avatar Oct 07 '15 11:10 SevInf

@SevInf Lets make a call on this

arikon avatar Oct 07 '15 19:10 arikon

@SevInf ping ?

SwinX avatar Nov 19 '15 12:11 SwinX

@SevInf Are you still going to do this? Or should we do it ourselves?

arikon avatar Nov 27 '15 06:11 arikon

@SevInf Any progress on this?

arikon avatar Dec 02 '15 08:12 arikon

Sorry, missed a few notifications. We've ditched the plan to use existing tests for visual regression and decided to go with vanilla gemini, so this is not as high priority as it used to be. However, I still think it is a good thing to do and I'm going to look into it during winter holidays

SevInf avatar Dec 02 '15 10:12 SevInf

Pinging this to indicate it would be nice for integrating into existing end-to-end tests (rather than requiring devs to write in one setup for image diffing and another setup for e2e).

Amy-Lynn avatar May 13 '19 14:05 Amy-Lynn

@Amy-Lynn hi. you can use hermione for it

sipayRT avatar May 16 '19 08:05 sipayRT

@sipayRT I might not have been clear (or I might be misunderstanding the purpose of hermione), but I already have a bunch of protractor/jasmine end-to-end tests and I'd like to be able to integrate with those

Amy-Lynn avatar May 21 '19 20:05 Amy-Lynn