Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/multiplebrowsernotclosing #23

Merged
merged 4 commits into from
Sep 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 22 additions & 3 deletions Engine/src/main/java/com/ing/engine/core/Task.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

package com.ing.engine.core;

import com.ing.datalib.component.Project;
Expand Down Expand Up @@ -67,12 +66,13 @@ public void run() {
try {
System.out.println("Running Iteration " + iter);
runIteration(iter++);
closePlaywrightInstance(iter-1);
} catch (Exception ex) {
LOG.log(Level.SEVERE, ex.getMessage(), ex);
}
}
Date endEexcDate = new Date();

if (report != null) {
Status s = report.finalizeReport();
Control.ReportManager.startDate = startexecDate;
Expand All @@ -82,6 +82,25 @@ public void run() {
}
}

private void closePlaywrightInstance(int iter) {
String browserName = playwrightDriver.getCurrentBrowser();
if (playwrightDriver != null) {
playwrightDriver.closeBrowser();
playwrightDriver.playwright.close();
}
String closureConfirmationText = "Playwright instance with [" + browserName + "] has been closed for Iteration : " + iter;
System.out.println("\n");
for (int i = 0; i < closureConfirmationText.length() + 7; i++) {
System.out.print("-");
}
System.out.println();
System.out.println("| " + closureConfirmationText + " |");
for (int i = 0; i < closureConfirmationText.length() + 7; i++) {
System.out.print("-");
}
System.out.println("\n");
}

private TestCase getTestCase() {
try {
Scenario scn = project().getScenarioByName(runContext.Scenario);
Expand Down Expand Up @@ -144,7 +163,7 @@ private void launchBrowser() throws UnCaughtException {
}

private CommandControl createControl() {
return new CommandControl(playwrightDriver,playwrightDriver,playwrightDriver, report) {
return new CommandControl(playwrightDriver, playwrightDriver, playwrightDriver, report) {
@Override
public void execute(String com, int sub) {
runner.runTestCase(com, sub);
Expand Down
8 changes: 4 additions & 4 deletions IDE/src/main/java/com/ing/ide/main/mainui/AppMenuBar.java
Original file line number Diff line number Diff line change
Expand Up @@ -199,10 +199,10 @@ private JMenu createConfigurationMenu() {
withMnemonics(
withIcon(
Utils.createMenuItem("Browser Configuration", sActionListener)), 'B'));
configure.add(
withMnemonics(
withIcon(
Utils.createMenuItem("AzureDevOps TestPlan Configuration", sActionListener)), 'T'));
// configure.add(
// withMnemonics(
// withIcon(
// Utils.createMenuItem("AzureDevOps TestPlan Configuration", sActionListener)), 'T'));
configure.addSeparator();

// configure.add(
Expand Down
10 changes: 5 additions & 5 deletions IDE/src/main/java/com/ing/ide/main/mainui/AppToolBar.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@ private void init() {
add(createButton("Save Project"));
addSeparator();

add(createButton("Object Spy"));
add(createButton("Object Heal"));
addSeparator();
// add(createButton("Object Spy"));
// add(createButton("Object Heal"));
// addSeparator();
// add(createButton("Mobile Spy"));
add(createButton("Image Spy"));
// add(createButton("Image Spy"));
addSeparator();
add(createButton("Run Settings"));
add(createButton("Browser Configuration"));
add(createButton("AzureDevOps TestPlan Configuration"));
// add(createButton("AzureDevOps TestPlan Configuration"));
addSeparator();
add(new javax.swing.Box.Filler(new java.awt.Dimension(0, 0), new java.awt.Dimension(0, 0), new java.awt.Dimension(32767, 32767)));
// add(createButton("Refresh"));
Expand Down
Loading