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

Automation with Playwright #164

Open
wants to merge 3 commits into
base: ok/integration
Choose a base branch
from
Open
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
37 changes: 37 additions & 0 deletions src/integrations/PlaywrightHelpers.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import * as path from "path";
const { chromium } = require("playwright");

export default {
async uploadToScale() {
// Launch the browser
const browser = await chromium.launch({ headless: true });
const page = await browser.newPage();
// Open JIRA
await page.goto(
"https://zubairidrisaweda.atlassian.net/projects/KAN?selectedItem=com.atlassian.plugins.atlassian-connect-plugin:com.kanoah.test-manager__main-project-page#!/testPlayer/testExecution/KAN-E1"
);

// Click on 'Sign in' button
await page.locator('[aria-label="Sign in"]').first().click();

// Fill in the input
await page
.locator('input[name="username"]')
.fill("zubairidrisaweda@gmail.com");

// Click submit
await page.locator("#login-submit").click();

// Type password
await page.locator('input[name="password"]').fill("*****");

// Click login
await page.locator("#login-submit").click();

// Start waiting for file chooser before clicking. Note no await.
const fileChooserPromise = page.waitForEvent("filechooser");
await page.getByText("select files").click();
const fileChooser = await fileChooserPromise;
await fileChooser.setFiles(path.join(__dirname, "screenshot_4.png"));
},
};