test: add tests for git connection (#1289)

* chore: add data-test attributes

* test: add github connection test, add applications modal

* chore: embed test GITHUB_CLIENT_* environment values

---------

Co-authored-by: Ali BARIN <ali.barin53@gmail.com>
This commit is contained in:
QAComet
2023-10-23 10:48:23 -06:00
committed by GitHub
parent a82d34cbce
commit 4cedbdbc60
11 changed files with 316 additions and 0 deletions

View File

@@ -0,0 +1,34 @@
const { GithubPage } = require('./apps/github/github-page');
const { BasePage } = require('./base-page');
export class ApplicationsModal extends BasePage {
applications = {
github: GithubPage
};
/**
* @param {import('@playwright/test').Page} page
*/
constructor (page) {
super(page);
this.modal = page.getByTestId('add-app-connection-dialog');
this.searchInput = page.getByTestId('search-for-app-text-field');
this.appListItem = page.getByTestId('app-list-item');
this.appLoader = page.getByTestId('search-for-app-loader');
}
/**
* @param string link
*/
async selectLink (link) {
if (this.applications[link] === undefined) {
throw {
message: `Unknown link "${link}" passed to ApplicationsModal.selectLink`
}
}
await this.searchInput.fill(link);
await this.appListItem.first().click();
return new this.applications[link](this.page);
}
}