Skip to content

Commit

Permalink
⬆️ static analysis revamp
Browse files Browse the repository at this point in the history
  • Loading branch information
sergiomartins committed Aug 29, 2020
1 parent 3516f6f commit fa5752b
Show file tree
Hide file tree
Showing 11 changed files with 37 additions and 21 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
QA vacancies in Portugal
QA vacancies in Portugal
========================

![](https://img.shields.io/static/v1?label=%F0%9F%8C%9F&message=If%20Useful&style=style=flat&color=BC4E99)
Expand All @@ -14,10 +14,10 @@ _An awesome curated list of the most recent QA vacancies in Portugal, updated ev
![](https://img.shields.io/github/contributors/sergiomartins8/qa-vacancies-in-portugal)
![](https://img.shields.io/github/license/sergiomartins8/qa-vacancies-in-portugal)

Vacancies
Vacancies
---------

> _Last updated: Sat, 29 Aug 2020 16:36_
> _Last updated: Sat, 29 Aug 2020 18:35_
### ItJobs

Expand Down
12 changes: 6 additions & 6 deletions docs/_coverpage.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
![](https://media.giphy.com/media/TakOTvDEIHtz4Xdbnp/giphy.gif)
![](img/rocket_cover.gif)

# QA vacancies in Portugal
> _An awesome curated list of the most recent QA vacancies in Portugal, updated every day!_
[![GitHub forks](https://img.shields.io/github/forks/sergiomartins8/qa-vacancies-in-portugal.svg?style=social&label=Fork&maxAge=2592000)](https://github.com/sergiomartins8/qa-vacancies-in-portugal/network/)
[![GitHub stars](https://img.shields.io/github/stars/sergiomartins8/qa-vacancies-in-portugal.svg?style=social&label=Star&maxAge=2592000)](https://github.com/sergiomartins8/qa-vacancies-in-portugal/stargazers/)
[![GitHub stars](https://img.shields.io/github/stars/sergiomartins8/qa-vacancies-in-portugal.svg?style=social&label=Star)](https://github.com/sergiomartins8/qa-vacancies-in-portugal/stargazers/)
[![GitHub forks](https://img.shields.io/github/forks/sergiomartins8/qa-vacancies-in-portugal.svg?style=social&label=Fork)](https://github.com/sergiomartins8/qa-vacancies-in-portugal/network/)

[![contributions welcome](https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat)](CONTRIBUTING.md)
[![made-with-Markdown](https://img.shields.io/badge/Made%20with-Markdown-1f425f.svg)](http://commonmark.org)
[![](https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat)](CONTRIBUTING.md)
![](https://img.shields.io/badge/built_with-❤-darkred)

[GitHub](https://github.com/sergiomartins8/qa-vacancies-in-portugal/)
[Open Vacancies](#vacancies)
[Vacancies](#vacancies)
Binary file added docs/img/rocket_cover.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions docs/img/spring-swing-rocket.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 4 additions & 2 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1">
<meta charset="UTF-8">
<title>QA Vacancies in Portugal</title>
<title>QA vacancies in Portugal</title>
<link rel="icon" href="img/spring-swing-rocket.svg">
<link rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/docsify-darklight-theme@latest/dist/style.min.css"
title="docsify-darklight-theme"
Expand All @@ -19,6 +20,7 @@
name: '',
coverpage: true,
hideSidebar: false,
defaultTheme : 'light',
darklightTheme: {
siteFont: 'Source Sans Pro',
dark: {
Expand All @@ -38,4 +40,4 @@
type="text/javascript">
</script>
</body>
</html>
</html>
5 changes: 3 additions & 2 deletions src/main/java/qa/vacancies/portugal/Application.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import net.steppschuh.markdowngenerator.text.emphasis.ItalicText;
import net.steppschuh.markdowngenerator.text.heading.Heading;
import net.steppschuh.markdowngenerator.text.quote.Quote;
import qa.vacancies.portugal.utils.constants.Constants;
import qa.vacancies.portugal.utils.markdown.MarkdownFileWriter;
import qa.vacancies.portugal.utils.markdown.MarkdownStringBuilder;
import qa.vacancies.portugal.vacancies.ItJobsVacancies;
Expand Down Expand Up @@ -42,7 +43,7 @@ public static void main(String[] args) {

private static StringBuilder fillTop() {
StringBuilder sb = new StringBuilder();
sb.append(new Heading(TITLE, 1)).append("\n\n")
sb.append(new Heading(TITLE, Constants.HEADING_TITLE)).append("\n\n")
.append(new Image("", STAR_IF_USEFUL_SHIELD)).append("\n")
.append(new Image("", STARS_SHIELD)).append("\n")
.append(new Image("", FORKS_SHIELD)).append("\n")
Expand All @@ -54,7 +55,7 @@ private static StringBuilder fillTop() {
.append(new Image("", ISSUES_SHIELD)).append("\n")
.append(new Image("", CONTRIBUTORS_SHIELD)).append("\n")
.append(new Image("", LICENSE_SHIELD)).append("\n\n")
.append(new Heading(VACANCIES, 2)).append("\n\n");
.append(new Heading(VACANCIES, Constants.HEADING_SUBTITLE)).append("\n\n");
return sb;
}

Expand Down
10 changes: 6 additions & 4 deletions src/main/java/qa/vacancies/portugal/pages/ItJobsPage.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@

public class ItJobsPage extends PageObject<ItJobsPage> {
private static final String BLOCK_BORDERLESS_SELECTOR = ".block.borderless";
private static final String TITLE_SELECTOR = ".title";
private static final String LIST_NAME_SELECTOR = ".list-name";

public ItJobsPage openAndSearch(String locationId, String query) {
open("https://www.itjobs.pt/emprego?location=" + locationId + "&q=" + query);
Expand All @@ -37,18 +39,18 @@ public List<Vacancy> getVacancies() {
private boolean containsQuery(SelenideElement element) {
return Stream
.of(Constants.QUERIES)
.anyMatch(query -> element.$(".title").getText().toLowerCase().contains(query));
.anyMatch(query -> element.$(TITLE_SELECTOR).getText().toLowerCase().contains(query));
}

private String getTitle(SelenideElement element) {
return element.$(".title").getText();
return element.$(TITLE_SELECTOR).getText();
}

private String getCompany(SelenideElement element) {
return element.$(".list-name").getText();
return element.$(LIST_NAME_SELECTOR).getText();
}

private String getUrl(SelenideElement element) {
return element.$(".title").getAttribute("href");
return element.$(TITLE_SELECTOR).getAttribute("href");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,9 @@ private Constants() {

public static final String TEST_AUTOMATION_QUERY = "test automation";
public static final String QUALITY_ASSURANCE_QUERY = "quality assurance";

public static final int HEADING_TITLE = 1;
public static final int HEADING_SUBTITLE = 2;
public static final int HEADING_WEBSITE = 3;
public static final int HEADING_LOCATION = 4;
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@
import java.nio.file.StandardOpenOption;

public class MarkdownFileWriter {

/**
* Private constructor to avoid instantiation.
*/
private MarkdownFileWriter() {
}

@SneakyThrows(value = IOException.class)
public static void appendMarkdown(String filename, StringBuilder sb) {
Files.write(Paths.get(filename), sb.toString().getBytes(), StandardOpenOption.APPEND);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package qa.vacancies.portugal.utils.markdown;

public interface MarkdownStringBuilder {

StringBuilder stringBuilder();
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,12 @@ public ItJobsVacancies() {

@Override
public StringBuilder stringBuilder() {
sb.append(new Heading("ItJobs", 3)).append("\n\n");
sb.append(new Heading("ItJobs", Constants.HEADING_WEBSITE)).append("\n\n");
appendVacancies("Braga", getVacanciesForLocation(BRAGA_ID));
appendVacancies("Porto", getVacanciesForLocation(PORTO_ID));
appendVacancies("Aveiro", getVacanciesForLocation(AVEIRO_ID));
appendVacancies("Coimbra", getVacanciesForLocation(COIMBRA_ID));
appendVacancies("Lisboa", getVacanciesForLocation(LISBOA_ID));

return sb;
}

Expand Down Expand Up @@ -76,7 +75,7 @@ private Set<Vacancy> mergeListsToSet(List<Vacancy> testAutomationList, List<Vaca

@SafeVarargs
private void appendVacancies(String location, Set<Vacancy>... vacancies) {
sb.append(new Heading(location, 4)).append("\n\n");
sb.append(new Heading(location, Constants.HEADING_LOCATION)).append("\n\n");
Arrays.stream(vacancies).forEach(set ->
set.forEach(vacancy ->
sb.append(new BoldText(vacancy.getTitle()))
Expand Down

0 comments on commit fa5752b

Please sign in to comment.