Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/awinogradov/dom-objects

DOM Objects declarations for tests, e2e, cypress and etc.
https://github.com/awinogradov/dom-objects

cypress dom e2e e2e-tests utils

Last synced: 3 months ago
JSON representation

DOM Objects declarations for tests, e2e, cypress and etc.

Awesome Lists containing this project

README

        

# DOM Objects

DOM Objects declarations for tests, e2e, cypress and etc.

> npm i -D dom-objects

## Usage

``` ts
// utils/objects.ts
import { configureDomObjects } from 'dom-objects';

const DO = configureDomObjects({
attributeName: 'cy',
});

export const header = DO('header');
export const createMenu = header.add('createMenu');
export const createButton = createMenu.add('createButton');
```

``` tsx
// src/components/button.tsx
import { createButton } from '../../utils/objects';

export const Page = () => (


Submit


)
```

``` ts
// cypress/e2e/test.cy.ts
import { createButton } from '../../utils/objects';

describe('Test', () => {
it('must be', () => {
//...
cy.get(createButton.query).click();
//...
});
});
```

### License [MIT](https://github.com/awinogradov/dom-objects/blob/main/LICENSE)