diff --git a/plugins/atshosts/successfactors.py b/plugins/atshosts/successfactors.py index e63b199..348bfaa 100644 --- a/plugins/atshosts/successfactors.py +++ b/plugins/atshosts/successfactors.py @@ -56,14 +56,18 @@ from ._shared import Get, Page, Row, is_web_url, only, parse_dt NAME = "successfactors" LABEL = "SuccessFactors" # A career site is on the company's own domain and names no SuccessFactors -# host. Discovery can therefore read a board only off a page that links a -# role, `/job//<id>` with the numeric requisition id, and it takes the -# host and a brand segment from that link. A page that only links the back end -# (`career5.successfactors.eu`, as Bang & Olufsen's does) or loads the sites' -# image CDN names the host with no slug, which keeps the company on the list -# of hosts the app names but has no board for. +# host, so discovery can read a board only off an absolute link to one of its +# own paths that no other site has: a role, `/job/<title>/<numeric id>/`, a +# landing page, `/go/<name>/<numeric id>/`, or a search with the query keys the +# sites' own forms send (`createNewAlert`, `locationsearch`, `optionsFacetsDD_`). +# The host and a brand segment before the path are the slug. A page that only +# links the back end (`career5.successfactors.eu`, as Bang & Olufsen's does) or +# loads the sites' image CDN names the host with no slug, which keeps the +# company on the list of hosts the app names but has no board for. PATTERNS = ( - r"https?://([a-z0-9-]+(?:\.[a-z0-9-]+)+)(?:/([A-Za-z0-9_-]+))?/job/[^/\s\"'<>?#]+/\d{9,10}/", + r"https?://([a-z0-9-]+(?:\.[a-z0-9-]+)+)(?:/([A-Za-z0-9_-]+))?" + r"/(?:job/[^/\s\"'<>?#]+/\d{9,10}/|go/[^/\s\"'<>?#]+/\d{6,}/" + r"|search/\?[^\s\"'<>]*(?:createNewAlert|locationsearch|optionsFacetsDD_))", r"(?:career|jobs|performancemanager)\d*\.successfactors\.(?:eu|com)|\.sapsf\.(?:eu|com)" r"|rmkcdn\.successfactors\.com", ) diff --git a/tests/test_ats_successfactors.py b/tests/test_ats_successfactors.py index 6a1eb71..97cf4fa 100644 --- a/tests/test_ats_successfactors.py +++ b/tests/test_ats_successfactors.py @@ -469,6 +469,22 @@ def test_discovery_finds_a_board_from_a_link_to_one_of_its_roles() -> None: assert [(h, s) for h, s, _ in boards_in(page)] == [("successfactors", "careers.vestas.com")] +@pytest.mark.parametrize(("link", "slug"), [ + # The `careers_url` of the seed's companies that name a search or a landing page. + ("https://careers.vestas.com/search/?q=&locationsearch=", "careers.vestas.com"), + ("https://jobs.systematic.com/search/?createNewAlert=false&q=&locationsearch=DE+%2B+AT", + "jobs.systematic.com"), + ("https://jobs.scania.com/go/Jobs-at-Scania/9096601/", "jobs.scania.com"), + ("https://careers.tryg.com/Tryg/go/All-open-positions/9394801/", "careers.tryg.com/Tryg"), + ("https://careers.ovhcloud.com/search/?createNewAlert=false&q=&locationsearch=&locale=en_US", + "careers.ovhcloud.com"), +]) +def test_discovery_finds_a_board_from_a_link_to_its_search_or_landing_page( + link: str, slug: str) -> None: + assert [(h, s) for h, s, _ in boards_in(f'<a href="{link}">Jobs</a>')] == [ + ("successfactors", slug)] + + def test_discovery_takes_the_brand_segment_and_keeps_its_case() -> None: page = '<a href="https://jobs.teradyne.com/MiR/job/Basak-PLM-Data-Analyst/1397096400/">x</a>' assert [(h, s) for h, s, _ in boards_in(page)] == [("successfactors", "jobs.teradyne.com/MiR")]