mirror of
https://github.com/plankanban/planka.git
synced 2025-08-05 13:35:27 +02:00
refactor the code
Signed-off-by: nabim777 <nabinalemagar019@gmail.com>
This commit is contained in:
parent
9670bd01f8
commit
8b1a599bee
2 changed files with 5 additions and 14 deletions
|
@ -1,12 +1,9 @@
|
|||
const util = require('util');
|
||||
|
||||
class dashboardPage {
|
||||
constructor() {
|
||||
this.createProjectIconSelector = `.Projects_addTitle__tXhB4`;
|
||||
this.projectTitleInputSelector = `input[name="name"]`;
|
||||
this.createProjectButtonSelector = `//button[text()="Create project"]`;
|
||||
this.projectTitleSelector = `//div[@class="item Header_item__OOEY7 Header_title__l+wMf"][text()="%s"]`;
|
||||
this.dashBoardHeaderSelector = `//div[@class="Projects_openTitle__PlaU6"][text()="%s"]`;
|
||||
}
|
||||
|
||||
async createProject(project) {
|
||||
|
@ -14,16 +11,6 @@ class dashboardPage {
|
|||
await page.fill(this.projectTitleInputSelector, project);
|
||||
await page.click(this.createProjectButtonSelector);
|
||||
}
|
||||
|
||||
async getProjectTilte() {
|
||||
return page.innerText(this.projectTitleSelector);
|
||||
}
|
||||
|
||||
async checkForProjectOpenedOrNot() {
|
||||
expect(
|
||||
await page.locator(util.format(this.dashboardPage.projectTitleInputSelector, project)),
|
||||
).toBeVisible();
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = dashboardPage;
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
const { When, Then } = require('@cucumber/cucumber');
|
||||
const util = require('util');
|
||||
const { expect } = require('playwright/test');
|
||||
|
||||
const DashboardPage = require('../pageObjects/DashboardPage');
|
||||
|
||||
|
@ -9,5 +11,7 @@ When('the user creates a project with name {string} using the webUI', async func
|
|||
});
|
||||
|
||||
Then('the created project {string} should be opened', async function (project) {
|
||||
dashboardPage.checkForProjectOpenedOrNot(project);
|
||||
expect(
|
||||
await page.locator(util.format(dashboardPage.projectTitleSelector, project)),
|
||||
).toBeVisible();
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue