From 7ed3ecb9359e3864fe1bf7773db95ad45ed95af7 Mon Sep 17 00:00:00 2001 From: mdgriffith Date: Sat, 23 May 2020 08:46:10 -0400 Subject: [PATCH] fix automatic test runner --- package-lock.json | 50 +++++++---------- package.json | 6 +- tests-rendering/automation/run.js | 12 +++- .../automation/templates/gather-styles.html | 3 + .../{ => Layout}/SafariBugIssue147.elm | 2 +- tests-rendering/elm.json | 2 +- tests-rendering/src/Tests/All.elm | 55 +++++++++++-------- 7 files changed, 67 insertions(+), 63 deletions(-) rename tests-rendering/cases/resolved/{ => Layout}/SafariBugIssue147.elm (94%) diff --git a/package-lock.json b/package-lock.json index 9ba17a0..f7e7c74 100644 --- a/package-lock.json +++ b/package-lock.json @@ -734,9 +734,9 @@ } }, "jszip": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/jszip/-/jszip-3.2.2.tgz", - "integrity": "sha512-NmKajvAFQpbg3taXQXr/ccS2wcucR1AZ+NtyWp2Nq7HHVsXhcJFR8p0Baf32C2yVvBylFWVeKf+WI2AnvlPhpA==", + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/jszip/-/jszip-3.4.0.tgz", + "integrity": "sha512-gZAOYuPl4EhPTXT0GjhI3o+ZAz3su6EhLrKUoAivcKqyqC7laS5JEv4XWZND9BgcDcF83vI85yGbDmDR6UhrIg==", "requires": { "lie": "~3.3.0", "pako": "~1.0.2", @@ -1002,20 +1002,24 @@ "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" }, - "sax": { - "version": "1.2.4", - "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz", - "integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==" - }, "selenium-webdriver": { - "version": "4.0.0-alpha.4", - "resolved": "https://registry.npmjs.org/selenium-webdriver/-/selenium-webdriver-4.0.0-alpha.4.tgz", - "integrity": "sha512-etJt20d8qInkxMAHIm5SEpPBSS+CdxVcybnxzSIB/GlWErb8pIWrArz/VA6VfUW0/6tIcokepXQ5ufvdzqqk1A==", + "version": "4.0.0-alpha.7", + "resolved": "https://registry.npmjs.org/selenium-webdriver/-/selenium-webdriver-4.0.0-alpha.7.tgz", + "integrity": "sha512-D4qnTsyTr91jT8f7MfN+OwY0IlU5+5FmlO5xlgRUV6hDEV8JyYx2NerdTEqDDkNq7RZDYc4VoPALk8l578RBHw==", "requires": { - "jszip": "^3.1.5", - "rimraf": "^2.6.3", - "tmp": "0.0.30", - "xml2js": "^0.4.19" + "jszip": "^3.2.2", + "rimraf": "^2.7.1", + "tmp": "0.0.30" + }, + "dependencies": { + "rimraf": { + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", + "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==", + "requires": { + "glob": "^7.1.3" + } + } } }, "semver": { @@ -1217,22 +1221,6 @@ "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" }, - "xml2js": { - "version": "0.4.19", - "resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.4.19.tgz", - "integrity": "sha512-esZnJZJOiJR9wWKMyuvSE1y6Dq5LCuJanqhxslH2bxM6duahNZ+HMpCLhBQGZkbX6xRf8x1Y2eJlgt2q3qo49Q==", - "requires": { - "sax": ">=0.6.0", - "xmlbuilder": "~9.0.1" - }, - "dependencies": { - "xmlbuilder": { - "version": "9.0.7", - "resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-9.0.7.tgz", - "integrity": "sha1-Ey7mPS7FVlxVfiD0wi35rKaGsQ0=" - } - } - }, "xmlbuilder": { "version": "13.0.2", "resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-13.0.2.tgz", diff --git a/package.json b/package.json index 2551806..8d49738 100644 --- a/package.json +++ b/package.json @@ -7,8 +7,8 @@ "test": "elm-test", "view-test": "node tests-rendering/automation/view.js", "test-render": "node tests-rendering/automation/run.js --chrome", - "test-render-sauce": "source sauce.env; node tests-rendering/automation/run.js --sauce", - "test-render-sauce-automated": "node tests-rendering/automation/run.js --sauce", + "test-render-sauce": "source sauce.env; node tests-rendering/automation/run.js --sauce --headless", + "test-render-sauce-automated": "node tests-rendering/automation/run.js --sauce --headless", "test-doc-preview": "bash tests-rendering/automation/doc-preview.sh", "bench": "node benchmarks/runtime/index.js", "list-issues": "hub issue -f \"%i,%U,%t,'%L'%n\" > issues.csv" @@ -29,6 +29,6 @@ "elm": "^0.19.1-3", "elm-test": "^0.19.1-revision2", "node-elm-compiler": "^5.0.4", - "selenium-webdriver": "^4.0.0-alpha.4" + "selenium-webdriver": "^4.0.0-alpha.7" } } diff --git a/tests-rendering/automation/run.js b/tests-rendering/automation/run.js index 893cbe9..5f01ea2 100644 --- a/tests-rendering/automation/run.js +++ b/tests-rendering/automation/run.js @@ -17,6 +17,7 @@ program .option("--build [value]", "Set build number for sauce labs") .option("--name [value]", "Set run name for sauce labs") .option("--verbose", "Print out all test results") + .option("--headless", "run tests without showing the browser") .parse(process.argv); // 'Windows 10' @@ -126,8 +127,13 @@ function prepare_sauce_driver(env) { } async function prepare_local_driver(env) { - const firefoxOptions = new firefox.Options().headless(); - const chromeOptions = new chrome.Options().headless(); + const firefoxOptions = new firefox.Options(); + const chromeOptions = new chrome.Options(); + + if (program.headless) { + firefoxOptions.headless(); + chromeOptions.headless(); + } let driver = await new Builder() .forBrowser(env.browser) @@ -163,7 +169,7 @@ async function run_test(driver, url) { await compile_and_embed({ template: "./tests-rendering/automation/templates/gather-styles.html", target: "./tmp/test.html", - elm: "src/Tests/Run.elm", + elm: "src/Tests/All.elm", elmOptions: { cwd: "./tests-rendering" }, }); console.log("Done compiling"); diff --git a/tests-rendering/automation/templates/gather-styles.html b/tests-rendering/automation/templates/gather-styles.html index 388f04c..3c30832 100644 --- a/tests-rendering/automation/templates/gather-styles.html +++ b/tests-rendering/automation/templates/gather-styles.html @@ -149,6 +149,9 @@ app.ports.report.subscribe(function (results) { test_results = results; + // NOTE - this is the signal to the automation that it is cool to retrieve results now + // So don't remove this like you did before :D + document.title = "tests finished"; }); app.ports.analyze.subscribe(function (ids) { diff --git a/tests-rendering/cases/resolved/SafariBugIssue147.elm b/tests-rendering/cases/resolved/Layout/SafariBugIssue147.elm similarity index 94% rename from tests-rendering/cases/resolved/SafariBugIssue147.elm rename to tests-rendering/cases/resolved/Layout/SafariBugIssue147.elm index 9f43d0a..9d66a8c 100644 --- a/tests-rendering/cases/resolved/SafariBugIssue147.elm +++ b/tests-rendering/cases/resolved/Layout/SafariBugIssue147.elm @@ -1,4 +1,4 @@ -module SafariBugIssue147 exposing (view) +module Layout.SafariBugIssue147 exposing (view) {-| diff --git a/tests-rendering/elm.json b/tests-rendering/elm.json index f46ea41..f6a7f6c 100644 --- a/tests-rendering/elm.json +++ b/tests-rendering/elm.json @@ -1,6 +1,6 @@ { "type": "application", - "source-directories": ["src", "../src", "cases/open"], + "source-directories": ["src", "../src", "cases/open", "cases/resolved"], "elm-version": "0.19.1", "dependencies": { "direct": { diff --git a/tests-rendering/src/Tests/All.elm b/tests-rendering/src/Tests/All.elm index 0eaaea9..98aaa2d 100644 --- a/tests-rendering/src/Tests/All.elm +++ b/tests-rendering/src/Tests/All.elm @@ -5,8 +5,8 @@ module Tests.All exposing (main) import ClippedElInFixedWidthColumn import ElInFixedHeightColumn import InFrontSize +import Layout.SafariBugIssue147 import NestedParagraphs -import SafariBugIssue147 import StackedScrollingColumnsHeight import Testable.Generator import Testable.Runner @@ -25,31 +25,38 @@ import WeirdCentering main : Testable.Runner.TestableProgram main = (Testable.Runner.program << List.concat) - [ --Testable.Generator.element "Basics" - --[] - -- , Testable.Generator.element "Align " [] - -- Tuple.pair "Basic Element" Tests.Basic.view - -- , Tuple.pair "Nearby" Tests.Nearby.view - -- , Tuple.pair "Element Alignment" Tests.ElementAlignment.view - -- , Tuple.pair "Transparency" Tests.Transparency.view - -- , Tuple.pair "Column Alignment" Tests.ColumnAlignment.view - -- -- This has 12k cases, so it runs slow and sometimes crashes IE - -- , Tuple.pair "Row Alignment" Tests.RowAlignment.view - -- , Tuple.pair "Column Spacing" Tests.ColumnSpacing.view - -- , Tuple.pair "Row Spacing" Tests.RowSpacing.view - -- [ Tuple.pair "Paragraph wrapping" Tests.TextWrapping.view - -- ] - -- , - issues + [ Testable.Generator.element "Basics" + [] + + -- , Testable.Generator.element "Align " + -- [] + -- , [ Tuple.pair + -- "Basic Element" + -- Tests.Basic.view + -- , Tuple.pair "Nearby" Tests.Nearby.view + -- , Tuple.pair "Element Alignment" Tests.ElementAlignment.view + -- , Tuple.pair "Transparency" Tests.Transparency.view + -- , Tuple.pair "Column Alignment" Tests.ColumnAlignment.view + -- -- This has 12k cases, so it runs slow and sometimes crashes IE + -- , Tuple.pair "Row Alignment" Tests.RowAlignment.view + -- , Tuple.pair "Column Spacing" Tests.ColumnSpacing.view + -- , Tuple.pair "Row Spacing" + -- Tests.RowSpacing.view + -- ] + -- , [ Tuple.pair "Paragraph wrapping" Tests.TextWrapping.view + -- ] + -- , issues ] issues = - [ Testable.Runner.rename "Weird Centering" WeirdCentering.view - , Testable.Runner.rename "Stacked scrolling columns height" StackedScrollingColumnsHeight.view - , Testable.Runner.rename "Safari bug issue147" SafariBugIssue147.view - , Testable.Runner.rename "Nested paragraphs" NestedParagraphs.view - , Testable.Runner.rename "In front size" InFrontSize.view - , Testable.Runner.rename "El in fixed height column" ElInFixedHeightColumn.view - , Testable.Runner.rename "Clipped el in fixed width column" ClippedElInFixedWidthColumn.view + [ -- Testable.Runner.rename "Weird Centering" WeirdCentering.view + -- , Testable.Runner.rename "Stacked scrolling columns height" StackedScrollingColumnsHeight.view + -- , + Testable.Runner.rename "Safari bug issue147" Layout.SafariBugIssue147.view + + -- , Testable.Runner.rename "Nested paragraphs" NestedParagraphs.view + -- , Testable.Runner.rename "In front size" InFrontSize.view + -- , Testable.Runner.rename "El in fixed height column" ElInFixedHeightColumn.view + -- , Testable.Runner.rename "Clipped el in fixed width column" ClippedElInFixedWidthColumn.view ]