Skip to content

Instantly share code, notes, and snippets.

View jan-molak's full-sized avatar
🌻
For better automated tests, try Serenity/JS!

Jan Molak jan-molak

🌻
For better automated tests, try Serenity/JS!
View GitHub Profile
import { actorCalled } from '@serenity-js/core';
import { BrowseTheWeb } from '@serenity-js/core';
import { protractor } from 'protractor';
actorCalled('Alice')
.whoCan(BrowseTheWeb.using(protractor.browser))
.attemptsTo(
AnswerQuizQuestion("How much of Earth's water is fresh?", "3%")
)
import { Task } from '@serenity-js/core';
import { Click } from '@serenity-js/protractor';
const AnswerQuizQuestion = (title: string, answer: string) =>
Task.where(`#actor answers ${ answer } to ${ title }`,
Click.on(
QuizQuestion.answers()
.of(Quiz.question(title))
.where(Text, equals(answer))
.first()
QuizQuestion.answers()
.of(Quiz.question("How much of Earth's water is fresh?"))
.where(Text, equals('3%'))
.first()
QuizQuestion.answers()
.of(Quiz.question("How much of Earth's water is fresh?"))
import { Target, Text } from '@serenity-js/protractor';
import { equals } from '@serenity-js/assertions';
import { by } from 'protractor';
class Quiz {
static questions = () =>
Target.all('questions').located(by.css('.quiz-question'))
static question = (title: string) =>
Quiz.questions()
import { Target } from '@serenity-js/protractor';
import { by } from 'protractor';
class Quiz {
static questions = () =>
Target.all('questions').located(by.css('.quiz-question'))
}
class QuizQuestion {
static title = () =>
<form id="quiz">
<section class="quiz-question">
<h3>How much of Earth's water is fresh?</h3>
<ul class="answers">
<li>23%</li>
<li>3%</li>
<li>42%</li>
</ul>
@jan-molak
jan-molak / private_fork.md
Created July 22, 2020 10:08 — forked from 0xjac/private_fork.md
Create a private fork of a public repository

The repository for the assignment is public and Github does not allow the creation of private forks for public repositories.

The correct way of creating a private frok by duplicating the repo is documented here.

For this assignment the commands are:

  1. Create a bare clone of the repository. (This is temporary and will be removed so just do it wherever.)

git clone --bare git@github.com:usi-systems/easytrace.git

@jan-molak
jan-molak / delete.bat
Created December 7, 2018 12:05 — forked from DavidEdwards/delete.bat
Delete all files and directory structure at the given path
@echo off
REM Completely delete file / directory
echo Are you sure that you want to delete %1?
echo y/n
choice /c:yn > nul
if errorlevel 2 goto no
if errorlevel 1 goto start
@jan-molak
jan-molak / authoriser.js
Created April 6, 2016 15:52
Mocking JavaScript a little code examples
'use strict';
/** @constructor */
function Authoriser() { }
/**
* @public
*
* @param {String} username
* @param {String} password