I am attempting to be taught to create a pipeline in Gitlab. All my exams fail due to the compilation problem. My code is included under together with the error message.
import loginPage from "../PageObjects/loginPage";
fixture('Login Exams')
.web page('https://www.saucedemo.com/');
take a look at('Consumer Login to the web site', async (t) => {
await loginPage.loginWebsite('performance_glitch_user','secret_sauce');
});
import { Selector, t } from "testcafe";
class loginPage{
userName: Selector;
password: Selector;
loginBtn: Selector;
pageName: Selector;
constructor(){
this.userName = Selector('#user-name');
this.password = Selector('#password');
this.loginBtn = Selector('#login-button');
this.pageName = Selector('.title');
}
async loginWebsite(username, password){
await t
.typeText(this.userName, username)
.typeText(this.password, password)
.click on(this.loginBtn)
.anticipate(Selector(this.pageName).innerText).eql('Merchandise');
}
}
export default new loginPage;
bundle.json
{
"title": "testcafeproj",
"model": "1.0.0",
"description": "Project",
"major": "index.js",
"scripts": {
"take a look at": "testcafe chrome exams/**/*",
"test2": "testcafe edge exams/**/*",
"take a look at:chrome:headless": "testcafe chrome:headless exams/**/*",
"take a look at:chrome:studies": "testcafe chrome exams/* --reporter html:studies/report.html",
"take a look at:chrome:studies:ss": "testcafe chrome exams/*.ts -s takeOnFails=true --reporter html:studies/report.html"
},
"creator": "take a look at",
"license": "ISC",
"devDependencies": {
"faker": "^5.5.3",
"faker-js": "^1.0.0",
"testcafe": "^2.4.0",
"typescript": "^4.9.5"
},
"dependencies": {
"@faker-js/faker": "^7.6.0",
"testcafe-reporter-html": "^1.4.6"
}
}
.gitlab-ci.yml
levels:
- take a look at
test_job:
picture: cypress/browsers:node18.12.0-chrome107
stage: take a look at
script:
- npm ci
- npm run take a look at:chrome:headless
