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

Adding bitbucket pipelines sample for firefox #8274

Closed
Closed
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 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
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 '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": "*"
}
}
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!');
});
Loading