Skip to content

Commit

Permalink
Apply in other workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
andrzejewsky committed Oct 11, 2024
1 parent bbf1a57 commit c8e5c16
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .github/actions/restore-accounts/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ runs:
API_URL: ${{ inputs.API_URL }}
BASE_URL: ${{ inputs.BASE_URL }}
run: |
node playwright/auth.js restore $ACCOUNTS
node playwright/auth.js restore "$ACCOUNTS"
2 changes: 1 addition & 1 deletion .github/workflows/run-tests-on-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ jobs:
CHECK_ID: ${{ steps.create-check.outputs.CHECK_ID }}
FRAMEWORK: ${{ steps.check-framework.outputs.result }}
IS_OLD_VERSION: ${{ steps.get-environment-variables.outputs.IS_OLD_VERSION }}
ACCOUNTS: ${{ steps.accounts.outputs.ACCOUNTS }}ą
ACCOUNTS: ${{ steps.accounts.outputs.ACCOUNTS }}
steps:
- uses: actions/checkout@v4

Expand Down
35 changes: 21 additions & 14 deletions playwright/auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,19 +46,27 @@ const ACCOUNT_EMAILS = {
product: "[email protected]",
};

const createQuery = (email, password) => `mutation TokenAuth{
tokenCreate(email: "${email}", password: "${password}") {
token
refreshToken
errors {
code
message
const createQuery = (email, password) => {
const query = `
mutation TokenAuth($email: String!, $password: String!) {
tokenCreate(email: $email, password: $password) {
token
refreshToken
errors {
code
message
}
user {
id
}
}
}
user {
id
}
}
}`;
`

const variables = { email, password }

return { query, variables }
};


const getEmailForPermission = (permission) => {
Expand All @@ -84,10 +92,9 @@ const getAuthForPermission = async (permissionName) => {

const email = getEmailForPermission(permissionName);
const password = getPasswordForPermission(permissionName);
const query = createQuery(email, password)

const response = await apiRequestContext.post(process.env.API_URL || "", {
data: { query },
data: createQuery(email, password),
});
const resposnseObj = await response.json()
const { errors } = resposnseObj.data.tokenCreate
Expand Down

0 comments on commit c8e5c16

Please sign in to comment.