Skip to content

Commit f1a0186

Browse files
committed
Run docker on android
1 parent 8fb2a4f commit f1a0186

File tree

3 files changed

+35
-13
lines changed

3 files changed

+35
-13
lines changed

.github/workflows/maestro-android.yml

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,23 @@ jobs:
4343
sudo udevadm control --reload-rules
4444
sudo udevadm trigger --name-match=kvm
4545
46+
- name: Start Rocket.Chat stack
47+
run: |
48+
docker compose up -d
49+
docker compose logs -f --tail=200 &
50+
51+
- name: Wait for Rocket.Chat to be ready
52+
run: |
53+
for i in $(seq 1 40); do
54+
code=$(curl --silent --max-time 2 -o /dev/null -w "%{http_code}" http://localhost:3000/api/info || echo "000")
55+
if [ "$code" = "200" ]; then break; fi
56+
sleep 3
57+
done
58+
if [ "$code" != "200" ]; then
59+
docker compose logs --tail=200
60+
exit 1
61+
fi
62+
4663
- name: Make Maestro script executable
4764
run: chmod +x .github/scripts/run-maestro.sh
4865

@@ -62,10 +79,14 @@ jobs:
6279
disable-animations: true
6380
script: ./.github/scripts/run-maestro.sh android ${{ inputs.shard }}
6481

82+
- name: Teardown Rocket.Chat
83+
if: always()
84+
run: docker compose down --volumes --remove-orphans
85+
6586
- name: Android Maestro Logs
6687
if: always()
6788
uses: actions/upload-artifact@v4
6889
with:
6990
name: Android Maestro Logs - Shard ${{ inputs.shard }}
7091
path: ~/.maestro/tests/
71-
retention-days: 7
92+
retention-days: 7

.maestro/scripts/data-setup.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ const getDeepLink = (method, server, ...params) => {
2222

2323

2424
const login = (username, password) => {
25-
const response = http.post(`${data.server}/api/v1/login`, {
25+
const response = http.post(`http://localhost:3000/api/v1/login`, {
2626
headers: {
2727
'Content-Type': 'application/json'
2828
},
@@ -44,7 +44,7 @@ const createUser = (customProps) => {
4444

4545
login(output.account.adminUser, output.account.adminPassword);
4646

47-
http.post(`${data.server}/api/v1/users.create`, {
47+
http.post(`http://localhost:3000/api/v1/users.create`, {
4848
headers: {
4949
'Content-Type': 'application/json',
5050
...headers
@@ -74,15 +74,15 @@ const deleteCreatedUser = async ({ username: usernameToDelete }) => {
7474
try {
7575
login(output.account.adminUser, output.account.adminPassword);
7676

77-
const result = http.get(`${data.server}/api/v1/users.info?username=${usernameToDelete}`, {
77+
const result = http.get(`http://localhost:3000/api/v1/users.info?username=${usernameToDelete}`, {
7878
headers: {
7979
'Content-Type': 'application/json',
8080
...headers
8181
}
8282
});
8383

8484
const userId = json(result.body)?.data?.user?._id;
85-
http.post(`${data.server}/api/v1/users.delete`, { userId, confirmRelinquish: true }, {
85+
http.post(`http://localhost:3000/api/v1/users.delete`, { userId, confirmRelinquish: true }, {
8686
headers: {
8787
'Content-Type': 'application/json',
8888
...headers
@@ -98,7 +98,7 @@ const createRandomTeam = (username, password) => {
9898

9999
const teamName = output.randomTeamName();
100100

101-
http.post(`${data.server}/api/v1/teams.create`, {
101+
http.post(`http://localhost:3000/api/v1/teams.create`, {
102102
headers: {
103103
'Content-Type': 'application/json',
104104
...headers
@@ -113,7 +113,7 @@ const createRandomRoom = (username, password, type = 'c') => {
113113
login(username, password);
114114
const room = `room${output.random()}`;
115115

116-
const response = http.post(`${data.server}/api/v1/${type === 'c' ? 'channels.create' : 'groups.create'}`, {
116+
const response = http.post(`http://localhost:3000/api/v1/${type === 'c' ? 'channels.create' : 'groups.create'}`, {
117117
headers: {
118118
'Content-Type': 'application/json',
119119
...headers
@@ -133,7 +133,7 @@ const sendMessage = (username, password, channel, msg, tmid) => {
133133
login(username, password);
134134
const channelParam = tmid ? { roomId: channel } : { channel };
135135

136-
const response = http.post(`${data.server}/api/v1/chat.postMessage`, {
136+
const response = http.post(`http://localhost:3000/api/v1/chat.postMessage`, {
137137
headers: {
138138
'Content-Type': 'application/json',
139139
...headers
@@ -153,7 +153,7 @@ const sendMessage = (username, password, channel, msg, tmid) => {
153153
const getProfileInfo = (userId) => {
154154
login(output.account.adminUser, output.account.adminPassword);
155155

156-
const result = http.get(`${data.server}/api/v1/users.info?userId=${userId}`, {
156+
const result = http.get(`http://localhost:3000/api/v1/users.info?userId=${userId}`, {
157157
headers: {
158158
'Content-Type': 'application/json',
159159
...headers
@@ -168,7 +168,7 @@ const getProfileInfo = (userId) => {
168168
const post = (endpoint, username, password, body) => {
169169
login(username, password);
170170

171-
const response = http.post(`${data.server}/api/v1/${endpoint}`, {
171+
const response = http.post(`http://localhost:3000/api/v1/${endpoint}`, {
172172
headers: {
173173
'Content-Type': 'application/json',
174174
...headers
@@ -182,7 +182,7 @@ const post = (endpoint, username, password, body) => {
182182
const createDM = (username, password, otherUsername) => {
183183
login(username, password);
184184

185-
const result = http.post(`${data.server}/api/v1/im.create`, {
185+
const result = http.post(`http://localhost:3000/api/v1/im.create`, {
186186
headers: {
187187
'Content-Type': 'application/json',
188188
...headers

.maestro/scripts/data.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
const data = {
2-
server: 'https://mobile.rocket.chat',
2+
server: 'http://10.0.2.2:3000',
33
alternateServer: 'https://stable.rocket.chat',
4-
...output.account,
4+
adminUser: '[email protected]',
5+
adminPassword: 'secretpassword123',
56
accounts: [],
67
channels: {
78
detoxpublic: {

0 commit comments

Comments
 (0)