Skip to content

Latest commit

 

History

History
53 lines (42 loc) · 2.28 KB

TEST_SUITE.md

File metadata and controls

53 lines (42 loc) · 2.28 KB

Test Suite

A GUIRE test suite exports a config like so:

let testURL = "/home/user/project-x/tests/example/index.html";

module.exports = {
    name: "test-name",
    url: `file://${testURL}`,
    waitForEl: "#capture",
    setupFn: function(done) {
        Array.prototype.slice.call(document.querySelectorAll("div.box")).forEach(function(boxEl) {
            boxEl.style.display = "none";
        });
        done();
    },
    components: [
        {
            name: "component-test-1",
            setupFn: function(done) {
                document.getElementById("box1").style.display = "block";
                done();
            }
        }
    ]
};

The exported configuration object makes up the test suite, which contains component tests.

Test suite options

Option Type Requirement Description
name string Required The name of the suite
url string Required The URL to the test page where the components are displayed
waitForEl string Optional CSS selector to check before starting (must return an element)
setupFn Function Optional Function to setup the page before running tests (special)
components Array Required Array of components to test

Component options

Option Type Requirement Description
name string Required The name of the component test
setupFn Function Optional Function to setup the component before testing (special)

Special functions

Some functions in the config are stringified and executed by Webdriver in the context of the testing page. These functions do not have access to variables defined in the closures around it.

Special functions operate in an asynchronous nature and are passed a done function as their only parameter. The functions are not treated as completed until the done callback is called.