diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000000..0ffb0c2e91 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,39 @@ +name: Hyperexecute +on: + workflow_dispatch: + inputs: + username: + required: true + description: LT Username + accessKey: + description: LT Access Key + required: true + sampleRepoLink: + description: Link to the HyperExecute sample repo + default: https://github.com/gauravchawhan/mathjs + required: true +jobs: + HyperExecute-Playwright: + runs-on: ${{ matrix.os }} + timeout-minutes: 15 + strategy: + fail-fast: false + matrix: + os: [windows-latest] + steps: + - name: Checkout sources + uses: actions/checkout@v2 + + - name: Starting CLI testing + shell: bash + run: | + echo "STEP 1 ) Downloading sample suite" + git clone https://github.com/gauravchawhan/mathjs + echo "STEP 2) Download CLI and setting environment variables" + cd mathjs + curl https://downloads.lambdatest.com/hyperexecute/windows/hyperexecute.exe -o hyperexecute.exe + export LT_USERNAME=${{ github.event.inputs.username }} + export LT_ACCESS_KEY=${{ github.event.inputs.accessKey }} + echo $LT_USERNAME + echo $LT_ACCESS_KEY + ./hyperexecute --user $LT_USERNAME --key $LT_ACCESS_KEY --config hyperexecute.yaml diff --git a/hyperexecute.yaml b/hyperexecute.yaml new file mode 100644 index 0000000000..18f181d2dd --- /dev/null +++ b/hyperexecute.yaml @@ -0,0 +1,32 @@ +--- +version: 0.1 +runson: win # defines the OS to test on + +concurrency: 1 # number of machines to execute the testcases +autosplit: true + +# pre steps sets up the environment for testing +pre: + - npm install + - npm install karma -g + - npm install -g karma-jasmine + - npm install karma-safari-launcher -g + - npm install karma-webdriver-launcher -g + - npm i karma-mocha -g + - npm i karma-webpack -g + - npm i mocha -g + + +# Smart cache +cacheKey: '{{ checksum "package-lock.json" }}' +cacheDirectories: + - node_modules + + # testDiscovery is used to discover all the test cases in test/unit-tests folder +testDiscovery: + type: raw + mode: dynamic + command: grep -nri 'describe' test/unit-tests -ir --include=*.test.js | sed 's/:.*//' + +# command to execute the test cases +testRunnerCommand: karma start test/browser-test-config/lt_karma.js --spec= $test \ No newline at end of file diff --git a/test/browser-test-config/lt_karma.js b/test/browser-test-config/lt_karma.js new file mode 100644 index 0000000000..ee14ab3a1d --- /dev/null +++ b/test/browser-test-config/lt_karma.js @@ -0,0 +1,70 @@ +var fs = require('fs'); +const baseKarma = require('./base-karma') +const mochaConfig = require('../../.mocharc.json') +const webpack = require('webpack') + + +module.exports = function(config) { + var webdriverConfig = { + hostname: 'hub.lambdatest.com', //lambdatest hub address + port: 80 + } + + const baseConfig = baseKarma(config) + + config.set(Object.assign(baseConfig, { + hostname: '127.0.0.1', // hostname, where karma web server will run + port: 9876, + basePath: '../..', + frameworks: ['mocha'], + + + client: { + mocha: { + timeout: mochaConfig.timeout + } + }, + files: [ + 'test/browser-test-config/browser-tests.test.js' + ], + + plugins: [ + + 'karma-webpack', + 'karma-mocha', + + 'karma-webdriver-launcher', + + ], + + captureTimeout: 600000, + retryLimit: 1, + browserDisconnectTimeout: 90000, + browserDisconnectTolerance: 1, + browserNoActivityTimeout: 90000, + + concurrency: 1, + logLevel: config.LOG_DEBUG, + browsers: ['Windows_Chrome'], + customLaunchers: { + 'Windows_Chrome': { + base: 'WebDriver', + config: webdriverConfig, + browserName: 'chrome', + version: 'latest', + build: 'OSS', + name: 'Jos MathJs', + video: true, // capture video for your test + visual: true, // capture screenshots on each step + network: true, // capture network logs for your test + console: true, // capture browser console logs + terminal: true, + user: process.env.LT_USERNAME, + accessKey: process.env.LT_ACCESS_KEY, + pseudoActivityInterval: 15000 // 5000 ms heartbeat + } + }, + singleRun: true, + autoWatch: true + })); +}; \ No newline at end of file