Skip to content

Instantly share code, notes, and snippets.

Avatar

Slawek Radzyminski slawekradzyminski

View GitHub Profile
View homepagestub.spec.js
/// <reference types="cypress" />
describe('home page', () => {
const array = [
{
id: 1,
firstName: 'Joann',
lastName: 'Ocado',
username: '12345',
View loginstub.spec.js
/// <reference types="cypress" />
describe('login page', () => {
const firstName = 'Slawek'
beforeEach(() => {
cy.visit('/login')
})
it('should login', () => {
View loginstub.spec.js
/// <reference types="cypress" />
describe('login page', () => {
const firstName = 'Slawek'
beforeEach(() => {
cy.visit('/login')
})
it('should login', () => {
View index.js
// ***********************************************************
// This example support/index.js is processed and
// loaded automatically before your test files.
//
// This is a great place to put global configuration and
// behavior that modifies Cypress.
//
// You can change the location of this file or turn off
// automatically serving support files with the
// 'supportFile' configuration option.
View delete.spec.js
/// <reference types="cypress" />
import { getRandomString } from "../util/random"
describe('home page', () => {
const firstName = getRandomString()
const lastName = getRandomString()
const username = getRandomString()
const password = getRandomString()
View loginwithstub.spec.js
/// <reference types="cypress" />
import { loginPage } from "../../pages/loginpage"
import { getRandomString } from "../../util/randomutil"
context('Register tests', () => {
const username = getRandomString()
const password = getRandomString()
View registerpage.js
export const registerPageCss = {
title: 'h2',
registerButton: '.btn-primary',
fieldSelector: '.form-group',
errorMessage: '.invalid-feedback',
usernameField: '[name=username]',
firstNameField: '[name=firstName]',
lastNameField: '[name=lastName]',
passwordField: '[name=password]'
}
View register.spec.js
/// <reference types="cypress" />
context('Register tests', () => {
beforeEach(() => {
cy.visit('/register')
})
it('Should register', () => {
cy.get('[name=firstName]').type(getRandomString())
View users.json
[
{
"id": 1,
"firstName": "Slawomir",
"lastName": "Radzyminski",
"username": "slawenty",
"password": "password"
},
{
"id": 2,
View homepage.spec.js
/// <reference types="cypress" />
context('Home page', () => {
beforeEach(() => {
cy.setTokenInLocalStorage()
cy.visit('/')
})
it('Should display at least one user', () => {