Skip to content

Instantly share code, notes, and snippets.

@andreybleme
andreybleme / address.spec.js
Last active July 2, 2021 14:55
andreybleme.com | Boosting Cypress end-to-end Tests
it('Should choose an address', () => {
cy.visit(urls.contact);
cy.setPlace('autocomplete-address', 'Pretty Street');
});
@andreybleme
andreybleme / cypress.json
Created March 28, 2020 00:03
andreybleme.com | Boosting Cypress end-to-end Tests
{
"projectId": "e54a51",
"defaultCommandTimeout": 10000,
"pageLoadTimeout": 120000
}
@andreybleme
andreybleme / integration-tests.yml
Last active March 26, 2020 23:44
andreybleme.com | Boosting Cypress end-to-end Tests
name: integration-tests-frontend
on: [pull_request]
jobs:
cypress-run:
runs-on: ubuntu-16.04
strategy:
fail-fast: false
matrix:
containers: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
steps:
@andreybleme
andreybleme / integration-tests.yml
Created March 26, 2020 23:27
andreybleme.com | Boosting Cypress end-to-end Tests
name: integration-tests
on: [pull_request]
jobs:
cypress-run:
runs-on: ubuntu-16.04
strategy:
# when one test fails, DO NOT cancel the other
# containers, because this will kill Cypress processes
# leaving the Dashboard hanging
# https://github.com/cypress-io/github-action/issues/48
@andreybleme
andreybleme / integration-tests.yml
Created February 28, 2020 02:02
andreybleme.com | Continuous Integration with Github Actions and Cypress end-to-end tests
name: integration-tests
on: [push]
jobs:
cypress-run:
runs-on: ubuntu-16.04
steps:
- name: Checkout
uses: actions/checkout@v1
# https://github.com/cypress-io/github-action
- name: Cypress run
@andreybleme
andreybleme / eventRequest.json
Last active January 18, 2020 14:46
andreybleme.com | Validate user e-mail domains with AWS Cognito
// console.log(JSON.stringify(event));
{
"version": "1",
"region": "eu-west-1",
"userPoolId": "eu-west-1_ad663Ml0G",
"userName": "Lucas",
"callerContext": {
"awsSdkVersion": "aws-sdk-unknown-unknown",
"clientId": "64ufi53tj8m8"
},
@andreybleme
andreybleme / index.js
Last active January 18, 2020 14:44
andreybleme.com | Validate user e-mail domains with AWS Cognito
exports.handler = async (event, context, callback) => {
const userEmailDomain = event.request.userAttributes.email.split("@")[1];
const allowedDomain = 'andreybleme.com';
if (userEmailDomain === allowedDomain) {
callback(null, event);
} else {
const error = new Error('Cannot authenticate users from domains different from ' + allowedDomain);
callback(error, event);
@andreybleme
andreybleme / observable.ts
Last active January 11, 2020 15:48
andreybleme.com | Securing Vuejs applications with Access Control List
import Vue from 'vue';
export const store = Vue.observable({
role: '',
disallowedRoutes: [] as any
});
export const mutations = {
setRole(role) {
store.role = role;
@andreybleme
andreybleme / index.ts
Last active January 11, 2020 15:48
andreybleme.com | Securing Vuejs applications with Access Control List
import Vue from 'vue';
import VueRouter from 'vue-router';
import routes from './routes';
import { store, mutations } from '@/setup/observable';
import { api } from '@/api';
Vue.use(VueRouter);
const router = new VueRouter({
@andreybleme
andreybleme / crazy-client-production.properties
Created August 16, 2019 02:19
andreybleme.com | Centralized configuration with Spring Cloud Config
url=postgres://andreybleme-prod:password123prod@andreybleme.com:5432/my-prod-database
url.encrypted={cipher}3cad1441589b2bfb37c0e6127499222779a3e07ce073914033dece432f7331ea2f6bb2b955dadff60ec62100501