chore: add linter to tests

This commit is contained in:
Jakub P.
2024-07-18 12:39:04 +02:00
parent 27610c002c
commit 0a1461231b
22 changed files with 66 additions and 33 deletions

View File

@@ -1,10 +1,11 @@
const { BasePage } = require('../../base-page');
const { AddGithubConnectionModal } = require('./add-github-connection-modal');
const { expect } = require('@playwright/test');
export class GithubPage extends BasePage {
constructor (page) {
super(page)
super(page);
this.addConnectionButton = page.getByTestId('add-connection-button');
this.connectionsTab = page.getByTestId('connections-tab');
this.flowsTab = page.getByTestId('flows-tab');
@@ -38,7 +39,7 @@ export class GithubPage extends BasePage {
await this.flowsTab.click();
await expect(this.flowsTab).toBeVisible();
}
return await this.flowRows.count() > 0
return await this.flowRows.count() > 0;
}
async hasConnections () {

View File

@@ -1,4 +1,5 @@
const { BasePage } = require('../../base-page');
const { expect } = require('@playwright/test');
export class GithubPopup extends BasePage {
@@ -11,7 +12,7 @@ export class GithubPopup extends BasePage {
}
getPathname () {
const url = this.page.url()
const url = this.page.url();
try {
return new URL(url).pathname;
} catch (e) {
@@ -34,17 +35,17 @@ export class GithubPopup extends BasePage {
loginInput.click();
await loginInput.fill(process.env.GITHUB_USERNAME);
const passwordInput = this.page.getByLabel('Password');
passwordInput.click()
passwordInput.click();
await passwordInput.fill(process.env.GITHUB_PASSWORD);
await this.page.getByRole('button', { name: 'Sign in' }).click();
// await this.page.waitForTimeout(2000);
if (this.page.isClosed()) {
return
return;
}
// await this.page.waitForLoadState('networkidle', 30000);
this.page.waitForEvent('load');
if (this.page.isClosed()) {
return
return;
}
await this.page.waitForURL(function (url) {
const u = new URL(url);
@@ -55,7 +56,7 @@ export class GithubPopup extends BasePage {
}
async handleAuthorize () {
if (this.page.isClosed()) { return }
if (this.page.isClosed()) { return; }
const authorizeButton = this.page.getByRole(
'button',
{ name: 'Authorize' }
@@ -69,7 +70,7 @@ export class GithubPopup extends BasePage {
) && (
u.searchParams.get('client_id') === null
);
})
});
const passwordInput = this.page.getByLabel('Password');
if (await passwordInput.isVisible()) {
await passwordInput.fill(process.env.GITHUB_PASSWORD);
@@ -87,6 +88,6 @@ export class GithubPopup extends BasePage {
};
}
}
await this.page.waitForEvent('close')
await this.page.waitForEvent('close');
}
}