From 86987f21ad9b5defcad27052eaf3b9c8f1727a15 Mon Sep 17 00:00:00 2001 From: Felix P Date: Mon, 24 Apr 2023 16:24:08 +0200 Subject: [PATCH 1/2] Remove support for puppeteer --- .github/workflows/test.yml | 22 --- .sauce/puppeteer.yml | 33 ---- Makefile | 4 - README.md | 3 - api/global.schema.json | 13 -- api/saucectl.schema.json | 204 +++----------------- api/v1alpha/framework/puppeteer.schema.json | 139 ------------- cmd/saucectl/saucectl.go | 1 - internal/cmd/ini/cmd.go | 3 - internal/cmd/ini/common.go | 2 - internal/cmd/ini/initializer.go | 73 ------- internal/cmd/ini/initializer_test.go | 201 ------------------- internal/cmd/ini/puppeteer.go | 44 ----- internal/cmd/new/cmd.go | 1 - internal/cmd/run/puppeteer.go | 182 ----------------- internal/cmd/run/run.go | 5 - internal/cmd/signup/cmd.go | 2 +- internal/docker/puppeteer.go | 88 --------- internal/framework/search.go | 1 - internal/http/testcomposer_test.go | 3 +- internal/msg/msg.go | 2 - internal/puppeteer/config.go | 159 --------------- 22 files changed, 30 insertions(+), 1155 deletions(-) delete mode 100644 .sauce/puppeteer.yml delete mode 100644 api/v1alpha/framework/puppeteer.schema.json delete mode 100644 internal/cmd/ini/puppeteer.go delete mode 100644 internal/cmd/run/puppeteer.go delete mode 100644 internal/docker/puppeteer.go delete mode 100644 internal/puppeteer/config.go diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 18ebae634..704cd906f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -113,28 +113,6 @@ jobs: saucectl saucectl.exe - puppeteer: - needs: build - runs-on: ubuntu-latest - - steps: - - name: Checkout Code - uses: actions/checkout@v3 - - - name: Download saucectl Binary - uses: actions/download-artifact@v3 - with: - name: saucectlbin - - - name: Set Permissions - run: chmod +x ./saucectl - - - name: Saucectl RUN - Config Driven - run: ./saucectl run -c .sauce/puppeteer.yml --timeout 10m - - - name: Saucectl RUN - CLI Driven - run: ./saucectl run puppeteer "**/*.test.js" -c "" --name "CLI Driven" --browser chrome --puppeteer.version 9.1.1 --rootDir tests/e2e/puppeteer --timeout 10m - puppeteer-replay: needs: build runs-on: ubuntu-latest diff --git a/.sauce/puppeteer.yml b/.sauce/puppeteer.yml deleted file mode 100644 index e75d33f55..000000000 --- a/.sauce/puppeteer.yml +++ /dev/null @@ -1,33 +0,0 @@ -apiVersion: v1alpha -kind: puppeteer -sauce: - region: us-west-1 - concurrency: 10 - metadata: - tags: - - e2e - build: "$BUILD_ID" -docker: - fileTransfer: copy -rootDir: tests/e2e/puppeteer -puppeteer: - version: 9.1.1 -suites: - - name: "chrome" - testMatch: [ "**/*.test.js" ] - browser: "chrome" - - name: "firefox" - testMatch: [ "**/*.test.js" ] - browser: "firefox" - -artifacts: - download: - when: always - match: - - console.log - directory: ./artifacts/ - -notifications: - slack: - channels: ["devx-slack-notifications"] - send: always # possible values [always,fail,never,pass] diff --git a/Makefile b/Makefile index a52564925..c6edb6f1a 100644 --- a/Makefile +++ b/Makefile @@ -35,10 +35,6 @@ coverage: playwright-ci: build-linux docker run --name playwright-ci -e "CI=true" -v $(shell pwd):/home/gitty/ -w "/home/gitty" --rm saucelabs/stt-playwright-node:latest "/home/gitty/saucectl" run -c ./.sauce/playwright.yml --verbose -#puppeteer-ci: @ Run tests against puppeteer in CI mode -puppeteer-ci: build-linux - docker run --name puppeteer-ci -e "CI=true" -v $(shell pwd):/home/gitty/ -w "/home/gitty" --rm saucelabs/stt-puppeteer-jest-node:latest "/home/gitty/saucectl" run -c ./.sauce/puppeteer.yml --verbose - #testcafe-ci: @ Run tests against testcafe in CI mode testcafe-ci: build-linux docker run --name testcafe-ci -e "CI=true" -v $(shell pwd):/home/gitty/ -w "/home/gitty" --rm saucelabs/stt-testcafe-node:latest "/home/gitty/saucectl" run -c ./.sauce/testcafe.yml --verbose diff --git a/README.md b/README.md index ec11a63a8..baf28aeb0 100644 --- a/README.md +++ b/README.md @@ -18,9 +18,6 @@ test history filtering, and analytics in Sauce Labs. - [Playwright](https://docs.saucelabs.com/web-apps/automated-testing/playwright/) // [Examples](https://github.com/saucelabs/saucectl-playwright-example) -- [Puppeteer](https://docs.saucelabs.com/web-apps/automated-testing/puppeteer/) -// [Examples](https://github.com/saucelabs/saucectl-puppeteer-example) - - [Replay](https://docs.saucelabs.com/web-apps/automated-testing/replay/) // [Examples](https://github.com/saucelabs/saucectl-replay-example) diff --git a/api/global.schema.json b/api/global.schema.json index dccdd3d30..66f89040d 100644 --- a/api/global.schema.json +++ b/api/global.schema.json @@ -11,7 +11,6 @@ "espresso", "imagerunner", "playwright", - "puppeteer", "puppeteer-replay", "testcafe", "xcuitest", @@ -74,18 +73,6 @@ "$ref": "v1alpha/framework/playwright.schema.json" } }, - { - "if": { - "properties": { - "kind": { - "const": "puppeteer" - } - } - }, - "then": { - "$ref": "v1alpha/framework/puppeteer.schema.json" - } - }, { "if": { "properties": { diff --git a/api/saucectl.schema.json b/api/saucectl.schema.json index c45058a3d..8b91378cf 100644 --- a/api/saucectl.schema.json +++ b/api/saucectl.schema.json @@ -11,7 +11,6 @@ "espresso", "imagerunner", "playwright", - "puppeteer", "puppeteer-replay", "testcafe", "xcuitest", @@ -315,7 +314,7 @@ ] }, "timeout": { - "$ref": "#/allOf/10/then/definitions/suite/properties/timeout" + "$ref": "#/allOf/9/then/definitions/suite/properties/timeout" } }, "additionalProperties": false @@ -344,7 +343,7 @@ "type": "boolean" }, "version": { - "$ref": "#/allOf/9/then/properties/playwright/properties/version", + "$ref": "#/allOf/8/then/properties/playwright/properties/version", "enum": [ "package.json", "9.7.0", @@ -399,7 +398,7 @@ "type": "string" }, "browser": { - "$ref": "#/allOf/9/then/properties/suites/items/properties/browserName", + "$ref": "#/allOf/8/then/properties/suites/items/properties/browserName", "enum": [ "chrome", "firefox", @@ -411,7 +410,7 @@ "type": "string" }, "platformName": { - "$ref": "#/allOf/5/then/properties/suites/items/properties/platform", + "$ref": "#/allOf/4/then/properties/suites/items/properties/platform", "enum": [ "macOS 11.00", "macOS 12", @@ -459,7 +458,7 @@ "type": "boolean" }, "timeout": { - "$ref": "#/allOf/10/then/definitions/suite/properties/timeout" + "$ref": "#/allOf/9/then/definitions/suite/properties/timeout" }, "preExec": { "description": "Specifies which commands to execute before starting the tests.", @@ -1036,7 +1035,7 @@ "type": "object", "properties": { "timeout": { - "$ref": "#/allOf/10/then/definitions/suite/properties/timeout" + "$ref": "#/allOf/9/then/definitions/suite/properties/timeout" } }, "additionalProperties": false @@ -1243,7 +1242,7 @@ } }, "timeout": { - "$ref": "#/allOf/10/then/definitions/suite/properties/timeout" + "$ref": "#/allOf/9/then/definitions/suite/properties/timeout" }, "appSettings": { "description": "Overwrite real device settings.", @@ -1356,7 +1355,7 @@ "$ref": "#/allOf/0/then/properties/defaults/properties/mode" }, "timeout": { - "$ref": "#/allOf/10/then/definitions/suite/properties/timeout" + "$ref": "#/allOf/9/then/definitions/suite/properties/timeout" } }, "additionalProperties": false @@ -1372,7 +1371,7 @@ "type": "object", "properties": { "version": { - "$ref": "#/allOf/9/then/properties/playwright/properties/version", + "$ref": "#/allOf/8/then/properties/playwright/properties/version", "enum": [ "package.json", "1.31.1", @@ -1412,7 +1411,7 @@ "$ref": "#/allOf/0/then/properties/defaults/properties/mode" }, "playwrightVersion": { - "$ref": "#/allOf/9/then/properties/playwright/properties/version" + "$ref": "#/allOf/8/then/properties/playwright/properties/version" }, "testMatch": { "description": "Paths to the playwright test files. Regex values are supported to indicate all files of a certain type or in a certain directory, etc.", @@ -1423,7 +1422,7 @@ "type": "array" }, "platformName": { - "$ref": "#/allOf/5/then/properties/suites/items/properties/platform", + "$ref": "#/allOf/4/then/properties/suites/items/properties/platform", "enum": [ "macOS 11.00", "macOS 12", @@ -1437,7 +1436,7 @@ "type": "object", "properties": { "browserName": { - "$ref": "#/allOf/9/then/properties/suites/items/properties/browserName", + "$ref": "#/allOf/8/then/properties/suites/items/properties/browserName", "enum": [ "chromium", "firefox", @@ -1518,7 +1517,7 @@ ] }, "timeout": { - "$ref": "#/allOf/10/then/definitions/suite/properties/timeout" + "$ref": "#/allOf/9/then/definitions/suite/properties/timeout" }, "preExec": { "$ref": "#/allOf/0/then/properties/suites/items/properties/preExec" @@ -1548,153 +1547,6 @@ "additionalProperties": true } }, - { - "if": { - "properties": { - "kind": { - "const": "puppeteer" - } - } - }, - "then": { - "$schema": "https://json-schema.org/draft-07/schema", - "title": "saucectl puppeteer runner configuration", - "description": "Configuration file for puppeteer using saucectl", - "type": "object", - "allOf": [ - { - "$ref": "#/allOf/0/then/allOf/0" - }, - { - "$ref": "#/allOf/0/then/allOf/1" - }, - { - "$ref": "#/allOf/0/then/allOf/2" - }, - { - "$ref": "#/allOf/0/then/allOf/3" - }, - { - "$ref": "#/allOf/0/then/allOf/4" - } - ], - "properties": { - "apiVersion": { - "const": "v1alpha" - }, - "kind": { - "const": "puppeteer" - }, - "showConsoleLog": { - "$ref": "#/allOf/0/then/properties/showConsoleLog" - }, - "defaults": { - "description": "Settings that are applied onto every suite by default, if no value is set on a suite explicitly.", - "type": "object", - "properties": { - "timeout": { - "$ref": "#/allOf/10/then/definitions/suite/properties/timeout" - } - }, - "additionalProperties": false - }, - "env": { - "$ref": "#/allOf/0/then/properties/env" - }, - "rootDir": { - "$ref": "#/allOf/0/then/properties/rootDir" - }, - "puppeteer": { - "description": "Contains details specific to the Puppeteer project.", - "type": "object", - "properties": { - "version": { - "$ref": "#/allOf/9/then/properties/playwright/properties/version", - "enum": [ - "package.json", - "17.0.0", - "15.5.0", - "14.2.0", - "13.1.3", - "12.0.1", - "10.4.0" - ] - } - }, - "required": [ - "version" - ], - "additionalProperties": false - }, - "suites": { - "description": "The set of properties providing details about the test suites to run.", - "type": "array", - "minItems": 1, - "items": { - "type": "object", - "properties": { - "name": { - "description": "The name of the test suite, which will be reflected in the test results in Sauce Labs.", - "type": "string" - }, - "browser": { - "$ref": "#/allOf/9/then/properties/suites/items/properties/browserName", - "enum": [ - "chrome", - "firefox" - ] - }, - "testMatch": { - "description": "The glob patterns Jest uses to detect test files.", - "type": "array" - }, - "env": { - "$ref": "#/allOf/0/then/properties/env" - }, - "browserArgs": { - "description": "Browser specific arguments.", - "type": "array", - "examples": [ - [ - "--no-sandbox" - ], - [ - "--disable-features=site-per-process" - ] - ] - }, - "timeout": { - "$ref": "#/allOf/10/then/definitions/suite/properties/timeout" - }, - "groups": { - "description": "Specific groups of tests.", - "type": "array", - "examples": [ - [ - "group1", - "group2" - ] - ] - } - }, - "required": [ - "name", - "browser", - "testMatch" - ], - "additionalProperties": false - } - } - }, - "required": [ - "apiVersion", - "kind", - "puppeteer", - "suites" - ], - "additionalProperties": true - } - }, { "if": { "properties": { @@ -1731,7 +1583,7 @@ "type": "object", "properties": { "timeout": { - "$ref": "#/allOf/10/then/definitions/suite/properties/timeout" + "$ref": "#/allOf/9/then/definitions/suite/properties/timeout" } }, "additionalProperties": false @@ -1752,7 +1604,7 @@ "type": "array" }, "browserName": { - "$ref": "#/allOf/9/then/properties/suites/items/properties/browserName", + "$ref": "#/allOf/8/then/properties/suites/items/properties/browserName", "enum": [ "chrome" ] @@ -1771,7 +1623,7 @@ "description": "A specific operating system on which to run the tests. Sauce Labs will try to choose a reasonable default if not explicitly specified." }, "timeout": { - "$ref": "#/allOf/10/then/definitions/suite/properties/timeout" + "$ref": "#/allOf/9/then/definitions/suite/properties/timeout" }, "passThreshold": { "$ref": "#/allOf/0/then/properties/suites/items/properties/passThreshold" @@ -1841,7 +1693,7 @@ "$ref": "#/allOf/0/then/properties/defaults/properties/mode" }, "timeout": { - "$ref": "#/allOf/10/then/definitions/suite/properties/timeout" + "$ref": "#/allOf/9/then/definitions/suite/properties/timeout" } }, "additionalProperties": false @@ -1857,7 +1709,7 @@ "type": "object", "properties": { "version": { - "$ref": "#/allOf/9/then/properties/playwright/properties/version", + "$ref": "#/allOf/8/then/properties/playwright/properties/version", "enum": [ "package.json", "2.3.1", @@ -1891,7 +1743,7 @@ "type": "string" }, "browserName": { - "$ref": "#/allOf/9/then/properties/suites/items/properties/browserName", + "$ref": "#/allOf/8/then/properties/suites/items/properties/browserName", "enum": [ "chrome", "firefox", @@ -1919,7 +1771,7 @@ "type": "boolean" }, "platformName": { - "$ref": "#/allOf/5/then/properties/suites/items/properties/platform", + "$ref": "#/allOf/4/then/properties/suites/items/properties/platform", "enum": [ "macOS 11.00", "macOS 12", @@ -2139,7 +1991,7 @@ "type": "boolean" }, "timeout": { - "$ref": "#/allOf/10/then/definitions/suite/properties/timeout" + "$ref": "#/allOf/9/then/definitions/suite/properties/timeout" }, "preExec": { "$ref": "#/allOf/0/then/properties/suites/items/properties/preExec" @@ -2211,7 +2063,7 @@ "type": "object", "properties": { "timeout": { - "$ref": "#/allOf/10/then/definitions/suite/properties/timeout" + "$ref": "#/allOf/9/then/definitions/suite/properties/timeout" } }, "additionalProperties": false @@ -2349,7 +2201,7 @@ } }, "timeout": { - "$ref": "#/allOf/10/then/definitions/suite/properties/timeout" + "$ref": "#/allOf/9/then/definitions/suite/properties/timeout" }, "passThreshold": { "$ref": "#/allOf/0/then/properties/suites/items/properties/passThreshold" @@ -2507,7 +2359,7 @@ "$ref": "#/allOf/0/then/properties/defaults/properties/mode" }, "timeout": { - "$ref": "#/allOf/10/then/definitions/suite/properties/timeout" + "$ref": "#/allOf/9/then/definitions/suite/properties/timeout" } }, "additionalProperties": false @@ -2549,7 +2401,7 @@ "$ref": "#/allOf/0/then/properties/suites/items/properties/browserVersion" }, "platformName": { - "$ref": "#/allOf/5/then/properties/suites/items/properties/platform", + "$ref": "#/allOf/4/then/properties/suites/items/properties/platform", "enum": [ "macOS 11.00", "macOS 12", @@ -2628,7 +2480,7 @@ ] }, "timeout": { - "$ref": "#/allOf/10/then/definitions/suite/properties/timeout" + "$ref": "#/allOf/9/then/definitions/suite/properties/timeout" }, "preExec": { "$ref": "#/allOf/0/then/properties/suites/items/properties/preExec" @@ -2766,14 +2618,14 @@ }, "defaults": { "description": "Settings that are applied onto every suite as a default value.", - "$ref": "#/allOf/10/then/definitions/suite" + "$ref": "#/allOf/9/then/definitions/suite" }, "suites": { "description": "List of suites", "type": "array", "minItems": 1, "items": { - "$ref": "#/allOf/10/then/definitions/suite" + "$ref": "#/allOf/9/then/definitions/suite" } } }, diff --git a/api/v1alpha/framework/puppeteer.schema.json b/api/v1alpha/framework/puppeteer.schema.json deleted file mode 100644 index 58ac4cf90..000000000 --- a/api/v1alpha/framework/puppeteer.schema.json +++ /dev/null @@ -1,139 +0,0 @@ -{ - "$schema": "https://json-schema.org/draft-07/schema", - "title": "saucectl puppeteer runner configuration", - "description": "Configuration file for puppeteer using saucectl", - "type": "object", - "allOf": [ - { - "$ref": "../subschema/artifacts.schema.json" - }, - { - "$ref": "../subschema/docker.schema.json" - }, - { - "$ref": "../subschema/npm.schema.json" - }, - { - "$ref": "../subschema/sauce.schema.json" - }, - { - "$ref": "../subschema/reporters.schema.json" - } - ], - "properties": { - "apiVersion": { - "const": "v1alpha" - }, - "kind": { - "const": "puppeteer" - }, - "showConsoleLog": { - "$ref": "../subschema/common.schema.json#/definitions/showConsoleLog" - }, - "defaults": { - "description": "Settings that are applied onto every suite by default, if no value is set on a suite explicitly.", - "type": "object", - "properties": { - "timeout": { - "$ref": "../subschema/common.schema.json#/definitions/timeout" - } - }, - "additionalProperties": false - }, - "env": { - "$ref": "../subschema/common.schema.json#/definitions/env" - }, - "rootDir": { - "$ref": "../subschema/common.schema.json#/definitions/rootDir" - }, - "puppeteer": { - "description": "Contains details specific to the Puppeteer project.", - "type": "object", - "properties": { - "version": { - "$ref": "../subschema/common.schema.json#/definitions/version", - "enum": [ - "package.json", - "17.0.0", - "15.5.0", - "14.2.0", - "13.1.3", - "12.0.1", - "10.4.0" - ] - } - }, - "required": [ - "version" - ], - "additionalProperties": false - }, - "suites": { - "description": "The set of properties providing details about the test suites to run.", - "type": "array", - "minItems": 1, - "items": { - "type": "object", - "properties": { - "name": { - "description": "The name of the test suite, which will be reflected in the test results in Sauce Labs.", - "type": "string" - }, - "browser": { - "$ref": "../subschema/common.schema.json#/definitions/browser", - "enum": [ - "chrome", - "firefox" - ] - }, - "testMatch": { - "description": "The glob patterns Jest uses to detect test files.", - "type": "array" - }, - "env": { - "$ref": "../subschema/common.schema.json#/definitions/env" - }, - "browserArgs": { - "description": "Browser specific arguments.", - "type": "array", - "examples": [ - [ - "--no-sandbox" - ], - [ - "--disable-features=site-per-process" - ] - ] - }, - "timeout": { - "$ref": "../subschema/common.schema.json#/definitions/timeout" - }, - "groups": { - "description": "Specific groups of tests.", - "type": "array", - "examples": [ - [ - "group1", - "group2" - ] - ] - } - }, - "required": [ - "name", - "browser", - "testMatch" - ], - "additionalProperties": false - } - } - }, - "required": [ - "apiVersion", - "kind", - "puppeteer", - "suites" - ], - "additionalProperties": true -} - diff --git a/cmd/saucectl/saucectl.go b/cmd/saucectl/saucectl.go index ea281442d..7320d4396 100644 --- a/cmd/saucectl/saucectl.go +++ b/cmd/saucectl/saucectl.go @@ -33,7 +33,6 @@ var ( - https://github.com/saucelabs/saucectl-cypress-example - https://github.com/saucelabs/saucectl-espresso-example - https://github.com/saucelabs/saucectl-playwright-example -- https://github.com/saucelabs/saucectl-puppeteer-example - https://github.com/saucelabs/saucectl-testcafe-example - https://github.com/saucelabs/saucectl-xcuitest-example` ) diff --git a/internal/cmd/ini/cmd.go b/internal/cmd/ini/cmd.go index a58e04223..3a7fc3896 100644 --- a/internal/cmd/ini/cmd.go +++ b/internal/cmd/ini/cmd.go @@ -17,7 +17,6 @@ import ( "github.com/saucelabs/saucectl/internal/imagerunner" "github.com/saucelabs/saucectl/internal/msg" "github.com/saucelabs/saucectl/internal/playwright" - "github.com/saucelabs/saucectl/internal/puppeteer" "github.com/saucelabs/saucectl/internal/segment" "github.com/saucelabs/saucectl/internal/testcafe" "github.com/saucelabs/saucectl/internal/xcuitest" @@ -194,8 +193,6 @@ func batchMode(cmd *cobra.Command, initCfg *initConfig) error { initCfg, errs = ini.initializeBatchEspresso(cmd.Flags(), initCfg) case playwright.Kind: initCfg, errs = ini.initializeBatchPlaywright(initCfg) - case puppeteer.Kind: - initCfg, errs = ini.initializeBatchPuppeteer(initCfg) case testcafe.Kind: initCfg, errs = ini.initializeBatchTestcafe(initCfg) case xcuitest.Kind: diff --git a/internal/cmd/ini/common.go b/internal/cmd/ini/common.go index 363253eea..0105e64eb 100644 --- a/internal/cmd/ini/common.go +++ b/internal/cmd/ini/common.go @@ -23,7 +23,6 @@ var configurators = map[string]func(cfg *initConfig) interface{}{ "cypress": configureCypress, "espresso": configureEspresso, "playwright": configurePlaywright, - "puppeteer": configurePuppeteer, "testcafe": configureTestcafe, "xcuitest": configureXCUITest, "imagerunner": configureImageRunner, @@ -36,7 +35,6 @@ var extraInfoDisplay = map[string]func(){ var sauceignores = map[string]string{ "cypress": sauceignoreCypress, "playwright": sauceignorePlaywright, - "puppeteer": sauceignorePuppeteer, "testcafe": sauceignoreTestcafe, } diff --git a/internal/cmd/ini/initializer.go b/internal/cmd/ini/initializer.go index 3f2c98a6e..be8d92c62 100644 --- a/internal/cmd/ini/initializer.go +++ b/internal/cmd/ini/initializer.go @@ -21,7 +21,6 @@ import ( "github.com/saucelabs/saucectl/internal/imagerunner" "github.com/saucelabs/saucectl/internal/msg" "github.com/saucelabs/saucectl/internal/playwright" - "github.com/saucelabs/saucectl/internal/puppeteer" "github.com/saucelabs/saucectl/internal/region" "github.com/saucelabs/saucectl/internal/testcafe" "github.com/saucelabs/saucectl/internal/vmd" @@ -76,8 +75,6 @@ func (ini *initializer) configure() (*initConfig, error) { return ini.initializeCypress() case playwright.Kind: return ini.initializePlaywright() - case puppeteer.Kind: - return ini.initializePuppeteer() case testcafe.Kind: return ini.initializeTestcafe() case espresso.Kind: @@ -504,31 +501,6 @@ func (ini *initializer) initializeTestcafe() (*initConfig, error) { return cfg, nil } -func (ini *initializer) initializePuppeteer() (*initConfig, error) { - cfg := &initConfig{frameworkName: puppeteer.Kind} - - frameworkMetadatas, err := ini.infoReader.Versions(context.Background(), cfg.frameworkName) - if err != nil { - return &initConfig{}, err - } - - err = ini.askVersion(cfg, frameworkMetadatas) - if err != nil { - return &initConfig{}, err - } - - err = ini.askPlatform(cfg, frameworkMetadatas) - if err != nil { - return &initConfig{}, err - } - - err = ini.askDownloadWhen(cfg) - if err != nil { - return &initConfig{}, err - } - return cfg, nil -} - func (ini *initializer) initializeEspresso() (*initConfig, error) { cfg := &initConfig{frameworkName: espresso.Kind} @@ -826,51 +798,6 @@ func (ini *initializer) initializeBatchPlaywright(initCfg *initConfig) (*initCon return initCfg, errs } -func (ini *initializer) initializeBatchPuppeteer(initCfg *initConfig) (*initConfig, []error) { - initCfg.frameworkName = puppeteer.Kind - var errs []error - - if initCfg.frameworkVersion == "" { - errs = append(errs, fmt.Errorf(msg.MissingFrameworkVersion, initCfg.frameworkName)) - } - if initCfg.platformName == "" { - errs = append(errs, errors.New(msg.MissingPlatformName)) - } - if initCfg.browserName == "" { - errs = append(errs, errors.New(msg.MissingBrowserName)) - } - - frameworkMetadatas, err := ini.infoReader.Versions(context.Background(), initCfg.frameworkName) - if err != nil { - errs = append(errs, err) - return &initConfig{}, errs - } - - frameworkVersionSupported := true - if initCfg.frameworkVersion != "" { - if err = checkFrameworkVersion(frameworkMetadatas, initCfg.frameworkName, initCfg.frameworkVersion); err != nil { - errs = append(errs, err) - frameworkVersionSupported = false - } - } - - if frameworkVersionSupported && initCfg.platformName != "" && initCfg.browserName != "" { - initCfg.platformName = strings.ToLower(initCfg.platformName) - initCfg.browserName = strings.ToLower(initCfg.browserName) - if err = checkBrowserAndPlatform(frameworkMetadatas, initCfg.frameworkName, initCfg.frameworkVersion, initCfg.browserName, initCfg.platformName); err != nil { - errs = append(errs, err) - } - } - - if initCfg.artifactWhenStr != "" { - initCfg.artifactWhenStr = strings.ToLower(initCfg.artifactWhenStr) - if initCfg.artifactWhen, err = checkArtifactDownloadSetting(initCfg.artifactWhenStr); err != nil { - errs = append(errs, err) - } - } - return initCfg, errs -} - func (ini *initializer) initializeBatchTestcafe(initCfg *initConfig) (*initConfig, []error) { initCfg.frameworkName = testcafe.Kind var errs []error diff --git a/internal/cmd/ini/initializer_test.go b/internal/cmd/ini/initializer_test.go index 5e13c6d6b..4f3044904 100644 --- a/internal/cmd/ini/initializer_test.go +++ b/internal/cmd/ini/initializer_test.go @@ -30,7 +30,6 @@ import ( "github.com/saucelabs/saucectl/internal/framework" "github.com/saucelabs/saucectl/internal/mocks" "github.com/saucelabs/saucectl/internal/playwright" - "github.com/saucelabs/saucectl/internal/puppeteer" "github.com/saucelabs/saucectl/internal/region" "github.com/saucelabs/saucectl/internal/testcafe" "github.com/saucelabs/saucectl/internal/vmd" @@ -1009,14 +1008,6 @@ func Test_initializers(t *testing.T) { }, }, }, - "puppeteer": { - { - FrameworkName: "puppeteer", - FrameworkVersion: "8.0.0", - DockerImage: "dummy-docker-image", - Platforms: []framework.Platform{}, - }, - }, imagerunner.Kind: { { FrameworkName: imagerunner.Kind, @@ -1034,7 +1025,6 @@ func Test_initializers(t *testing.T) { espresso.Kind, imagerunner.Kind, playwright.Kind, - "puppeteer", testcafe.Kind, xcuitest.Kind, }, nil @@ -1180,67 +1170,6 @@ func Test_initializers(t *testing.T) { artifactWhen: config.WhenPass, }, }, - { - name: "Puppeteer - docker - chrome", - procedure: func(c *expect.Console) error { - - _, err := c.ExpectString("Select puppeteer version") - if err != nil { - return err - } - _, err = c.SendLine("8.0.0") - if err != nil { - return err - } - _, err = c.ExpectString("Select browser:") - if err != nil { - return err - } - _, err = c.SendLine("chrome") - if err != nil { - return err - } - _, err = c.ExpectString("Select platform:") - if err != nil { - return err - } - _, err = c.SendLine("docker") - if err != nil { - return err - } - _, err = c.ExpectString("Download artifacts:") - if err != nil { - return err - } - _, err = c.SendLine("when tests are passing") - if err != nil { - return err - } - _, err = c.ExpectEOF() - if err != nil { - return err - } - return nil - }, - ini: &initializer{infoReader: ir}, - execution: func(i *initializer, cfg *initConfig) error { - newCfg, err := i.initializePuppeteer() - if err != nil { - return err - } - *cfg = *newCfg - return nil - }, - startState: &initConfig{}, - expectedState: &initConfig{ - frameworkName: puppeteer.Kind, - frameworkVersion: "8.0.0", - platformName: "", - browserName: "chrome", - mode: "docker", - artifactWhen: config.WhenPass, - }, - }, { name: "Testcafe - macOS 11.00 - safari", procedure: func(c *expect.Console) error { @@ -2444,136 +2373,6 @@ func Test_initializer_initializeBatchPlaywright(t *testing.T) { } } -func Test_initializer_initializeBatchPuppeteer(t *testing.T) { - ini := &initializer{ - infoReader: &mocks.FakeFrameworkInfoReader{VersionsFn: func(ctx context.Context, frameworkName string) ([]framework.Metadata, error) { - return []framework.Metadata{ - { - FrameworkName: "puppeteer", - FrameworkVersion: "1.0.0", - Platforms: []framework.Platform{ - { - PlatformName: "docker", - BrowserNames: []string{"chrome", "firefox"}, - }, - }, - }, - }, nil - }}, - userService: &mocks.UserService{ConcurrencyFn: func(ctx context.Context) (iam.Concurrency, error) { - return iam.Concurrency{ - Org: iam.OrgConcurrency{ - Allowed: iam.CloudConcurrency{ - VDC: 2, - }, - }, - }, nil - }}, - } - var emptyErr []error - - type args struct { - initCfg *initConfig - } - tests := []struct { - name string - args args - want *initConfig - wantErrs []error - }{ - { - name: "Basic", - args: args{ - initCfg: &initConfig{ - frameworkName: "puppeteer", - frameworkVersion: "1.0.0", - browserName: "chrome", - platformName: "docker", - region: "us-west-1", - artifactWhen: "fail", - }, - }, - want: &initConfig{ - frameworkName: "puppeteer", - frameworkVersion: "1.0.0", - browserName: "chrome", - platformName: "docker", - region: "us-west-1", - artifactWhen: config.WhenFail, - }, - wantErrs: emptyErr, - }, - { - name: "invalid browser/platform", - args: args{ - initCfg: &initConfig{ - frameworkName: "puppeteer", - frameworkVersion: "1.0.0", - browserName: "dummy", - platformName: "dummy", - artifactWhenStr: "dummy", - }, - }, - want: &initConfig{ - frameworkName: "puppeteer", - frameworkVersion: "1.0.0", - browserName: "dummy", - platformName: "dummy", - artifactWhenStr: "dummy", - }, - wantErrs: []error{ - errors.New("dummy: unsupported browser. Supported browsers are: chrome, firefox"), - errors.New("dummy: unknown download condition"), - }, - }, - { - name: "no flags", - args: args{ - initCfg: &initConfig{ - frameworkName: "puppeteer", - }, - }, - want: &initConfig{ - frameworkName: "puppeteer", - }, - wantErrs: []error{ - errors.New("no puppeteer version specified"), - errors.New("no platform name specified"), - errors.New("no browser name specified"), - }, - }, - { - name: "invalid framework version / Invalid config file", - args: args{ - initCfg: &initConfig{ - frameworkName: "puppeteer", - frameworkVersion: "8.0.0", - }, - }, - want: &initConfig{ - frameworkName: "puppeteer", - frameworkVersion: "8.0.0", - }, - wantErrs: []error{ - errors.New("no platform name specified"), - errors.New("no browser name specified"), - errors.New("puppeteer 8.0.0 is not supported. Supported versions are: 1.0.0"), - }, - }, - } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - got, errs := ini.initializeBatchPuppeteer(tt.args.initCfg) - if !reflect.DeepEqual(got, tt.want) { - t.Errorf("initializeBatchPuppeteer() got = %v, want %v", got, tt.want) - } - if !reflect.DeepEqual(errs, tt.wantErrs) { - t.Errorf("initializeBatchPuppeteer() got1 = %v, want %v", errs, tt.wantErrs) - } - }) - } -} - func Test_initializer_initializeBatchXcuitest(t *testing.T) { dir := fs.NewDir(t, "apps", fs.WithFile("ios-app.ipa", "myAppContent", fs.WithMode(0644)), diff --git a/internal/cmd/ini/puppeteer.go b/internal/cmd/ini/puppeteer.go deleted file mode 100644 index d871ce0ad..000000000 --- a/internal/cmd/ini/puppeteer.go +++ /dev/null @@ -1,44 +0,0 @@ -package ini - -import ( - // imports embed to load .sauceignore - _ "embed" - "fmt" - - "github.com/saucelabs/saucectl/internal/config" - "github.com/saucelabs/saucectl/internal/puppeteer" -) - -func configurePuppeteer(cfg *initConfig) interface{} { - return puppeteer.Project{ - TypeDef: config.TypeDef{ - APIVersion: puppeteer.APIVersion, - Kind: puppeteer.Kind, - }, - Sauce: config.SauceConfig{ - Region: cfg.region, - Sauceignore: ".sauceignore", - Concurrency: cfg.concurrency, - }, - RootDir: ".", - Puppeteer: puppeteer.Puppeteer{ - Version: cfg.frameworkVersion, - }, - Suites: []puppeteer.Suite{ - { - Name: fmt.Sprintf("puppeteer - %s - %s", firstNotEmpty(cfg.platformName, cfg.mode), cfg.browserName), - Browser: cfg.browserName, - }, - }, - Artifacts: config.Artifacts{ - Download: config.ArtifactDownload{ - When: cfg.artifactWhen, - Directory: "./artifacts", - Match: []string{"*"}, - }, - }, - } -} - -//go:embed sauceignore/puppeteer.sauceignore -var sauceignorePuppeteer string diff --git a/internal/cmd/new/cmd.go b/internal/cmd/new/cmd.go index d38ea5fef..5aa1aa3f0 100644 --- a/internal/cmd/new/cmd.go +++ b/internal/cmd/new/cmd.go @@ -14,7 +14,6 @@ var ( - https://github.com/saucelabs/saucectl-cypress-example - https://github.com/saucelabs/saucectl-espresso-example - https://github.com/saucelabs/saucectl-playwright-example -- https://github.com/saucelabs/saucectl-puppeteer-example - https://github.com/saucelabs/saucectl-testcafe-example - https://github.com/saucelabs/saucectl-xcuitest-example` ) diff --git a/internal/cmd/run/puppeteer.go b/internal/cmd/run/puppeteer.go deleted file mode 100644 index 4507b4a66..000000000 --- a/internal/cmd/run/puppeteer.go +++ /dev/null @@ -1,182 +0,0 @@ -package run - -import ( - "errors" - "fmt" - "os" - "path/filepath" - - "github.com/rs/zerolog/log" - cmds "github.com/saucelabs/saucectl/internal/cmd" - "github.com/spf13/cobra" - "github.com/spf13/pflag" - "golang.org/x/text/cases" - "golang.org/x/text/language" - - "github.com/saucelabs/saucectl/internal/backtrace" - "github.com/saucelabs/saucectl/internal/ci" - "github.com/saucelabs/saucectl/internal/config" - "github.com/saucelabs/saucectl/internal/credentials" - "github.com/saucelabs/saucectl/internal/docker" - "github.com/saucelabs/saucectl/internal/flags" - "github.com/saucelabs/saucectl/internal/msg" - "github.com/saucelabs/saucectl/internal/puppeteer" - "github.com/saucelabs/saucectl/internal/region" - "github.com/saucelabs/saucectl/internal/report/captor" - "github.com/saucelabs/saucectl/internal/segment" - "github.com/saucelabs/saucectl/internal/usage" - "github.com/saucelabs/saucectl/internal/viper" -) - -// NewPuppeteerCmd creates the 'run' command for Puppeteer. -func NewPuppeteerCmd() *cobra.Command { - sc := flags.SnakeCharmer{Fmap: map[string]*pflag.Flag{}} - - cmd := &cobra.Command{ - Use: "puppeteer", - Short: "Run puppeteer tests", - SilenceUsage: true, - Hidden: true, // TODO reveal command once ready - TraverseChildren: true, - PreRunE: func(cmd *cobra.Command, args []string) error { - sc.BindAll() - return preRun() - }, - Run: func(cmd *cobra.Command, args []string) { - // Test patterns are passed in via positional args. - viper.Set("suite::testMatch", args) - - exitCode, err := runPuppeteer(cmd, true) - if err != nil { - log.Err(err).Msg("failed to execute run command") - backtrace.Report(err, map[string]interface{}{ - "username": credentials.Get().Username, - }, gFlags.cfgFilePath) - } - os.Exit(exitCode) - }, - } - - sc.Fset = cmd.Flags() - - sc.String("name", "suite::name", "", "Set the name of the job as it will appear on Sauce Labs") - - // Browser & Platform - sc.String("browser", "suite::browser", "", "Run tests against this browser") - - // Puppeteer - sc.String("puppeteer.version", "puppeteer::version", "", "The Puppeteer version to use") - - // Misc - sc.String("rootDir", "rootDir", ".", "Control what files are available in the context of a test run, unless explicitly excluded by .sauceignore") - - // NPM - sc.String("npm.registry", "npm::registry", "", "Specify the npm registry URL") - sc.StringToString("npm.packages", "npm::packages", map[string]string{}, "Specify npm packages that are required to run tests") - sc.Bool("npm.strictSSL", "npm::strictSSL", true, "Whether or not to do SSL key validation when making requests to the registry via https") - - sc.StringSlice("browserArgs", "suite::browserArgs", []string{}, "Pass browser args to puppeteer") - sc.StringSlice("groups", "suite::groups", []string{}, "Pass groups to puppeteer") - - return cmd -} - -func runPuppeteer(cmd *cobra.Command, isCLIDriven bool) (int, error) { - if !isCLIDriven { - config.ValidateSchema(gFlags.cfgFilePath) - } - - p, err := puppeteer.FromFile(gFlags.cfgFilePath) - if err != nil { - return 1, err - } - - p.CLIFlags = flags.CaptureCommandLineFlags(cmd.Flags()) - - // Normalize path to package.json file - if p.Puppeteer.Version == "package.json" { - p.Puppeteer.Version = filepath.Join(p.RootDir, p.Puppeteer.Version) - } - - if err := applyPuppeteerFlags(&p); err != nil { - return 1, err - } - puppeteer.SetDefaults(&p) - - if err := puppeteer.Validate(&p); err != nil { - return 1, err - } - - regio := region.FromString(p.Sauce.Region) - if regio == region.USEast4 { - return 1, errors.New(msg.NoFrameworkSupport) - } - - restoClient.URL = regio.APIBaseURL() - testcompClient.URL = regio.APIBaseURL() - - if !gFlags.noAutoTagging { - p.Sauce.Metadata.Tags = append(p.Sauce.Metadata.Tags, ci.GetTags()...) - } - - tracker := segment.DefaultTracker - - go func() { - props := usage.Properties{} - props.SetFramework("puppeteer").SetFVersion(p.Puppeteer.Version).SetFlags(cmd.Flags()).SetSauceConfig(p.Sauce). - SetArtifacts(p.Artifacts).SetDocker(p.Docker).SetNPM(p.Npm).SetNumSuites(len(p.Suites)).SetJobs(captor.Default.TestResults). - SetSlack(p.Notifications.Slack) - tracker.Collect(cases.Title(language.English).String(cmds.FullName(cmd)), props) - _ = tracker.Close() - }() - - cleanupArtifacts(p.Artifacts) - - return runPuppeteerInDocker(p) -} - -func runPuppeteerInDocker(p puppeteer.Project) (int, error) { - log.Info().Msg("Running puppeteer in Docker") - printTestEnv("docker") - - cd, err := docker.NewPuppeteer(p, &testcompClient, &testcompClient, &restoClient, &rdcClient, createReporters(p.Reporters, p.Notifications, - p.Sauce.Metadata, &testcompClient, &restoClient, "puppeteer", "docker")) - if err != nil { - return 1, err - } - - cleanPuppeteerPackages(&p) - return cd.RunProject() -} - -func applyPuppeteerFlags(p *puppeteer.Project) error { - if gFlags.selectedSuite != "" { - if err := puppeteer.FilterSuites(p, gFlags.selectedSuite); err != nil { - return err - } - } - - // Use the adhoc suite instead, if one is provided - if p.Suite.Name != "" { - p.Suites = []puppeteer.Suite{p.Suite} - } - - return nil -} - -func cleanPuppeteerPackages(p *puppeteer.Project) { - // Don't allow framework installation, it is provided by the runner - ignoredPackages := []string{} - puppeteerVersion, hasPuppeteer := p.Npm.Packages["puppeteer"] - puppeteerCoreVersion, hasPuppeteerCore := p.Npm.Packages["puppeteer-core"] - if hasPuppeteer { - ignoredPackages = append(ignoredPackages, fmt.Sprintf("puppeteer@%s", puppeteerVersion)) - } - if hasPuppeteerCore { - ignoredPackages = append(ignoredPackages, fmt.Sprintf("puppeteer-core@%s", puppeteerCoreVersion)) - } - if hasPuppeteer || hasPuppeteerCore { - log.Warn().Msg(msg.IgnoredNpmPackagesMsg("puppeteer", p.Puppeteer.Version, ignoredPackages)) - p.Npm.Packages = config.CleanNpmPackages(p.Npm.Packages, []string{"puppeteer", "puppeteer-core"}) - } -} diff --git a/internal/cmd/run/run.go b/internal/cmd/run/run.go index 5b859a1cc..ebb4fefe5 100644 --- a/internal/cmd/run/run.go +++ b/internal/cmd/run/run.go @@ -29,7 +29,6 @@ import ( "github.com/saucelabs/saucectl/internal/msg" "github.com/saucelabs/saucectl/internal/notification/slack" "github.com/saucelabs/saucectl/internal/playwright" - "github.com/saucelabs/saucectl/internal/puppeteer" "github.com/saucelabs/saucectl/internal/puppeteer/replay" "github.com/saucelabs/saucectl/internal/report" "github.com/saucelabs/saucectl/internal/report/buildtable" @@ -167,7 +166,6 @@ func Command() *cobra.Command { NewCypressCmd(), NewEspressoCmd(), NewPlaywrightCmd(), - NewPuppeteerCmd(), NewReplayCmd(), NewTestcafeCmd(), NewXCUITestCmd(), @@ -227,9 +225,6 @@ func Run(cmd *cobra.Command) (int, error) { if typeDef.Kind == testcafe.Kind { return runTestcafe(cmd, testcafeFlags{}, false) } - if typeDef.Kind == puppeteer.Kind { - return runPuppeteer(cmd, false) - } if typeDef.Kind == replay.Kind { return runReplay(cmd, false) } diff --git a/internal/cmd/signup/cmd.go b/internal/cmd/signup/cmd.go index da197da9f..e2cfbbaff 100644 --- a/internal/cmd/signup/cmd.go +++ b/internal/cmd/signup/cmd.go @@ -41,7 +41,7 @@ func Command() *cobra.Command { func Run() error { saucebotSignup := ` (‾) - || Puppeteer, + || ################## /( Playwright, ## ## ,..%( TestCafe, (# ## .,,.....%( Cypress! diff --git a/internal/docker/puppeteer.go b/internal/docker/puppeteer.go deleted file mode 100644 index 0126d3601..000000000 --- a/internal/docker/puppeteer.go +++ /dev/null @@ -1,88 +0,0 @@ -package docker - -import ( - "context" - - "github.com/saucelabs/saucectl/internal/framework" - "github.com/saucelabs/saucectl/internal/job" - "github.com/saucelabs/saucectl/internal/puppeteer" - "github.com/saucelabs/saucectl/internal/report" -) - -// PuppeterRunner represents the docker implementation of a test runner. -type PuppeterRunner struct { - ContainerRunner - Project puppeteer.Project -} - -// NewPuppeteer creates a new PuppeterRunner instance. -func NewPuppeteer(c puppeteer.Project, ms framework.MetadataService, wr job.Writer, jr job.Reader, dl job.ArtifactDownloader, reps []report.Reporter) (*PuppeterRunner, error) { - r := PuppeterRunner{ - Project: c, - ContainerRunner: ContainerRunner{ - Ctx: context.Background(), - containerConfig: &containerConfig{}, - Framework: framework.Framework{ - Name: c.Kind, - Version: c.Puppeteer.Version, - }, - FrameworkMeta: ms, - ShowConsoleLog: c.ShowConsoleLog, - JobWriter: wr, - JobReader: jr, - ArtfactDownloader: dl, - Reporters: reps, - MetadataSearchStrategy: framework.NewSearchStrategy(c.Puppeteer.Version, c.RootDir), - }, - } - - var err error - r.docker, err = Create() - if err != nil { - return nil, err - } - - return &r, nil -} - -// RunProject runs the tests defined in config.Project. -func (r *PuppeterRunner) RunProject() (int, error) { - verifyFileTransferCompatibility(r.Project.Sauce.Concurrency, &r.Project.Docker) - - if err := r.fetchImage(&r.Project.Docker); err != nil { - return 1, err - } - - sigChan := r.registerSkipSuitesOnSignal() - defer unregisterSignalCapture(sigChan) - - containerOpts, results := r.createWorkerPool(r.Project.Sauce.Concurrency) - defer close(results) - - go func() { - for _, suite := range r.Project.Suites { - containerOpts <- containerStartOptions{ - Docker: r.Project.Docker, - BeforeExec: r.Project.BeforeExec, - Project: r.Project, - Browser: suite.Browser, - DisplayName: suite.Name, - SuiteName: suite.Name, - Environment: suite.Env, - RootDir: r.Project.RootDir, - Sauceignore: r.Project.Sauce.Sauceignore, - ConfigFilePath: r.Project.ConfigFilePath, - CLIFlags: r.Project.CLIFlags, - Timeout: suite.Timeout, - } - } - close(containerOpts) - }() - - hasPassed := r.collectResults(r.Project.Artifacts.Download, results, len(r.Project.Suites)) - if !hasPassed { - return 1, nil - } - - return 0, nil -} diff --git a/internal/framework/search.go b/internal/framework/search.go index bb28910d8..95d8f9215 100644 --- a/internal/framework/search.go +++ b/internal/framework/search.go @@ -70,7 +70,6 @@ func toNpmPackageName(frameworkName string) string { mapping := map[string]string{ "cypress": "cypress", "playwright": "@playwright/test", - "puppeteer": "puppeteer", "testcafe": "testcafe", } diff --git a/internal/http/testcomposer_test.go b/internal/http/testcomposer_test.go index 50891cb64..13aa2d055 100644 --- a/internal/http/testcomposer_test.go +++ b/internal/http/testcomposer_test.go @@ -180,12 +180,11 @@ func TestTestComposer_Frameworks(t *testing.T) { }{ { name: "HTTP - 200", - body: `[{"name":"cypress","version":"12.6.0"},{"name":"cypress","version":"12.3.0"},{"name":"playwright","version":"1.31.1"},{"name":"playwright","version":"1.29.2"},{"name":"puppeteer","version":"10.4.0"},{"name":"puppeteer","version":"10.2.0"},{"name":"puppeteer-replay","version":"0.8.0"},{"name":"puppeteer-replay","version":"0.7.0"},{"name":"testcafe","version":"2.1.0"},{"name":"testcafe","version":"2.0.1"}]`, + body: `[{"name":"cypress","version":"12.6.0"},{"name":"cypress","version":"12.3.0"},{"name":"playwright","version":"1.31.1"},{"name":"playwright","version":"1.29.2"},{"name":"puppeteer-replay","version":"0.8.0"},{"name":"puppeteer-replay","version":"0.7.0"},{"name":"testcafe","version":"2.1.0"},{"name":"testcafe","version":"2.0.1"}]`, httpCode: 200, want: []string{ "cypress", "playwright", - "puppeteer", "puppeteer-replay", "testcafe", }, diff --git a/internal/msg/msg.go b/internal/msg/msg.go index c8c386c82..617a066d4 100644 --- a/internal/msg/msg.go +++ b/internal/msg/msg.go @@ -41,7 +41,6 @@ For more information, visit https://docs.saucelabs.com/dev/cli/saucectl/usage/us or peruse some of our example repositories: - https://github.com/saucelabs/saucectl-cypress-example - https://github.com/saucelabs/saucectl-playwright-example - - https://github.com/saucelabs/saucectl-puppeteer-example - https://github.com/saucelabs/saucectl-testcafe-example` // SauceIgnoreSuggestion is a recommendation to add unnecessary files to .sauceignore in the case that the bundled file is too big. @@ -52,7 +51,6 @@ For more information, visit https://docs.saucelabs.com/dev/cli/saucectl/usage/us or peruse some of our example repositories: - https://github.com/saucelabs/saucectl-cypress-example - https://github.com/saucelabs/saucectl-playwright-example - - https://github.com/saucelabs/saucectl-puppeteer-example - https://github.com/saucelabs/saucectl-testcafe-example` // ArchiveFileCountWarning is a warning to the user that their project archive may be unintentionally large. diff --git a/internal/puppeteer/config.go b/internal/puppeteer/config.go deleted file mode 100644 index 6fc176a59..000000000 --- a/internal/puppeteer/config.go +++ /dev/null @@ -1,159 +0,0 @@ -package puppeteer - -import ( - "errors" - "fmt" - "os" - "time" - - "github.com/saucelabs/saucectl/internal/config" - "github.com/saucelabs/saucectl/internal/msg" - "github.com/saucelabs/saucectl/internal/region" -) - -// Config descriptors. -var ( - // Kind represents the type definition of this config. - Kind = "puppeteer" - - // APIVersion represents the supported config version. - APIVersion = "v1alpha" -) - -// Project represents the puppeteer project configuration. -type Project struct { - config.TypeDef `yaml:",inline" mapstructure:",squash"` - Defaults config.Defaults `yaml:"defaults,omitempty" json:"defaults"` - ShowConsoleLog bool `yaml:"showConsoleLog" json:"-"` - DryRun bool `yaml:"-" json:"-"` - ConfigFilePath string `yaml:"-" json:"-"` - CLIFlags map[string]interface{} `yaml:"-" json:"-"` - Sauce config.SauceConfig `yaml:"sauce,omitempty" json:"sauce"` - // Suite is only used as a workaround to parse adhoc suites that are created via CLI args. - Suite Suite `yaml:"suite,omitempty" json:"-"` - Suites []Suite `yaml:"suites,omitempty" json:"suites"` - BeforeExec []string `yaml:"beforeExec,omitempty" json:"beforeExec"` - Docker config.Docker `yaml:"docker,omitempty" json:"docker"` - Puppeteer Puppeteer `yaml:"puppeteer,omitempty" json:"puppeteer"` - Npm config.Npm `yaml:"npm,omitempty" json:"npm"` - RootDir string `yaml:"rootDir,omitempty" json:"rootDir"` - Artifacts config.Artifacts `yaml:"artifacts,omitempty" json:"artifacts"` - Reporters config.Reporters `yaml:"reporters,omitempty" json:"-"` - Env map[string]string `yaml:"env,omitempty" json:"env"` - Notifications config.Notifications `yaml:"notifications,omitempty" json:"-"` -} - -// Suite represents the puppeteer test suite configuration. -type Suite struct { - Name string `yaml:"name,omitempty" json:"name"` - Browser string `yaml:"browser,omitempty" json:"browser"` - TestMatch []string `yaml:"testMatch,omitempty" json:"testMatch"` - Env map[string]string `yaml:"env,omitempty" json:"env"` - BrowserArgs []string `yaml:"browserArgs,omitempty" json:"browserArgs"` - Timeout time.Duration `yaml:"timeout,omitempty" json:"timeout"` - Groups []string `yaml:"groups,omitempty" json:"groups"` -} - -// Puppeteer represents the configuration for puppeteer. -type Puppeteer struct { - // Version represents the puppeteer framework version. - Version string `yaml:"version,omitempty" json:"version"` -} - -// FromFile creates a new puppeteer project based on the filepath. -func FromFile(cfgPath string) (Project, error) { - var p Project - - if err := config.Unmarshal(cfgPath, &p); err != nil { - return p, err - } - - p.ConfigFilePath = cfgPath - - return p, nil -} - -// SetDefaults applies config defaults in case the user has left them blank. -func SetDefaults(p *Project) { - if p.Kind == "" { - p.Kind = Kind - } - - if p.APIVersion == "" { - p.APIVersion = APIVersion - } - - if p.Sauce.Concurrency < 1 { - p.Sauce.Concurrency = 2 - } - - // Set default docker file transfer to mount - if p.Docker.FileTransfer == "" { - p.Docker.FileTransfer = config.DockerFileMount - } - - // Default rootDir to . - if p.RootDir == "" { - p.RootDir = "." - msg.LogRootDirWarning() - } - - if p.Defaults.Timeout < 0 { - p.Defaults.Timeout = 0 - } - - for k := range p.Suites { - s := &p.Suites[k] - - if s.Timeout <= 0 { - s.Timeout = p.Defaults.Timeout - } - } - p.Sauce.Metadata.SetDefaultBuild() - - // Apply global env vars onto every suite. - for k, v := range p.Env { - for ks := range p.Suites { - s := &p.Suites[ks] - if s.Env == nil { - s.Env = map[string]string{} - } - s.Env[k] = v - } - } -} - -// Validate validates basic configuration of the project and returns an error if any of the settings contain illegal -// values. This is not an exhaustive operation and further validation should be performed both in the client and/or -// server side depending on the workflow that is executed. -func Validate(p *Project) error { - p.Puppeteer.Version = config.StandardizeVersionFormat(p.Puppeteer.Version) - if p.Puppeteer.Version == "" { - return errors.New(msg.MissingFrameworkVersionConfig) - } - - // Check rootDir exists. - if p.RootDir != "" { - if _, err := os.Stat(p.RootDir); err != nil { - return fmt.Errorf(msg.UnableToLocateRootDir, p.RootDir) - } - } - - regio := region.FromString(p.Sauce.Region) - if regio == region.None { - return errors.New(msg.MissingRegion) - } - - return nil -} - -// FilterSuites filters out suites in the project that don't match the given suite name. -func FilterSuites(p *Project, suiteName string) error { - for _, s := range p.Suites { - if s.Name == suiteName { - p.Suites = []Suite{s} - return nil - } - } - return fmt.Errorf(msg.SuiteNameNotFound, suiteName) -} From 0683ca3729ae84f7925dc7e4835c045a9bb2545b Mon Sep 17 00:00:00 2001 From: Felix P Date: Tue, 25 Apr 2023 19:33:08 +0200 Subject: [PATCH 2/2] Remove saucebot --- internal/cmd/signup/cmd.go | 22 ++-------------------- 1 file changed, 2 insertions(+), 20 deletions(-) diff --git a/internal/cmd/signup/cmd.go b/internal/cmd/signup/cmd.go index e2cfbbaff..f88400572 100644 --- a/internal/cmd/signup/cmd.go +++ b/internal/cmd/signup/cmd.go @@ -39,30 +39,12 @@ func Command() *cobra.Command { // Run runs the command func Run() error { - saucebotSignup := ` - (‾) - || - ################## /( Playwright, - ## ## ,..%( TestCafe, - (# ## .,,.....%( Cypress! - (## ## ((((.......%( - (## ## #### - ,################## ## %## - ### /### - /################\ /## - (#####/ sSSSs \##########) - /######( sSSSSSs )##### - ##/ ######\ sSSSs /###### - #### ##################### -## ## (#### ##### - ## ##### ##### - ##### ##### - + signupMessage := ` Achieve digital confidence with the Sauce Labs Testrunner Toolkit View and analyze test results online with a free Sauce Labs account: https://bit.ly/saucectl-signup` - fmt.Println(saucebotSignup) + fmt.Println(signupMessage) return nil }