Skip to content

Commit

Permalink
Merge pull request #8 from CristianDavideConte/beta
Browse files Browse the repository at this point in the history
Beta
  • Loading branch information
CristianDavideConte authored May 19, 2022
2 parents 425b0c4 + a8a1fa5 commit ff46bbc
Show file tree
Hide file tree
Showing 15 changed files with 635 additions and 198 deletions.
82 changes: 82 additions & 0 deletions .github/workflows/uss_tests_linux.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
name: uss-tests-linux

# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events for beta and master branches
push:
pull_request:

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
chrome-test:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Checkout
uses: actions/checkout@v3
# Workaround for creating the package.json file
- name: Setup npm package
run: npm init -y && npm install
# Install and start the localhost server in the background
- name: Run server
run: npx http-server -c-1 &
# Runs a single command using the runners shell
- name: Cypress run
uses: cypress-io/github-action@v2
with:
wait-on: "http://localhost:8080"
build: npm i -D cypress
browser: chrome

firefox-test:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Checkout
uses: actions/checkout@v3
# Workaround for creating the package.json file
- name: Setup npm package
run: npm init -y && npm install
# Install and start the localhost server in the background
- name: Run server
run: npx http-server -c-1 &
# Runs a single command using the runners shell
- name: Cypress run
uses: cypress-io/github-action@v2
with:
wait-on: "http://localhost:8080"
build: npm i -D cypress
browser: firefox

#not available yet
# edge-test:
# # The type of runner that the job will run on
# runs-on: ubuntu-latest
# # Steps represent a sequence of tasks that will be executed as part of the job
# steps:
# # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
# - name: Checkout
# uses: actions/checkout@v3
# # Workaround for creating the package.json file
# - name: Setup npm package
# run: npm init -y && npm install
# # Installs Edge
# - name: Install Microsoft Edge
# uses: browser-actions/setup-edge@latest
# # Install and start the localhost server in the background
# - name: Run server
# run: npx http-server -c-1 &
# # Runs a single command using the runners shell
# - name: Cypress run
# uses: cypress-io/github-action@v2
# with:
# wait-on: "http://localhost:8080"
# build: npm i -D cypress
# browser: edge
81 changes: 81 additions & 0 deletions .github/workflows/uss_tests_macos.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
name: uss-tests-macos

# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events for beta and master branches
push:
pull_request:

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
chrome-test:
# The type of runner that the job will run on
runs-on: macos-10.15
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Checkout
uses: actions/checkout@v3
# Workaround for creating the package.json file
- name: Setup npm package
run: npm init -y && npm install
# Install and start the localhost server in the background
- name: Run server
run: npx http-server -c-1 &
# Runs a single command using the runners shell
- name: Cypress run
uses: cypress-io/github-action@v2
with:
wait-on: "http://localhost:8080"
build: npm i -D cypress
browser: chrome

firefox-test:
# The type of runner that the job will run on
runs-on: macos-10.15
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Checkout
uses: actions/checkout@v3
# Workaround for creating the package.json file
- name: Setup npm package
run: npm init -y && npm install
# Install and start the localhost server in the background
- name: Run server
run: npx http-server -c-1 &
# Runs a single command using the runners shell
- name: Cypress run
uses: cypress-io/github-action@v2
with:
wait-on: "http://localhost:8080"
build: npm i -D cypress
browser: firefox

edge-test:
# The type of runner that the job will run on
runs-on: macos-10.15
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Checkout
uses: actions/checkout@v3
# Workaround for creating the package.json file
- name: Setup npm package
run: npm init -y && npm install
# Installs Edge
- name: Install Microsoft Edge
uses: browser-actions/setup-edge@latest
# Install and start the localhost server in the background
- name: Run server
run: npx http-server -c-1 &
# Runs a single command using the runners shell
- name: Cypress run
uses: cypress-io/github-action@v2
with:
wait-on: "http://localhost:8080"
build: npm i -D cypress
browser: edge
90 changes: 90 additions & 0 deletions .github/workflows/uss_tests_windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
name: uss-tests-windows

# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events for beta and master branches
push:
pull_request:

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
chrome-test:
# The type of runner that the job will run on
runs-on: windows-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Checkout
uses: actions/checkout@v3
# Workaround for creating the package.json file
- name: Setup npm package
run: npm init -y && npm install
# Installs the localhost server
- name: Install Server
run: npm install --global http-server
# Runs the locahost server
- name: Run server
run: cmd /c START /b http-server
# Runs a single command using the runners shell
- name: Cypress run
uses: cypress-io/github-action@v2
with:
wait-on: "http://localhost:8080"
build: npm i -D cypress
browser: chrome

firefox-test:
# The type of runner that the job will run on
runs-on: windows-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Checkout
uses: actions/checkout@v3
# Workaround for creating the package.json file
- name: Setup npm package
run: npm init -y && npm install
# Installs the localhost server
- name: Install Server
run: npm install --global http-server
# Runs the locahost server
- name: Run server
run: cmd /c START /b http-server
# Runs a single command using the runners shell
- name: Cypress run
uses: cypress-io/github-action@v2
with:
wait-on: "http://localhost:8080"
build: npm i -D cypress
browser: firefox

edge-test:
# The type of runner that the job will run on
runs-on: windows-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Checkout
uses: actions/checkout@v3
# Workaround for creating the package.json file
- name: Setup npm package
run: npm init -y && npm install
# Installs Edge
- name: Install Microsoft Edge
uses: browser-actions/setup-edge@latest
# Installs the localhost server
- name: Install Server
run: npm install --global http-server
# Runs the locahost server
- name: Run server
run: cmd /c START /b http-server
# Runs a single command using the runners shell
- name: Cypress run
uses: cypress-io/github-action@v2
with:
wait-on: "http://localhost:8080"
build: npm i -D cypress
browser: edge
4 changes: 2 additions & 2 deletions cypress.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"env": {
"testSite": "https://cristiandavideconte.github.io/universalSmoothScroll/" ,
"preferredTimeout": 15000
"testSite": "http://127.0.0.1:8080/",
"preferredTimeout": 4000
}
}
9 changes: 5 additions & 4 deletions cypress/integration/x-axis-getters-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,10 @@ describe("getXStepLengthCalculator-Body", function() {
uss._containersData = new Map();
expect(uss.getXStepLengthCalculator()).to.be.undefined;

uss.setXStepLengthCalculator(nonTempTestCalculator, uss.getPageScroller());
uss.setXStepLengthCalculator(nonTempTestCalculator, uss.getPageScroller(), false, true);
expect(uss.getXStepLengthCalculator()).to.equal(nonTempTestCalculator);

uss.setXStepLengthCalculator(tempTestCalculator, uss.getPageScroller(), true);
uss.setXStepLengthCalculator(tempTestCalculator, uss.getPageScroller(), true, true);
expect(uss.getXStepLengthCalculator(uss.getPageScroller(), true)).to.equal(tempTestCalculator);

return new Cypress.Promise(resolve => {
Expand Down Expand Up @@ -116,10 +116,11 @@ describe("getMaxScrollX-Body", function() {
.then((win) => {
uss = win.uss;
uss._containersData = new Map();

const _expectedMaxScrollX = uss.getPageScroller().scrollWidth / 2 + uss.getScrollbarsMaxDimension();

expect(Number.isFinite(uss.getMaxScrollX())).to.be.true;
expect(uss.getMaxScrollX() > 0).to.be.true;
expect(uss.getMaxScrollX()).to.equal(uss.getPageScroller().scrollWidth / 2 + uss.getScrollbarsMaxDimension());
expect(uss.getMaxScrollX()).to.be.closeTo(_expectedMaxScrollX, 1);

//test elements that are unscrollable on the x-axis
expect(uss.getMaxScrollX(win.document.getElementById("yScroller"))).to.equal(0);
Expand Down
21 changes: 11 additions & 10 deletions cypress/integration/x-axis-scroll-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,11 @@ describe("scrollXTo-StoppedScrollingWhileAnimating-Body", function() {
var uss;
var _resolve;
const _testCalculator = (i = 0) => {
return (remaning, originalTimestamp, currentTimestamp, total, currentYPosition, finalYPosition, container) => {
if(i++ < 10) return total / 10;
uss.stopScrollingX();
_resolve();
return (remaning, originalTimestamp, currentTimestamp, total, currentXPosition, finalXPosition, container) => {
if(!uss.isXscrolling()) return total; //testing phase of the setXStepLengthCalculator
i++;
if(i < 10) return total / 10;
uss.stopScrollingX(container, _resolve);
}
}
it("Checks the scrollXTo method whenever a scroll animation is stopped inside a stepLengthCalculator", function(){
Expand All @@ -85,12 +86,12 @@ describe("scrollXTo-StoppedScrollingWhileAnimating-Body", function() {
.then((win) => {
uss = win.uss;
uss._containersData = new Map();
uss.setXStepLengthCalculator(_testCalculator());


uss.setXStepLengthCalculator(_testCalculator(), uss.getPageScroller(), false, true);
return new Cypress.Promise(resolve => {
_resolve = resolve;
uss.scrollXTo(100, uss.getPageScroller());
});
});
}).then(() => {
bodyScrollLeftShouldToBe(90);
})
Expand Down Expand Up @@ -165,7 +166,7 @@ describe("scrollXToBy-StillStart-False-ExtendedScrollingWhileAnimating-Body", fu
.then((win) => {
uss = win.uss;
uss._containersData = new Map();
uss.setXStepLengthCalculator(_testCalculator());
uss.setXStepLengthCalculator(_testCalculator(), uss.getPageScroller(), false, true);
return new Cypress.Promise(resolve => {
_resolve = resolve;
uss.scrollXTo(100, uss.getPageScroller());
Expand All @@ -192,7 +193,7 @@ describe("scrollXTo-scrollXTo-ReplaceScrollingWhileAnimating-Body", function() {
.then((win) => {
uss = win.uss;
uss._containersData = new Map();
uss.setXStepLengthCalculator(_testCalculator());
uss.setXStepLengthCalculator(_testCalculator(), uss.getPageScroller(), false, true);
return new Cypress.Promise(resolve => {
_resolve = resolve;
uss.scrollXTo(100, uss.getPageScroller());
Expand Down Expand Up @@ -248,7 +249,7 @@ describe("isXScrolling-StoppedScrollingWhileAnimating-Body", function() {
uss = win.uss;
uss._containersData = new Map();
expect(uss.isXscrolling()).to.be.false;
uss.setXStepLengthCalculator(_testCalculator());
uss.setXStepLengthCalculator(_testCalculator(), uss.getPageScroller(), false, true);
return new Cypress.Promise(resolve => {
_resolve = resolve;
uss.scrollXTo(100, uss.getPageScroller());
Expand Down
Loading

0 comments on commit ff46bbc

Please sign in to comment.