Skip to content

Commit

Permalink
feat: Support setting reporters for TestCafe (#832)
Browse files Browse the repository at this point in the history
* feat: Support setting reporters for TestCafe

* clean up

* Update api/v1alpha/framework/testcafe.schema.json

Co-authored-by: Mike Han <[email protected]>

* Update internal/cmd/run/testcafe.go

Co-authored-by: Mike Han <[email protected]>

* re-generate schema

* Temporarily disable iOS tests

---------

Co-authored-by: Mike Han <[email protected]>
  • Loading branch information
tianfeng92 and mhan83 authored Jan 3, 2024
1 parent 3af4169 commit ce8f67f
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 14 deletions.
28 changes: 15 additions & 13 deletions .sauce/testcafe.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,18 @@ suites:
- "*.test.js"
platformName: "Windows 10"

- name: iOS Test
browserName: safari
src:
- "*.test.js"
simulators:
- name: iPhone 12 Simulator
platformName: iOS
platformVersions:
- "14.3"
- name: iPad mini (5th generation) Simulator
platformName: iOS
platformVersions:
- "14.3"
# TODO: Temporarily disable iOS tests. They will be re-enabled once devx-2711 is resolved.
# - name: iOS Test
# browserName: safari
# src:
# - "*.test.js"
# simulators:
# - name: iPhone 12 Simulator
# platformName: iOS
# platformVersions:
# - "14.3"
# - name: iPad mini (5th generation) Simulator
# platformName: iOS
# platformVersions:
# - "14.3"
#
9 changes: 9 additions & 0 deletions api/saucectl.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -1778,6 +1778,15 @@
"2.0.1",
"2.0.0"
]
},
"configFile": {
"description": "The TestCafe configuration file.",
"type": "string",
"examples": [
"testcaferc.json",
"testcaferc.js",
"testcaferc.cjs"
]
}
},
"required": [
Expand Down
9 changes: 9 additions & 0 deletions api/v1alpha/framework/testcafe.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,15 @@
"2.0.1",
"2.0.0"
]
},
"configFile": {
"description": "The TestCafe configuration file.",
"type": "string",
"examples": [
"testcaferc.json",
"testcaferc.js",
"testcaferc.cjs"
]
}
},
"required": [
Expand Down
5 changes: 4 additions & 1 deletion internal/cmd/run/testcafe.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ func NewTestcafeCmd() *cobra.Command {
sc.Fset = cmd.Flags()
sc.String("name", "suite::name", "", "Set the name of the job as it will appear on Sauce Labs")

// TestCafe
sc.String("testcafe.version", "testcafe::version", "", "The TestCafe version to use")
sc.String("testcafe.configFile", "testcafe::configFile", "", "The path to TestCafe config file")

// Browser & Platform
sc.String("browser", "suite::browserName", "", "Run tests against this browser")
sc.String("browserVersion", "suite::browserVersion", "", "The browser version (default: latest)")
Expand Down Expand Up @@ -104,7 +108,6 @@ func NewTestcafeCmd() *cobra.Command {

// Misc
sc.String("rootDir", "rootDir", ".", "Control what files are available in the context of a test run, unless explicitly excluded by .sauceignore")
sc.String("testcafe.version", "testcafe::version", "", "The TestCafe version to use")
sc.StringSlice("clientScripts", "suite::clientScripts", []string{}, "Inject scripts from the specified files into each page visited during the tests")
sc.Float64("speed", "suite::speed", 1, "Specify the test execution speed")
sc.Bool("disablePageCaching", "suite::disablePageCaching", false, "Prevent the browser from caching page content")
Expand Down
2 changes: 2 additions & 0 deletions internal/testcafe/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,8 @@ type Screenshots struct {
type Testcafe struct {
// Version represents the testcafe framework version.
Version string `yaml:"version,omitempty" json:"version"`
// ConfigFile represents the testcafe config file
ConfigFile string `yaml:"configFile,omitempty" json:"configFile"`
}

// FromFile creates a new testcafe project based on the filepath.
Expand Down

0 comments on commit ce8f67f

Please sign in to comment.