mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-22 23:53:48 +01:00
Add test for static/dynamic RAM check
This commit is contained in:
parent
d0ca2d8c36
commit
20062b11b9
@ -1,5 +1,6 @@
|
|||||||
{
|
{
|
||||||
"baseUrl": "http://localhost:8000",
|
"baseUrl": "http://localhost:8000",
|
||||||
|
"fixturesFolder": false,
|
||||||
"trashAssetsBeforeRuns": true,
|
"trashAssetsBeforeRuns": true,
|
||||||
"screenshotsFolder": ".cypress/screenshots",
|
"screenshotsFolder": ".cypress/screenshots",
|
||||||
"videosFolder": ".cypress/videos",
|
"videosFolder": ".cypress/videos",
|
||||||
|
@ -1,32 +1,55 @@
|
|||||||
export {};
|
export {};
|
||||||
|
|
||||||
it("creates and runs a NetScript 2.0 script", () => {
|
describe("netscript", () => {
|
||||||
cy.findByRole("button", { name: "Exit Tutorial" }).click();
|
it("creates and runs a NetScript 2.0 script", () => {
|
||||||
cy.findByText("Got it!").click();
|
cy.findByRole("button", { name: "Exit Tutorial" }).click();
|
||||||
|
cy.findByText("Got it!").click();
|
||||||
|
|
||||||
cy.findByRole("textbox").type("connect n00dles{enter}");
|
cy.findByRole("textbox").type("connect n00dles{enter}");
|
||||||
cy.findByText(/connected to n00dles/i);
|
cy.findByText(/connected to n00dles/i);
|
||||||
|
|
||||||
cy.findByRole("textbox").type("run NUKE.exe{enter}");
|
cy.findByRole("textbox").type("run NUKE.exe{enter}");
|
||||||
cy.findByText(/gained root access/i);
|
cy.findByText(/gained root access/i);
|
||||||
|
|
||||||
cy.findByRole("textbox").type("home{enter}");
|
cy.findByRole("textbox").type("home{enter}");
|
||||||
cy.findByText(/connected to home/i);
|
cy.findByText(/connected to home/i);
|
||||||
|
|
||||||
cy.findByRole("textbox").type("nano script.js{enter}");
|
cy.findByRole("textbox").type("nano script.js{enter}");
|
||||||
|
|
||||||
// monaco can take a bit
|
// monaco can take a bit
|
||||||
cy.findByRole("code", { timeout: 15_000 }).type("{selectall}{del}")
|
cy.findByRole("code", { timeout: 15_000 }).type("{selectall}{del}")
|
||||||
.type(`export const main = async (ns) => {{}
|
.type(`export const main = async (ns) => {{}
|
||||||
while(true) {{}
|
while(true) {{}
|
||||||
await ns.hack("n00dles");`);
|
await ns.hack("n00dles");`);
|
||||||
|
|
||||||
cy.findByText("RAM: 1.70GB");
|
cy.findByText("RAM: 1.70GB");
|
||||||
cy.findByRole("button", { name: /Save & Close/i }).click();
|
cy.findByRole("button", { name: /Save & Close/i }).click();
|
||||||
|
|
||||||
cy.findByRole("textbox").type("run script.js{enter}");
|
cy.findByRole("textbox").type("run script.js{enter}");
|
||||||
cy.findByText(/Running script with 1 thread/);
|
cy.findByText(/Running script with 1 thread/);
|
||||||
|
|
||||||
cy.findByRole("textbox").type("ps{enter}");
|
cy.findByRole("textbox").type("ps{enter}");
|
||||||
cy.findByText(/\(PID - 1\) script.js/);
|
cy.findByText(/\(PID - 1\) script.js/);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("errors and shows a dialog box when static RAM !== dynamic RAM", () => {
|
||||||
|
cy.findByRole("button", { name: "Exit Tutorial" }).click();
|
||||||
|
cy.findByText("Got it!").click();
|
||||||
|
|
||||||
|
cy.findByRole("textbox").type("nano script.js{enter}");
|
||||||
|
|
||||||
|
// monaco can take a bit
|
||||||
|
cy.findByRole("code", { timeout: 15_000 }).type("{selectall}{del}")
|
||||||
|
.type(`export const main = async (ns) => {{}
|
||||||
|
const command = "hack";
|
||||||
|
ns[command]("n00dles");`);
|
||||||
|
|
||||||
|
cy.findByText("RAM: 1.60GB");
|
||||||
|
cy.findByRole("button", { name: /Save & Close/i }).click();
|
||||||
|
|
||||||
|
cy.findByRole("textbox").type("run script.js{enter}");
|
||||||
|
cy.findByText(
|
||||||
|
/Dynamic RAM usage calculated to be greater than initial RAM usage on fn: hack./i,
|
||||||
|
);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user