@rich-automation/lotto 2.0.5 → 2.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -20,6 +20,7 @@ yarn add @rich-automation/lotto
20
20
 
21
21
  1. 내부적으로 Playwright 또는 Puppeteer를 사용하므로, Chromium이 사전에 설치되어 있어야 합니다. ([링크](https://github.com/rich-automation/lotto-module/blob/main/package.json#L38-L39))
22
22
  2. 구매는 [동행복권](https://dhlottery.co.kr/common.do?method=main) 사이트에서 진행되며, 예치금 충전 기능은 없으므로 미리 계정에 예치금을 충전해두어야 합니다.
23
+ 3. 건전 구매 서약서에 동의하세요 (https://www.dhlottery.co.kr/hpns/sdnsCamPainView), 1년 주기로 동의가 필요합니다.
23
24
 
24
25
  ## 사용법
25
26
 
@@ -23,9 +23,10 @@ class PlaywrightPage {
23
23
  return this.page.url();
24
24
  });
25
25
  }
26
- goto(url) {
26
+ goto(url, options) {
27
27
  return __awaiter(this, void 0, void 0, function* () {
28
- yield this.page.goto(url, { waitUntil: 'load' });
28
+ const waitUntil = (options === null || options === void 0 ? void 0 : options.waitUntil) === 'idle' ? 'networkidle' : 'load';
29
+ yield this.page.goto(url, { waitUntil });
29
30
  });
30
31
  }
31
32
  fill(selector, value) {
@@ -22,9 +22,10 @@ class PuppeteerPage {
22
22
  return this.page.url();
23
23
  });
24
24
  }
25
- goto(url) {
25
+ goto(url, options) {
26
26
  return __awaiter(this, void 0, void 0, function* () {
27
- yield this.page.goto(url, { waitUntil: 'load' });
27
+ const waitUntil = (options === null || options === void 0 ? void 0 : options.waitUntil) === 'idle' ? 'networkidle0' : 'load';
28
+ yield this.page.goto(url, { waitUntil });
28
29
  });
29
30
  }
30
31
  fill(selector, value) {
@@ -66,10 +66,10 @@ class LottoService {
66
66
  if (this.browserController.configs.controller === 'api') {
67
67
  throw lottoError_1.default.NotSupported('API mode does not support signIn.');
68
68
  }
69
- // 페이지 이동
69
+ // 페이지 이동 (RSA 키 로딩 등 비동기 스크립트 완료까지 대기)
70
70
  const page = yield this.browserController.focus(0);
71
71
  this.logger.debug('[signIn]', 'goto', 'login page');
72
- yield page.goto(urls_1.URLS.LOGIN);
72
+ yield page.goto(urls_1.URLS.LOGIN, { waitUntil: 'idle' });
73
73
  this.logger.debug('[signIn]', 'page url', yield page.url());
74
74
  // 로그인 시도
75
75
  this.logger.debug('[signIn]', 'try login');
@@ -20,9 +20,10 @@ export class PlaywrightPage {
20
20
  return this.page.url();
21
21
  });
22
22
  }
23
- goto(url) {
23
+ goto(url, options) {
24
24
  return __awaiter(this, void 0, void 0, function* () {
25
- yield this.page.goto(url, { waitUntil: 'load' });
25
+ const waitUntil = (options === null || options === void 0 ? void 0 : options.waitUntil) === 'idle' ? 'networkidle' : 'load';
26
+ yield this.page.goto(url, { waitUntil });
26
27
  });
27
28
  }
28
29
  fill(selector, value) {
@@ -19,9 +19,10 @@ export class PuppeteerPage {
19
19
  return this.page.url();
20
20
  });
21
21
  }
22
- goto(url) {
22
+ goto(url, options) {
23
23
  return __awaiter(this, void 0, void 0, function* () {
24
- yield this.page.goto(url, { waitUntil: 'load' });
24
+ const waitUntil = (options === null || options === void 0 ? void 0 : options.waitUntil) === 'idle' ? 'networkidle0' : 'load';
25
+ yield this.page.goto(url, { waitUntil });
25
26
  });
26
27
  }
27
28
  fill(selector, value) {
@@ -60,10 +60,10 @@ export class LottoService {
60
60
  if (this.browserController.configs.controller === 'api') {
61
61
  throw LottoError.NotSupported('API mode does not support signIn.');
62
62
  }
63
- // 페이지 이동
63
+ // 페이지 이동 (RSA 키 로딩 등 비동기 스크립트 완료까지 대기)
64
64
  const page = yield this.browserController.focus(0);
65
65
  this.logger.debug('[signIn]', 'goto', 'login page');
66
- yield page.goto(URLS.LOGIN);
66
+ yield page.goto(URLS.LOGIN, { waitUntil: 'idle' });
67
67
  this.logger.debug('[signIn]', 'page url', yield page.url());
68
68
  // 로그인 시도
69
69
  this.logger.debug('[signIn]', 'try login');
@@ -8,7 +8,9 @@ export declare class PlaywrightPage implements BrowserPageInterface {
8
8
  logger?: LoggerInterface;
9
9
  constructor(context: BrowserContext, page: Page, logger?: LoggerInterface);
10
10
  url(): Promise<string>;
11
- goto(url: string): Promise<void>;
11
+ goto(url: string, options?: {
12
+ waitUntil?: 'load' | 'idle';
13
+ }): Promise<void>;
12
14
  fill(selector: string, value: string | number): Promise<void>;
13
15
  click(selector: string, domDirect?: boolean): Promise<void>;
14
16
  select(selector: string, value: string): Promise<void>;
@@ -6,7 +6,9 @@ export declare class PuppeteerPage implements BrowserPageInterface {
6
6
  logger?: LoggerInterface;
7
7
  constructor(page: Page, logger?: LoggerInterface);
8
8
  url(): Promise<string>;
9
- goto(url: string): Promise<void>;
9
+ goto(url: string, options?: {
10
+ waitUntil?: 'load' | 'idle';
11
+ }): Promise<void>;
10
12
  fill(selector: string, value: string | number): Promise<void>;
11
13
  click(selector: string, domDirect?: boolean): Promise<void>;
12
14
  select(selector: string, value: string): Promise<void>;
@@ -32,7 +32,9 @@ export interface BrowserControllerInterface<T extends BrowserController = Browse
32
32
  }
33
33
  export interface BrowserPageInterface {
34
34
  url(): Promise<string>;
35
- goto(url: string): Promise<void>;
35
+ goto(url: string, options?: {
36
+ waitUntil?: 'load' | 'idle';
37
+ }): Promise<void>;
36
38
  fill(selector: string, value: string | number): Promise<void>;
37
39
  click(selector: string, domDirect?: boolean): Promise<void>;
38
40
  select(selector: string, value: string): Promise<void>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rich-automation/lotto",
3
- "version": "2.0.5",
3
+ "version": "2.0.6",
4
4
  "description": "Lotto module",
5
5
  "publishConfig": {
6
6
  "access": "public",