Git Product home page Git Product logo

hermione-gemini-migrator's Introduction

hermione-gemini-migrator

Plugin for hermione for migration gemini tests.

Install

npm i -D hermione-gemini-migrator

Usage

Set options for the plugin in your hermione config:

module.exports = {
    // ...

    plugins: {
        'hermione-gemini-migrator': {
            enabled: false,
            filePathReplacer: filePath =>
                filePath
                    .replace('gemini.js', 'hermione.js')
                    .replace('gemini/test-suites', 'features'),
            browserIdReplacer: browserId => {
                switch(browserId) {
                    case 'ie11':
                        return 'edge-desktop'
                    default:
                        return browserId;
                }
            }
            commandReplacers: {
                url: code => code.replace(/url\((.*?)\);/, (match, p1) => {
                    return `customUrl(${JSON.stringify(qs.parse(url.parse(p1.replace(/\"/g, '')).query))})`;
                })
            },
            afterEach: (hermione) => {
                const {
                    inputSuite,
                    outputTestCollection,
                    inputFilePath,
                    outputFilePath,
                    inputScreenPaths,
                    outputScreenPaths,
                    config,
                    utils
                } = hermione.geminiMigrator;

                // Pring filepathh
                console.log(outputFilePath);

                // Print input test names
                utils.suiteWalker(inputSuite, suite => {
                    if (suite.url && !(suite.children && suite.children.length)) console.log(suite.fullName);
                });

                // Print output test names
                const testDict = {};

                outputTestCollection.eachTest(test => {
                    const fullName = test.fullTitle();

                    if (testDict[fullName]) return;
                    
                    testDict[fullName] = true;
                    console.log(fullName);
                });
            }
        }
    },

    // ...
}

Run hermione with cli option (if enabled: false):

npx hermione --gemini-migrate

Options

Option Default Description
enabled false Option for enable/disable the plugin.
geminiConfig '.gemini.js' Path to Gemini config.
inputPatterns '**/*.gemini.js' Patterns for searching gemini files. Read more: fast-glob
filePathReplacer filePath => filePath.replace(/gemini/g, 'hermione') Function for replacing substring in test filePath.
browserIdReplacer browserId => browserId Function for replacing substring in browserId.
commandReplacers {} Object with functions for replacing default command to custom in hermione tests.
codeFormatter code => code Function for formatting code before writting. For example: prettier
before hermione => {} Async or sync function that is called before writting all test files.
beforeEach hermione => {} Async or sync function that is called before writting each test file.
afterEach hermione => {} Async or sync function that is called after writting each test file.
after hermione => {} Async or sync function that is called after writting all test files.

Licence

MIT

hermione-gemini-migrator's People

Contributors

dependabot[bot] avatar ruslanxdev avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.