@memlab/e2e 1.0.4 → 1.0.5

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.
@@ -31,6 +31,7 @@ export declare class TestPlanner {
31
31
  private prepareSynthesizer;
32
32
  private generateVisitPlan;
33
33
  loadCookies(visitPlan: IE2EScenarioVisitPlan, synthesizer: IE2EScenarioSynthesizer): Cookies;
34
+ private populateDomainInCookiesFromScenario;
34
35
  private populateDomainInCookies;
35
36
  private setSnapshotMode;
36
37
  private assignSnapshotIds;
@@ -107,7 +107,8 @@ class TestPlanner {
107
107
  loadCookies(visitPlan, synthesizer) {
108
108
  var _a;
109
109
  if (this.scenario && this.scenario.cookies) {
110
- return this.scenario.cookies();
110
+ const cookies = this.scenario.cookies();
111
+ return this.populateDomainInCookiesFromScenario(cookies, this.scenario);
111
112
  }
112
113
  let cookieFile = synthesizer.getCookieFile(visitPlan);
113
114
  // if no cookie file is specified
@@ -122,6 +123,20 @@ class TestPlanner {
122
123
  const cookies = JSON.parse(fs_1.default.readFileSync(cookieFile, 'UTF-8'));
123
124
  return this.populateDomainInCookies(cookies, synthesizer.getDomain(), synthesizer.getDomainPrefixes());
124
125
  }
126
+ populateDomainInCookiesFromScenario(cookies, scenario) {
127
+ const ret = [];
128
+ const url = new URL(scenario.url());
129
+ const domain = '.' + url.hostname.split('.').slice(1).join('.');
130
+ for (const cookie of cookies) {
131
+ if (cookie.domain) {
132
+ ret.push(Object.assign({}, cookie));
133
+ }
134
+ else {
135
+ ret.push(Object.assign(Object.assign({}, cookie), { domain }));
136
+ }
137
+ }
138
+ return ret;
139
+ }
125
140
  populateDomainInCookies(cookies, domain, domainPrefixes) {
126
141
  const cookiesTemplate = cookies;
127
142
  const ret = [];
@@ -36,6 +36,6 @@ function back(page) {
36
36
  }
37
37
  // specify the number of repeat for the action
38
38
  function repeat() {
39
- return 15;
39
+ return 1;
40
40
  }
41
41
  module.exports = { action, back, repeat, url };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@memlab/e2e",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
4
4
  "license": "MIT",
5
5
  "description": "memlab browser E2E interaction libraries",
6
6
  "author": "Liang Gong <lgong@fb.com>",