gemini-testing / gemini

💀💀💀[DEPRECATED] Use hermione
https://github.com/gemini-testing/hermione
MIT License
1.5k stars 149 forks source link

How can I capture screenshot of full page? #924

Closed biorobot777 closed 6 years ago

biorobot777 commented 6 years ago

Output of gemini --version: 5.7.2

...

Contents of .gemini.js file:

module.exports = {
  rootUrl: "http://yandex.ru",
  gridUrl: "http://127.0.0.1:4444/wd/hub",
  windowSize: "320x640",
  screenshotsDir: "./gemini-reports/screens",

  browsers: {
    chrome: {
      screenshotMode: "fullpage",
      compositeImage: true,

      desiredCapabilities: {
        browserName: "chrome",
        version: "68",
        chromeOptions: {
          args: [ 'headless' ],
        },
      }
    }
  },

  system: {
    plugins: {
      "html-reporter/gemini": {
        enabled: true,
        path: "gemini-reports",
        defaultView: "all"
      }
    }
  }
};

Command used to run the test:

selenium-standalone start
gemini update

Expected behaviour: Screenshot of full page ...

Actual result:

screenshot: https://yadi.sk/i/SWflUsoz3Ywqwu

DudaGod commented 6 years ago

Hello.

Quick solution - remove screenshotMode: "fullpage". Gemini will determine which mode should use and take screenshot correctly. I will take a look later why it does not work with "fullpage" mode.

biorobot777 commented 6 years ago

@DudaGod , thank U for prompt reply, but this solution doesn't work for me.

DudaGod commented 6 years ago

Try to use my config:

module.exports = {
    rootUrl: 'https://github.com',
    gridUrl: 'http://127.0.0.1:4444/wd/hub',
    compositeImage: true,
    sessionsPerBrowser: 1,
    calibrate: false,

    browsers: {
        'chrome-desktop': {
            desiredCapabilities: {
                browserName: 'chrome'
            }
        }
    },

    sets: {
        desktop: {
            files: [
                './your-gemini-tests/**/*.gemini.js'
            ],
            browsers: ['chrome-desktop']
        }
    },

    system: {
        plugins: {
            'html-reporter/gemini': {
                enabled: true,
                path: 'gemini-report',
                defaultView: 'all'
            }
        }
    }
};

And my test:

gemini.suite('github', (suite) => {
  suite
    .setUrl('/')
    .setCaptureElements('body')
    .capture('plain');

Did you know that you can use hermione for regression testing too? Look at my example.

Hermione config:

module.exports = {
    baseUrl: 'http://github.com',
    gridUrl: 'http://127.0.0.1:4444/wd/hub',
    sessionsPerBrowser: 1,
    calibrate: false,

    sets: {
        desktop: {
            files: [
                './your-hermione-tests/**/*.hermione.js'
            ],
            browsers: [
                'chrome-desktop',
            ]
        }
    },

    browsers: {
        'chrome-desktop': {
            desiredCapabilities: {
                browserName: 'chrome'
            },
            compositeImage: true
        }
    },

    plugins: {
        'html-reporter/hermione': {
            enabled: true,
            path: 'hermione-report',
            defaultView: 'all'
        }
    }
};

hermione test:

describe('github', function() {
  it('test-name', function() {
    return this.browser
      .url('/')
      .assertView('plain', 'body')
  });
});
biorobot777 commented 6 years ago

Thanks, it works.