diff --git a/examples/running-tests-in-firefox-using-bitbucket-pipelines-ci/README.md b/examples/running-tests-in-firefox-using-bitbucket-pipelines-ci/README.md new file mode 100644 index 00000000000..2a3415e6a22 --- /dev/null +++ b/examples/running-tests-in-firefox-using-bitbucket-pipelines-ci/README.md @@ -0,0 +1,14 @@ +# Example: Running Tests in Chrome Using Bitbucket Pipelines CI + +*A set of sample files that explains how to use Bitbucket Pipelines CI in Chrome (Headless) to run TestCafe tests in the cloud.* + +## Running the example + +1. Clone the TestCafe repository to your machine. + + ```sh + git clone https://github.com/DevExpress/testcafe.git + ``` + +2. Create a new Bitbucket repository and copy the sample files from *examples/running-tests-in-firefox-using-bitbucket-pipelines-ci* to your repository. +3. Follow the steps described in the [Running Tests in Bitbucket Pipelines CI](https://testcafe.io/documentation/402821/guides/continuous-integration/bitbucket-pipelines) topic. diff --git a/examples/running-tests-in-firefox-using-bitbucket-pipelines-ci/bitbucket-pipelines.yml b/examples/running-tests-in-firefox-using-bitbucket-pipelines-ci/bitbucket-pipelines.yml new file mode 100644 index 00000000000..5f64673daee --- /dev/null +++ b/examples/running-tests-in-firefox-using-bitbucket-pipelines-ci/bitbucket-pipelines.yml @@ -0,0 +1,21 @@ +image: cimg/node:current-browsers +pipelines: + pull-requests: + '**': + - step: + script: + - wget -O ~/FirefoxSetup.tar.bz2 "https://download.mozilla.org/?product=firefox-latest-ssl&os=linux64" + - sudo tar xjf ~/FirefoxSetup.tar.bz2 -C /opt + - sudo ln -s /opt/firefox/firefox /usr/bin/firefox + - npm install + - npm test + + branches: + master: + - step: + script: + - wget -O ~/FirefoxSetup.tar.bz2 "https://download.mozilla.org/?product=firefox-latest-ssl&os=linux64" + - sudo tar xjf ~/FirefoxSetup.tar.bz2 -C /opt + - sudo ln -s /opt/firefox/firefox /usr/bin/firefox + - npm install + - npm test diff --git a/examples/running-tests-in-firefox-using-bitbucket-pipelines-ci/index.html b/examples/running-tests-in-firefox-using-bitbucket-pipelines-ci/index.html new file mode 100644 index 00000000000..1b3b868a507 --- /dev/null +++ b/examples/running-tests-in-firefox-using-bitbucket-pipelines-ci/index.html @@ -0,0 +1,12 @@ + +
+ + + + + + \ No newline at end of file diff --git a/examples/running-tests-in-firefox-using-bitbucket-pipelines-ci/package.json b/examples/running-tests-in-firefox-using-bitbucket-pipelines-ci/package.json new file mode 100644 index 00000000000..17f697d5110 --- /dev/null +++ b/examples/running-tests-in-firefox-using-bitbucket-pipelines-ci/package.json @@ -0,0 +1,26 @@ +{ + "name": "running-tests-using-bitbucket-pipelines", + "version": "1.0.0", + "description": "An example of how to run TestCafe tests in the cloud using Chrome with Bitbucket Pipelines CI.", + "main": "server.js", + "scripts": { + "test": "testcafe 'firefox:headless --disable-setuid-sandbox --window-size=1920x1080' tests/index-test.js --app \"node server.js\"" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/DevExpress/testcafe.git" + }, + "author": "Developer Express Inc. (https://devexpress.com)", + "license": "MIT", + "bugs": { + "url": "https://github.com/DevExpress/testcafe/issues" + }, + "homepage": "https://github.com/DevExpress/testcafe#readme", + "dependencies": { + "connect": "^3.4.1", + "serve-static": "^1.11.1" + }, + "devDependencies": { + "testcafe": "*" + } +} \ No newline at end of file diff --git a/examples/running-tests-in-firefox-using-bitbucket-pipelines-ci/server.js b/examples/running-tests-in-firefox-using-bitbucket-pipelines-ci/server.js new file mode 100644 index 00000000000..5f233605cea --- /dev/null +++ b/examples/running-tests-in-firefox-using-bitbucket-pipelines-ci/server.js @@ -0,0 +1,6 @@ +const connect = require('connect'); +const serveStatic = require('serve-static'); + +connect().use(serveStatic(__dirname)).listen(9090, () => { + process.stdout.write('Server running on 9090...\n'); +}); diff --git a/examples/running-tests-in-firefox-using-bitbucket-pipelines-ci/tests/index-test.js b/examples/running-tests-in-firefox-using-bitbucket-pipelines-ci/tests/index-test.js new file mode 100644 index 00000000000..94677f92869 --- /dev/null +++ b/examples/running-tests-in-firefox-using-bitbucket-pipelines-ci/tests/index-test.js @@ -0,0 +1,10 @@ +import { Selector } from 'testcafe'; + +fixture `Check if the button text changes` + .page `http://localhost:9090/index.html`; + +test('My test', async t => { + await t + .click('#click-here') + .expect(Selector('#click-here').value).eql('Hello!'); +});