-
-
Notifications
You must be signed in to change notification settings - Fork 783
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Cleanup after merge, move test dependencies to dev
- Loading branch information
Showing
8 changed files
with
217 additions
and
162 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,35 @@ | ||
const { | ||
After, | ||
Before, | ||
AfterAll, | ||
BeforeAll, | ||
setDefaultTimeout, | ||
} = require("@cucumber/cucumber"); | ||
const { createSession, closeSession } = require("nightwatch-api"); | ||
// cucumber.conf.js file | ||
|
||
setDefaultTimeout(60000); | ||
// runs before all scenarios | ||
BeforeAll(async function () {}); | ||
const { Before, BeforeAll, AfterAll, After, setDefaultTimeout } = require('@cucumber/cucumber'); | ||
const { chromium } = require('playwright'); | ||
const { deleteProject } = require('./testHelpers/apiHelpers'); | ||
const config = require('./config'); | ||
|
||
// runs before each scenario | ||
setDefaultTimeout(config.timeout); | ||
|
||
// launch the browser | ||
BeforeAll(async function () { | ||
global.browser = await chromium.launch({ | ||
// makes true for CI | ||
headless: config.headless, | ||
slowMo: config.slowMo, | ||
}); | ||
}); | ||
|
||
// close the browser | ||
AfterAll(async function () { | ||
await global.browser.close(); | ||
}); | ||
|
||
// Create a new browser context and page per scenario | ||
Before(async function () { | ||
await createSession(); | ||
global.context = await global.browser.newContext(); | ||
global.page = await global.context.newPage(); | ||
}); | ||
|
||
// runs after each scenario | ||
// Cleanup after each scenario | ||
After(async function () { | ||
await closeSession(); | ||
await deleteProject(); | ||
await global.page.close(); | ||
await global.context.close(); | ||
}); | ||
|
||
// runs after all scenarios | ||
AfterAll(async function () {}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,16 @@ | ||
module.exports = { | ||
url: function () { | ||
return this.api.launchUrl + "/dashboard"; | ||
}, | ||
commands: { | ||
isDashboardPage: async function () { | ||
let result = false; | ||
await this.waitForElementVisible("@dashboardHeader"); | ||
await this.isVisible("@dashboardHeader", (res) => { | ||
result = res.value; | ||
}); | ||
return result; | ||
}, | ||
}, | ||
elements: { | ||
dashboardHeader: { | ||
selector: "a.Header_title__3SEjb", | ||
}, | ||
}, | ||
}; | ||
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"]`; | ||
} | ||
|
||
async createProject(project) { | ||
await page.click(this.createProjectIconSelector); | ||
await page.fill(this.projectTitleInputSelector, project); | ||
await page.click(this.createProjectButtonSelector); | ||
} | ||
} | ||
|
||
module.exports = dashboardPage; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,38 @@ | ||
module.exports = { | ||
url: function () { | ||
return this.api.launchUrl + "/login"; | ||
}, | ||
commands: { | ||
logIn: function (email, password) { | ||
return this.waitForElementVisible("@emailInput") | ||
.setValue("@emailInput", email) | ||
.waitForElementVisible("@passwordInput") | ||
.setValue("@passwordInput", password) | ||
.waitForElementVisible("@loginBtn") | ||
.click("@loginBtn"); | ||
}, | ||
}, | ||
elements: { | ||
emailInput: { | ||
selector: "input[name=emailOrUsername]", | ||
}, | ||
passwordInput: { | ||
selector: "input[name=password]", | ||
}, | ||
loginBtn: { | ||
selector: "form button", | ||
}, | ||
}, | ||
}; | ||
const config = require(`../config`); | ||
|
||
class LoginPage { | ||
constructor() { | ||
// url | ||
this.homeUrl = config.baseUrl; | ||
this.loginUrl = `${this.homeUrl}login`; | ||
|
||
// selectors | ||
this.loginButtonSelector = `//i[@class="right arrow icon"]`; | ||
this.usernameSelector = `//input[@name='emailOrUsername']`; | ||
this.passwordSelector = `//input[@name='password']`; | ||
this.errorMessageSelector = `//div[@class='ui error visible message']`; | ||
this.userActionSelector = `//span[@class="User_initials__9Wp90"]`; | ||
this.logOutSelector = `//a[@class="item UserStep_menuItem__5pvtT"][contains(text(),'Log Out')]`; | ||
} | ||
|
||
async goToLoginUrl() { | ||
await page.goto(this.loginUrl); | ||
} | ||
|
||
async logOut() { | ||
await page.click(this.userActionSelector); | ||
await page.click(this.logOutSelector); | ||
} | ||
|
||
async login(username, password) { | ||
await page.fill(this.usernameSelector, username); | ||
await page.fill(this.passwordSelector, password); | ||
await page.click(this.loginButtonSelector); | ||
} | ||
|
||
async getErrorMessage() { | ||
return page.innerText(this.errorMessageSelector); | ||
} | ||
} | ||
|
||
module.exports = LoginPage; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters