From cc0ae1cdeba2bbffa93a550fa0379a249714ad75 Mon Sep 17 00:00:00 2001 From: Karan Shah <64479353+karanshah-browserstack@users.noreply.github.com> Date: Tue, 2 May 2023 18:16:59 +0530 Subject: [PATCH 1/6] Add sdk sample repo --- browserstack.yml | 75 ++++++++++++++ package.json | 9 +- src/test/local/codecept.conf.js | 43 -------- src/test/local/local_test.js | 12 +-- src/test/parallel/codecept.conf.js | 108 -------------------- src/test/parallel/parallel_test.js | 15 --- src/test/sample/codecept.conf.js | 35 +++++++ src/test/sample/sample_test.js | 10 ++ src/test/{parallel => sample}/steps_file.js | 0 src/test/single/codecept.conf.js | 64 ------------ src/test/single/single_test.js | 16 --- src/test/single/steps_file.js | 10 -- 12 files changed, 129 insertions(+), 268 deletions(-) create mode 100644 browserstack.yml delete mode 100644 src/test/parallel/codecept.conf.js delete mode 100644 src/test/parallel/parallel_test.js create mode 100644 src/test/sample/codecept.conf.js create mode 100644 src/test/sample/sample_test.js rename src/test/{parallel => sample}/steps_file.js (100%) delete mode 100644 src/test/single/codecept.conf.js delete mode 100644 src/test/single/single_test.js delete mode 100644 src/test/single/steps_file.js diff --git a/browserstack.yml b/browserstack.yml new file mode 100644 index 0000000..c13fe08 --- /dev/null +++ b/browserstack.yml @@ -0,0 +1,75 @@ +# ============================= +# Set BrowserStack Credentials +# ============================= +# Add your BrowserStack userName and acccessKey here or set BROWSERSTACK_USERNAME and +# BROWSERSTACK_ACCESS_KEY as env variables +userName: YOUR_USERNAME +accessKey: YOUR_ACCESS_KEY + +# ====================== +# BrowserStack Reporting +# ====================== +# The following capabilities are used to set up reporting on BrowserStack: +# Set 'projectName' to the name of your project. Example, Marketing Website +projectName: BrowserStack Samples +# Set `buildName` as the name of the job / testsuite being run +buildName: browserstack build +# `buildIdentifier` is a unique id to differentiate every execution that gets appended to +# buildName. Choose your buildIdentifier format from the available expressions: +# ${BUILD_NUMBER} (Default): Generates an incremental counter with every execution +# ${DATE_TIME}: Generates a Timestamp with every execution. Eg. 05-Nov-19:30 +# Read more about buildIdentifiers here -> https://www.browserstack.com/docs/automate/selenium/organize-tests +buildIdentifier: '#${BUILD_NUMBER}' # Supports strings along with either/both ${expression} +# Set `source` in the syntax `:sample-: +source: codeceptjs:sample-sdk:v1.0 + +# ======================================= +# Platforms (Browsers / Devices to test) +# ======================================= +# Platforms object contains all the browser / device combinations you want to test on. +# Entire list available here -> (https://www.browserstack.com/list-of-browsers-and-platforms/automate) +platforms: + - os: OS X + osVersion: Big Sur + browserName: Chrome + browserVersion: latest + - os: Windows + osVersion: 10 + browserName: Chrome + browserVersion: latest + - deviceName: Samsung Galaxy S22 Ultra + browserName: chrome # Try 'samsung' for Samsung browser + osVersion: 12.0 + +# ======================= +# Parallels per Platform +# ======================= +# The number of parallel threads to be used for each platform set. +# BrowserStack's SDK runner will select the best strategy based on the configured value +# +# Example 1 - If you have configured 3 platforms and set `parallelsPerPlatform` as 2, a total of 6 (2 * 3) parallel threads will be used on BrowserStack +# +# Example 2 - If you have configured 1 platform and set `parallelsPerPlatform` as 5, a total of 5 (1 * 5) parallel threads will be used on BrowserStack +parallelsPerPlatform: 1 + +# ========================================== +# BrowserStack Local +# (For localhost, staging/private websites) +# ========================================== +# Set browserStackLocal to true if your website under test is not accessible publicly over the internet +# Learn more about how BrowserStack Local works here -> https://www.browserstack.com/docs/automate/selenium/local-testing-introduction +browserstackLocal: true # (Default false) + +# browserStackLocalOptions: +# Options to be passed to BrowserStack local in-case of advanced configurations + # localIdentifier: # (Default: null) Needed if you need to run multiple instances of local. + # forceLocal: true # (Default: false) Set to true if you need to resolve all your traffic via BrowserStack Local tunnel. + # Entire list of arguments availabe here -> https://www.browserstack.com/docs/automate/selenium/manage-incoming-connections + +# =================== +# Debugging features +# =================== +debug: false # # Set to true if you need screenshots for every selenium command ran +networkLogs: false # Set to true to enable HAR logs capturing +consoleLogs: errors # Remote browser's console debug levels to be printed (Default: errors) +# Available options are `disable`, `errors`, `warnings`, `info`, `verbose` (Default: errors) diff --git a/package.json b/package.json index 8684933..a2e3926 100644 --- a/package.json +++ b/package.json @@ -5,9 +5,9 @@ "main": "index.js", "scripts": { "test": "echo \"Error: no test specified\" && exit 1", - "single": "npx codeceptjs run -c src/test/single/codecept.conf.js --steps", - "parallel": "npx codeceptjs run-multiple bstack -c src/test/parallel/codecept.conf.js --steps", - "local": "npx codeceptjs run -c src/test/local/codecept.conf.js --steps" + "sample-test": "browserstack-node-sdk codeceptjs run -c src/test/sample/codecept.conf.js --steps", + "sample-local-test": "browserstack-node-sdk codeceptjs run -c src/test/local/codecept.conf.js --steps", + "postinstall": "npm update browserstack-node-sdk" }, "repository": { "type": "git", @@ -21,7 +21,8 @@ "homepage": "https://github.com/browserstack/codecept-js-browserstack#readme", "devDependencies": { "codeceptjs": "^3.2.3", - "webdriverio": "^7.17.4" + "webdriverio": "^7.17.4", + "browserstack-node-sdk": "latest" }, "dependencies": { "browserstack-local": "^1.5.2", diff --git a/src/test/local/codecept.conf.js b/src/test/local/codecept.conf.js index 446faa6..80105e9 100644 --- a/src/test/local/codecept.conf.js +++ b/src/test/local/codecept.conf.js @@ -15,51 +15,8 @@ exports.config = { user: BROWSERSTACK_USERNAME, key: BROWSERSTACK_ACCESS_KEY, browser: 'chrome', - // For W3C-based scripts, use the following capabilties: - capabilities: { - "bstack:options" : { - "os": "Windows", - "osVersion": "10", - "local": "true", - "projectName": "Codecept + WebdriverIO", - "buildName": "browserstack-build-1", - "sessionName": "BStack local codecept-js", - "source": "codecept-js:sample-main:v1.1" - }, - "browserVersion": "latest", - } - // Mentioned below are the capabilities based on JSON Wire Protocol - // capabilities: { - // "os": "Windows", - // "os_version": "10", - // "browser_version": "latest", - // "browserstack.local": "true", - // "project": "Codecept + WebdriverIO", - // "build": "browserstack-build-1", - // "name": "BStack local codecept-js", - // "browserstack.source": "codecept-js:sample-main:v1.1" - // } } }, - - bootstrap: async function () { - console.log("Connecting Local"); - exports.bs_local = new browserstack.Local(); - exports.bs_local.start_async = util.promisify(exports.bs_local.start); - try { - await exports.bs_local.start_async({ 'key': BROWSERSTACK_ACCESS_KEY }); - console.log('Connected. Now testing...'); - } catch(er) { - console.log('Local start failed with error', er); - return; - } - }, - - teardown: function () { - exports.bs_local.stop(() => { - console.log("Disconnected Local"); - }); - }, include: { I: './steps_file.js' }, diff --git a/src/test/local/local_test.js b/src/test/local/local_test.js index 5c2a4d5..4dcd295 100644 --- a/src/test/local/local_test.js +++ b/src/test/local/local_test.js @@ -1,14 +1,10 @@ +const assert = require('assert'); Feature('BrowserStack Local Testing'); Scenario('Local Test', async ({ I }) => { - I.amOnPage("http://bs-local.com:45691/check") + I.amOnPage("http://bs-local.com:45454/") - let text = await I.grabTextFrom('/html/body') + let text = await I.grabTitle() console.log(text) - if(text === "Up and running"){ - I.executeScript('browserstack_executor: {"action": "setSessionStatus", "arguments": {"status":"passed","reason": "Local Instance is runnning"}}') - } - else{ - I.executeScript('browserstack_executor: {"action": "setSessionStatus", "arguments": {"status":"failed","reason": "Local Instance is not runnning!"}}') - } + assert.equal(text, "BrowserStack Local", "Local Instance is not runnning!") }); diff --git a/src/test/parallel/codecept.conf.js b/src/test/parallel/codecept.conf.js deleted file mode 100644 index 5657f43..0000000 --- a/src/test/parallel/codecept.conf.js +++ /dev/null @@ -1,108 +0,0 @@ -require('dotenv').config() - -const BROWSERSTACK_USERNAME = process.env.BROWSERSTACK_USERNAME -const BROWSERSTACK_ACCESS_KEY = process.env.BROWSERSTACK_ACCESS_KEY - -exports.config = { - tests: './*_test.js', - output: './output', - timeout: 120, - helpers: { - WebDriver: { - url: 'https://bstackdemo.com', - user: BROWSERSTACK_USERNAME, - key: BROWSERSTACK_ACCESS_KEY, - browser: 'chrome', - desiredCapabilities: {} - } - }, - - multiple: { - bstack: { - browsers: [ - { - browser: "Safari", - //For W3C-based scripts, use the following capabilties: - desiredCapabilities: { - "bstack:options" : { - "os": "OS X", - "osVersion": "Catalina", - "projectName": "Codecept + WebdriverIO", - "buildName": "browserstack-build-1", - "sessionName": "BStack parallel codecept-js 1", - "debug" : "true", - "networkLogs" : "true", - "source": "codecept-js:sample-main:v1.1" - }, - "browserVersion": "latest", - }, - //Mentioned below are the capabilities based on JSON Wire Protocol - /* - desiredCapabilities: { - "os": "OS X", - "os_version": "Catalina", - "browser_version": "latest", - "project": "Codecept + WebdriverIO", - "build": "browserstack-build-1", - "name": "BStack parallel codecept-js 1", - "browserstack.debug": "true", - 'browserstack.networkLogs': 'true', - "browserstack.source": "codecept-js:sample-main:v1.1" - }, - */ - }, - - { - browser: "Firefox", - //For W3C-based scripts, use the following capabilties: - desiredCapabilities: { - "bstack:options" : { - "os": "Windows", - "osVersion": "10", - "projectName": "Codecept + WebdriverIO", - "buildName": "browserstack-build-1", - "sessionName": "BStack parallel codecept-js 2", - "debug" : "true", - "networkLogs" : "true", - "source": "codecept-js:sample-main:v1.1" - }, - "browserVersion": "latest", - }, - //Mentioned below are the capabilities based on JSON Wire Protocol - /* - desiredCapabilities: { - "os": "Windows", - "os_version": "10", - "browser_version": "latest", - "project": "Codecept + WebdriverIO", - "build": "browserstack-build-1", - "name": "BStack parallel codecept-js 2", - "browserstack.debug": "true", - 'browserstack.networkLogs': 'true', - "browserstack.source": "codecept-js:sample-main:v1.1" - }, - */ - }, - ], - }, - }, - - include: { - I: './steps_file.js' - }, - bootstrap: null, - mocha: {}, - name: 'CodeceptJS-BrowserStack', - plugins: { - pauseOnFail: {}, - retryFailedStep: { - enabled: true - }, - tryTo: { - enabled: true - }, - screenshotOnFail: { - enabled: true - } - } -} diff --git a/src/test/parallel/parallel_test.js b/src/test/parallel/parallel_test.js deleted file mode 100644 index 5e726fb..0000000 --- a/src/test/parallel/parallel_test.js +++ /dev/null @@ -1,15 +0,0 @@ -Feature('Add to Cart'); - -Scenario('Single Test', async ({ I }) => { - I.amOnPage("https://bstackdemo.com") - let expectedProductName = await I.grabTextFrom('//*[@id="1"]/p') - I.click('//*[@id="1"]/div[4]') - let productName = await I.grabTextFrom('//*[@id="__next"]/div/div/div[2]/div[2]/div[2]/div/div[3]/p[1]') - - if (productName === expectedProductName) { - I.executeScript('browserstack_executor: {"action": "setSessionStatus", "arguments": {"status":"passed","reason": "Product matched!"}}') - } - else { - I.executeScript('browserstack_executor: {"action": "setSessionStatus", "arguments": {"status":"failed","reason": "Product Did Not Match!"}}') - } -}); diff --git a/src/test/sample/codecept.conf.js b/src/test/sample/codecept.conf.js new file mode 100644 index 0000000..04e4a32 --- /dev/null +++ b/src/test/sample/codecept.conf.js @@ -0,0 +1,35 @@ +require('dotenv').config() +const BROWSERSTACK_USERNAME = process.env.BROWSERSTACK_USERNAME +const BROWSERSTACK_ACCESS_KEY = process.env.BROWSERSTACK_ACCESS_KEY + +exports.config = { + tests: './*_test.js', + output: './output', + timeout: 120, + helpers: { + WebDriver: { + url: 'https://bstackdemo.com', + user: BROWSERSTACK_USERNAME, + key: BROWSERSTACK_ACCESS_KEY, + browser: "Chrome" + } + }, + include: { + I: './steps_file.js' + }, + bootstrap: null, + mocha: {}, + name: 'CodeceptJS-BrowserStack', + plugins: { + pauseOnFail: {}, + retryFailedStep: { + enabled: true + }, + tryTo: { + enabled: true + }, + screenshotOnFail: { + enabled: true + } + } +} diff --git a/src/test/sample/sample_test.js b/src/test/sample/sample_test.js new file mode 100644 index 0000000..0bdb5b5 --- /dev/null +++ b/src/test/sample/sample_test.js @@ -0,0 +1,10 @@ +const assert = require('assert'); +Feature('Add to Cart'); + +Scenario('Sample Test', async ({ I }) => { + I.amOnPage("https://bstackdemo.com") + let expectedProductName = await I.grabTextFrom('//*[@id="1"]/p') + I.click('//*[@id="1"]/div[4]') + let productName = await I.grabTextFrom('//*[@id="__next"]/div/div/div[2]/div[2]/div[2]/div/div[3]/p[1]') + assert.equal(productName, expectedProductName, "Product Did Not Match!") +}); diff --git a/src/test/parallel/steps_file.js b/src/test/sample/steps_file.js similarity index 100% rename from src/test/parallel/steps_file.js rename to src/test/sample/steps_file.js diff --git a/src/test/single/codecept.conf.js b/src/test/single/codecept.conf.js deleted file mode 100644 index 4c1677e..0000000 --- a/src/test/single/codecept.conf.js +++ /dev/null @@ -1,64 +0,0 @@ -require('dotenv').config() -const BROWSERSTACK_USERNAME = process.env.BROWSERSTACK_USERNAME -const BROWSERSTACK_ACCESS_KEY = process.env.BROWSERSTACK_ACCESS_KEY - -exports.config = { - tests: './*_test.js', - output: './output', - timeout: 120, - helpers: { - WebDriver: { - url: 'https://bstackdemo.com', - user: BROWSERSTACK_USERNAME, - key: BROWSERSTACK_ACCESS_KEY, - browser: 'Edge', - //For W3C-based scripts, use the following capabilties: - capabilities: { - "bstack:options" : { - "os": "Windows", - "osVersion": "10", - "projectName": "Codecept + WebdriverIO", - "buildName": "browserstack-build-1", - "sessionName": "BStack single codecept-js", - "debug" : "true", - "networkLogs" : "true", - "source": "codecept-js:sample-main:v1.1" - }, - "browserVersion": "latest", - } - - //Mentioned below are the capabilities based on JSON Wire Protocol - /* - capabilities: { - "os": "Windows", - "os_version": "10", - "browser_version": "latest", - "project": "Codecept + WebdriverIO", - "build": "browserstack-build-1", - "name": "BStack single codecept-js", - "browserstack.debug": "true", - 'browserstack.networkLogs': 'true', - "browserstack.source": "codecept-js:sample-main:v1.1" - } - */ - } - }, - include: { - I: './steps_file.js' - }, - bootstrap: null, - mocha: {}, - name: 'CodeceptJS-BrowserStack', - plugins: { - pauseOnFail: {}, - retryFailedStep: { - enabled: true - }, - tryTo: { - enabled: true - }, - screenshotOnFail: { - enabled: true - } - } -} diff --git a/src/test/single/single_test.js b/src/test/single/single_test.js deleted file mode 100644 index da1e35c..0000000 --- a/src/test/single/single_test.js +++ /dev/null @@ -1,16 +0,0 @@ -Feature('Add to Cart'); - -Scenario('Single Test', async ({ I }) => { - I.amOnPage("https://bstackdemo.com") - let expectedProductName = await I.grabTextFrom('//*[@id="1"]/p') - I.click('//*[@id="1"]/div[4]') - let productName = await I.grabTextFrom('//*[@id="__next"]/div/div/div[2]/div[2]/div[2]/div/div[3]/p[1]') - - if(productName === expectedProductName){ - I.executeScript('browserstack_executor: {"action": "setSessionStatus", "arguments": {"status":"passed","reason": "Product matched!"}}') - } - else{ - I.executeScript('browserstack_executor: {"action": "setSessionStatus", "arguments": {"status":"failed","reason": "Product Did Not Match!"}}') - } - -}); diff --git a/src/test/single/steps_file.js b/src/test/single/steps_file.js deleted file mode 100644 index 1c249f6..0000000 --- a/src/test/single/steps_file.js +++ /dev/null @@ -1,10 +0,0 @@ -// in this file you can append custom step methods to 'I' object - -module.exports = function() { - return actor({ - - // Define custom steps here, use 'this' to access default methods of I. - // It is recommended to place a general 'login' function here. - - }); - } From 1fc4c91a5eaa7f43f57e1210a73d310ee5fdcd09 Mon Sep 17 00:00:00 2001 From: Karan Shah <64479353+karanshah-browserstack@users.noreply.github.com> Date: Tue, 2 May 2023 18:17:33 +0530 Subject: [PATCH 2/6] Update workflow --- .github/workflows/reviewing_changes.yml | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/.github/workflows/reviewing_changes.yml b/.github/workflows/reviewing_changes.yml index b5fdf90..569a10f 100644 --- a/.github/workflows/reviewing_changes.yml +++ b/.github/workflows/reviewing_changes.yml @@ -59,14 +59,11 @@ jobs: - name: Install dependencies run: npm install - - name: Run single tests - run: npm run single + - name: Run sample tests + run: npm run sample-test - name: Run local tests - run: npm run local - - - name: Run parallel tests - run: npm run parallel + run: npm run sample-test - if: always() uses: actions/github-script@98814c53be79b1d30f795b907e553d8679345975 From 83f52473cf227112514a191afd841626c4758643 Mon Sep 17 00:00:00 2001 From: Neha Agarwal Date: Mon, 26 Jun 2023 10:58:51 +0530 Subject: [PATCH 3/6] Added bstack to scenerio --- src/test/local/local_test.js | 2 +- src/test/sample/sample_test.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/test/local/local_test.js b/src/test/local/local_test.js index 4dcd295..0162d0c 100644 --- a/src/test/local/local_test.js +++ b/src/test/local/local_test.js @@ -1,7 +1,7 @@ const assert = require('assert'); Feature('BrowserStack Local Testing'); -Scenario('Local Test', async ({ I }) => { +Scenario('BStack Local Test', async ({ I }) => { I.amOnPage("http://bs-local.com:45454/") let text = await I.grabTitle() diff --git a/src/test/sample/sample_test.js b/src/test/sample/sample_test.js index 0bdb5b5..0d719f0 100644 --- a/src/test/sample/sample_test.js +++ b/src/test/sample/sample_test.js @@ -1,7 +1,7 @@ const assert = require('assert'); Feature('Add to Cart'); -Scenario('Sample Test', async ({ I }) => { +Scenario('BStack Sample Test', async ({ I }) => { I.amOnPage("https://bstackdemo.com") let expectedProductName = await I.grabTextFrom('//*[@id="1"]/p') I.click('//*[@id="1"]/div[4]') From c551f6409f9a4649355cac31404c7e0f86db8d95 Mon Sep 17 00:00:00 2001 From: Neha Agarwal Date: Wed, 5 Jul 2023 11:42:39 +0530 Subject: [PATCH 4/6] Fix readme --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 383c16f..a926032 100644 --- a/README.md +++ b/README.md @@ -10,8 +10,8 @@ * Update `.env` file with your [BrowserStack Username and Access Key](https://www.browserstack.com/accounts/settings). ## Running your tests -* To run tests, run `npm run parallel` -* To run local tests, run `npm run local` +* To run tests, run `npm run sample-test` +* To run local tests, run `npm run sample-local-test` Understand how many parallel sessions you need by using our [Parallel Test Calculator](https://www.browserstack.com/automate/parallel-calculator?ref=github) From d28f73f0b5b368b096b523445a4a0b6b502441f0 Mon Sep 17 00:00:00 2001 From: Neha Agarwal Date: Wed, 5 Jul 2023 11:53:13 +0530 Subject: [PATCH 5/6] Fix workflow file --- .github/workflows/reviewing_changes.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/reviewing_changes.yml b/.github/workflows/reviewing_changes.yml index 569a10f..0d4eb99 100644 --- a/.github/workflows/reviewing_changes.yml +++ b/.github/workflows/reviewing_changes.yml @@ -63,7 +63,7 @@ jobs: run: npm run sample-test - name: Run local tests - run: npm run sample-test + run: npm run sample-local-test - if: always() uses: actions/github-script@98814c53be79b1d30f795b907e553d8679345975 From 374edbe241216bcf9e0fa40c7f7fe02f24c442e2 Mon Sep 17 00:00:00 2001 From: Neha Agarwal Date: Mon, 10 Jul 2023 13:45:31 +0530 Subject: [PATCH 6/6] delete workflow sdk --- .github/workflows/reviewing_changes.yml | 88 ------------------------- 1 file changed, 88 deletions(-) delete mode 100644 .github/workflows/reviewing_changes.yml diff --git a/.github/workflows/reviewing_changes.yml b/.github/workflows/reviewing_changes.yml deleted file mode 100644 index 0d4eb99..0000000 --- a/.github/workflows/reviewing_changes.yml +++ /dev/null @@ -1,88 +0,0 @@ -# This job is to test different npm profiles in main branch against Pull Request raised -# This workflow targets codecept-js - -name: NodeJS Test workflow on workflow_dispatch - -on: - workflow_dispatch: - inputs: - pull_request_number: - description: 'The pull request number to build' - required: true - -jobs: - comment-run: - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - max-parallel: 3 - matrix: - node: ['14', '16', '18'] - os: [ macos-latest, windows-latest, ubuntu-latest ] - name: Codecept-js Repo ${{ matrix.node }} - ${{ matrix.os }} Sample - env: - BROWSERSTACK_USERNAME: ${{ secrets.BROWSERSTACK_USERNAME }} - BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }} - - steps: - - uses: actions/checkout@v3 - with: - ref: refs/pull/${{ github.event.inputs.pull_request_number }}/head - - name: Fetch Commit SHA - run: | - git log -1 --format='%H' - echo "commit_sha=$(git log -1 --format='%H')" >> $GITHUB_ENV - echo "commit_sha=$(git log -1 --format='%H')" >> $env:GITHUB_ENV - - uses: actions/github-script@98814c53be79b1d30f795b907e553d8679345975 - id: status-check-in-progress - env: - job_name: Codecept-js Repo ${{ matrix.node }} - ${{ matrix.os }} Sample - with: - github-token: ${{ github.token }} - script: | - const result = await github.rest.checks.create({ - owner: context.repo.owner, - repo: context.repo.repo, - name: process.env.job_name, - head_sha: process.env.commit_sha, - status: 'in_progress' - }).catch((err) => ({status: err.status, response: err.response})); - console.log(`The status-check response : ${result.status} Response : ${JSON.stringify(result.response)}`) - if (result.status !== 201) { - console.log('Failed to create check run') - } - - name: Setup node - uses: actions/setup-node@v3 - with: - node-version: ${{ matrix.node }} - - - name: Install dependencies - run: npm install - - - name: Run sample tests - run: npm run sample-test - - - name: Run local tests - run: npm run sample-local-test - - - if: always() - uses: actions/github-script@98814c53be79b1d30f795b907e553d8679345975 - id: status-check-completed - env: - conclusion: ${{ job.status }} - job_name: Codecept-js Repo ${{ matrix.node }} - ${{ matrix.os }} Sample - with: - github-token: ${{ github.token }} - script: | - const result = await github.rest.checks.create({ - owner: context.repo.owner, - repo: context.repo.repo, - name: process.env.job_name, - head_sha: process.env.commit_sha, - status: 'completed', - conclusion: process.env.conclusion - }).catch((err) => ({status: err.status, response: err.response})); - console.log(`The status-check response : ${result.status} Response : ${JSON.stringify(result.response)}`) - if (result.status !== 201) { - console.log('Failed to create check run') - }