Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: Add example showing usePackageLock #56

Merged
merged 6 commits into from
Nov 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,16 @@ jobs:
with:
working-directory: ./examples/browser_profile
concurrency: 10

react:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Run saucectl
uses: saucelabs/saucectl-run-action@v4
with:
working-directory: ./examples/react
concurrency: 10

36 changes: 36 additions & 0 deletions examples/react/.sauce/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
apiVersion: v1alpha
kind: testcafe
sauce:
region: us-west-1
concurrency: 2
metadata:
tags:
- e2e
- release team
- other tag
testcafe:
version: 3.6.2
configFile: .testcaferc.js
# Controls what files are available in the context of a test run (unless explicitly excluded by .sauceignore).
rootDir: ./
suites:
- name: "testcafe react example - firefox"
browserName: "firefox"
src:
- "tests/*.test.ts"
platformName: "Windows 11"

# Controls what artifacts to fetch when the suites have finished.
artifacts:
download:
when: always
match:
- console.log
directory: ./artifacts/

reporters:
spotlight: # Prints an overview of failed or otherwise interesting jobs.
enabled: true

npm:
usePackageLock: true
1 change: 1 addition & 0 deletions examples/react/.sauceignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
3 changes: 3 additions & 0 deletions examples/react/.testcaferc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
disableNativeAutomation: true,
};
48 changes: 48 additions & 0 deletions examples/react/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# saucectl TestCafe & React Example

This example demonstrates how to use a test time dependency when running your
TestCafe tests with saucectl.

## What You'll Need

The steps below illustrate one of the quickest ways to get set up. If you'd like
a more in-depth guide, please check out our
[documentation](https://docs.saucelabs.com/dev/cli/saucectl/#installing-saucectl).

### Install `saucectl`

```sh
npm install -g saucectl
```

### Set Your Sauce Labs Credentials

```sh
saucectl configure
```

## Running The Examples

Simply check out this repo, navigate into `examples/react` and run the
command below :rocket:

```sh
saucectl run
```

## Configuration

The test in this example requires the
[testcafe-react-selectors](https://github.com/DevExpress/testcafe-react-selectors)
package so it needs to be available in the test environment. We can define a
list of packages to install before test execution in the saucectl configuration
file.

```yaml
npm:
usePackageLock: true
```

Enabling the `usePackageLock` option ensures that the project's package.json and
package-lock.json are used during package installation. In most cases, this will
reduce the time needed for package installation.
Loading