Skip to content

Instantly share code, notes, and snippets.

View slawekradzyminski's full-sized avatar

Slawek Radzyminski slawekradzyminski

View GitHub Profile
const request = require('supertest');
const app = require('./app');
describe('GET /', () => {
it('should return a 200 status code and a welcome message', async () => {
const res = await request(app).get('/');
expect(res.statusCode).toEqual(200);
expect(res.body).toEqual({ message: 'Welcome to my API!' });
});
const registerUrl = 'http://localhost:4000/users/signup'
export const register = (user: User) => {
const registerResponse = http.post(registerUrl, registerBody(user), {
headers: jsonHeaders,
});
check(registerResponse, { "is status 201": (r) => r.status === 201 });
}
const registerBody = (user: User) => {
export default function () {
const user = getUser()
register(user)
sleep(3)
const token = login(user)
sleep(3)
getAllUsers(token)
}
import { sleep, check } from 'k6';
import { Options } from 'k6/options';
import http from 'k6/http';
export let options:Options = {
vus: 100,
iterations: 100
};
export default () => {
/// <reference types="cypress" />
describe('home page', () => {
const array = [
{
id: 1,
firstName: 'Joann',
lastName: 'Ocado',
username: '12345',
/// <reference types="cypress" />
describe('login page', () => {
const firstName = 'Slawek'
beforeEach(() => {
cy.visit('/login')
})
it('should login', () => {
/// <reference types="cypress" />
describe('login page', () => {
const firstName = 'Slawek'
beforeEach(() => {
cy.visit('/login')
})
it('should login', () => {
// ***********************************************************
// 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.
/// <reference types="cypress" />
import { getRandomString } from "../util/random"
describe('home page', () => {
const firstName = getRandomString()
const lastName = getRandomString()
const username = getRandomString()
const password = getRandomString()
/// <reference types="cypress" />
import { loginPage } from "../../pages/loginpage"
import { getRandomString } from "../../util/randomutil"
context('Register tests', () => {
const username = getRandomString()
const password = getRandomString()