Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Keep LocalStorage

未关闭
#2,968 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
30/100
Issue 类型
功能
描述清晰度
需要澄清
活跃度
停滞
领域
testing

调研方向

从 Puppeteer helper 和所示配置入手,尤其关注 keepBrowserState 如何处理不同场景之间的 cookie 和浏览器状态。追踪 LocalStorage 在哪里被重置或保留;完成标准是 LocalStorage 在相关测试之间以与 cookie 相同的方式持久存在,并且有覆盖该行为的测试。

由索引模型根据 Issue 内容生成。

描述

What are you trying to achieve?

i want keep LocalStorage like keepCookies

What do you get instead?

Provide console output if related. Use --verbose mode for more details.

My First Test --
  test something
    我 在页面 "https://....com/"
    我 保存屏幕截图 "see-first.jpg"
    我 看到 "text"
    我 等 2
    我 单击 "客户/广告主", ".ant-btn"
    我 wait for navigation 
    我 等待元素 ".right", 5
    我 单击 "账号登录", ".right"
    我 单击 "密码登录", ".TabR"
    我 填写字段 "#Authorize_username", "...@sina.com"
    我 填写字段 "#Authorize_password", "123456"
    我 单击 "立即登录", ".ant-btn-primary"
    我 等 5
    我 保存屏幕截图 "see-chengfayun.jpg"
  ✔ OK in 14313ms

Provide test source code if related

// paste test
Feature('My First Test');

Scenario('test something', ({ I }) => {
  I.amOnPage('https://....com/');
  I.saveScreenshot("see-first.jpg")
  I.see('text');
  I.wait(2);
  I.click('客户/广告主', '.ant-btn');
  I.waitForNavigation();
  I.waitForElement('.right', 5);
  I.click('账号登录', '.right');
  I.click('密码登录', '.TabR');
  I.fillField('#Authorize_username', '...@sina.com');
  I.fillField('#Authorize_password', '123456');
  I.click('立即登录', '.ant-btn-primary');
  I.wait(5)
  //截图
  I.saveScreenshot("see-chengfayun.jpg")
});
Details
  • CodeceptJS version: 3.0.7
  • NodeJS Version: v14.16.1
  • Operating System: macos
  • puppeteer
  • Configuration file:
# paste config here
exports.config = {
  tests: './*_test.js',
  output: './output',
  helpers: {
    Puppeteer: {
      url: 'http://localhost',
      show: true,
      windowSize: '1200x900',
      keepBrowserState: true,
    }
  },
  include: {
    I: './steps_file.js'
  },
  bootstrap: null,
  mocha: {},
  name: 'PuppeteerTests',
  translation: 'zh-CN',
  plugins: {
    pauseOnFail: {},
    retryFailedStep: {
      enabled: true
    },
    tryTo: {
      enabled: true
    },
    screenshotOnFail: {
      enabled: true
    }
  }
}
主要语言
JavaScript
星标
4.2k
派生
756
平均合并
2 天 9 小时
30 天内合并 PR
16

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

codeceptjs/CodeceptJS 的其他 Issue

查看 codeceptjs/CodeceptJS 的全部 Issue

相似的 Issue

更多 JavaScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。