Skip to content

Instantly share code, notes, and snippets.

View LeonardoFassini's full-sized avatar

Leonardo Tironi Fassini LeonardoFassini

View GitHub Profile
/// <reference types="cypress" />
{
"extends": "../tsconfig",
"compilerOptions": {
"baseUrl": "../node_modules",
"target": "es5",
"types": ["cypress", "node"]
},
"include": ["**/*.ts"]
}
const cucumber = require('cypress-cucumber-preprocessor').default;
const browserify = require('@cypress/browserify-preprocessor');
module.exports = (on, config) => {
const options = browserify.defaultOptions;
options.browserifyOptions.plugin.unshift(['tsify']);
on('file:preprocessor', cucumber(options));
};
Before({ tags: "@loggedIn" }, () => {
localStorage.setItem('@authLS', 'admin');
});
Feature: Todo
I want to be able to manage my todos
Background: Logging in
Given I am logged in
Scenario: List all todos
Given I am at the todo page
Then There should be a list of todos
import { AuthContext } from '@app/modules/app/auth.provider';
import { AppPath } from '@app/modules/app/routes/routes-list';
import { ContentFullHeightStyled } from '@app/modules/login/components/atm.content-full-height';
import { useLogin } from '@app/modules/login/use-login.hook';
import { Button } from '@atomic/atm.button/button.component';
import { ButtonKind } from '@atomic/atm.button/button.style';
import { Card } from '@atomic/atm.card/card.component';
import { VSeparator } from '@atomic/atm.separator/separator.style';
import { H1, Text } from '@atomic/atm.typography';
import { FlashMessageDispatcherContext } from '@atomic/mol.flash-message/flash-message.provider';
// use
When(/I insert the (incorrect|correct) username/, (username: string) => {})
// instead of
When('I insert the (incorrect|correct) username', (username: string) => {})
// use
And('There should be a conversation history with the feedback {string}', (feedback: string) => {})
// instead of
And(/There should be a conversation history with the feedback {string}/, (feedback: string) => {})
import { Given, When, Then } from 'cypress-cucumber-preprocessor/steps';
Given('I am at the login page', () => {
cy.visit('/');
});
When('I type the correct username', () => {
cy.get('[data-test=loginInput]').type('admin');
});
When('I put {string} {string} in the {string}', (first, second, third) => {
// do something here...
})