Skip to content

Commit

Permalink
add fs.promises
Browse files Browse the repository at this point in the history
  • Loading branch information
Matt307082 committed Aug 5, 2024
1 parent 4057737 commit 8a86fe8
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions var/www/html/tests/console.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const fs = require('fs');
const fs = require('fs').promises;
const webdriver = require('selenium-webdriver');
const Chrome = require('selenium-webdriver/chrome');
const options = new Chrome.Options();
Expand Down Expand Up @@ -57,7 +57,7 @@ describe('console service front-end tests', function(){
let table = await driver.findElement(webdriver.By.className("table"));
expect(table).not.toBeUndefined();
let encodedString = await driver.takeScreenshot();
await fs.writeFileSync('./screens/desktops-page.png', encodedString, 'base64');
await fs.writeFile('./screens/desktops-page.png', encodedString, 'base64');
})

it("desktops : click on delete no desktop selected, should display error toast", async function(){
Expand All @@ -68,7 +68,7 @@ describe('console service front-end tests', function(){
expect(text).toBe("Error, no desktop selected");
});
let encodedString = await driver.takeScreenshot();
await fs.writeFileSync('./screens/desktops-page-error-toast.png', encodedString, 'base64');
await fs.writeFile('./screens/desktops-page-error-toast.png', encodedString, 'base64');
})

});
Expand Down Expand Up @@ -99,7 +99,7 @@ describe('console service front-end tests', function(){
let table = await driver.findElement(webdriver.By.className("table"));
expect(table).not.toBeUndefined();
let encodedString = await driver.takeScreenshot();
await fs.writeFileSync('./screens/apps-page.png', encodedString, 'base64');
await fs.writeFile('./screens/apps-page.png', encodedString, 'base64');
})

it("apps : click on delete but no apps selected, should display error toast", async function(){
Expand All @@ -110,7 +110,7 @@ describe('console service front-end tests', function(){
expect(text).toBe("Error, no apps selected");
});
let encodedString = await driver.takeScreenshot();
await fs.writeFileSync('./screens/apps-page-error-toast.png', encodedString, 'base64');
await fs.writeFile('./screens/apps-page-error-toast.png', encodedString, 'base64');
})

it("apps : click on add button, modal should appear", async function(){
Expand All @@ -121,7 +121,7 @@ describe('console service front-end tests', function(){
expect(className.includes("show")).toBe(true);
});
let encodedString = await driver.takeScreenshot();
await fs.writeFileSync('./screens/apps-page-modal-open.png', encodedString, 'base64');
await fs.writeFile('./screens/apps-page-modal-open.png', encodedString, 'base64');
})

it("apps : click on close button, modal should diseappear", async function(){
Expand All @@ -133,7 +133,7 @@ describe('console service front-end tests', function(){
expect(className.includes("show")).toBe(false);
});
let encodedString = await driver.takeScreenshot();
await fs.writeFileSync('./screens/apps-page-modal-close.png', encodedString, 'base64');
await fs.writeFile('./screens/apps-page-modal-close.png', encodedString, 'base64');
}, 10000)

});
Expand Down Expand Up @@ -164,7 +164,7 @@ describe('console service front-end tests', function(){
let table = await driver.findElement(webdriver.By.className("table"));
expect(table).not.toBeUndefined();
let encodedString = await driver.takeScreenshot();
await fs.writeFileSync('./screens/webfont-page.png', encodedString, 'base64');
await fs.writeFile('./screens/webfont-page.png', encodedString, 'base64');
})

it("webfront : dock section should not be visible", async function(){
Expand Down Expand Up @@ -202,7 +202,7 @@ describe('console service front-end tests', function(){
let table = await driver.findElement(webdriver.By.className("table"));
expect(table).not.toBeUndefined();
let encodedString = await driver.takeScreenshot();
await fs.writeFileSync('./screens/banIP-page.png', encodedString, 'base64');
await fs.writeFile('./screens/banIP-page.png', encodedString, 'base64');
})

it("banIp : click on unban but no user selected, should display error toast", async function(){
Expand All @@ -213,7 +213,7 @@ describe('console service front-end tests', function(){
expect(text).toBe("Error, no banned user selected");
});
let encodedString = await driver.takeScreenshot();
await fs.writeFileSync('./screens/banIP-page-error-toast.png', encodedString, 'base64');
await fs.writeFile('./screens/banIP-page-error-toast.png', encodedString, 'base64');
})

it("banIp : click on add button, modal should appear", async function(){
Expand All @@ -224,7 +224,7 @@ describe('console service front-end tests', function(){
expect(className.includes("show")).toBe(true);
});
let encodedString = await driver.takeScreenshot();
await fs.writeFileSync('./screens/banIP-page-modal-open.png', encodedString, 'base64');
await fs.writeFile('./screens/banIP-page-modal-open.png', encodedString, 'base64');
})

it("banIp : click on close button, modal should diseappear", async function(){
Expand All @@ -236,7 +236,7 @@ describe('console service front-end tests', function(){
expect(className.includes("show")).toBe(false);
});
let encodedString = await driver.takeScreenshot();
await fs.writeFileSync('./screens/banIP-page-modal-close.png', encodedString, 'base64');
await fs.writeFile('./screens/banIP-page-modal-close.png', encodedString, 'base64');
}, 10000)

});
Expand Down Expand Up @@ -267,7 +267,7 @@ describe('console service front-end tests', function(){
let table = await driver.findElement(webdriver.By.className("table"));
expect(table).not.toBeUndefined();
let encodedString = await driver.takeScreenshot();
await fs.writeFileSync('./screens/banLogin-page.png', encodedString, 'base64');
await fs.writeFile('./screens/banLogin-page.png', encodedString, 'base64');
})

it("banLogin : click on unban but no user selected, should display error toast", async function(){
Expand All @@ -278,7 +278,7 @@ describe('console service front-end tests', function(){
expect(text).toBe("Error, no banned user selected");
});
let encodedString = await driver.takeScreenshot();
await fs.writeFileSync('./screens/banLogin-page-error-toast.png', encodedString, 'base64');
await fs.writeFile('./screens/banLogin-page-error-toast.png', encodedString, 'base64');
})

it("banLogin : click on add button, modal should appear", async function(){
Expand All @@ -289,7 +289,7 @@ describe('console service front-end tests', function(){
expect(className.includes("show")).toBe(true);
});
let encodedString = await driver.takeScreenshot();
await fs.writeFileSync('./screens/banLogin-page-mdoal-open.png', encodedString, 'base64');
await fs.writeFile('./screens/banLogin-page-mdoal-open.png', encodedString, 'base64');
})

it("banLogin : click on close button, modal should diseappear", async function(){
Expand All @@ -301,7 +301,7 @@ describe('console service front-end tests', function(){
expect(className.includes("show")).toBe(false);
});
let encodedString = await driver.takeScreenshot();
await fs.writeFileSync('./screens/banLogin-page-modal-close.png', encodedString, 'base64');
await fs.writeFile('./screens/banLogin-page-modal-close.png', encodedString, 'base64');
}, 10000)

});
Expand Down

0 comments on commit 8a86fe8

Please sign in to comment.