Skip to content

Commit

Permalink
[Temp] Test screenshot without headless
Browse files Browse the repository at this point in the history
  • Loading branch information
hoangdat committed Aug 6, 2024
1 parent 9cf25f5 commit 21c92f6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import org.junit.jupiter.params.provider.MethodSource;

import com.microsoft.playwright.Browser;
import com.microsoft.playwright.Browser.NewContextOptions;
import com.microsoft.playwright.BrowserContext;
import com.microsoft.playwright.BrowserType;
import com.microsoft.playwright.Page;
Expand Down Expand Up @@ -55,8 +56,11 @@ public void setUp(SupportedPlatform supportedPlatform) {
case FIREFOX -> playwright.firefox().launch(new BrowserType.LaunchOptions().setHeadless(runHeadlessTest));
default -> throw new UnsupportedPlatformException();
};
browserContext = browser.newContext(
new Browser.NewContextOptions().setViewportSize(1920, 1080));

NewContextOptions contextOptions = new Browser.NewContextOptions()
.setViewportSize(1100, 800);
browserContext = browser.newContext(contextOptions);

page = browserContext.newPage();
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.tmail.scenarios;

import java.nio.file.Path;
import com.microsoft.playwright.Page;
import com.tmail.base.BaseScenario;
import com.tmail.robots.BasicAuthLoginRobot;
Expand Down Expand Up @@ -28,8 +29,10 @@ public void execute(Page page) {
loginRobot.enterUsername(username);
loginRobot.enterPassword(password);
loginRobot.clickLogin();

mailboxDashboardRobot.waitUntilExactLabelIsVisible("Compose");

page.screenshot(new Page.ScreenshotOptions().setPath(Path.of("screenshot2.png")));
}

}

0 comments on commit 21c92f6

Please sign in to comment.