Skip to content

Commit

Permalink
Adding bitbucket pipelines sample for firefox
Browse files Browse the repository at this point in the history
  • Loading branch information
Aditya Inapurapu committed Sep 11, 2024
1 parent ef32f4c commit f5cf432
Show file tree
Hide file tree
Showing 6 changed files with 89 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -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.
Original file line number Diff line number Diff line change
@@ -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 ci
- 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 ci
- npm test
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<html>
<head>
<script type="text/javascript">
function change() {
document.getElementById("click-here").value = "Hello!";
}
</script>
</head>
<body>
<input type="button" value="Click here" id="click-here" onclick="change()"></input>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -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 'chromium: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": "*"
}
}
Original file line number Diff line number Diff line change
@@ -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');
});
Original file line number Diff line number Diff line change
@@ -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!');
});

0 comments on commit f5cf432

Please sign in to comment.