-
Notifications
You must be signed in to change notification settings - Fork 165
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Avraham wales <[email protected]>
- Loading branch information
1 parent
4315476
commit cbbf9b7
Showing
5 changed files
with
72 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import { SCRAPERS } from '../definitions'; | ||
import { exportTransactions, extendAsyncTimeout, getTestsConfig, maybeTestCompanyAPI } from '../tests/tests-utils'; | ||
import { LoginResults } from './base-scraper-with-browser'; | ||
import PagiScraper from './pagi'; | ||
|
||
|
||
const COMPANY_ID = 'pagi'; // TODO this property should be hard-coded in the provider | ||
const testsConfig = getTestsConfig(); | ||
|
||
describe('Pagi legacy scraper', () => { | ||
beforeAll(() => { | ||
extendAsyncTimeout(); // The default timeout is 5 seconds per async test, this function extends the timeout value | ||
}); | ||
test('should expose login fields in scrapers constant', () => { | ||
expect(SCRAPERS.pagi).toBeDefined(); | ||
expect(SCRAPERS.pagi.loginFields).toContain('username'); | ||
expect(SCRAPERS.pagi.loginFields).toContain('password'); | ||
}); | ||
|
||
maybeTestCompanyAPI(COMPANY_ID, (config) => config.companyAPI.invalidPassword)('should fail on invalid user/password"', async () => { | ||
const options = { | ||
...testsConfig.options, | ||
companyId: COMPANY_ID, | ||
}; | ||
|
||
const scraper = new PagiScraper(options); | ||
|
||
const result = await scraper.scrape({ username: 'e10s12', password: '3f3ss3d' }); | ||
|
||
expect(result).toBeDefined(); | ||
expect(result.success).toBeFalsy(); | ||
expect(result.errorType).toBe(LoginResults.InvalidPassword); | ||
}); | ||
|
||
maybeTestCompanyAPI(COMPANY_ID)('should scrape transactions"', async () => { | ||
const options = { | ||
...testsConfig.options, | ||
companyId: COMPANY_ID, | ||
}; | ||
|
||
const scraper = new PagiScraper(options); | ||
const result = await scraper.scrape(testsConfig.credentials.pagi); | ||
expect(result).toBeDefined(); | ||
const error = `${result.errorType || ''} ${result.errorMessage || ''}`.trim(); | ||
expect(error).toBe(''); | ||
expect(result.success).toBeTruthy(); | ||
|
||
exportTransactions(COMPANY_ID, result.accounts || []); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import BeinleumiGroupBaseScraper from './base-beinleumi-group'; | ||
|
||
class PagiScraper extends BeinleumiGroupBaseScraper { | ||
BASE_URL = 'https://online.pagi.co.il/'; | ||
|
||
LOGIN_URL = `${this.BASE_URL}/MatafLoginService/MatafLoginServlet?bankId=PAGIPORTAL&site=Private&KODSAFA=HE`; | ||
|
||
TRANSACTIONS_URL = `${this.BASE_URL}/wps/myportal/FibiMenu/Online/OnAccountMngment/OnBalanceTrans/PrivateAccountFlow`; | ||
|
||
} | ||
|
||
export default PagiScraper; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters