Skip to content
Merged
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
16 changes: 16 additions & 0 deletions .github/workflows/desktop-linux-prod-test-pull.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,35 +48,51 @@ jobs:

- name: Run tauri unit tests
uses: nick-fields/retry@v2
id: linuxRunUnit
continue-on-error: true
with:
timeout_minutes: 12
max_attempts: 3
command: xvfb-run ../phoenix-desktop/src-tauri/target/debug/phoenix-test --run-tests=unit -q

- name: Run tauri integration tests
uses: nick-fields/retry@v2
id: linuxRunIntegration
continue-on-error: true
with:
timeout_minutes: 12
max_attempts: 3
command: xvfb-run ../phoenix-desktop/src-tauri/target/debug/phoenix-test --run-tests=integration -q

- name: Run tauri mainview tests
uses: nick-fields/retry@v2
id: linuxRunMainview
continue-on-error: true
with:
timeout_minutes: 12
max_attempts: 3
command: xvfb-run ../phoenix-desktop/src-tauri/target/debug/phoenix-test --run-tests=mainview -q

- name: Run tauri livepreview tests
uses: nick-fields/retry@v2
id: linuxRunLivepreview
continue-on-error: true
with:
timeout_minutes: 12
max_attempts: 3
command: xvfb-run ../phoenix-desktop/src-tauri/target/debug/phoenix-test --run-tests=livepreview -q

- name: Run tauri LegacyInteg tests
uses: nick-fields/retry@v2
id: linuxRunLegacyInteg
continue-on-error: true
with:
timeout_minutes: 20
max_attempts: 3
command: xvfb-run ../phoenix-desktop/src-tauri/target/debug/phoenix-test --run-tests=LegacyInteg -q

- name: Fail on test runs failed in Linux
if: steps.linuxRunUnit.outcome == 'failure' || steps.linuxRunIntegration.outcome == 'failure' || steps.linuxRunMainview.outcome == 'failure' || steps.linuxRunLivepreview.outcome == 'failure' || steps.linuxRunLegacyInteg.outcome == 'failure'
run: |
echo "Linux tests failed, marking step as failed"
exit 1
16 changes: 16 additions & 0 deletions .github/workflows/desktop-linux-test-pull.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,35 +47,51 @@ jobs:

- name: Run tauri unit tests
uses: nick-fields/retry@v2
id: linuxRunUnit
continue-on-error: true
with:
timeout_minutes: 12
max_attempts: 3
command: xvfb-run ../phoenix-desktop/src-tauri/target/debug/phoenix-test --run-tests=unit -q

- name: Run tauri integration tests
uses: nick-fields/retry@v2
id: linuxRunIntegration
continue-on-error: true
with:
timeout_minutes: 12
max_attempts: 3
command: xvfb-run ../phoenix-desktop/src-tauri/target/debug/phoenix-test --run-tests=integration -q

- name: Run tauri mainview tests
uses: nick-fields/retry@v2
id: linuxRunMainview
continue-on-error: true
with:
timeout_minutes: 12
max_attempts: 3
command: xvfb-run ../phoenix-desktop/src-tauri/target/debug/phoenix-test --run-tests=mainview -q

- name: Run tauri livepreview tests
uses: nick-fields/retry@v2
id: linuxRunLivepreview
continue-on-error: true
with:
timeout_minutes: 12
max_attempts: 3
command: xvfb-run ../phoenix-desktop/src-tauri/target/debug/phoenix-test --run-tests=livepreview -q

- name: Run tauri LegacyInteg tests
uses: nick-fields/retry@v2
id: linuxRunLegacyInteg
continue-on-error: true
with:
timeout_minutes: 20
max_attempts: 3
command: xvfb-run ../phoenix-desktop/src-tauri/target/debug/phoenix-test --run-tests=LegacyInteg -q

- name: Fail on test runs failed in Linux
if: steps.linuxRunUnit.outcome == 'failure' || steps.linuxRunIntegration.outcome == 'failure' || steps.linuxRunMainview.outcome == 'failure' || steps.linuxRunLivepreview.outcome == 'failure' || steps.linuxRunLegacyInteg.outcome == 'failure'
run: |
echo "Linux tests failed, marking step as failed"
exit 1
16 changes: 16 additions & 0 deletions .github/workflows/desktop-mac-m1-test-pull.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,35 +40,51 @@ jobs:

- name: Run tauri unit tests
uses: nick-fields/retry@v2
id: macM1RunUnit
continue-on-error: true
with:
timeout_minutes: 12
max_attempts: 3
command: ../phoenix-desktop/src-tauri/target/debug/phoenix-test --run-tests=unit -q

- name: Run tauri integration tests
uses: nick-fields/retry@v2
id: macM1RunIntegration
continue-on-error: true
with:
timeout_minutes: 12
max_attempts: 3
command: ../phoenix-desktop/src-tauri/target/debug/phoenix-test --run-tests=integration -q

- name: Run tauri mainview tests
uses: nick-fields/retry@v2
id: macM1RunMainview
continue-on-error: true
with:
timeout_minutes: 12
max_attempts: 3
command: ../phoenix-desktop/src-tauri/target/debug/phoenix-test --run-tests=mainview -q

- name: Run tauri livepreview tests
uses: nick-fields/retry@v2
id: macM1RunLivepreview
continue-on-error: true
with:
timeout_minutes: 12
max_attempts: 3
command: ../phoenix-desktop/src-tauri/target/debug/phoenix-test --run-tests=livepreview -q

- name: Run tauri LegacyInteg tests
uses: nick-fields/retry@v2
id: macM1RunLegacyInteg
continue-on-error: true
with:
timeout_minutes: 30
max_attempts: 3
command: ../phoenix-desktop/src-tauri/target/debug/phoenix-test --run-tests=LegacyInteg -q

- name: Fail on test runs failed in Mac M1
if: steps.macM1RunUnit.outcome == 'failure' || steps.macM1RunIntegration.outcome == 'failure' || steps.macM1RunMainview.outcome == 'failure' || steps.macM1RunLivepreview.outcome == 'failure' || steps.macM1RunLegacyInteg.outcome == 'failure'
run: |
echo "Mac M1 tests failed, marking step as failed"
exit 1
16 changes: 16 additions & 0 deletions .github/workflows/desktop-mac-test-pull.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,35 +40,51 @@ jobs:

- name: Run tauri unit tests
uses: nick-fields/retry@v2
id: macRunUnit
continue-on-error: true
with:
timeout_minutes: 12
max_attempts: 3
command: ../phoenix-desktop/src-tauri/target/debug/phoenix-test --run-tests=unit -q

- name: Run tauri integration tests
uses: nick-fields/retry@v2
id: macRunIntegration
continue-on-error: true
with:
timeout_minutes: 12
max_attempts: 3
command: ../phoenix-desktop/src-tauri/target/debug/phoenix-test --run-tests=integration -q

- name: Run tauri mainview tests
uses: nick-fields/retry@v2
id: macRunMainview
continue-on-error: true
with:
timeout_minutes: 12
max_attempts: 3
command: ../phoenix-desktop/src-tauri/target/debug/phoenix-test --run-tests=mainview -q

- name: Run tauri livepreview tests
uses: nick-fields/retry@v2
id: macRunLivepreview
continue-on-error: true
with:
timeout_minutes: 12
max_attempts: 3
command: ../phoenix-desktop/src-tauri/target/debug/phoenix-test --run-tests=livepreview -q

- name: Run tauri LegacyInteg tests
uses: nick-fields/retry@v2
id: macRunLegacyInteg
continue-on-error: true
with:
timeout_minutes: 30
max_attempts: 3
command: ../phoenix-desktop/src-tauri/target/debug/phoenix-test --run-tests=LegacyInteg -q

- name: Fail on test runs failed in Mac
if: steps.macRunUnit.outcome == 'failure' || steps.macRunIntegration.outcome == 'failure' || steps.macRunMainview.outcome == 'failure' || steps.macRunLivepreview.outcome == 'failure' || steps.macRunLegacyInteg.outcome == 'failure'
run: |
echo "Mac tests failed, marking step as failed"
exit 1
30 changes: 24 additions & 6 deletions src/services/login.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,12 @@
*
*/

/*global logger*/

define(function (require, exports, module) {
const EventDispatcher = require("utils/EventDispatcher"),
PreferencesManager = require("preferences/PreferencesManager"),
Metrics = require("utils/Metrics"),
Dialogs = require("widgets/Dialogs"),
DefaultDialogs = require("widgets/DefaultDialogs"),
Strings = require("strings"),
Expand Down Expand Up @@ -164,10 +166,16 @@ define(function (require, exports, module) {
return localAutoAuthURL.replace("http://localhost:", "");
}

const PLATFORM_STRINGS = {
"win": "Windows",
"mac": "mac",
"linux": "Linux"
};
// never rejects.
async function _getAppAuthSession() {
const authPortURL = _getAutoAuthPortURL();
const appName = encodeURIComponent(`${Strings.APP_NAME} Desktop on ${Phoenix.platform}`);
const platformStr = PLATFORM_STRINGS[Phoenix.platform] || Phoenix.platform;
const appName = encodeURIComponent(`${Strings.APP_NAME} Desktop on ${platformStr}`);
const resolveURL = `${Phoenix.config.account_url}getAppAuthSession?autoAuthPort=${authPortURL}&appName=${appName}`;
// {"isSuccess":true,"appSessionID":"a uuid...","validationCode":"SWXP07"}
try {
Expand All @@ -182,7 +190,8 @@ define(function (require, exports, module) {
return null;
} catch (e) {
console.error(e, "Failed to call getAppAuthSession API endpoint", resolveURL);
// todo raise metrics/log
Metrics.countEvent(Metrics.EVENT_TYPE.AUTH, 'getAppAuth', Phoenix.platform);
logger.reportError(e, "Failed to call getAppAuthSession API endpoint" + resolveURL);
return null;
}
}
Expand All @@ -197,7 +206,7 @@ define(function (require, exports, module) {
} catch (e) {
console.error("failed to send auth login verification code to node", e);
// we ignore this and continue for manual verification
// todo raise metrics
Metrics.countEvent(Metrics.EVENT_TYPE.AUTH, 'autoFail', Phoenix.platform);
}
}

Expand Down Expand Up @@ -290,8 +299,10 @@ define(function (require, exports, module) {
setTimeout(checkLoginStatus, 100);
}
}
let isAutoSignedIn = false;
exports.on(_EVT_PAGE_FOCUSED, checkLoginStatus);
async function _AutoSignedIn() {
isAutoSignedIn = true;
await checkLoginStatus();
}
authNodeConnector.one(EVENT_CONNECTED, _AutoSignedIn);
Expand All @@ -301,13 +312,18 @@ define(function (require, exports, module) {
exports.off(_EVT_PAGE_FOCUSED, checkLoginStatus);
authNodeConnector.off(EVENT_CONNECTED, _AutoSignedIn);
clearTimeout(closeTimeout);
Metrics.countEvent(Metrics.EVENT_TYPE.AUTH,
isAutoSignedIn ? 'autoLogin' : 'manLogin'
, Phoenix.platform);
Metrics.countEvent(Metrics.EVENT_TYPE.AUTH, "login",
isAutoSignedIn ? 'auto' : 'man');
});
NativeApp.openURLInDefaultBrowser(appSignInURL);
}

async function signOutAccount() {
const resolveURL = `${Phoenix.config.account_url}logoutSession`;
try {
const resolveURL = `${Phoenix.config.account_url}logoutSession`;
let input = {
appSessionID: userProfile.apiKey
};
Expand All @@ -329,23 +345,25 @@ define(function (require, exports, module) {
Strings.SIGNED_OUT_FAILED_TITLE,
Strings.SIGNED_OUT_FAILED_MESSAGE
);
Metrics.countEvent(Metrics.EVENT_TYPE.AUTH, 'logoutFail', Phoenix.platform);
return;
// todo raise metrics
}
await _resetAccountLogin();
Dialogs.showModalDialog(
DefaultDialogs.DIALOG_ID_INFO,
Strings.SIGNED_OUT,
Strings.SIGNED_OUT_MESSAGE_FRIENDLY
);
Metrics.countEvent(Metrics.EVENT_TYPE.AUTH, 'logoutOK', Phoenix.platform);
} catch (error) {
console.error("Network error. Could not log out session.", error);
Dialogs.showModalDialog(
DefaultDialogs.DIALOG_ID_ERROR,
Strings.SIGNED_OUT_FAILED_TITLE,
Strings.SIGNED_OUT_FAILED_MESSAGE
);
// todo raise metrics
Metrics.countEvent(Metrics.EVENT_TYPE.AUTH, 'getAppAuth', Phoenix.platform);
logger.reportError(error, "Failed to call logout calling" + resolveURL);
}
}

Expand Down
3 changes: 2 additions & 1 deletion src/utils/Metrics.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,8 @@ define(function (require, exports, module) {
USER: "user",
NODEJS: "node",
LINT: "lint",
GIT: "git"
GIT: "git",
AUTH: "auth"
};

/**
Expand Down
Loading