diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index 83ca2a57..72a12044 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -4,59 +4,53 @@ name: Unit Tests on: pull_request jobs: - unit-tests-p2: - name: Polymer 2 on the CI agent - runs-on: ubuntu-latest - steps: - - name: Set up Node 12.x - uses: actions/setup-node@v2 - with: - node-version: 12.x - - - name: Check out the source code - uses: actions/checkout@v2 - - - name: Install latest npm - # magi-cli 1.0 requires npm 7 or higher - run: "npm install -g npm@8" - - - name: Install global npm dependencies - # bower is needed to run 'bower install' - # polymer-cli is needed to run the lint step - run: "npm install --quiet --no-progress --global bower polymer-cli" - - - name: Install project npm dependencies - run: "npm ci" - - - name: Install project Bower dependencies - run: "bower install --quiet" - - - name: Run automated magi-cli checks - run: "npm run check" - - - name: Run a linter - run: "npm run lint" - - # the full set of environments is tested with Polymer 3 below - - name: Run unit tests locally (in the VM instance running this job) - run: "xvfb-run -s '-screen 0 1024x768x24' npm test" +# Running local tests is disabled due to outdated dependencies +# see https://github.com/vaadin/components-team-tasks/issues/628 +# unit-tests-p2: +# name: Polymer 2 on the CI agent +# runs-on: ubuntu-latest +# steps: +# - name: Set up Node 16.x +# uses: actions/setup-node@v4 +# with: +# node-version: 16.x +# +# - name: Check out the source code +# uses: actions/checkout@v2 +# +# - name: Install global npm dependencies +# # bower is needed to run 'bower install' +# # polymer-cli is needed to run the lint step +# run: "npm install --quiet --no-progress --global bower polymer-cli" +# +# - name: Install project npm dependencies +# run: "npm ci" +# +# - name: Install project Bower dependencies +# run: "bower install --quiet" +# +# - name: Run automated magi-cli checks +# run: "npm run check" +# +# - name: Run a linter +# run: "npm run lint" +# +# # the full set of environments is tested with Polymer 3 below +# - name: Run unit tests locally (in the VM instance running this job) +# run: "xvfb-run -s '-screen 0 1024x768x24' npm test" unit-tests-p3: name: Polymer 3 on SauceLabs runs-on: ubuntu-latest steps: - - name: Set up Node 12.x - uses: actions/setup-node@v2 + - name: Set up Node 16.x + uses: actions/setup-node@v4 with: - node-version: 12.x + node-version: 16.x - name: Check out the (Polymer 2) source code uses: actions/checkout@v2 - - name: Install latest npm - # magi-cli 1.0 requires npm 7 or higher - run: "npm install -g npm@8" - - name: Install global npm dependencies # bower and polymer-modulizer are needed to run the Polymer 3 conversion step run: "npm install --quiet --no-progress --global bower magi-cli polymer-modulizer" diff --git a/.github/workflows/visual-tests.yml b/.github/workflows/visual-tests.yml.disabled similarity index 100% rename from .github/workflows/visual-tests.yml rename to .github/workflows/visual-tests.yml.disabled diff --git a/README.md b/README.md index c16e006e..80ea88dd 100644 --- a/README.md +++ b/README.md @@ -146,6 +146,9 @@ To use the Material theme, import the correspondent file from the `theme/materia ## Running tests from the command line +> [!WARNING] +> Running tests locally from the CLI does not work due to outdated dependencies. Run tests via SauceLabs or in the browser instead. + 1. When in the `vaadin-text-field` directory, run `polymer test` diff --git a/package-lock-p3.json b/package-lock-p3.json index 16313c9a..9e963dfe 100644 --- a/package-lock-p3.json +++ b/package-lock-p3.json @@ -10023,8 +10023,7 @@ }, "node_modules/sauce-connect-launcher": { "version": "1.3.2", - "resolved": "https://registry.npmjs.org/sauce-connect-launcher/-/sauce-connect-launcher-1.3.2.tgz", - "integrity": "sha512-wf0coUlidJ7rmeClgVVBh6Kw55/yalZCY/Un5RgjSnTXRAeGqagnTsTYpZaqC4dCtrY4myuYpOAZXCdbO7lHfQ==", + "resolved": "git+ssh://git@github.com/vaadin/sauce-connect-launcher.git#20fca782221404fef626c985e975268bfaba05cd", "dev": true, "hasInstallScript": true, "optional": true, @@ -21556,10 +21555,9 @@ "dev": true }, "sauce-connect-launcher": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/sauce-connect-launcher/-/sauce-connect-launcher-1.3.2.tgz", - "integrity": "sha512-wf0coUlidJ7rmeClgVVBh6Kw55/yalZCY/Un5RgjSnTXRAeGqagnTsTYpZaqC4dCtrY4myuYpOAZXCdbO7lHfQ==", + "version": "git+ssh://git@github.com/vaadin/sauce-connect-launcher.git#20fca782221404fef626c985e975268bfaba05cd", "dev": true, + "from": "sauce-connect-launcher@vaadin/sauce-connect-launcher#upgrade-sauce-connect-5", "optional": true, "requires": { "adm-zip": "~0.4.3", @@ -23665,7 +23663,7 @@ "cleankill": "^2.0.0", "lodash": "^4.17.10", "request": "^2.85.0", - "sauce-connect-launcher": "^1.0.0", + "sauce-connect-launcher": "vaadin/sauce-connect-launcher#upgrade-sauce-connect-5", "temp": "^0.8.1", "uuid": "^3.2.1" }, diff --git a/package-lock.json b/package-lock.json index 13bac08e..d533f126 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12115,8 +12115,7 @@ }, "node_modules/sauce-connect-launcher": { "version": "1.3.2", - "resolved": "https://registry.npmjs.org/sauce-connect-launcher/-/sauce-connect-launcher-1.3.2.tgz", - "integrity": "sha512-wf0coUlidJ7rmeClgVVBh6Kw55/yalZCY/Un5RgjSnTXRAeGqagnTsTYpZaqC4dCtrY4myuYpOAZXCdbO7lHfQ==", + "resolved": "git+ssh://git@github.com/vaadin/sauce-connect-launcher.git#20fca782221404fef626c985e975268bfaba05cd", "dev": true, "hasInstallScript": true, "optional": true, @@ -27255,10 +27254,9 @@ "dev": true }, "sauce-connect-launcher": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/sauce-connect-launcher/-/sauce-connect-launcher-1.3.2.tgz", - "integrity": "sha512-wf0coUlidJ7rmeClgVVBh6Kw55/yalZCY/Un5RgjSnTXRAeGqagnTsTYpZaqC4dCtrY4myuYpOAZXCdbO7lHfQ==", + "version": "git+ssh://git@github.com/vaadin/sauce-connect-launcher.git#20fca782221404fef626c985e975268bfaba05cd", "dev": true, + "from": "sauce-connect-launcher@vaadin/sauce-connect-launcher#upgrade-sauce-connect-5", "optional": true, "requires": { "adm-zip": "~0.4.3", @@ -30703,7 +30701,7 @@ "cleankill": "^2.0.0", "lodash": "^4.17.10", "request": "^2.85.0", - "sauce-connect-launcher": "^1.0.0", + "sauce-connect-launcher": "vaadin/sauce-connect-launcher#upgrade-sauce-connect-5", "temp": "^0.8.1", "uuid": "^3.2.1" } diff --git a/package.json b/package.json index 00703387..71635b63 100644 --- a/package.json +++ b/package.json @@ -45,5 +45,10 @@ }, "devDependencies": { "@vaadin/vaadin-component-dev-dependencies": "^3.2.0" + }, + "overrides": { + "wct-sauce": { + "sauce-connect-launcher": "vaadin/sauce-connect-launcher#upgrade-sauce-connect-5" + } } } diff --git a/wct.conf.js b/wct.conf.js index 0c940836..172c0e17 100644 --- a/wct.conf.js +++ b/wct.conf.js @@ -1,6 +1,11 @@ var envIndex = process.argv.indexOf('--env') + 1; var env = envIndex ? process.argv[envIndex] : undefined; +// workaround for Android 7+ blocking all HTTP traffic +// see https://wiki.saucelabs.com/display/DOCS/Known+Issues +// add it to your own local `/etc/hosts` to run SauceLabs tests locally +var tunneledLocalhost = 'localhost-for-saucelabs'; + module.exports = { testTimeout: 180 * 1000, verbose: false, @@ -14,55 +19,41 @@ module.exports = { ] } }, - // MAGI REMOVE START - istanbul: { - dir: './coverage', - reporters: ['text-summary', 'lcov'], - include: [ - '**/vaadin-text-field/src/*.html' - ], - exclude: [], - thresholds: { - global: { - statements: 87 - } - } - } - // MAGI REMOVE END }, registerHooks: function(context) { - const saucelabsPlatformsMobile = [ - 'iOS Simulator/iphone@12.2', - 'iOS Simulator/iphone@10.3' - ]; - - const saucelabsPlatformsMicrosoft = [ - 'Windows 10/microsoftedge@18', - 'Windows 10/internet explorer@11' - ]; - - const saucelabsPlatformsDesktop = [ - 'macOS 10.13/safari@latest' - ]; - - const saucelabsPlatforms = [ - ...saucelabsPlatformsMobile, - ...saucelabsPlatformsMicrosoft, - ...saucelabsPlatformsDesktop - ]; - - const cronPlatforms = [ - 'iOS Simulator/ipad@12.2', - 'iOS Simulator/iphone@10.3', + const testBrowsers = [ + { + deviceName: 'Android GoogleAPI Emulator', + platformName: 'Android', + platformVersion: '11.0', + browserName: 'Chrome', + }, + 'iOS Simulator/iphone@10.3', // should be 9.x, but SauceLabs does not provide that + 'macOS 11/safari@latest', + 'Windows 10/microsoftedge@latest', + 'Windows 10/internet explorer@11', 'Windows 10/chrome@latest', - 'Windows 10/firefox@latest' + 'Windows 10/firefox@latest', ]; if (env === 'saucelabs') { - context.options.plugins.sauce.browsers = saucelabsPlatforms; - } else if (env === 'saucelabs-cron') { - context.options.plugins.sauce.browsers = cronPlatforms; + context.options.webserver = context.options.webserver || {}; + context.options.webserver.hostname = tunneledLocalhost; + context.options.plugins.sauce.tunnelOptions = { + tunnelDomains: tunneledLocalhost + }; + + context.options.plugins.sauce.browsers = testBrowsers; } + + // Map legacy tunnel-identifier option to new tunnel-name option + context.hookLate('prepare', (done) => { + context.options.activeBrowsers.forEach((browser) => { + browser['tunnel-name'] = browser['tunnel-identifier']; + delete browser['tunnel-identifier']; + }); + done(); + }); } };