This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# bash script that can setup environment with common linting and testing tools | |
yes="${@}" | |
function yes_or_no { | |
if [[ $yes == "-y" ]]; then | |
echo "🛑👍🛑 !!! skipping question !!! 🛑👍🛑" | |
else |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
packagejson=$(cat package.json) | |
addtopackagejson=$(echo '{ | |
"author": "Marcel Mokoš <https://github.com/marcelmokos>", | |
"pre-commit": [ | |
"lint:pre-commit" | |
], | |
"scripts": { | |
"test": "jest --env=jsdom", | |
"test:coverage": "yarn test -- --coverage", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
root: true | |
parser: babel-eslint | |
extends: | |
# http://eslint.org/docs/user-guide/configuring#using-eslintrecommended | |
- eslint:recommended | |
# https://github.com/gajus/eslint-plugin-flowtype | |
- plugin:flowtype/recommended | |
# https://www.npmjs.com/package/eslint-config-airbnb-base |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# EditorConfig: http://EditorConfig.org | |
# EditorConfig Properties: https://github.com/editorconfig/editorconfig/wiki/EditorConfig-Properties | |
# top-most EditorConfig file | |
root = true | |
### defaults | |
[*] | |
charset = utf-8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*-------- Promise.then() syntax ---------*/ | |
// when expect() is in Promise.then() method body | |
// we have to use callback function done() | |
it("test two inputs to have labels with same classes using Promise.then() ", (done) => { | |
getInputsLabelElement(input1).then((label1) => { | |
getInputsLabelElement(input2).then((label2) => { | |
label1.getAttribute("class").then((label1Classes) => { | |
label2.getAttribute("class").then((label2Classes) => { | |
expect(label1Classes).toBe(label2Classes); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*-------- Promise.then() syntax ---------*/ | |
/** | |
* @param inputElementWithLabel {ElementFinder} | |
* @returns {Promise.<ElementFinder>} | |
*/ | |
export const getInputsLabelElement = (inputElementWithLabel) => { | |
inputElementWithLabel.getAttribute("id").then((inputId) => { | |
return $(`[for='${inputId}']`); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Base ui component class that other components should inherit from. | |
*/ | |
export default class UIComponent { | |
/** | |
* This class property enables use of specific functions 'isDisplayed' and 'waitUntilDisplayed' | |
* @type {ElementFinder} | |
*/ | |
selector = undefined; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Page from "../../utils/Page"; | |
import Common from "./Common"; | |
export default class Homepage extends Page { | |
selector = $("#page-main"); | |
get = () => { | |
/** | |
* Browser window will maximize width and height | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Homepage from "./pages/Homepage"; | |
const homepage = new Homepage(); | |
describe("homepage", () => { | |
describe("when on homepage", () => { | |
beforeAll(() => { | |
homepage.get(); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Homepage from "./pages/Homepage"; | |
const homepage = new Homepage(); | |
describe("homepage", () => { | |
describe("when on homepage", () => { | |
beforeAll(() => { | |
homepage.get(); | |
}); |