Skip to content

Commit 0b97f7d

Browse files
committed
bugfix: screenshot generation issue
1 parent 41ab9e1 commit 0b97f7d

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

src/test/java/io/github/tahanima/e2e/login/LoginE2ETest.java

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package io.github.tahanima.e2e.login;
22

3-
import io.github.tahanima.e2e.BaseE2ETest;
43
import io.github.tahanima.data.login.LoginData;
4+
import io.github.tahanima.e2e.BaseE2ETest;
55
import io.github.tahanima.pages.login.LoginPage;
66
import io.github.tahanima.pages.product.ProductsPage;
77
import org.testng.ITestNGMethod;
@@ -37,22 +37,19 @@ public void createBrowserContextAndPage() {
3737
}
3838

3939
@AfterMethod(alwaysRun = true)
40-
public void closeBrowserContext() {
41-
browserContext.close();
42-
}
43-
44-
@Override
45-
public void initialize() {}
46-
47-
@AfterMethod
48-
public void captureScreenshot(ITestResult result) {
40+
public void captureScreenshotAndCloseBrowserContext(ITestResult result) {
4941
ITestNGMethod method = result.getMethod();
5042

5143
if (ITestResult.FAILURE == result.getStatus()) {
5244
loginPage.captureScreenshot(method.getMethodName());
5345
}
46+
47+
browserContext.close();
5448
}
5549

50+
@Override
51+
public void initialize() {}
52+
5653
@Test(
5754
testName = "TC-1",
5855
dataProvider = "loginData",

0 commit comments

Comments
 (0)