Skip to content

Instantly share code, notes, and snippets.

View javigomez's full-sized avatar

Javier Gomez javigomez

View GitHub Profile
@javigomez
javigomez / sourcegraph_batch_changes_example.yml
Created October 13, 2022 14:54
sourcegraph batch changes example
name: migrate-gha-runners-to-ephemeral
description: This batch change migrates GHA runners to ephemeral
on:
# Find all repositories that contain [self-hosted, {runner}] without -ephemeral suffix
- repositoriesMatchingQuery: context:global content:"runs-on:" NOT content:"-ephemeral" lang:yaml file:.github/workflows/* patternType:literal
# Describe the changeset (e.g., GitHub pull request) you want for each repository.
changesetTemplate:
title: 'build(NOJIRA-1234): migrate GHA runners to ephemeral'
body: Updates GHA runners to ephemeral runners. For more info check [this](https://www.notion.so/typeform/Migration-to-Ephemeral-runners-ffd85bafaed44cfd8a0c135701c4a6a7)
branch: NOJIRA-1234-ephemeral-runners
@javigomez
javigomez / page-object.rb
Created October 15, 2018 22:12
page object test
require 'rubygems'
require 'selenium-webdriver'
require 'page-object/page_factory'
require_relative 'pages/duckduckgo_page'
World(PageObject::PageFactory)
browser = Selenium::WebDriver.for :chrome
# browser.get "http://duckduckgo.com"
my_page_object = DuckduckgoSearchPage.new(browser)
@javigomez
javigomez / wait-for-grid.sh
Created April 20, 2018 10:30
Wait for Selenium Grid by @diemol
#!/bin/bash
# wait-for-grid.sh
set -e
cmd="$@"
while ! curl -sSL "http://hub:4444/wd/hub/status" 2>&1 \
| jq -r '.value.ready' 2>&1 | grep "true" >/dev/null; do
echo 'Waiting for the Grid'
# IMAGENES
docker image ls
# PARAR CONTAINERs
docker-compose down
docker stop $(docker ps -q)
docker kill -f CONTAINER_ID
# LIMPIAR IMAGENES Y CONTENEDORES ANTIGUOS
docker system prune
@javigomez
javigomez / multiple_choice_block.rb
Created November 23, 2017 16:11
multiple choice page object
#file: features/support/pages/multiple_choice_block.rb
module MultipleChoiceBlock
include PageObject
divs(:choice_list, css: '.is-focused .stkv-qa-choice')
sections(:block_list, class: 'stkv-qa-block')
def commit_answer
self.choice_list_elements[selected_choice_id].click
end
# file: features/support/pages/short_text_block.rb
module InputTextBlock
include PageObject
text_field(:text_input, css: '.is-focused input')
button(:ok_button, css: '.is-focused .stkv-qa-block-btn.is-visible .stkv-qa-block-btn__button')
def commit_answer
self.fill_answer
@javigomez
javigomez / test_steps.rb
Created November 23, 2017 16:09
step file
# file: features/step_definitions/test_step.rb
...
When(/^I (?:commit|have committed) the block$/) do
@current_progress_bar =
on_page(@block_type.to_page_object).commit_answer
end
@javigomez
javigomez / progress_bar_declarative_gherkin.feature
Created November 23, 2017 16:09
Progress bar declarative gherkin
# file: features/acceptance/functionality/progress_bar_functionality.feature
Scenario Outline: Progress bar status if block is answered
Given I have visited a typeform with many <block type> blocks
When I commit the block
Then the progress bar should increase
Examples:
| block type |
| short text |
| multiple choice |
@javigomez
javigomez / progress_bar_imperative_gherkin.feature
Created November 23, 2017 16:07
wrong progress bar feature
Scenario: Progress bar status if block is answered
Given I have visited a typeform with 3 blocks
And the "What is your name" "short text" block is focused
When I answer "my name is Javi"
And I click "Ok button"
Then the progress bar should increase to 33%
Then the "How old are you" "number" block is focused
When I answer "35"
...
@javigomez
javigomez / progress_bar.feature
Created November 23, 2017 16:05
Progress Bar Feature Gherkin
Feature: Progress bar functionality
As a typeform user
I want to see the progress bar
So I know how many questions do I still have to answer