Move Cypress directory and convert it to JavaScript (#2170)
parent
16b2cf0e89
commit
afbc283423
18 changed files with 75 additions and 75 deletions
@ -0,0 +1,26 @@ |
||||
const { defineConfig } = require("cypress"); |
||||
|
||||
module.exports = defineConfig({ |
||||
e2e: { |
||||
setupNodeEvents(on, config) { |
||||
|
||||
}, |
||||
fixturesFolder: "test/cypress/fixtures", |
||||
screenshotsFolder: "test/cypress/screenshots", |
||||
videosFolder: "test/cypress/videos", |
||||
downloadsFolder: "test/cypress/downloads", |
||||
supportFile: "test/cypress/support/e2e.js", |
||||
baseUrl: "http://localhost:3002", |
||||
defaultCommandTimeout: 10000, |
||||
pageLoadTimeout: 60000, |
||||
viewportWidth: 1920, |
||||
viewportHeight: 1080, |
||||
specPattern: [ |
||||
"test/cypress/e2e/setup.cy.js", |
||||
"test/cypress/e2e/**/*.js" |
||||
], |
||||
}, |
||||
env: { |
||||
baseUrl: "http://localhost:3002", |
||||
}, |
||||
}); |
@ -1,15 +0,0 @@ |
||||
import { defineConfig } from "cypress"; |
||||
|
||||
export default defineConfig({ |
||||
e2e: { |
||||
baseUrl: "http://localhost:3002", |
||||
defaultCommandTimeout: 10000, |
||||
pageLoadTimeout: 60000, |
||||
viewportWidth: 1920, |
||||
viewportHeight: 1080, |
||||
specPattern: ["cypress/e2e/setup.cy.ts", "cypress/e2e/**/*.ts"], |
||||
}, |
||||
env: { |
||||
baseUrl: "http://localhost:3002", |
||||
}, |
||||
}); |
@ -1,24 +0,0 @@ |
||||
import { actor } from "../support/actors/actor"; |
||||
import { DEFAULT_USER_DATA } from "../support/const/user-data"; |
||||
import { DashboardPage } from "../support/pages/dasboard-page"; |
||||
import { SetupPage } from "../support/pages/setup-page"; |
||||
|
||||
describe("user can create a new account on setup page", () => { |
||||
before(() => { |
||||
cy.visit("/setup"); |
||||
}); |
||||
|
||||
it("user can create new account", () => { |
||||
cy.url().should("be.equal", SetupPage.url); |
||||
actor.setupTask.fillAndSubmitSetupForm( |
||||
DEFAULT_USER_DATA.username, |
||||
DEFAULT_USER_DATA.password, |
||||
DEFAULT_USER_DATA.password |
||||
); |
||||
|
||||
cy.url().should("be.equal", DashboardPage.url); |
||||
cy.get('[role="alert"]') |
||||
.should("be.visible") |
||||
.and("contain.text", "Added Successfully."); |
||||
}); |
||||
}); |
@ -1,8 +0,0 @@ |
||||
import { SetupTask } from "../tasks/setup-task"; |
||||
|
||||
class Actor { |
||||
setupTask: SetupTask = new SetupTask(); |
||||
} |
||||
|
||||
const actor = new Actor(); |
||||
export { actor }; |
@ -1 +0,0 @@ |
||||
import "./commands"; |
@ -1,15 +0,0 @@ |
||||
import { SetupPage } from "../pages/setup-page"; |
||||
|
||||
export class SetupTask { |
||||
fillAndSubmitSetupForm( |
||||
username: string, |
||||
password: string, |
||||
passwordRepeat: string |
||||
) { |
||||
cy.get(SetupPage.usernameInput).type(username); |
||||
cy.get(SetupPage.passWordInput).type(password); |
||||
cy.get(SetupPage.passwordRepeatInput).type(passwordRepeat); |
||||
|
||||
cy.get(SetupPage.submitSetupForm).click(); |
||||
} |
||||
} |
@ -0,0 +1,18 @@ |
||||
const actor = require("../support/actors/actor"); |
||||
const userData = require("../support/const/user-data"); |
||||
const dashboardPage = require("../support/pages/dashboard-page"); |
||||
const setupPage = require("../support/pages/setup-page"); |
||||
|
||||
describe("user can create a new account on setup page", () => { |
||||
before(() => { |
||||
cy.visit("/setup"); |
||||
}); |
||||
it("user can create new account", () => { |
||||
cy.url().should("be.equal", setupPage.SetupPage.url); |
||||
actor.actor.setupTask.fillAndSubmitSetupForm(userData.DEFAULT_USER_DATA.username, userData.DEFAULT_USER_DATA.password, userData.DEFAULT_USER_DATA.password); |
||||
cy.url().should("be.equal", dashboardPage.DashboardPage.url); |
||||
cy.get('[role="alert"]') |
||||
.should("be.visible") |
||||
.and("contain.text", "Added Successfully."); |
||||
}); |
||||
}); |
@ -0,0 +1,8 @@ |
||||
const setupTask = require("../tasks/setup-task"); |
||||
class Actor { |
||||
constructor() { |
||||
this.setupTask = new setupTask.SetupTask(); |
||||
} |
||||
} |
||||
const actor = new Actor(); |
||||
exports.actor = actor; |
@ -1,4 +1,4 @@ |
||||
export const DEFAULT_USER_DATA = { |
||||
exports.DEFAULT_USER_DATA = { |
||||
username: "testuser", |
||||
password: "testuser123", |
||||
}; |
@ -0,0 +1 @@ |
||||
require("./commands"); |
@ -1,3 +1,3 @@ |
||||
export const DashboardPage = { |
||||
exports.DashboardPage = { |
||||
url: Cypress.env("baseUrl") + "/dashboard", |
||||
}; |
@ -1,4 +1,4 @@ |
||||
export const SetupPage = { |
||||
exports.SetupPage = { |
||||
url: Cypress.env("baseUrl") + "/setup", |
||||
usernameInput: '[data-cy="username-input"]', |
||||
passWordInput: '[data-cy="password-input"]', |
@ -0,0 +1,11 @@ |
||||
const setupPage = require("../pages/setup-page"); |
||||
|
||||
class SetupTask { |
||||
fillAndSubmitSetupForm(username, password, passwordRepeat) { |
||||
cy.get(setupPage.SetupPage.usernameInput).type(username); |
||||
cy.get(setupPage.SetupPage.passWordInput).type(password); |
||||
cy.get(setupPage.SetupPage.passwordRepeatInput).type(passwordRepeat); |
||||
cy.get(setupPage.SetupPage.submitSetupForm).click(); |
||||
} |
||||
} |
||||
exports.SetupTask = SetupTask; |
Loading…
Reference in new issue