-
Notifications
You must be signed in to change notification settings - Fork 674
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding bitbucket pipelines sample for firefox
- Loading branch information
Aditya Inapurapu
committed
Sep 11, 2024
1 parent
ef32f4c
commit f5cf432
Showing
6 changed files
with
89 additions
and
0 deletions.
There are no files selected for viewing
14 changes: 14 additions & 0 deletions
14
examples/running-tests-in-firefox-using-bitbucket-pipelines-ci/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
21 changes: 21 additions & 0 deletions
21
examples/running-tests-in-firefox-using-bitbucket-pipelines-ci/bitbucket-pipelines.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
12 changes: 12 additions & 0 deletions
12
examples/running-tests-in-firefox-using-bitbucket-pipelines-ci/index.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
26 changes: 26 additions & 0 deletions
26
examples/running-tests-in-firefox-using-bitbucket-pipelines-ci/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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": "*" | ||
} | ||
} |
6 changes: 6 additions & 0 deletions
6
examples/running-tests-in-firefox-using-bitbucket-pipelines-ci/server.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'); | ||
}); |
10 changes: 10 additions & 0 deletions
10
examples/running-tests-in-firefox-using-bitbucket-pipelines-ci/tests/index-test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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!'); | ||
}); |