Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test #3

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
6 changes: 6 additions & 0 deletions .vscode/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
tsconfig.json
output
node_modules
package.lock.json
reports
assets
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"git.ignoreLimitWarning": true
}
49 changes: 48 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,52 @@ Create a simple test framework using NPM, Cypress and Cucumber to automate a sel
- https://www.cypress.io
- https://www.npmjs.com/package/cypress-cucumber-preprocessor

The bet slip is where a customer will enter a stake against an outcome that they have selected and place a bet. As an example a customer may want to place a bet on Leeds United to beat Manchester United. They would navigate to the event to find the market that they want to place the bet against, add that outcome to the bet slip, enter their stake (e.g. £1) and place a single bet.
There are a multitude of bet types available to customers but for the purpose of this technical test it is sufficient to place only single type bets (e.g. Leeds United to beat Manchester United).
There is no requirement for you to actually place the bet in the below scenario, you will therefore not need to have a registered account with PokerStars Sports or have to log in to the website.
Task:

Create a BDD automation framework to address the below scenarios;


Scenario 1 -Darts

As a PokerStars Sports user I want to navigate to https://www.pokerstarssports.uk and navigate to a Darts event. Once I have arrived at a darts event I would then like to verify that a `GET` request was made to

Scenario 2 - Betslip

As a PokerStars Sports user I want to add an outcome to the bet slip for any sport and verify that the outcome is added to the bet slip. I would then like to remove this from the bet slip and verify that the bet slip is now empty.
Scenario 3 - Reporting (Optional)

For visibility of test runs we would like to see a reporting function within your framework that reports on test runs.
Once all test scenarios are finished please add instructions to the README file on how to execute these tests and any other useful information.

You can either upload this project to GitHub which is preferred or we will also accept this zipped up and sent as an attachment.

---------------------------------------------------------------------------------------------------#To execute the tests

With browser: npm run test
Headless: npx run test:headless

These two commands are defined in the package.json under scripts, we can also add more variants of running the test. for example for each spec/feature individually

For the reporting I have added the mochawesome reporting which will get the report in html format, We can change the format to Json in cypress.json

I prefer to use the cypress dashboard especially when the tests are running on pipeline

ISSUE: Just faced one issue "Cypress detected that an uncaught error was thrown from a cross origin script." Found the alternative that is to ignore the error on the application and proceed with the cypress test execution

Note:
I couldn't able to test and run my tests which I have written due to the non accessible domain(UK) sports section

I have completed one scenario by using by getting the locators over the email as because of time difference it is not easy to get hold of any of my firends after working hours.

I have also installed mochawesome dependecies so after every run there should be a report generated.

The reports will be under cypress/reports folder in json format, It'll be created automatically once the report is complied after the test run. the naming convention for the reports is date format which is defined in config file(cypress.json)

There will be another folder for screenshots
=======

After completing the tasks, please update the README.md file with your scenarios from Task 1 and instructions on how to run your tests, include any information you think is relevant, interesting or useful. The preferred delivery method for this project is via Github but we will also accept a zipped file sent as an email attachment.

After completing the tasks, please update the README.md file with your scenarios from Task 1 and instructions on how to run your tests, include any information you think is relevant, interesting or useful. The preferred delivery method for this project is via Github but we will also accept a zipped file sent as an email attachment.
21 changes: 21 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Node.js
# Build a general Node.js project with npm.
# Add steps that analyze code, save build artifacts, deploy, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/javascript

trigger:
- master

pool:
vmImage: ubuntu-latest

steps:
- task: NodeTool@0
inputs:
versionSpec: '10.x'
displayName: 'Install Node.js'

- script: |
npm install
npm run build
displayName: 'npm install and build'
30 changes: 30 additions & 0 deletions cypress.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"testFiles": "**/*.{feature,features}",
"baseUrl": "https://www.pokerstarssports.uk",
"video": true,
"viewportWidth": 1600,
"viewportHeight": 1200,
"defaultCommandTimeout": 10000,
"numTestsKeptInMemory": 1,
"reporter": "cypress-multi-reporters",
"reporterOptions": {
"reporterEnabled": "mochawesome",
"mochawesomeReporterOptions": {
"reportDir": "cypress/reports",
"quite": true,
"overwrite": false,
"html": true,
"json": false,
"VideoUploadOnPasses": false,
"timestamp": "ddmmyyyy_HHMMss"
}
},
"retries": {
"runMode": 2,
"openMode": 0
},
"footy": {
"url": "https://idcta.api.bbc.co.uk/idcta/init?policy=notification&buttonColour=white&ptrt=https%3A%2F%2Fwww.bbc.co.uk%2Fsport%2Ffootball"

}
}
5 changes: 5 additions & 0 deletions cypress/fixtures/example.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"name": "Using fixtures to represent data",
"email": "[email protected]",
"body": "Fixtures are a great way to mock data for responses to routes"
}
9 changes: 9 additions & 0 deletions cypress/integration/Add and remove betslip/betSlip.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@

Feature: Score & fixture

Scenario: Add and remove from betslip

Given I want to add an outcome to the bet slip for any sport
And verify that the outcome is added to the bet slip
Then like to remove this from the bet slip
And verify that the bet slip is now empty
9 changes: 9 additions & 0 deletions cypress/integration/darts/darts.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Feature: I want to browse on pokerstars UK for Darts event

Scenario: load the base url and navigate to darts event

Given Navigate to pokerstarssports UK
And click on sports hyperlink on the home page
When click on darts
Then I would then like to verify that a GET request was made to the request URL

11 changes: 11 additions & 0 deletions cypress/plugins/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@

module.exports = (on, config) => {
// `on` is used to hook into various events Cypress emits
// `config` is the resolved Cypress config
}

const cucumber = require('cypress-cucumber-preprocessor').default

module.exports = (on, config) => {
on('file:preprocessor', cucumber())
}
Loading