This commit is contained in:
2026-02-15 11:27:52 -08:00
parent 89e4981193
commit 946ad9f155
5 changed files with 169 additions and 16 deletions

16
e2e/.vscode/tasks.json vendored Normal file
View File

@@ -0,0 +1,16 @@
{
"version": "2.0.0",
"tasks": [
{
"type": "npm",
"script": "open",
"problemMatcher": [],
"label": "npm: open",
"detail": "./node_modules/.bin/cypress open",
"group": {
"kind": "build",
"isDefault": true
}
}
]
}

View File

@@ -1,4 +1,76 @@
Password breach warning error mitigation:
To suppress Chrome's "password exposed in breach" warning during Cypress tests with intentional weak test passwords, **disable Chrome's password leak detection features via browser launch flags**. This is the cleanest, most reliable solution for test environments.
### ✅ Recommended Fix (Cypress Config)
Add this to your Cypress configuration to disable the relevant Chrome features:
#### For Cypress v10+ (`cypress.config.js`):
```javascript
const { defineConfig } = require('cypress');
module.exports = defineConfig({
e2e: {
setupNodeEvents(on, config) {
on('before:browser:launch', (browser, launchOptions) => {
if (browser.name === 'chrome') {
// Disable password breach warnings + related features
launchOptions.args.push(
'--disable-features=PasswordLeakDetection,PasswordManagerLeakDetection,PasswordCheck,InsecureCredentialsWarning'
);
// Optional: Disable password manager entirely if warnings persist
// launchOptions.args.push('--disable-blink-features=PasswordManager');
}
return launchOptions;
});
},
},
});
```
#### For Cypress ≤ v9 (`cypress/plugins/index.js`):
```javascript
module.exports = (on, config) => {
on('before:browser:launch', (browser, launchOptions) => {
if (browser.name === 'chrome') {
launchOptions.args.push(
'--disable-features=PasswordLeakDetection,PasswordManagerLeakDetection,PasswordCheck,InsecureCredentialsWarning'
);
}
return launchOptions;
});
};
```
### 🔑 Why this works:
- `PasswordLeakDetection` / `PasswordManagerLeakDetection`: Blocks breach-checking logic
- `PasswordCheck`: Disables Chrome's "Password Checkup" feature
- `InsecureCredentialsWarning`: Suppresses "insecure password" UI warnings (critical for obvious passwords like "Accounting")
- Flags are **non-intrusive**—they dont alter your apps behavior or test logic
- Works in both headed and headless Chrome modes
- Zero maintenance vs. fragile DOM-interaction workarounds
### ⚠️ Important Notes:
1. **Test passwords remain intentionally weak**—this solution *only* silences Chrome's UI warning.
🔒 *Never use these passwords outside isolated test environments.*
2. If warnings persist:
- Update Chrome flags based on your Chrome version (check `chrome://version` → "Command Line")
- Temporarily add `--disable-blink-features=PasswordManager` (disables entire password manager; use only if tests dont rely on autofill)
3. **Do NOT**:
- Try clicking away the warning in tests (flaky, slows tests, fragile selector)
- Disable Safe Browsing globally (`--safebrowsing-disable-auto-update`)—overly broad security risk
- Modify system Chrome settings (Cypress uses isolated profiles)
### 💡 Pro Tip:
For future-proofing, consider generating **unique strong passwords per test run** (e.g., `Accounting_${Date.now()}`) and resetting them between tests. This avoids breach warnings *and* aligns with security best practices—but the flag solution above is perfect for your current constraint of fixed sample passwords. 😊
=-=-=-=-=-=-=-=-=-=-=-=-
From the olden times years ago:

View File

@@ -14,22 +14,34 @@ describe("SMOKE SETUP", () => {
.then((res) => {
cy.request({
method: "POST",
url: `${Cypress.env("apiBaseUrl")}trial/seed`,
url: `${Cypress.env("apiBaseUrl")}license/permanently-erase-all-data`,
auth: {
bearer: res.data.token
}, ///small/-7/true
body: {
seedLevel: "small",
timeZoneOffset: -7,
e2e: true
}
})
.its("body")
.then((resjob) => {
cy.log(`resjob is: ${JSON.stringify(resjob)}`);
// expect(resjob.body).to.have.property('jobId');
confirmJobDone(resjob.jobId, res.data.token);
});
},
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify("I understand")
}).then(() => {
cy.request({
method: "POST",
url: `${Cypress.env("apiBaseUrl")}trial/seed`,
auth: {
bearer: res.data.token
}, ///small/-7/true
body: {
seedLevel: "small",
timeZoneOffset: -7,
e2e: true
}
})
.its("body")
.then((resjob) => {
cy.log(`resjob is: ${JSON.stringify(resjob)}`);
// expect(resjob.body).to.have.property('jobId');
confirmJobDone(resjob.jobId, res.data.token);
});
});
});
//-----------------------------------------------------
});
@@ -49,3 +61,56 @@ function confirmJobDone(jobId, authToken) {
confirmJobDone(jobId, authToken);
});
}
//===============================================
// describe("SMOKE SETUP", () => {
// it("Generates test data without issue", () => {
// cy.request({
// url: `${Cypress.env("apiBaseUrl")}auth`,
// method: "POST",
// body: {
// login: Cypress.env("admin").login,
// password: Cypress.env("admin").password
// }
// })
// .its("body")
// .then((res) => {
// cy.request({
// method: "POST",
// url: `${Cypress.env("apiBaseUrl")}trial/seed`,
// auth: {
// bearer: res.data.token
// }, ///small/-7/true
// body: {
// seedLevel: "small",
// timeZoneOffset: -7,
// e2e: true
// }
// })
// .its("body")
// .then((resjob) => {
// cy.log(`resjob is: ${JSON.stringify(resjob)}`);
// // expect(resjob.body).to.have.property('jobId');
// confirmJobDone(resjob.jobId, res.data.token);
// });
// });
// //-----------------------------------------------------
// });
// });
// function confirmJobDone(jobId, authToken) {
// cy.request({
// method: "GET",
// url: `${Cypress.env("apiBaseUrl")}job-operations/status/${jobId}`,
// auth: {
// bearer: authToken
// }
// }).then((resp) => {
// //3 means job done
// if (resp.body.data == 3) return;
// // else recurse
// cy.wait(1000);
// confirmJobDone(jobId, authToken);
// });
// }

View File

@@ -5,7 +5,7 @@ describe("SMOKE NAV", () => {
cy.get("[data-cy=navicon]").click();
cy.get("[data-cy=home]").click();
cy.get("[data-cy='nav/home-dashboard']").click();
cy.get("[data-cy='nav/home-dashboard']").click();//26fail Timed out retrying after 5000ms: Expected to find element: [data-cy='nav/home-dashboard'], but never found it.
cy.get("[data-cy=generalerror]").should("not.exist");
cy.get("[data-cy=navicon]").click();

View File

@@ -62,7 +62,7 @@ describe("Workorder creation", () => {
cy.ayChooseGZPickList("projectId", "e2e");
cy.get("[data-cy='serviceDate:date']").type(dayjs().format("YYYY-MM-DD"));
cy.get("[data-cy='serviceDate:time']").type(dayjs().format("HH:mm"));
cy.get("[data-cy=customerContactName]").type(`Jayne Smith`);
cy.get("[data-cy=customerContactName]").type(`Jayne Smith`);//26fail Timed out retrying after 5000ms: Expected to find element: [data-cy=customerContactName], but never found it.
cy.get("[data-cy=customerReferenceNumber]").type(
`cref-${Cypress.config("cyid")}`
);