Skip to content

Instantly share code, notes, and snippets.

View IsmagilovQA's full-sized avatar

Vitaliy IsmagilovQA

  • Brightgrove LTD
  • Kharkiv, Ukraine
View GitHub Profile
@IsmagilovQA
IsmagilovQA / gist:82825bff66f0a9143d79409264bac17c
Created November 8, 2022 14:55
Selenide - custom condition: textIgnoreSpaces
public static Condition textIgnoreSpaces(String text) {
return new Condition("text with spaces" + text) {
@Override
@Nonnull
public CheckResult check(Driver driver, WebElement element) {
String textWithSpaces = element.getText();
return new CheckResult(textWithSpaces.replaceAll("\\s+", "").equals(text), textWithSpaces);
}
};
}
@IsmagilovQA
IsmagilovQA / gist:a3c702517b13ca8e5ec433234983e8ef
Created November 8, 2022 14:53
Selenide - custom conditions
https://github.com/selenide/selenide/wiki/Custom-conditions#moving
@IsmagilovQA
IsmagilovQA / gist:3e7c6aeddcd0b103d2155a23d8c61a5a
Last active January 5, 2022 15:07
Selenium | Open new tab via Keys and JavaScript
Option 1: driver.FindElement(By.CssSelector("body")).SendKeys(Keys.LeftControl + "T");
Option 2: String selectLinkOpeninNewTab = Keys.chord(Keys.CONTROL,"t");
Option 3: executeJavaScript("window.open()");
Option 4: driver.switchTo().window(new ArrayList<>(WebDriverRunner.getWebDriver().getWindowHandles()).get(numberTab - 1));
@IsmagilovQA
IsmagilovQA / gist:979b72bf50a4445c750f55e4efe34e0f
Created January 5, 2022 15:00
Selenide | Scrolling via JavaScript
Скролл в самый верх делаю таким способом -
executeJavaScript("$(document).scrollTop(0)", "");
Скролл в самый низ делаю таким способом -
window.scrollTo(0,document.body.scrollHeight);
COURSE [Chrome Dev Tools]
Arsbatyrov.ru/chrome/main ->
https://playground.learnqa.ru/chrome/#
Открыть dev tools -> Command+Option+i
Вкладка Elements
Теги
< tag>
(интерпретатор - оболочка -> bash for Unix systems)
( use this link: https://appleinsider.ru/tips-tricks/mac-os-x-nachinayushhim-o-rabote-v-terminale.html)
Интерпретатор zsh по сути улучшенный bash.
В заголовке терминала отображен текущий каталог
ls посмотреть содержимое текущего каталога (LIST)
ls -ltr посмотреть с датой и правами (нижний в списке будет последним добавленным/измененным)
COURSE [GIT]
https://ru.hexlet.io/courses/intro_to_git
Основы Git
git --version - посмотреть установленную версию
brew install git - установить гит
echo "export LANG=en_US.UTF-8" >> ~/.bashrc потом source ~/.bashrc - изменяет язык гита в консоли
git config --global user.name "Vitaliy Ismagilov" - установить имя
git config --global user.email "[email protected]" - установить почту
COURSE [CSS Selectors]
Searching is based on Tags and Attributes.
Tags: div, input, a, ul, li
Attributes: id, class, name, type
Special annotations (shortcuts):
for id -> #idName
For class -> .className
Basics
Searching is based on Tags and Attributes.
Instructions:
/ -> absolute xpath, start searching from the root node
// -> relative xpath, starts from the node of your choice
//* -> we can put * if we don’t want to specify tag name (means ANY tag)
[@attributeName] -> @ means attribute in [ ]
‘Value’ -> all values we should put inside ‘ ‘
@IsmagilovQA
IsmagilovQA / gist:feebe283dbfc0bd97dfde2d47760cb89
Created January 5, 2022 14:46
[IntelliJ IDEA hotkeys on macOS]
- Double shift -> open search panel;
- Command + 1 -> open/close left navigation bar
- Command + N -> `New` (in navigation bar) / `Generate` (in main window)
- Command + D -> Duplicate the code row
- Option + Command + V -> extract variable (every part of line can be extracted). Option 1
- .var - at the end of line to declare variable (postfix completion). Option 2
- Control + Space -> completion (Control + Space x 2 -> suggest variants in case no imports)
- Control + Shift + Space -> smart completion (only available options for current type)
- Option + Enter -> resolving the problem (e.g. add imports automatically, optimise imports, run test)
- Control + Option + O -> optimise imports