youriwims / testrunner-toolkit-cascadia

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cypress + TestRunner Toolkit Cascadia Conference

Build CircleCI Status PRs Welcome Chromium version

Sauce Labs Testrunner Toolkit is a containerized testing solution that simplifies user setup, speeds up test execution time and supports native Javascript frameworks like Puppeteer and Playwright for running end-to-end web tests with Sauce Labs.

Requirements

  • Docker installed
  • Make sure the Docker daemon is running (e.g. docker info works in your terminal)
  • A Sauce Labs account; if you don't have one, start a free trial

Install

Using NPM:

npm install -g saucectl

Connect to Sauce Labs

A Sauce Labs user name and access key are needed to post the test results. You can get your SAUCE_ACCESS_KEY from Account > User Settings in Sauce Labs.

To authenticate yourself, the following environment variables need to be set:

  • SAUCE_USERNAME
  • SAUCE_ACCESS_KEY

You can export them as follows:

export SAUCE_USERNAME=<your-username>
export SAUCE_ACCESS_KEY=<your-access-key>

If you are using a cloud CI/CD tool, we strongly suggest protecting these values through secrets or context variables.

Getting started

npx saucectl new

This command will ask you to choose one of the frameworks:

After that, a ./sauce/config.yml file and an example test under the tests directory will be created, where you can start working from.

Run your first test

npx saucectl run

This command will run the example test based on the ./.sauce/config.yml file.

Using saucectl

To learn more about saucectl and its commands and flags, please visit the saucectl repository.

Quick demo

Demo

Configuration

saucectl requires a configuration file to know what tests to run and what framework to use. By default, .sauce/config.yml will be the place where saucectl will look for its configuration.

NOTE: Test files need to match (spec|test) in their file name so they will be automatically detected as testfiles.

Run a single file

files:
  - ./tests/file.spec.js

Run multiple files

files:
  - ./tests/*.spec.js

Run an entire directory

files:
  - ./tests/cypress/

Images

Image is hosted in Docker Hub

Base image + Cypress contains saucectl with different versions of Cypress.

Examples

Cypress Snippet

context('Actions', () => {
	beforeEach(() => {
		cy.visit('https://example.cypress.io/commands/actions')
	})
	it('.type() - type into a DOM element', () => {
		// https://on.cypress.io/type
		cy.get('.action-email')
			.type('fake@email.com').should('have.value', 'fake@email.com')
	})
})

About

License:MIT License


Languages

Language:JavaScript 100.0%