Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into pr/nissant/842-1
Browse files Browse the repository at this point in the history
  • Loading branch information
baruchiro committed Apr 1, 2024
2 parents 874cc13 + c873557 commit 053a579
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 3 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/pr-title.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Validate Conventional Commit title

on:
pull_request:
types: [opened, edited, synchronize, reopened]

jobs:
validate:
runs-on: ubuntu-latest
steps:
- name: install commitlint
run: npm install -g @commitlint/cli @commitlint/config-angular
- name: config commitlint
run: |
echo "module.exports = {extends: ['@commitlint/config-angular']}" > commitlint.config.js
- name: validate PR title
run: |
echo "${{ github.event.pull_request.title }}" | commitlint
3 changes: 1 addition & 2 deletions src/scrapers/max.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,11 @@ export interface ScrapedTransaction {
};
}

const BASE_ACTIONS_URL = 'https://online.max.co.il';
const BASE_API_ACTIONS_URL = 'https://onlinelcapi.max.co.il';
const BASE_WELCOME_URL = 'https://www.max.co.il';

const LOGIN_URL = `${BASE_WELCOME_URL}/homepage/welcome`;
const PASSWORD_EXPIRED_URL = `${BASE_ACTIONS_URL}/Anonymous/Login/PasswordExpired.aspx`;
const PASSWORD_EXPIRED_URL = `${BASE_WELCOME_URL}/renew-password`;
const SUCCESS_URL = `${BASE_WELCOME_URL}/homepage/personal`;

enum MaxPlanName {
Expand Down
16 changes: 15 additions & 1 deletion src/scrapers/visa-cal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,12 @@ async function hasInvalidPasswordError(page: Page) {
return errorMessage === InvalidPasswordMessage;
}

async function hasChangePasswordForm(page: Page) {
const frame = await getLoginFrame(page);
const errorFound = await elementPresentOnPage(frame, '.change-password-subtitle');
return errorFound;
}

function getPossibleLoginResults() {
debug('return possible login results');
const urls: LoginOptions['possibleResults'] = {
Expand All @@ -162,7 +168,13 @@ function getPossibleLoginResults() {
return hasInvalidPasswordError(page);
}],
// [LoginResults.AccountBlocked]: [], // TODO add when reaching this scenario
// [LoginResults.ChangePassword]: [], // TODO add when reaching this scenario
[LoginResults.ChangePassword]: [async (options?: { page?: Page }) => {
const page = options?.page;
if (!page) {
return false;
}
return hasChangePasswordForm(page);
}],
};
return urls;
}
Expand Down Expand Up @@ -303,6 +315,8 @@ class VisaCalScraper extends BaseScraperWithBrowser<ScraperSpecificCredentials>
} catch (e) {
const currentUrl = await getCurrentUrl(this.page);
if (currentUrl.endsWith('dashboard')) return;
const requiresChangePassword = await hasChangePasswordForm(this.page);
if (requiresChangePassword) return;
throw e;
}
},
Expand Down

0 comments on commit 053a579

Please sign in to comment.