Skip to content

Commit

Permalink
Update log messages and expect statemments
Browse files Browse the repository at this point in the history
  • Loading branch information
Fabricio-ESP committed Jan 2, 2025
1 parent c45a95b commit 8bef7df
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 19 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ jobs:
- name: Run IDF installation and post install test script (non-Windows)
if: runner.os != 'Windows'
run: |
export DEBUG="true"
# export DEBUG="true"
export LOG_TO_FILE="true"
chmod +x ./tests/run_test.sh
. ./tests/run_test.sh "../test-bin/eim" "${{ env.CLI_TAG }}"
Expand Down Expand Up @@ -116,7 +116,7 @@ jobs:
- name: Run IDF installation and post install test script (Windows)
if: runner.os == 'Windows'
run: |
$env:DEBUG="true"
# $env:DEBUG="true"
$env:LOG_TO_FILE="true"
.\tests\run_test.ps1 "..\test-bin\eim.exe" "${{ env.CLI_TAG }}"
Expand Down
12 changes: 6 additions & 6 deletions tests/classes/tauriRunner.class.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export class EIMRunner {
timeout,
`Element with id ${id} not found`
);
logger.debug(`Selected element ${element}`);
logger.debug(`Selected element at ${await element.getRect()}`);
return element;
} catch (error) {
logger.debug(`Error during selection: ${error}`);
Expand All @@ -83,7 +83,7 @@ export class EIMRunner {
timeout,
`Element with class ${className} not found`
);
logger.debug(`Selected element ${element}`);
logger.debug(`Selected element at ${await element.getRect()}`);
return element;
} catch (error) {
logger.debug(`Error during selection: ${error}`);
Expand All @@ -98,7 +98,7 @@ export class EIMRunner {
timeout,
`Element with attribute ${cssAttribute} not found`
);
logger.debug(`Selected element ${element}`);
logger.debug(`Selected element at ${await element.getRect()}`);
return element;
} catch (error) {
logger.debug(`Error during selection: ${error}`);
Expand All @@ -113,7 +113,7 @@ export class EIMRunner {
timeout,
`Element with test ID ${dataId} not found`
);
logger.debug(`Selected element ${element}`);
logger.debug(`Selected element at ${await element.getRect()}`);
return element;
} catch (error) {
logger.debug(`Error during selection: ${error}`);
Expand All @@ -130,7 +130,7 @@ export class EIMRunner {
timeout,
`Element containing text "${text}" not found`
);
logger.debug(`Selected element ${element}`);
logger.debug(`Selected element at ${await element.getRect()}`);
return element;
} catch (error) {
logger.debug(`Error during selection: ${error}`);
Expand All @@ -147,7 +147,7 @@ export class EIMRunner {
timeout,
`Button with text "${text}" not found`
);
logger.debug(`Selected button ${button}`);
logger.debug(`Selected element at ${await element.getRect()}`);
await button.click();
} catch (error) {
logger.debug(`Error during selection: ${error}`);
Expand Down
36 changes: 27 additions & 9 deletions tests/scripts/defaultInstall.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ describe("EIM Application Launch", () => {
// Wait for the header to be present
const header = await eimRunner.findByCSS("h1");
const text = await header.getText();
expect(text).to.equal("Welcome to ESP-IDF Installation Manager!");
expect(text, "Expected welcome text").to.equal(
"Welcome to ESP-IDF Installation Manager!"
);
} catch (error) {
logger.info("Failed to get Welcome header", error);
throw error;
Expand All @@ -59,11 +61,16 @@ describe("EIM Application Launch", () => {
await eimRunner.clickButton("Get Started");
const header = await eimRunner.findByCSS("h1");
const text = await header.getText();
expect(text).to.equal("Installation Setup");
expect(text, "Expected installation setup screen").to.equal(
"Installation Setup"
);
const simplified = await eimRunner.findByText(
"Simplified Installation"
);
expect(await simplified.isDisplayed()).to.be.true;
expect(
await simplified.isDisplayed(),
"Expected option for simplified installation"
).to.be.true;
} catch (error) {
logger.info("Failed to locate get started button", error);
throw error;
Expand All @@ -78,7 +85,10 @@ describe("EIM Application Launch", () => {
const installing = await eimRunner.findByText(
"Please wait while the installation progresses..."
);
expect(await installing.isDisplayed()).to.be.true;
expect(
await installing.isDisplayed(),
"Expected installation progress screen"
).to.be.true;
const startTime = Date.now();

while (Date.now() - startTime < 1200000) {
Expand All @@ -97,8 +107,12 @@ describe("EIM Application Launch", () => {
const completed = await eimRunner.findByText(
"Installation Complete!"
);
expect(completed).to.not.be.false;
expect(await completed.isDisplayed()).to.be.true;
expect(completed, "Expected installation to be completed").to.not.be
.false;
expect(
await completed.isDisplayed(),
"Expected 'Installation Complete' text displayed"
).to.be.true;
} catch (error) {
logger.info("Failed to complete installation", error);
throw error;
Expand All @@ -110,10 +124,14 @@ describe("EIM Application Launch", () => {

try {
const saveConfig = await eimRunner.findByText("Save Configuration");
expect(saveConfig).to.not.be.false;
expect(await saveConfig.isDisplayed()).to.be.true;
expect(saveConfig, "Expected screen for saving configuration").to
.not.be.false;
expect(
await saveConfig.isDisplayed(),
"Expected option to save configuration to be displayed"
).to.be.true;
const exit = await eimRunner.findByText("Exit Installer");
expect(exit).to.not.be.false;
expect(exit, "Expected option to exit installer").to.not.be.false;
} catch (error) {
logger.info("Failed to complete installation", error);
throw error;
Expand Down
8 changes: 6 additions & 2 deletions tests/scripts/startup.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ describe("EIM Application Launch", () => {
// Wait for the header to be present
const header = await eimRunner.findByCSS("h1");
const text = await header.getText();
expect(text).to.equal("Welcome to ESP-IDF Installation Manager!");
expect(text, "Expected welcome text").to.equal(
"Welcome to ESP-IDF Installation Manager!"
);
} catch (error) {
logger.info("Failed to get Welcome header", error);
throw error;
Expand All @@ -63,7 +65,9 @@ describe("EIM Application Launch", () => {
try {
const footer = await eimRunner.findByClass("footer");
const text = await footer.getText();
expect(text).to.equal(`ESP-IDF Installation Manager ${eimVersion}`);
expect(text, "Expected correct version shown on page").to.equal(
`ESP-IDF Installation Manager ${eimVersion}`
);
} catch (error) {
logger.info("Failed to get EIM version footer", error);
throw error;
Expand Down

0 comments on commit 8bef7df

Please sign in to comment.