# webplex

> ### Getting Started

Latest version **1.5.1** (published 2022-10-04) · ViacomCBS license · 0 weekly downloads

## Install

```sh
npm install webplex
pnpm add webplex
yarn add webplex
bun add webplex
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; large bundle.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.5.1 |
| Published | 2022-10-04 |
| First published | 2022-10-04 |
| Weekly downloads | 0 |
| License | ViacomCBS |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 12.7 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Acatl Pacheco |
| Maintainers | yasemin.yarnell |

## Links

- npm: https://www.npmjs.com/package/webplex
- npm.io page: https://npm.io/package/webplex

## Recent versions

- 1.5.1 (latest) — 2022-10-04

## README

# Cypress-WebPlex

### Getting Started

Some E2E tests in Webplex have been implemented using [Cypress](https://www.cypress.io/), a JavaScript testing framework to test everything running in the browser.
We used the Cypress Module API to manage the configurations,
here some usefullt tips about it: https://docs.cypress.io/guides/guides/module-api.

### Launch Cypress Tests

In the root of webplex:

```sh
yarn cypress:run  # run all tests headlessly in the Electron browser.
yarn cypress:open # open interactive-mode window
```

With the previous commands all tests will be launched in the **stage** enviroment.
To run tests in different enviroments it is possible to set an `-env` variable in the terminal:

```sh
yarn cypress:run --env prod  # these will launch all the tests with production url
```

We currently have 5 enviroments that we can pass to `--env`:

- `stage`
- `prod`
- `review`
- `dev => run e2e tests on a Feature Instance`
- `local=> run e2e test on the local enviroment`

### Generate a new test

Inside the folder **./cypress/integration** create a new file with `.spec.js` extension.
Each test-case must be wrapped with **TestFiltering** function and **Cypress.env('sites').forEach(()=>{})**:

```javascript
/// <reference types="cypress" />
TestFilter(['smoke'], () => {
  Cypress.env('sites').forEach(site => {
    describe('Some test suite', () => {
      before(() => {
        cy.visit(site.urls)
      })
      it('Some test case',()=>{...})
    })
  })
})
```

### Tests Filtering

```sh
CYPRESS_TEST_TAGS=testToBeFiltered yarn cypress:run
```

To execute tests with two tags(ex.: regression, smoke) we will use the command:

```sh
CYPRESS_TEST_TAGS=testToBeFiltered1,testToBeFiltered2 yarn cypress:run
```

Using `CYPRESS_TEST_TAGS` variable we filter the tests we want to run.
Each test-case is wrapped by a `TestFilter` function that has been defined inside the **.cypress/support/testFilter.js**

```javascript
/// <reference types="cypress" />
TestFilters(['smoke', 'regression'], () => {
  describe('Some Test Suite', () => {
    it('Some Test Case', () => {
      ;/..../
    })

    it('Some Test Case 2', () => {
      ;/..../
    })
  })
})
```

The parameters we pass to the **TestFilter** function (ex.: 'smoke', 'regression') are the values that we will pass to the `CYPRESS_TEST_TAGS` variable for filtering.

### Test Reporting

(https://docs.cypress.io/guides/tooling/reporters)
We are currently using **Mochawesome** for test reporting.
After each test finishes to run mohcawesome generate a folder **./cypress/cypress-test-report** with an HTML test report inside it.

Key to run cypress dashboard=cypress run --record --key 3753e23a-9889-4478-a122-c04a29ef3824
Please ensure that your cypress.config.js file is checked into source control.

Run below command to run cypress tests:
npm run test
The command to generate report:  npm run allure:report
Directory to generate the report : http://127.0.0.1:62553/index.html

---
_Source: https://npm.io/package/webplex · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
