Skip to content

Commit ef55dfc

Browse files
committed
Make all readme files point to Sauce Docs
1 parent 5381e04 commit ef55dfc

File tree

14 files changed

+38
-1565
lines changed

14 files changed

+38
-1565
lines changed

cypress/README.md

Lines changed: 6 additions & 187 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,13 @@ npm run sauce-visual-check
6767
Alternatively, you can run your tests on Sauce Labs.
6868

6969
- Install `saucectl`
70+
7071
```sh { name=npm-install-saucectl}
7172
npm install saucectl
7273
```
7374

7475
- Install the plugin in your `.sauce/config.yml`
76+
7577
```yml
7678
[...]
7779

@@ -83,6 +85,7 @@ npm:
8385
```
8486

8587
- Run saucectl
88+
8689
```sh { name=saucectl-run }
8790
npx saucectl run
8891
```
@@ -91,197 +94,13 @@ npx saucectl run
9194
- Accept all diffs, so they become new baselines.
9295

9396
- Run saucectl (with a modified screen)
97+
9498
```sh { name=saucectl-run-visual-check }
9599
VISUAL_CHECK=true npx saucectl run
96100
```
97101

98102
- Go to https://app.saucelabs.com/visual/builds to review changes.
99103

100-
## How to add visual testing to your setup
101-
102-
- Add plugin to your Cypress project
103-
104-
```sh
105-
npm install --save @saucelabs/cypress-visual-plugin
106-
```
107-
108-
- Add plugin in the project configuration, at the top of the file:
109-
```ts
110-
import { CypressSauceVisual } from '@saucelabs/cypress-visual-plugin';
111-
112-
export default defineConfig({
113-
e2e: {
114-
[...]
115-
setupNodeEvents(on, config) {
116-
CypressSauceVisual.register(on, config);
117-
},
118-
},
119-
})
120-
```
121-
122-
- Register Sauce Visual for Cypress commands. Add the following line in your `cypress/support/e2e.ts`:
123-
```ts
124-
import '@saucelabs/cypress-visual-plugin/commands';
125-
```
126-
127-
- Capture screenshot in one of your tests:
128-
129-
```ts
130-
context('Sauce Demo', () => {
131-
it('.type() - type into a DOM element', () => {
132-
cy.visit('https://www.saucedemo.com/')
133-
134-
cy.visualCheck('visual: my-homepage');
135-
})
136-
});
137-
```
138-
139-
- Configure with your Sauce credentials from https://app.saucelabs.com/user-settings.
140-
141-
```sh
142-
export SAUCE_USERNAME=__YOUR_SAUCE_USER_NAME__
143-
export SAUCE_ACCESS_KEY=__YOUR_SAUCE_ACCESS_KEY__
144-
```
145-
146-
- Run the test the way you are used to.
147-
148-
149-
## Advanced usage
150-
151-
### Test results summary
152-
153-
`cy.sauceVisualResults()` can be used to obtain a summary of test results. The command will make the test wait until the results are calculated and return a summary in format:
154-
```ts
155-
{
156-
QUEUED: number; // Diffs that are pending for processing. Should be 0 in case the test is completed without any timeouts
157-
EQUAL: number; // Diffs that have no changes detected
158-
UNAPPROVED: number; // Diffs that have detected changes and waiting for action
159-
APPROVED: number; // Diffs that have detected changes and have been approved
160-
REJECTED: number; // Diffs that have detected changes and have been rejected
161-
}
162-
```
163-
164-
`cy.sauceVisualResults()` is particularly useful for composing assertions on the result of each visual test.
165-
166-
Example:
167-
```ts
168-
const EXPECTED_TOTAL_UNAPPROVED_DIFFS = 0;
169-
170-
cy.sauceVisualResults().its("UNAPPROVED").should("eq", EXPECTED_TOTAL_UNAPPROVED_DIFFS);
171-
```
172-
173-
### Build name
174-
175-
`buildName` can be defined in the `cypress.config.js` configuration file.
176-
177-
Example
178-
```javascript
179-
export default defineConfig({
180-
e2e: {
181-
[...]
182-
saucelabs: {
183-
buildName: 'SauceDemo - Cypress',
184-
},
185-
[...]
186-
}
187-
}
188-
```
189-
190-
### Project
191-
192-
`project` can be defined in the `cypress.config.js` configuration file.
193-
194-
Example
195-
```javascript
196-
export default defineConfig({
197-
e2e: {
198-
[...]
199-
saucelabs: {
200-
project: process.env.GITHUB_REPOSITORY,
201-
},
202-
[...]
203-
}
204-
}
205-
```
206-
207-
### Branch
208-
209-
`branch` can be defined in the `cypress.config.js` configuration file.
210-
211-
Example
212-
```javascript
213-
export default defineConfig({
214-
e2e: {
215-
[...]
216-
saucelabs: {
217-
branch: process.env.GITHUB_REF_NAME,
218-
},
219-
[...]
220-
}
221-
}
222-
```
223-
224-
### Region
225-
226-
By default, visual tests are uploaded to `us-west-1` region. \
227-
This value can be overridden in the `cypress.config.js` configuration file.
228-
229-
Example
230-
```javascript
231-
export default defineConfig({
232-
e2e: {
233-
[...]
234-
saucelabs: {
235-
region: 'eu-central-1',
236-
},
237-
[...]
238-
}
239-
}
240-
```
241-
242-
### Ignored regions
243-
244-
#### Component-based ignored region
245-
246-
Sauce Visual provides a way to ignore a list of components.
247-
248-
An ignored component can be a specific element from the page.
249-
250-
Those ignored components are specified when requesting a new snapshot.
251-
252-
Example:
253-
254-
```javascript
255-
cy.visualCheck('login-page', { ignoredRegions: [
256-
cy.get('[data-test="username"]'),
257-
] });
258-
```
259-
260-
#### User-specified ignored region
261-
262-
Alternatively, ignored regions can be user-specified areas. A region is defined by four elements.
263-
264-
- `x`, `y`: The location of the top-left corner of the ignored region
265-
- `width`: The width of the region to ignore
266-
- `height`: The height of the region to ignore
267-
268-
*Note: all values are pixels*
269-
270-
Example:
271-
272-
```javascript
273-
cy.visualCheck('login-page', { ignoredRegions: [
274-
{
275-
x: 240,
276-
y: 800,
277-
width: 1520,
278-
height: 408
279-
}
280-
] });
281-
```
282-
283-
## Limitations
284-
285-
Sauce Visual plugin for Cypress **DOES NOT** support `cypress open`.
104+
## Installation & Usage
286105

287-
Screenshots will be captured and sent to Sauce Labs only when `cypress run` is executed.
106+
View installation and usage instructions on the [Sauce Docs website](https://docs.saucelabs.com/visual-testing/integrations/cypress/).

dotnet-nunit/README.md

Lines changed: 2 additions & 155 deletions
Original file line numberDiff line numberDiff line change
@@ -37,159 +37,6 @@ MODIFIED=true dotnet test
3737

3838
- Open the test or go to https://app.saucelabs.com/visual/builds to review changes.
3939

40-
## How to add visual testing to your setup
40+
## Installation & Usage
4141

42-
- Add [sauce visual](https://www.nuget.org/packages/SauceLabs.Visual/) dependency
43-
```powershell {"id":"01HHQ3FQDWBD7ZSD2PQKG2AKDZ"}
44-
dotnet add package SauceLabs.Visual
45-
```
46-
47-
- Declare a RemoteWebDriver and a VisualApi instance as class variables
48-
49-
```csharp {"id":"01HHQ3FQDWBD7ZSD2PQQ2E5HSZ"}
50-
using OpenQA.Selenium.Remote;
51-
using SauceLabs.Visual;
52-
53-
private RemoteWebDriver Driver { get; set; }
54-
private VisualClient VisualClient { get; set; }
55-
```
56-
57-
- Initialize WebDriver and VisualApi in `[OneTimeSetUp]` method
58-
59-
```csharp {"id":"01HHQ3FQDWBD7ZSD2PQTRQSGV3"}
60-
[OneTimeSetUp]
61-
public async Task Setup()
62-
{
63-
var capabilities = GetCapabilities();
64-
65-
Driver = new RemoteWebDriver(sauceUrl, capabilities);
66-
VisualClient = await VisualClient.Create(Driver, Region.UsWest1);
67-
// Enable other options
68-
VisualClient.CaptureDom = true;
69-
}
70-
```
71-
72-
- Add a check to one of your tests:
73-
74-
```csharp {"id":"01HHQ3FQDWBD7ZSD2PQZQMJRH1"}
75-
await VisualClient.VisualCheck("My login page")
76-
```
77-
78-
- Don't forget to quit the WebDriver in @AfterAll section
79-
80-
```csharp {"id":"01HHQ3FQDWBD7ZSD2PR1PW1V54"}
81-
[OneTimeTearDown]
82-
public async Task Teardown()
83-
{
84-
Driver?.Quit();
85-
VisualClient.Dispose();
86-
}
87-
```
88-
89-
- Create a `SetUpFixture` class that will take care of closing your Visual build:
90-
91-
```csharp {"id":"01HHQ3FQDWBD7ZSD2PR1PW1V54"}
92-
[SetUpFixture]
93-
public class SetupFixture
94-
{
95-
[OneTimeTearDown]
96-
public async Task RunAfterAnyTests()
97-
{
98-
await VisualClient.Finish();
99-
}
100-
}
101-
```
102-
103-
- Configure with your Sauce credentials from https://app.saucelabs.com/user-settings.
104-
105-
```sh {"id":"01HHQ3FQDWBD7ZSD2PR4Y27KEQ"}
106-
export SAUCE_USERNAME=__YOUR_SAUCE_USERNAME__
107-
export SAUCE_ACCESS_KEY=__YOUR_SAUCE_ACCESS_KEY__
108-
```
109-
110-
- Run the test the way you are used to.
111-
112-
## Advanced usage
113-
114-
### Test results summary
115-
116-
`VisualClient.VisualResults()` returns a summary of test results in `Dictionnary<DiffStatus, int>` format where `DiffStatus` is one of the following:
117-
118-
- `DiffStatus.QUEUED`: Diffs that are pending for processing. Should be 0 in case the test is completed without any timeouts
119-
- `DiffStatus.EQUAL`: Diffs that have no changes detected
120-
- `DiffStatus.UNAPPROVED`: Diffs that have detected changes and waiting for action
121-
- `DiffStatus.APPROVED`: Diffs that have detected changes and have been approved
122-
- `DiffStatus.REJECTED`: Diffs that have detected changes and have been rejected
123-
124-
Sample usage:
125-
126-
```csharp
127-
var expectedTotalUnapprovedDiffs = 0;
128-
129-
var results = await VisualClient.VisualResults();
130-
Assert.AreEqual(expectedTotalUnapprovedDiffs, results[DiffStatus.Unapproved]);
131-
```
132-
133-
### Build attributes
134-
135-
When creating the `VisualClient` client, extra fields can be set to define the context, thus acting on which baselines new snapshots will be compared to. ([More info on baseline matching](../../visual-testing.md#baseline-matching))
136-
137-
It needs to be defined through a `CreateBuildOptions` object.
138-
139-
Properties available:
140-
- `string? Name`: The name of the build
141-
- `string? Project`: The name of the project
142-
- `string? Branch`: The name of the branch
143-
- `string? CustomId`: A customId to be able to retrieve the current build
144-
- `string? DefaultBranch`: The name of the default branch
145-
146-
Example:
147-
148-
```csharp
149-
VisualClient = await VisualClient.Create(Driver, Region.UsWest1,
150-
new CreateBuildOptions() { Name = "My Visual Build", Project = "csharp-project", Branch = "feature-branch" });
151-
```
152-
153-
### Ignored regions
154-
155-
#### Component-based ignored region
156-
157-
Sauce Visual provides a way to ignore a list of components.
158-
159-
An ignored component can be a specific element from the page.
160-
161-
Those ignored components are specified when requesting a new snapshot.
162-
163-
Example:
164-
165-
```csharp
166-
var btnAction = Driver.FindElement(By.CssSelector(".app_logo"));
167-
168-
await VisualClient.VisualCheck("Inventory Page",
169-
new VisualCheckOptions()
170-
{
171-
IgnoreElements = new[] { btnAction }
172-
});
173-
```
174-
175-
#### User-specified ignored region
176-
177-
Alternatively, ignored regions can be user-specified areas. A region is defined by four elements.
178-
179-
- `x`, `y`: The location of the top-left corner of the ignored region
180-
- `width`: The width of the region to ignore
181-
- `height`: The height of the region to ignore
182-
183-
_Note: all values are pixels_
184-
185-
Example:
186-
187-
```csharp
188-
await VisualClient.VisualCheck("Inventory Page",
189-
new VisualCheckOptions()
190-
{
191-
IgnoreRegions = new[] { new IgnoreRegion(10, 10, 100, 100) }
192-
});
193-
```
194-
195-
[Follow me](/wd-java/src/test/java/com/example/InventoryIgnoreRegionsTest.java#L38-L50) to see complete working example
42+
View installation and usage instructions on the [Sauce Docs website](https://docs.saucelabs.com/visual-testing/integrations/csharp/).

0 commit comments

Comments
 (0)